From f3612b7024e5828bdd37fb6d39c1b4ebe989e819 Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 31 Mar 2020 20:28:10 +0300 Subject: vscode: scroll to the syntax node in rust editor when highlighting --- editors/code/src/commands/syntax_tree.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'editors') diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index eba511193..e443c5e54 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts @@ -127,6 +127,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { if (!rustTextRange) return; this.rustEditor.setDecorations(AstInspector.astDecorationType, [rustTextRange]); + this.rustEditor.revealRange(rustTextRange); const rustSourceCode = this.rustEditor.document.getText(rustTextRange); const astTextRange = this.findAstRange(astTextLine); @@ -145,7 +146,7 @@ class AstInspector implements vscode.HoverProvider, Disposable { const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine); if (!parsedRange) return; - const [, begin, end] = parsedRange.map(off => doc.positionAt(+off)); + const [begin, end] = parsedRange.slice(1).map(off => doc.positionAt(+off)); return new vscode.Range(begin, end); } -- cgit v1.2.3