-
Notifications
You must be signed in to change notification settings - Fork 827
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
Return code actions of the source
type for the current cursor position?
#1554
Comments
Actually this has some legacy / backwards compatibility issues :-) At the beginning there weren't any source or refactoring code actions. Code actions were solely used to (quick) fix code, not to write / rewrite code. So if a client asks for code actions without any kind the standard quick fix code actions should be returned. If a server returns more code actions (e.g. includes source code actions) clients are allowed to filter them to ensure UI consistency.
As said the minimum a server needs to return are the default quick fix actions. It is allowed to return more and clients other than VS Code might do something with them. However VS Code decided to drop them
This is up to the client to decide.
We decided not to do this. Reason is that a server can easily compute all active diagnostics for the given file. The diagnostics provided in a code action request are hints for the server to know which errors the user currently sees. If you run a source code action (for example fixAll) this is not very useful since the server should fix all errors and not rely on what the user sees in the context. Hope that makes sense. |
Thank you. This makes it much clearer. I do think that something of the effect of what you wrote below should be in the spec to make this official:
|
Agree. |
VSCode and other editors request code actions whenever caret/selection is changed. Those requests don't specify any "kinds" in
context.only
. Is server expected to return code action types of thesource
kind in this case?Empirical evidence shows that:
source
code actions unless explicitly asked for those usingcontext.only: ['source']
(which happens when explicitly triggeringSource actions...
menu item in VSCode, for example).source
code action in that case, editor (VSCode) filters out thesource
kind and doesn't show in the view as an annotation or a bulb icon.Questions:
source
code actions unless explicitly asked?source
code actions for cases when request is made for the current caret position in the file?source
code actions include whole document range and all active diagnostics in the file (currently not the case in VSCode, for example)?The text was updated successfully, but these errors were encountered: