-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LSP always return unrelated items and too many #42152
Comments
@devoncarew - should this be filed on an lsp component instead? |
There are two reasons for the large payload:
@iamcco out of interest, which client and version are you using? |
@DanTup Thanks for the info and I use coc.nvim. I will test option |
option |
@iamcco what sort of times are you seeing with/without that option? Depending on the response to microsoft/language-server-protocol#954 we might be able to reduce the payload for some cases (like this one where we could filter by the prefix). When the payload is large, what's the impact in your editor? Is it just slow to show the completion list, or does it hang the editor (eg. if its single threaded and deserialising the JSON)? The LSP spec has support for partial results which allows a server to deliver results in small batches. We could potentially send two batches (one for in-scope symbols and one for the auto-import symbols), however that would only speed up the initial completion list and not reduce the deserialisation costs (so if your editor is hanging during deserialisation that might not help). I haven't started any work on supporting that as I don't know of any clients that support it currently. |
With all completeItems (option true) it slow down to show the autocomplete menu. Also a little slow down the client filter when forward typing. My solution now is use the middleware to filter completeItems with the prefix character to reduce the result, so it will not slow down the client filter when typing. |
This is why I was hoping for clarification on microsoft/language-server-protocol#954 - we might be able to do that in the server. I just did some testing in VS Code, and I found:
So assuming the spec would be updated to use VS Code's behaviour as a reference, I believe it may be safe for the server to filter on the prefix (though we may lose some of the fuzzy matching that VS Code does). |
Thanks for the testing. |
@DanTup FYI: We have fuzzy matching filtering support in server for another client. I suspect that the matching it uses is close enough to VS Code's matching to allow us to re-use it. |
Great! In that case if I can get some confirmation from Code or LSP that the behaviour described above is deliberate and can be made explicit in the spec, we should be able to make some significant gains here (and when using LSP for VS Code, could also significantly improve LiveShare) without any loss in usability :-) |
Bug: #42152. Bug: #40026. Change-Id: I4c921ddff3224d736c4236861d0ff156f58be595 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150628 Commit-Queue: Danny Tuppeny <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
The latest dev versions of the Dart SDK and the Flutter master channel have the changes detailed above which should significantly reduce the number of completion items returned by filtering them based on the prefix to the left of the caret (see #40026 (comment)). If you're able to try this out, please let me know if you still see cases with huge payloads. Thanks! |
I have test with version 2.9.0-19.0.dev and it wokrs great! Thank you!! |
Great! Thanks for confirming 🙂 |
This tracker is for issues related to:
Info:
Flutter 1.17.2 • channel stable • https://github.com/flutter/flutter.git
dart --version
):Dart VM version: 2.8.3 (stable) (Tue May 26 18:39:38 2020 +0200) on "macos_x64"
10.15.4
Step to repeoduce issue:
Create flutter project with
flutter create xxxname
lib/main.dart
addprint$
and$
is cursor, then press<ctrl>+<space>
to trigger autocompleteThen checkout the Dart LSP output channel:
The response items (26773 items) are too many, and most of them are unrelated items. This lag autocomplete when coding.
the full response complete items log is here
output.log 10 MB
The text was updated successfully, but these errors were encountered: