mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
vscode: prerefactor util.ts and ctx.ts
This commit is contained in:
parent
3d93e2108e
commit
a63446f254
2 changed files with 14 additions and 10 deletions
|
@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient';
|
|||
|
||||
import { Config } from './config';
|
||||
import { createClient } from './client';
|
||||
import { isRustDocument } from './util';
|
||||
import { isRustEditor, RustEditor } from './util';
|
||||
|
||||
export class Ctx {
|
||||
private constructor(
|
||||
|
@ -22,17 +22,15 @@ export class Ctx {
|
|||
return res;
|
||||
}
|
||||
|
||||
get activeRustEditor(): vscode.TextEditor | undefined {
|
||||
get activeRustEditor(): RustEditor | undefined {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
return editor && isRustDocument(editor.document)
|
||||
return editor && isRustEditor(editor)
|
||||
? editor
|
||||
: undefined;
|
||||
}
|
||||
|
||||
get visibleRustEditors(): vscode.TextEditor[] {
|
||||
return vscode.window.visibleTextEditors.filter(
|
||||
editor => isRustDocument(editor.document),
|
||||
);
|
||||
get visibleRustEditors(): RustEditor[] {
|
||||
return vscode.window.visibleTextEditors.filter(isRustEditor);
|
||||
}
|
||||
|
||||
registerCommand(name: string, factory: (ctx: Ctx) => Cmd) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue