-
-
Notifications
You must be signed in to change notification settings - Fork 390
Handling of Diagnostics
in code action contexts is questionable
#4056
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
Labels
type: enhancement
New feature or request
Comments
See also #4051 (comment) |
To clarify/summarize my somewhat-rambly comment: I agree! A process like this makes a lot of sense to me:
And I think there's potential to consolidate some of the logic for both of these steps to simplify things for plugin authors a bit. As for edge cases/exceptions... I'll leave it to the experts! |
keithfancher
added a commit
to keithfancher/haskell-language-server
that referenced
this issue
Feb 9, 2024
Rather than doing a full compare with incoming `Diagnostic` objects from the client. This brings the "remove redundant imports/exports" code actions more in line with behavior described in haskell#4056, and has the pleasant side-effect of fixing broken code actions in neovim (haskell#3857).
This was referenced Feb 9, 2024
fendor
added a commit
that referenced
this issue
Feb 21, 2024
…ions are in scope (#4063) * Use *only* incoming range to determine which code actions are in scope Rather than doing a full compare with incoming `Diagnostic` objects from the client. This brings the "remove redundant imports/exports" code actions more in line with behavior described in #4056, and has the pleasant side-effect of fixing broken code actions in neovim (#3857). * Remove redundant imports ;) * Rename param for clarity --------- Co-authored-by: fendor <fendor@users.noreply.github.com>
soulomoon
pushed a commit
to soulomoon/haskell-language-server
that referenced
this issue
Feb 23, 2024
…ions are in scope (haskell#4063) * Use *only* incoming range to determine which code actions are in scope Rather than doing a full compare with incoming `Diagnostic` objects from the client. This brings the "remove redundant imports/exports" code actions more in line with behavior described in haskell#4056, and has the pleasant side-effect of fixing broken code actions in neovim (haskell#3857). * Remove redundant imports ;) * Rename param for clarity --------- Co-authored-by: fendor <fendor@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When we get a
textDocument/codeAction
request, the context contains someDiagnostic
s. These are (allegedly) diagnostics that are a) visible to the user and b) overlap with the requested range.However, it's fairly unclear what the client is allowed to do in populating this field. In particular, it's not clear that they have to give it back to us as we sent it to them. The spec also indicates that this field is unreliable, the doc for it says
(emphasis mine)
We rely on the context
Diagnostics
quite a bit:data
field.Moreover, we don't really need to do this at all: we can just consult our diagnostic store and filter it based on the given range. This is more direct and simpler, and we should probably just do this in almost all cases. The exception would be cases where we actually do care about presentation: for example, the "suppress this warning" code action does care about whether the diagnostic it is proposing to suppress is in fact visible to the user. But this is an exceptional case.
The text was updated successfully, but these errors were encountered: