-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Filter code actions based on prefix, not equality #2146
Conversation
(My goal here is to be able to make a nice emacs function that pulls out all the import-fixing actions and gets the user to pick one, which requires both this and emacs-lsp/lsp-mode#3071) |
build error:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable, it would be great if someone could try it with VSCode and verify that it works as expected
Seems unrelated? Hopefully merging master will fix it.
I don't believe that it will affect anything in VSCode, but I'll see if I can test that... |
Are you sure? the pr is touching the file which does not compile, maybe the error comes from imports
|
It's quite unclear in the spec, but in microsoft/language-server-protocol#970 it's suggested that the intention is that the kinds given in `only` should be used as *prefix* filters of the generated code action kinds. That is to say, if the client asks for `only = [ CodeActionRefactor ]`, we should give them all kinds of refactoring code actions, including those whose kind is `CodeActionRefactorInline` (because as "hierarchical strings" they are represented as `"refactor"` and `"refactor.inline"`). This is quite important for the client: e.g. I hit this because I wanted to ask for all the import quickfixes so I could present them to the user to pick one. But they use various subkinds of `"quickfix.import"`, so currently you cannot ask for them all (asking for `"quickfix.import"` currentl returns nothing!). The ipmlemention is a little ugly: this needs some helper funcitons in `lsp`, which I'll make a PR for separately, but I didn't want to block this.
Huh. For some reason the pre-commit hook strips a couple of language pragmas which are actually needed. Weird. Fixed.
No change in VSCode as far as I can see. It already seems to list all the quickfixes when you hit (Rebased on master) |
dc8a203
to
683bbd9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Nicer version as promised in haskell#2146.
Nicer version as promised in #2146. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
It's quite unclear in the spec, but in
microsoft/language-server-protocol#970
it's suggested that the intention is that the kinds given in
only
should be used as prefix filters of the generated code action kinds.
That is to say, if the client asks for
only = [ CodeActionRefactor ]
,we should give them all kinds of refactoring code actions, including
those whose kind is
CodeActionRefactorInline
(because as "hierarchicalstrings" they are represented as
"refactor"
and"refactor.inline"
).This is quite important for the client: e.g. I hit this because I wanted
to ask for all the import quickfixes so I could present them to the user
to pick one. But they use various subkinds of
"quickfix.import"
, socurrently you cannot ask for them all (asking for
"quickfix.import"
currentl returns nothing!).
The ipmlemention is a little ugly: this needs some helper funcitons in
lsp
, which I'll make a PR for separately, but I didn't want to blockthis.