Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Inlay hint #2018
Inlay hint #2018
Changes from 61 commits
a9cf8b7
e5b8147
375ff3a
48a65f2
0ba4906
4e43386
7b691d2
90fb030
21fb6e0
d60c157
ea953eb
83b152e
a8f30ed
fcb6ec5
730e47d
f6932b8
e1979d8
e9dd64c
6e5f09c
16d1b32
d249241
c5a6469
d833b4c
a9e268b
3d3d6b1
595471f
c88bbd2
f2528b4
113fbb9
3e81846
ae17344
0566c0f
0014a4d
fcf7212
f4e38fa
719bbbc
ad6814e
b67dd54
77c6bfb
75bda39
d7c7b0b
f07cc30
d370af9
ea1e4f2
8ae7630
405de83
3779a13
f57acee
ffb0280
8269fbf
b5370ec
99fdf69
3fb3027
56f4f6e
37857bb
9992e23
f38e620
b54f24c
e80903e
cd5b946
e63422e
3823e3b
2523ed8
9f22d31
343c6eb
53beedc
653f9be
804f1c0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of requesting new inlay hints for all of the views, maybe it would be better to use the logic that I used at the semantic tokens refresh. Meaning that only requests for the views that are currently visible ( = selected) are made, and for the other views a variable is set that a request should be made as soon as the view gets activated. See also the description of the refresh requests in the lsp specs, that say clients can delay request for non-visible tabs. The reason I did it this way was because one server (I think it was rust-analyzer) would send a refresh request after each text change. And if someone has for example 10 tabs in the window, but only one of it active, then we send 9 useless requests all the time and do the inlay hints processing and phantom updates even for views that are not visible currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think that I would work on optimizing this.
Inlay hints doesn't seem like an expensive request (like semantic token is).
If this turns to be a problem only than I would optimize and add more code.
Here is one implementation detail of how inlay hints currently function.
If the server implements the workspace/inlayHint/refresh request,
we will request inlay hints for each session view.
So the client will refresh the inlay hints each time the server desires,
as an end result we should not end up with stale inlay hints in one view ever.
Even if the server supports or does not support the workspace/inlayHint/refresh request,
there is this peace of code that will request inlay hints as soon as the view gets active:
https://github.com/sublimelsp/LSP/pull/2018/files#diff-982c110867d9809c978a5597e4da66ce7538b327675a66b8f27214413b7c0ec1R345
This logic is redundant for servers that do support workspace/inlayHint/refresh request,
but I would say that it is necessary for servers for that do not support workspace/inlayHint/refresh. (just in case to update stale inlay hints as soon as the user focuses one view)
But as I said I would not add any code for optimizing this until it turns out to be a perf issue.