Skip to content

How to navigate a comments programmatically? #184

Discussion options

You must be logged in to vote

Hi @KrabsWong ,

To open a file and navigate to some specific position, you must open a file, show it and reveal the position (line - character). Something like:

    const document = await vscode.workspace.openTextDocument(fileUri);
    await vscode.window.showTextDocument(document);

    const position = new Selection(line, column, line, column);
    window.activeTextEditor.selection = newPosition;
    window.activeTextEditor.revealRange(newPosition, reviewType);

About the comment itself, I didn't play with it that much, but it seems the CommentThread interface has a collapsibleState, which defines if the thread must be displayed collapsed/expanded when opened the document.

BTW, I would s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@KrabsWong
Comment options

Answer selected by KrabsWong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants