Issue with Link Provider's resolveLink method
See original GitHub issuemonaco-editor version: 0.17.0 monaco-editor-webpack-plugin: 1.7.0 Browser: Chrome OS: -
Steps or JS usage snippet reproducing the issue:
- Register a Link Provider for monaco-editor
monaco.languages.registerLinkProvider('json', {
provideLinks:
(model: monaco.editor.ITextModel, token: monaco.CancellationToken):
monaco.languages.ProviderResult<monaco.languages.ILinksList> => {
return {
links: [{
range: {
startLineNumber: 1,
startColumn: 1,
endLineNumber: 2,
endColumn: 10,
}
}]
};
},
resolveLink:
(link: monaco.languages.ILink, token: monaco.CancellationToken):
monaco.languages.ProviderResult<monaco.languages.ILink> => {
// Call method to set position on the editor
return {range: link.range};
}
});
- Click on the link on the monaco editor.
- This results with the following error:
ERROR Error: missing
Error: missing
at eval (getLinks.js:123)
at ZoneDelegate.invoke (zone.js:390)
at Object.onInvoke (VM5290 core.js:17652)
at ZoneDelegate.invoke (zone.js:389)
at Zone.run (zone.js:149)
I want to implement a feature that redirects these links to a specific line number on the editor. To do so, I passed in a method in resolveLink that allows me to set the position on the editor.
The resolveLink method gets called when a url is not provided in monaco.languages.ILink in the provideLinks method. However, monaco-editor throws an error when a url is not provided when returning the link in resolveLink method. If I provide a url in the resolveLink method, the resolveLink will not be called again when the same link is clicked again. If I don’t provide a url, it works perfectly as expected by allowing me to redirect this link to a specific line number multiple times, but it throws the same error above on the console.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Added a vscode pull request microsoft/vscode#78732
I opened an microsoft/vscode#78731 addressing this