question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Link Provider's resolveLink method

See original GitHub issue

monaco-editor version: 0.17.0 monaco-editor-webpack-plugin: 1.7.0 Browser: Chrome OS: -

Steps or JS usage snippet reproducing the issue:

  1. 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};
          }
    });
  1. Click on the link on the monaco editor.
  2. 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:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mmuletcommented, Aug 8, 2019

Added a vscode pull request microsoft/vscode#78732

1reaction
mmuletcommented, Aug 8, 2019

I opened an microsoft/vscode#78731 addressing this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve Link dialog box appears when trying to open Inventor ...
Issue : When opening Inventor file the 'Resolve Link' dialog box opens and is related to fasteners (Content Center files) parts or assemblies ......
Read more >
2013 - DD4T - Dynamic Link Resolution Falls Over Within ...
It sees and recognises the type ComponentLink without an issue. So it seems to be losing that information when built. I can also...
Read more >
Links - Cloud Foundry BOSH
Links provide a solution to the above problem by making the Director responsible for the IP management. Release authors get a consistent way...
Read more >
LinkProvider | Monaco Editor API
Interface LinkProvider. A provider of links. ... Methods. provideLinks. provideLinks(model: ITextModel, token: CancellationToken): ... Optional resolveLink.
Read more >
What Are the Common Causes of Full Text Linking Problems ...
For example, you find an Article from Provider A, and go through a link resolver to link to Full Text from Provider B,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found