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

Advertise code action support #1038

Merged
merged 2 commits into from
May 29, 2020
Merged

Conversation

YaLTeR
Copy link
Contributor

@YaLTeR YaLTeR commented May 27, 2020

Fixes #1037

@YaLTeR
Copy link
Contributor Author

YaLTeR commented May 27, 2020

Hm, even though some code actions do show this way, they show without the rust-analyzer:
image
and I'm not sure I'm seeing all of actions I'm supposed to see. Not sure why.

@martskins
Copy link
Collaborator

martskins commented May 27, 2020

Haven't looked too much into this, but it seems to me like command based actions have been removed now in rust-analyzer (https://github.com/rust-analyzer/rust-analyzer/pull/4494/files#diff-cb373ef102a169ef5e1af6f370fd21ccL718) and they seem to now use a different struct for the CodeActions, it would be nice to get the payload of the response from rust-analyzer and maybe check that it correctly deserializes to a lsp_types::CodeActionOrCommand.

On another note, you might want to rebase this to dev and change the target branch to it as well, as per this. There are some changes around code actions in ranges there that might be worth testing too.

@YaLTeR YaLTeR force-pushed the advertise-code-action branch from b9a8771 to 6ed3266 Compare May 29, 2020 05:27
@YaLTeR
Copy link
Contributor Author

YaLTeR commented May 29, 2020

I rebased my changes onto dev and I see two issues:

  1. LanguageClient_textDocument_codeAction() is broken (only the # version works).
  2. For some reason on my vimrc the code actions take several seconds to actually apply and, strangely enough, also several seconds to undo with a u for large files (like src/language_server_protocol.rs). This was not the case when based on the next branch and this is also not the case with min-vimrc. I've no idea what causes this, any help?

Visual code actions seem to work fine.

@martskins
Copy link
Collaborator

About the first issue, I think it's because LanguageClient_textDocument_codeAction calls this:
call('LanguageClient#textDocument_codeAction', 'n', a:000), but it really should be calling this call('LanguageClient#textDocument_codeAction', a:000). (Note there's one parameater less there). I can raise a PR to fix this but if you are comfortable including that in this PR I say go for it.

The second issue I could not reproduce, checked out your PR and tried with LanguageClient-neovim 's code base and both visual and single line code actions show and apply in a very short time.

PS: remember to also change the target branch of the PR

@YaLTeR YaLTeR changed the base branch from next to dev May 29, 2020 07:30
@YaLTeR
Copy link
Contributor Author

YaLTeR commented May 29, 2020

About the first issue, I think it's because LanguageClient_textDocument_codeAction calls this:
call('LanguageClient#textDocument_codeAction', 'n', a:000), but it really should be calling this call('LanguageClient#textDocument_codeAction', a:000). (Note there's one parameater less there). I can raise a PR to fix this but if you are comfortable including that in this PR I say go for it.

Could you make a separate PR please?

The second issue I could not reproduce, checked out your PR and tried with LanguageClient-neovim 's code base and both visual and single line code actions show and apply in a very short time.

Yeah, I'll check the profile log to see what causes it.

PS: remember to also change the target branch of the PR

Oh, right, thanks.

@martskins
Copy link
Collaborator

Sure, opened #1039 to fix that.

@YaLTeR
Copy link
Contributor Author

YaLTeR commented May 29, 2020

I found how to reproduce the hang issue: set foldmethod=syntax. All these seconds it seems to spend recomputing fold and syntax information.

But "good" news is that I was wrong and it is also present on the next branch, so it's not a new issue.

@YaLTeR
Copy link
Contributor Author

YaLTeR commented May 29, 2020

I pushed a fix for the empty string action kind, I think the PR is good to merge now.

@autozimu autozimu merged commit c21b9eb into autozimu:dev May 29, 2020
@autozimu
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code actions broken on newest rust-analyzer
3 participants