mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-16 07:15:24 +00:00
Centralize the check for languageId on document
Also move visibleRustEditors to Ctx
This commit is contained in:
parent
b95756d21b
commit
2f54c1d653
5 changed files with 25 additions and 24 deletions
|
@ -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';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue