-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show doc comments in LSP (#5968)
# Description ## Problem Part of #5797 ## Summary ![lsp-doc-comments](https://github.com/user-attachments/assets/9560d41a-3163-4489-820e-a0f488b98f1a) This is just an experiment! We now parse doc comments, like we parse attributes, and attach them to AST nodes. From there we store them in `NodeInterner` (for now only if in LSP mode). Then we retrieve those comments for hover and autocompletion. ## Additional Context I decided to always store the doc comments in the NodeInterner. I've been thinking and maybe the doc comments shouldn't be parsed as `String`, but instead be a `Span`. Then we wouldn't need to allocate a string for them, and only read from the source file when needed. But... that's an optimization that can be done later. After merging this, the next steps could be: 1. Copy the doc comments found in the many `.md` files into the standard library (they will be duplicated, but just for a wihle) 2. Create a script or something that generates the `.md` files from the doc comments Note: I removed the lalrpop code because I got some errors and I thought maybe it's not very useful to keep that code around if we have to make changes to it to maintain it, but it's not working (we could always revive it from git's history). But let me know if this is wrong. ## 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. --------- Co-authored-by: Tom French <[email protected]>
- Loading branch information
1 parent
b86c2bc
commit 45f4ae0
Showing
39 changed files
with
720 additions
and
720 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.