aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/util.ts')
-rw-r--r--editors/code/src/util.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts
index f56c6bada..7c95769bb 100644
--- a/editors/code/src/util.ts
+++ b/editors/code/src/util.ts
@@ -1,6 +1,7 @@
1import * as lc from "vscode-languageclient"; 1import * as lc from "vscode-languageclient";
2import * as vscode from "vscode"; 2import * as vscode from "vscode";
3import { strict as nativeAssert } from "assert"; 3import { strict as nativeAssert } from "assert";
4import { TextDocument } from "vscode";
4 5
5export function assert(condition: boolean, explanation: string): asserts condition { 6export function assert(condition: boolean, explanation: string): asserts condition {
6 try { 7 try {
@@ -65,3 +66,10 @@ export async function sendRequestWithRetry<TParam, TRet>(
65function sleep(ms: number) { 66function sleep(ms: number) {
66 return new Promise(resolve => setTimeout(resolve, ms)); 67 return new Promise(resolve => setTimeout(resolve, ms));
67} 68}
69
70export function isRustDocument(document: TextDocument) {
71 return document.languageId === 'rust'
72 // SCM diff views have the same URI as the on-disk document but not the same content
73 && document.uri.scheme !== 'git'
74 && document.uri.scheme !== 'svn';
75} \ No newline at end of file