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: |
pepeiborra
left a comment
There was a problem hiding this comment.
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
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
onlyshould 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.