typescript-language-server / typescript-language-server

TypeScript & JavaScript Language Server

Home Page:https://www.npmjs.com/package/typescript-language-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to Disable "Move to a new file" action?

Caliv0 opened this issue · comments

I'm using Emacs with lsp-mode. When I'm working on my Angular projects, I use ts-ls and angular-ls together.
When I try to fix something I try to take a look at the possible lsp actions to see my options.
The problem appears when there is only this option available, then it automatically moves the current file to a new one which violates the angular naming convention for files (app.component.ts becomes AppComponent.ts). It then updates every import statement with the new files breaking them when the file is renamed to follow the naming convention.

I want to disable this action because I trigger it all the time and don't see it's use case. How can I do that?

It's coming from typescript (tsserver) and it's not possible to disable it but I would argue that the problem lies with lsp-mode executing this action automatically. While it might make sense for quick fixes (quickfix code actions), this is a refactoring (refactor type) code action I don't think it makes sense to automatically invoke refactoring actions since those are opinionated and it should be user's explicit choice whether to execute those.

Thanks for the idea, lsp-mode can be configured in order to not automatically apply actions.

One can configure like to: (setq lsp-auto-execute-action nil)

emacs-lsp/lsp-mode#4221