aboutsummaryrefslogtreecommitdiff
path: root/code/src/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'code/src/main.ts')
-rw-r--r--code/src/main.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/code/src/main.ts b/code/src/main.ts
index 75a824b7b..72bef7061 100644
--- a/code/src/main.ts
+++ b/code/src/main.ts
@@ -34,6 +34,16 @@ export function activate(context: vscode.ExtensionContext) {
34 )) 34 ))
35 35
36 registerCommand('libsyntax-rust.syntaxTree', () => openDoc(uris.syntaxTree)) 36 registerCommand('libsyntax-rust.syntaxTree', () => openDoc(uris.syntaxTree))
37 registerCommand('libsyntax-rust.extendSelection', () => {
38 let editor = vscode.window.activeTextEditor
39 let file = activeSyntax()
40 if (editor == null || file == null) return
41 editor.selections = editor.selections.map((s) => {
42 let range = file.extendSelection(s)
43 if (range == null) return null
44 return new vscode.Selection(range.start, range.end)
45 })
46 })
37} 47}
38 48
39export function deactivate() { } 49export function deactivate() { }
@@ -49,6 +59,11 @@ export class Syntax {
49 59
50 syntaxTree(): string { return this.imp.syntaxTree() } 60 syntaxTree(): string { return this.imp.syntaxTree() }
51 highlight(): Array<[number, number, string]> { return this.imp.highlight() } 61 highlight(): Array<[number, number, string]> { return this.imp.highlight() }
62 extendSelection(range: vscode.Range): vscode.Range {
63 let range_ = fromVsRange(this.doc, range);
64 let extRange = this.imp.extendSelection(range_[0], range_[1]);
65 return toVsRange(this.doc, extRange);
66 }
52} 67}
53 68
54 69