-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: LSP autocompletion for attributes (#5963)
# Description ## Problem While working a lot with attributes lately I thought it would be nice if we had autocompletion there too. ## Summary Built-in attributes are suggested (I don't know if I got them all right, I don't know which attributes are allowed on structs) and also "function attributes" (we need to give this a name) are suggested if their first argument type matches that of the item the annotation is on (and with auto-import, we effectively get all annotations available to be placed on a function/struct/module). ![lsp-complete-attribute](https://github.com/user-attachments/assets/ab918a88-203d-42e1-88a8-412e5c67029c) ## Additional Context If we add new attributes we'll have to remember to update the LSP code. But... I think this might be rare, so it might be fine to have to remember this. Also eventually if would be nice if all attributes had an associated function (even if it's a built-in one) and then we wouldn't need special code for that. ## 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
7 changed files
with
238 additions
and
16 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
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.