aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorveetaha <[email protected]>2020-03-31 18:28:10 +0100
committerveetaha <[email protected]>2020-03-31 18:28:10 +0100
commitf3612b7024e5828bdd37fb6d39c1b4ebe989e819 (patch)
tree6652859b9a84aa10d9e70a24d61dc0d09cc86bda /editors
parente86bfc0995a0c52eeed2703d33a9089032b68c77 (diff)
vscode: scroll to the syntax node in rust editor when highlighting
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/commands/syntax_tree.ts3
1 files changed, 2 insertions, 1 deletions
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 {
127 if (!rustTextRange) return; 127 if (!rustTextRange) return;
128 128
129 this.rustEditor.setDecorations(AstInspector.astDecorationType, [rustTextRange]); 129 this.rustEditor.setDecorations(AstInspector.astDecorationType, [rustTextRange]);
130 this.rustEditor.revealRange(rustTextRange);
130 131
131 const rustSourceCode = this.rustEditor.document.getText(rustTextRange); 132 const rustSourceCode = this.rustEditor.document.getText(rustTextRange);
132 const astTextRange = this.findAstRange(astTextLine); 133 const astTextRange = this.findAstRange(astTextLine);
@@ -145,7 +146,7 @@ class AstInspector implements vscode.HoverProvider, Disposable {
145 const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine); 146 const parsedRange = /\[(\d+); (\d+)\)/.exec(astLine);
146 if (!parsedRange) return; 147 if (!parsedRange) return;
147 148
148 const [, begin, end] = parsedRange.map(off => doc.positionAt(+off)); 149 const [begin, end] = parsedRange.slice(1).map(off => doc.positionAt(+off));
149 150
150 return new vscode.Range(begin, end); 151 return new vscode.Range(begin, end);
151 } 152 }