Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description ## Problem Part of #1577 ## Summary LSP will now suggest completions anywhere there's a Path. Here are some scenarios: ### Autocomplete functions in full paths, with parameters ![lsp-complete-function](https://github.com/user-attachments/assets/48f1bc08-50e6-4c10-b22a-8c99dd67736d) ### Autocomplete functions when they exist in a use statement ![lsp-complete-function-after-use](https://github.com/user-attachments/assets/74f27049-ec4d-4722-972b-586e1f834969) ### Built-in functions are also suggested ![lsp-builtin-functions](https://github.com/user-attachments/assets/17ecd98b-7001-4981-a1ba-f54ec4aa8ca3) ### Autocomplete local variables ![lsp-local-var](https://github.com/user-attachments/assets/671efe94-4a4d-4cd8-a66b-982d67276383) ### Autocomplete types in several type positions ![lsp-suggest-type](https://github.com/user-attachments/assets/e52a965a-59b1-47a9-aff2-c5c7cbce8e37) ### Built-in types are also suggested ![lsp-builtin-type](https://github.com/user-attachments/assets/9b3c0bb6-b429-447a-9b13-7d1d939127dc) ### Autocomplete type parameters ![lsp-type-parameter](https://github.com/user-attachments/assets/e8bd3e8d-ac20-48f9-b416-426d9ddfcd4e) ## Additional Context Sorry for the large diff, the bulk of it is traversing the AST. I thought about using something like the Visitor pattern, but I'm not exactly sure how it would look in Rust and whether it would greatly reduce the amount of code. It could be a separate refactor, though! (and we have tons of tests now, so it should be safe to do too). Another big chunk of code is tests... So the actual logic isn't that large. Some more things could be done on top of this, like suggesting `Self` if it's available, but I wanted to stop making this PR bigger 😊 ## 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