helix icon indicating copy to clipboard operation
helix copied to clipboard

Code Actions on save

Open archseer opened this issue 3 years ago • 4 comments

Discussed in https://github.com/helix-editor/helix/discussions/1540

Originally posted by kevinsjoberg January 19, 2022 Helix currently supports running Code Actions manually by pressing <space>+a. Some language servers also supports running specific code actions on save, e.g., typescript-language-server and gopls.

Preferably, we extend the language server configuration to allow for specifying code actions to run on save. The actions themselves would then run asynchronously, similar to what we already do for auto formatting.

archseer avatar Jan 23 '22 07:01 archseer

The VSCode config seems to be:

"[go]": {
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    }
},

source.organizeImports and now source.sortImports (https://code.visualstudio.com/updates/v1_57#_sort-imports-source-action) seem to be the standardized name for this behavior and could be auto-enabled if the LSP offers them.

archseer avatar Jan 23 '22 08:01 archseer

Really want to have this feature w

HoangNguyen689 avatar Dec 28 '24 05:12 HoangNguyen689

Any news on this? I rely heavily on removing unused imports on save when working on typescript projects.

brielov avatar Apr 08 '25 21:04 brielov

That will be great to have for Typescript as well.

nrei0 avatar Jun 12 '25 11:06 nrei0