diff options
Diffstat (limited to 'editors/code/src/util.ts')
-rw-r--r-- | editors/code/src/util.ts | 8 |
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 @@ | |||
1 | import * as lc from "vscode-languageclient"; | 1 | import * as lc from "vscode-languageclient"; |
2 | import * as vscode from "vscode"; | 2 | import * as vscode from "vscode"; |
3 | import { strict as nativeAssert } from "assert"; | 3 | import { strict as nativeAssert } from "assert"; |
4 | import { TextDocument } from "vscode"; | ||
4 | 5 | ||
5 | export function assert(condition: boolean, explanation: string): asserts condition { | 6 | export function assert(condition: boolean, explanation: string): asserts condition { |
6 | try { | 7 | try { |
@@ -65,3 +66,10 @@ export async function sendRequestWithRetry<TParam, TRet>( | |||
65 | function sleep(ms: number) { | 66 | function sleep(ms: number) { |
66 | return new Promise(resolve => setTimeout(resolve, ms)); | 67 | return new Promise(resolve => setTimeout(resolve, ms)); |
67 | } | 68 | } |
69 | |||
70 | export 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 | ||