aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/ctx.ts
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-03-07 12:07:44 +0000
committerVeetaha <[email protected]>2020-03-07 12:08:35 +0000
commita63446f2549afbeafe632c425112b7c38b5c9991 (patch)
treede59f376c1101a122b8abdcf0e1f7a9a53c45e23 /editors/code/src/ctx.ts
parent3d93e2108e182350e8bbf51d02a76c85ef831f8e (diff)
vscode: prerefactor util.ts and ctx.ts
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r--editors/code/src/ctx.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index b4e983a0c..25ef38aed 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient';
3 3
4import { Config } from './config'; 4import { Config } from './config';
5import { createClient } from './client'; 5import { createClient } from './client';
6import { isRustDocument } from './util'; 6import { isRustEditor, RustEditor } from './util';
7 7
8export class Ctx { 8export class Ctx {
9 private constructor( 9 private constructor(
@@ -22,17 +22,15 @@ export class Ctx {
22 return res; 22 return res;
23 } 23 }
24 24
25 get activeRustEditor(): vscode.TextEditor | undefined { 25 get activeRustEditor(): RustEditor | undefined {
26 const editor = vscode.window.activeTextEditor; 26 const editor = vscode.window.activeTextEditor;
27 return editor && isRustDocument(editor.document) 27 return editor && isRustEditor(editor)
28 ? editor 28 ? editor
29 : undefined; 29 : undefined;
30 } 30 }
31 31
32 get visibleRustEditors(): vscode.TextEditor[] { 32 get visibleRustEditors(): RustEditor[] {
33 return vscode.window.visibleTextEditors.filter( 33 return vscode.window.visibleTextEditors.filter(isRustEditor);
34 editor => isRustDocument(editor.document),
35 );
36 } 34 }
37 35
38 registerCommand(name: string, factory: (ctx: Ctx) => Cmd) { 36 registerCommand(name: string, factory: (ctx: Ctx) => Cmd) {