-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 Hints Example #553
Comments
@jrieken Can your test repo work as one? https://github.com/jrieken/test-inlayhints |
This comment was marked as spam.
This comment was marked as spam.
That's just client side, much more helpful would be proper LSP implementation. |
@burner1024 and if anyone else needs it. I spend about a hour to solve but I found it. server side this.connection.languages.inlayHint.on((arg) => {
const one = InlayHint.create(Position.create(1,1), [InlayHintLabelPart.create("type")], InlayHintKind.Type);
one.data = "1";
const two = InlayHint.create(Position.create(2,2), [InlayHintLabelPart.create("parameter")], InlayHintKind.Parameter);
two.data = "2";
return [one, two];
});
this.connection.languages.inlayHint.resolve((hint) => {
(hint.label as InlayHintLabelPart[])[0].tooltip = "tooltip";
hint.textEdits = [TextEdit.insert(Position.create(1, 1), "number")];
return hint;
}); Make sure to enable that in server capabilities connection.onInitialize(() => {
return {
capabilities: {
// ...
inlayHintProvider: {
documentSelector: [{language: "json"}],
resolveProvider: true
},
inlineValueProvider: {
documentSelector: [{language: "json"}],
},
// ...
}
};
}); |
Can we get an example extension using the proposed Inlay Hints API? Per the 1.64 release notes, this API is nearing completion and it would be helpful to have an extension sample available.
The text was updated successfully, but these errors were encountered: