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

Add CodeAction codeActionLiteralSupport Feature #4163

Merged
merged 4 commits into from
Apr 29, 2022
Merged

Add CodeAction codeActionLiteralSupport Feature #4163

merged 4 commits into from
Apr 29, 2022

Conversation

sak96
Copy link
Contributor

@sak96 sak96 commented Apr 22, 2022

Why the Pull Request?

As per ale dev philosophy point 8 this feature is added to allow use code actions like import fixes, implementation of interfaces. This could fix no code action received from server mentioned in #3523.

The working is based on allowing lsp with capability CodeActionClientCapabilities with codeActionLiteralSupport to advertise as such.

Tasks

  • get feature working
  • fix coding standards issue
  • write test cases for code
  • Add documentation

References

Credits: @Benabik for initial version

Benabik and others added 3 commits April 22, 2022 20:43
Without this, rust-analyzer doesn't return any code actions.  With it,
everything works properly.
@sak96 sak96 changed the title Add CodeAction Feature Add CodeAction codeActionLiteralSupport Feature Apr 22, 2022
@Benabik
Copy link
Contributor

Benabik commented Apr 27, 2022

Not sure how to raise visibility on this, but this does fix rust-analyzer and doesn't break tests, which is great. Thanks for the improvements on my hasty code.

Even though I don't write a ton of Rust, this makes ALE far more useful. The "Implement missing members" action alone is a huge productivity gain.

@sak96
Copy link
Contributor Author

sak96 commented Apr 27, 2022

Yeah Implement missing members is really a quality of life improvement.

I wanted to debug it but i saw that you had already figure it out so i just improved your pr.

@sak96
Copy link
Contributor Author

sak96 commented Apr 27, 2022

trying to insert some gentle reminder.
hope not offensive or irritating

@w0rp @hsanson

image

@sak96
Copy link
Contributor Author

sak96 commented Apr 27, 2022

max([value, 1])

Without the above empty line has no code fixes
codefix_max_column

With the above empty line also has code fixes
codefix

Special values like for example -1 to denote the end of a line are not supported.
[reference](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position)
Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay... not expert in LSP but from my test I can tell this does not breaks anything on my side and from the comments seems to be very useful.

Thanks for the contribution.

@hsanson hsanson merged commit 3348222 into dense-analysis:master Apr 29, 2022
@sak96 sak96 deleted the feature/code-action branch April 29, 2022 18:22
cyyever pushed a commit to cyyever/ale that referenced this pull request Jul 11, 2022
* Advertise codeActionLiteralSupport to LSP server

Without this, rust-analyzer doesn't return any code actions.  With it,
everything works properly.

* linter fixes

* test cases fixes

* Fix underflow of column in position.

Special values like for example -1 to denote the end of a line are not supported.
[reference](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position)

Co-authored-by: Brian Gernhardt <brian@gernhardtsoftware.com>
cyyever pushed a commit to cyyever/ale that referenced this pull request Jul 11, 2022
* Advertise codeActionLiteralSupport to LSP server

Without this, rust-analyzer doesn't return any code actions.  With it,
everything works properly.

* linter fixes

* test cases fixes

* Fix underflow of column in position.

Special values like for example -1 to denote the end of a line are not supported.
[reference](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position)

Co-authored-by: Brian Gernhardt <brian@gernhardtsoftware.com>
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.

None yet

3 participants