-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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 location links goto definition goes to the nearest symbol #167564
Comments
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.73.1. Please try upgrading to the latest version and checking whether this issue remains. Happy Coding! |
It remains. |
Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue. Happy Coding! |
Steps to reproduce:
It will go to the definition of nearest token (the default behaviour of clicking on inlay hints) instead of the link target. It also should not make the nearest token blue and only blue the link part. |
Please tell me if there is anything else missing. |
I can reproduce it in monaco playground as well with this code: monaco.languages.register({
id: 'myLang'
});
monaco.editor.create(document.getElementById('container'), {
value: `
tokenWithNoDefinition
tokenWithDefinition
targetOfToken
targetOfInlayHint
`,
language: 'myLang',
colorDecorators: true
});
monaco.languages.registerDefinitionProvider('myLang', {
provideDefinition: (model, position) => {
if (position.lineNumber === 3) {
return {
range: new monaco.Range(5, 1, 5, 14),
uri: model.uri,
};
}
},
});
const inlayLabel = (model) => [
{
label: 'Unlinked<',
},
{
label: 'linked',
location: {
range: new monaco.Range(6, 1, 6, 14),
uri: model.uri,
}
},
{
label: '>Unlinked2',
},
];
monaco.languages.registerInlayHintsProvider('myLang', {
provideInlayHints: (model) => {
return {
hints: [
{
label: inlayLabel(model),
position: new monaco.Position(2, 22),
},
{
label: inlayLabel(model),
position: new monaco.Position(3, 20),
},
]
};
},
}); It creates two inlay hints but ctrl+click on either of them won't go to the |
Thanks. Code sample is the way to go 👏 |
@jrieken Can you please reopen this issue? It is not fixed completely yet (#167886 (comment)) |
Thanks for the ping. I didn't really test this. I have #169532 up for this. It should reduce confusing and make this less error prone |
Thanks! this now works correctly. |
Implement location link for type inlay hints fix #11701 This actually doesn't work due a problem in vscode: microsoft/vscode#167564
Marking as verified due to previous comment. |
Does this issue occur when all extensions are disabled?: No
Steps to Reproduce:
It should use the location data which the language server provides if I ctrl+click on the linked part, but instead it runs go to definition for the nearest token (which is colored in addition to the inlay hint part which is under cursor).
The text was updated successfully, but these errors were encountered: