<p dir="auto">I've been using HoverProvider to quickly display the origin file of a user function in Lua.<br>
I'm using the Markdown syntax for creating a clickable link, which opens the file in the editor:</p>
<p dir="auto"><code class="notranslate">[c:\temp\file.lua](file:c:\temp\file.lua)</code> -&gt; <a href="#here">c:\temp\file.lua</a></p>
<p dir="auto">I'm wondering if this link syntax also supports line number, and if it does, what is the syntax of it?</p>
<p dir="auto">I believe this question is also generally related to all places where an extension can display text formatted with Markdown.</p>
<p dir="auto">Hi,</p>
<p dir="auto">At the moment the virtual documents created by TextDocumentContentProvider can contain links to external resources, but I would expect it to work with links that use the same scheme that was registered with registerTextDocumentContentProvider. Here's an example to show what I mean:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;
var vscode = require('vscode');

function activate(context) {

    let initUri = vscode.Uri.parse('link-test://authority/page1');

    const provider = {
        provideTextDocumentContent: function(uri) {
            if (uri.path === &quot;/page1&quot;) {
                return `&lt;a href=&quot;link-test://authority/page2&quot;&gt;Page 2&lt;/a&gt;`;
            } else {
                return `&lt;a href=&quot;link-test://authority/page1&quot;&gt;Page 1&lt;/a&gt;`;
            }
        }
    };

    let registration = vscode.workspace.registerTextDocumentContentProvider('link-test', provider);

    let disposable = vscode.commands.registerCommand('extension.testLinks', () =&gt; {
        return vscode.commands.executeCommand('vscode.previewHtml', initUri, vscode.ViewColumn.Two).then((success) =&gt; {
        }, (reason) =&gt; {
            vscode.window.showErrorMessage(reason);
        });

    });
    context.subscriptions.push(disposable, registration);
}
exports.activate = activate;"><pre class="notranslate"><span class="pl-s">"use strict"</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">vscode</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'vscode'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">function</span> <span class="pl-en">activate</span><span class="pl-kos">(</span><span class="pl-s1">context</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

    <span class="pl-k">let</span> <span class="pl-s1">initUri</span> <span class="pl-c1">=</span> <span class="pl-s1">vscode</span><span class="pl-kos">.</span><span class="pl-c1">Uri</span><span class="pl-kos">.</span><span class="pl-en">parse</span><span class="pl-kos">(</span><span class="pl-s">'link-test://authority/page1'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-k">const</span> <span class="pl-s1">provider</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
        <span class="pl-en">provideTextDocumentContent</span>: <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">uri</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">uri</span><span class="pl-kos">.</span><span class="pl-c1">path</span> <span class="pl-c1">===</span> <span class="pl-s">"/page1"</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
                <span class="pl-k">return</span> <span class="pl-s">`&lt;a href="link-test://authority/page2"&gt;Page 2&lt;/a&gt;`</span><span class="pl-kos">;</span>
            <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-kos">{</span>
                <span class="pl-k">return</span> <span class="pl-s">`&lt;a href="link-test://authority/page1"&gt;Page 1&lt;/a&gt;`</span><span class="pl-kos">;</span>
            <span class="pl-kos">}</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>

    <span class="pl-k">let</span> <span class="pl-s1">registration</span> <span class="pl-c1">=</span> <span class="pl-s1">vscode</span><span class="pl-kos">.</span><span class="pl-c1">workspace</span><span class="pl-kos">.</span><span class="pl-en">registerTextDocumentContentProvider</span><span class="pl-kos">(</span><span class="pl-s">'link-test'</span><span class="pl-kos">,</span> <span class="pl-s1">provider</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-k">let</span> <span class="pl-s1">disposable</span> <span class="pl-c1">=</span> <span class="pl-s1">vscode</span><span class="pl-kos">.</span><span class="pl-c1">commands</span><span class="pl-kos">.</span><span class="pl-en">registerCommand</span><span class="pl-kos">(</span><span class="pl-s">'extension.testLinks'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-s1">vscode</span><span class="pl-kos">.</span><span class="pl-c1">commands</span><span class="pl-kos">.</span><span class="pl-en">executeCommand</span><span class="pl-kos">(</span><span class="pl-s">'vscode.previewHtml'</span><span class="pl-kos">,</span> <span class="pl-s1">initUri</span><span class="pl-kos">,</span> <span class="pl-s1">vscode</span><span class="pl-kos">.</span><span class="pl-c1">ViewColumn</span><span class="pl-kos">.</span><span class="pl-c1">Two</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">success</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">reason</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
            <span class="pl-s1">vscode</span><span class="pl-kos">.</span><span class="pl-c1">window</span><span class="pl-kos">.</span><span class="pl-en">showErrorMessage</span><span class="pl-kos">(</span><span class="pl-s1">reason</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-c1">subscriptions</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-s1">disposable</span><span class="pl-kos">,</span> <span class="pl-s1">registration</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-s1">exports</span><span class="pl-kos">.</span><span class="pl-c1">activate</span> <span class="pl-c1">=</span> <span class="pl-s1">activate</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">When I click the link Page 2 I would expect the provideTextDocumentContent callback to be called with the URI specified in the link.</p>