neoclide/coc-tsserver

"Move to a new file" action works weird

dr0bz opened this issue · 2 comments

dr0bz commented

Precondition:
I have a file feature.ts with a class in it:

export default class Feature {

}

What i want to do is to refactor: rename class and the file to Component and component.ts respectively. Class renaming works pretty well, but renaming the file - NOT.

The issue:

Steps to reproduce:

  • i navigate to Component class (already renamed from Feature to Component)
  • put cursor on 'Component'
  • do a :call CocActionAsync('codeAction', 'cursor')
  • choose 'Move to a new file'

The Result:

I end up with

  • an empty feature.ts file.
  • a new file Component.ts is created with the Component class in it.

My expectation:

  • I should get prompted for an new file name. My files have snakeCase, not CamelCase naming.
  • There shouldn't be an empty file left

CocCommand workspace.renameCurrentFile - works as expected. Am i missing the purpose of 'Move to a new file' function?

The Move to a new file code action is came from tsserver, which didn't prompt you for a new file name.

Same behavior in VSCode, this is tsserver's limit.

dr0bz commented

Thanks for clarification. Then :CocCommand workspace.renameCurrentFile is the only way i can achieve it.