Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeActionKind filtering #970

Closed
kjeremy opened this issue May 1, 2020 · 5 comments
Closed

CodeActionKind filtering #970

kjeremy opened this issue May 1, 2020 · 5 comments

Comments

@kjeremy
Copy link
Contributor

kjeremy commented May 1, 2020

Since CodeActionKind can be specified as a hierarchy or explicitly listed out in the capabilities does that mean that filtering via CodeActionContext.only is really a match against the beginning of the string?

@rchl
Copy link
Contributor

rchl commented May 26, 2020

Since I've been implementing this in Sublime's LSP client, I can share some practical experience.

As far as servers behave, the server should really only receive (through CodeActionContext.only) the exact kind it has specified as being supported through codeActionProvider. codeActionKinds. So if the server specifies source.fixAll.eslint as being supported, it would be the client's responsibility to send it exactly that, even if user has specified more generic source.fixAll.

@dbaeumer
Copy link
Member

Yes, the idea is that the server for example should return all refactoring code actions if asked for CodeActionKind.Refactor.

@rchl please note that for backwards compatibility a client can still ask a server for code action with no context since this was the initial implementation.

@rchl
Copy link
Contributor

rchl commented May 26, 2020

@rchl please note that for backwards compatibility a client can still ask a server for code action with no context since this was the initial implementation.

Yes. And if the server does not understand CodeActionContext.only, it might reply with all code action types and then the client's responsibility is to filter those results to only match what the user requested.

Note that I'm talking in the context of user-configurable "Code actions on save" feature which is really an editor rather than spec feature.

@dbaeumer
Copy link
Member

For the code action on save you are correct. And there was an bug in VS Code which didn't handle this correctly but that got fixed.

@dbaeumer
Copy link
Member

I will close the issue. Please ping if there is any action that we should apply to the spec.

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants