-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description ## Problem The LSP server recently became very slow. The main culprits are these two PRs: - #5461 - #5561 Those PRs made it so that when a file is opened, changed or saved, we re-analyze the entire workspace. It turns out that's too slow (I tried it on a few big projects and it wasn't slow, but it is slow in one of our projects). The old behavior was to only check the package where the file is, not the entire workspace. Another issue is that inlay hints don't work well inside contracts because they have generated code that ends up overlapping the real code. ## Summary This is what this PR does: it only checks the enclosing package when opening or saving a document (essentially reverting #5461). There's also a speed-up here because previously the entire workspace's files were loaded and parsed, even if we only ended up analyzing one package. In this PR we always load a single package. The downside is that if you have a workspace with two projects, A and B, where A depends on B, if you search for references of a type that's defined in B starting from B, you won't find references to it in project A (it will work fine if you search for references starting from A, because when we analyze A we also analyze its dependencies). But that downgrade in behavior is preferable to a slow experience. Regarding inlay hints, they are now completely disabled inside contracts. ## Additional Context There's also a fix for when hover requests sometimes crashes. Debugging this I noticed it happens when hovering over modules we can't find, and that too is related to generated code inside contracts. The fix is to at least not crash the LSP server and not return any hover info. ## 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
50 additions
and
94 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