microsoft / microsoft/monaco-editor

goto definition doesn't work for symbols in extraLibs with scheme+hostname in url

Open
#967 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request typescript typescript-multifile
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

monaco-editor version: 0.13.1
Browser: Chrome
OS: win10

i'm adding external libs like this:

libs.forEach((lib, i: number) => {
    monaco.languages.typescript.javascriptDefaults.addExtraLib(lib.text, lib.url);
    monaco.editor.createModel(lib.text, "typescript", monaco.Uri.parse(lib.url));
});

however, if the libs' urls are absolute urls (http://...) , then, for symbols defined in those libs (eg keyCode, below):

  • the hover tool works fine (it shows the type & comment defined in the extraLib):
    image

  • goto-definition doesn't work (does nothing),

  • peek definition shows the peek popup, with the correct extraLib filename & path, but the contents are the file that was right-clicked on:
    image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report in Chrome with monaco.languages.typescript.javascriptDefaults.addExtraLib and monaco.editor.createModel using an absolute http URL. Trace how these entry points resolve the extraLib URI for goto-definition and peek definition. Done means goto-definition opens the correct extraLib location and peek definition displays its contents.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.