Skip to content
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

Add proposed textDocument/inlayHints to protocol & client. #772

Closed
wants to merge 2 commits into from

Conversation

sam-mccall
Copy link

This addresses the FR microsoft/language-server-protocol#956
And corresponds to the spec in microsoft/language-server-protocol#1249

@sam-mccall
Copy link
Author

@dbaeumer I'm guessing that as a new feature, this should all go under "proposed"?
Does this mean I should fold the spec text (i.e. microsoft/language-server-protocol#1249) into this PR as a protocol.inlayHints.proposed.md file?

@dbaeumer
Copy link
Member

dbaeumer commented Jun 3, 2021

@sam-mccall yes, this all has to go under proposed. And it is easier to keep the markdown spec part in sync if it is part of this repository as well. Adding it to the spec can be done when we think that the proposed API has reach some stability.

@sam-mccall
Copy link
Author

@dbaeumer Gentle ping to get this back on your radar :-)

We've got a server implementation of this in clangd which is coming up to a release cycle, and are looking to add matching support in a client soon. Having the protocol landed in some form (proposed, or even just rough agreement on the protocol structure) would let us align on that. IME it's hard to rip out nonstandard extensions later especially if they're "richer" than the standard replacement.

@dbaeumer
Copy link
Member

dbaeumer commented Aug 9, 2021

I was out on vacation. I will try to find out where VS Code is with that. What we can do is to add something that mirrors VS Code's proposed API. But then the proposed API might change if the VS Code API changes.

@dbaeumer
Copy link
Member

I followed up with the VS Code team and they expect changes in the realm of inlay Hints.

Given that and the fact that the PR doesn't contain any server implementation I will currently not merge it.

@sam-mccall are you willing to add the server code as well? Otherwise it is hard to write tests for this.

@sam-mccall
Copy link
Author

@dbaeumer thanks for following up.

I'm willing to add node server code & tests if you think this it's likely it can be merged in that case.
(If it's going to be blocked waiting for VSCode changes anyway, then I'd probably wait)

@dbaeumer
Copy link
Member

@sam-mccall I would propose to wait for now and see what happens in VS Code.

@RedyAu
Copy link

RedyAu commented Jan 31, 2022

I'd like to second this issue.
VSCode now has a toggle like this:
image
Can you give us a status update? It seems many language-extensions are blocked on this PR, although admittedly I didn't take the time to fully understand the chain of things that need to happen.

Related issue: microsoft/language-server-protocol#956
I'm coming from this Dart extension issue: Dart-Code/Dart-Code#3609

@dbaeumer
Copy link
Member

dbaeumer commented Feb 1, 2022

VS Code will finalize the API this month. After that I think it is a good time to look into the PR again.

@rami3l
Copy link

rami3l commented Feb 22, 2022

@dbaeumer Gentle reminder: microsoft/vscode#16221 (comment) is now closed.

@dbaeumer
Copy link
Member

Anyone interested in preparing a new PR or updating this one? Based on reviews we did we changed the VS Code API to allow more features (like navigating on inlay hints) which resulted in changes in the API.

@sam-mccall
Copy link
Author

sam-mccall commented Feb 22, 2022

I can take another pass at it but probably not for a few weeks.

If someone else wants to jump on it before then, please do!

@dbaeumer
Copy link
Member

dbaeumer commented Mar 4, 2022

A first draft version is available here:

import { RequestHandler, RequestHandler0 } from 'vscode-jsonrpc';

@fwcd
Copy link
Contributor

fwcd commented Mar 7, 2022

@dbaeumer Thanks for the nice work, just a question:

In the proposed LSP API, the range parameter of InlayHintParams is called viewPort whereas both the new VSCode API and rust-analyzer call it range. Any reason for not picking range for LSP too?

@matklad
Copy link
Contributor

matklad commented Mar 7, 2022

Yeah, viewPort would also be inconsistent with LSP's semantic highlighhting:

@fwcd
Copy link
Contributor

fwcd commented Mar 7, 2022

Another slight inconsistency is textDocument/inlayHint (singular) in the current LSP proposal vs. textDocument/semanticTokens (plural). A lot of other textDocument requests are singular too though, so perhaps naming the request in singular is more idiomatic?

@dbaeumer
Copy link
Member

dbaeumer commented Mar 8, 2022

I called it viewPort since this is how we called it in the inline values. I chatted with @jrieken that we should also make it consistent in the VS Code API.

In general all request are singular. The semantic token one slipped in and it was too late to correct it since it already moved out of proposed and I didn't want to break it.

@dbaeumer
Copy link
Member

dbaeumer commented Mar 8, 2022

If we choose range we could make it consistent since inline values is still proposed.

@dbaeumer
Copy link
Member

dbaeumer commented Mar 8, 2022

OK. We will use range since a client can ask for a range that is not the viewPort.

@dbaeumer
Copy link
Member

I will close the PR. The feature has shipped in 3.17

@dbaeumer dbaeumer closed this May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants