Skip to content

What's the condition for DocumentLink target to be undefined? #106308

Closed

Description

@usernamehw

I would like to use api to get links from the document:

const links = await vscode.commands.executeCommand<DocumentLink[]>('vscode.executeLinkProvider', document.uri);

DocumentLink is guaranteed to have a range: Range;, but not the target?: Uri;. What are the cases when target is undefined, or am I using the wrong type?

Activity

  1. usernamehw commented on Sep 8, 2020

    @usernamehw
    ContributorAuthor

    vscode/src/vs/vscode.d.ts

    Lines 4030 to 4058 in 62f1bf8

    export class DocumentLink {
    /**
    * The range this link applies to.
    */
    range: Range;
    /**
    * The uri this link points to.
    */
    target?: Uri;
    /**
    * The tooltip text when you hover over this link.
    *
    * If a tooltip is provided, is will be displayed in a string that includes instructions on how to
    * trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
    * user settings, and localization.
    */
    tooltip?: string;
    /**
    * Creates a new document link.
    *
    * @param range The range the document link applies to. Must not be empty.
    * @param target The uri the document link points to.
    */
    constructor(range: Range, target?: Uri);
    }

  2. jrieken commented on Sep 9, 2020

    @jrieken
    Contributor

    Links without target must be resolved, see

    resolveDocumentLink?(link: T, token: CancellationToken): ProviderResult<T>;
    . The command seems to not resolve them.

  3. added
    unreleasedPatch has not yet been released in VS Code Insiders
    insiders-releasedPatch has been released in VS Code Insiders
    and removed
    unreleasedPatch has not yet been released in VS Code Insiders
    on Sep 9, 2020
  4. added a commit that references this issue on Sep 14, 2020
  5. github-actions commented on Sep 16, 2020

    @github-actions
    Contributor

    This bug has been fixed in to the latest release of VS Code Insiders!

    Alexander (@usernamehw), you can help us out by confirming things are working as expected in the latest Insiders release. If things look good, please leave a comment with the text /verified to let us know. If not, please ensure you're on version 9e50567 of Insiders (today's or later - you can use Help: About in the command pallete to check), and leave a comment letting us know what isn't working as expected.

    Happy Coding!

  6. locked and limited conversation to collaborators on Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apiauthor-verification-requestedIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugeditor-contribEditor collection of extrasinsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions