Skip to content

[lsp] make source action kinds more specific #63823

Description

LSP server advertises support for the following code action kinds:

codeActionKinds: [
    "quickfix",
    "source.organizeImports",
    "source.removeUnusedImports",
    "source.sortImports",
    "source.fixAll"
]

For example: https://github.com/microsoft/typescript-go/blob/092b34f534182baf2875887c20ffed2177f14d92/internal/lsp/lsproto/lsp.go#L313-L314

It should ideally advertise more specific kinds with a .ts suffix (for example). So for example source.removeUnusedImports.ts. That would allow the LSP client to target ts-server-specific code action from "code actions on save" functionality without triggering actions of other servers.

So for example:

    "editor.codeActionsOnSave": {
        "source.removeUnusedImports.ts": "explicit"  // Trigger for typescript server but not other servers that might be running on the file
    },

It will still be possible for the user to specify just source.removeUnusedImports so it should be a backward-compatible change.

Metadata

Metadata

Labels

Possible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some cases

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions