-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: let LSP suggest trait impl methods as you are typing them (#6029)
# Description ## Problem Part of #1577 ## Summary Now that we have the "Implement missing members" code action, it's a small step to have autocompletion suggest a trait method as you are typing its name (like in Rust Analyzer). The only tricky part was that `fn foo` produced a parse error so I made that parse to a function without arguments and without body (but still reporting a parser error). A nice side-effect of this is that if you type that and you think "Hm, what should the parameters be" the rest of the LSP features don't stop working (like, inlay hints don't disappear, etc.) Even though "Implement missing members" might seem to be better than offering completions one by one, this completion has two advantages: 1. It offers default methods 2. It teaches the user that LSP can suggest trait methods, so they could think "hm, I wonder if there's a code action that suggests all of them" (at least this was my experience for discovering the code action) ![lsp-suggest-trait-impl-method](https://github.com/user-attachments/assets/00d1a6f8-597b-4686-ab20-78cc145f22f4) ## Additional Context ## Documentation Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
8 changed files
with
667 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.