forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limited autocomplete for expressions (FuelLabs#4207)
## Description This PR adds autocomplete functionality for expressions to the LSP. It's triggered by entering `.` after a variable. Closes FuelLabs#2408 ### Use cases - Works inside of `main` functions - Works inside of other functions outside of an impl - Supports function chaining - Finds all methods for a struct anywhere in the namespace ### Limitations - Does not work inside of impl methods. This is because "incomplete" impl methods apparently cause the compiler to error out before generating tokens for the file - Can be slow to populate. This slowness is due to the compile time after every keystroke. - Doesn't show up in certain cases, depending on what other errors are inside the file. This is because the compiler won't generate tokens when certain errors are present. ### Screen captures ![Feb-28-2023 16-36-04](https://user-images.githubusercontent.com/47993817/222015034-e488180e-4389-4bdc-9b98-f4f3c646a11a.gif) method chaining ![Feb-28-2023 16-39-35](https://user-images.githubusercontent.com/47993817/222015426-eea06066-d07d-4fdb-a488-3e20802de79e.gif) ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [x] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
- Loading branch information
Showing
16 changed files
with
434 additions
and
106 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
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.