Centralize the check for languageId on document
Also move visibleRustEditors to Ctx
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as lc from "vscode-languageclient";
|
||||
import * as vscode from "vscode";
|
||||
import { strict as nativeAssert } from "assert";
|
||||
import { TextDocument } from "vscode";
|
||||
|
||||
export function assert(condition: boolean, explanation: string): asserts condition {
|
||||
try {
|
||||
@@ -65,3 +66,10 @@ export async function sendRequestWithRetry<TParam, TRet>(
|
||||
function sleep(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
export function isRustDocument(document: TextDocument) {
|
||||
return document.languageId === 'rust'
|
||||
// SCM diff views have the same URI as the on-disk document but not the same content
|
||||
&& document.uri.scheme !== 'git'
|
||||
&& document.uri.scheme !== 'svn';
|
||||
}
|
||||
Reference in New Issue
Block a user