aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorveetaha <[email protected]>2020-05-26 20:51:04 +0100
committerveetaha <[email protected]>2020-05-26 20:55:35 +0100
commit3c749b6224282e18db264b1e2e6f19f14b5c0a26 (patch)
tree34a70580f5462b9b3916cf04e8819a1848d80d59
parente3280eb4ae9d8c49badeaa0a503f546b95dfcd31 (diff)
Partially fix displaying inlay hints in Github PR diff views
-rw-r--r--editors/code/src/util.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts
index 127a9e911..793c481fb 100644
--- a/editors/code/src/util.ts
+++ b/editors/code/src/util.ts
@@ -74,10 +74,11 @@ export type RustDocument = vscode.TextDocument & { languageId: "rust" };
74export type RustEditor = vscode.TextEditor & { document: RustDocument }; 74export type RustEditor = vscode.TextEditor & { document: RustDocument };
75 75
76export function isRustDocument(document: vscode.TextDocument): document is RustDocument { 76export function isRustDocument(document: vscode.TextDocument): document is RustDocument {
77 return document.languageId === 'rust' 77 // Prevent corrupted text (particularly via inlay hints) in diff views
78 // SCM diff views have the same URI as the on-disk document but not the same content 78 // by allowing only `file` schemes
79 && document.uri.scheme !== 'git' 79 // unfortunately extensions that use diff views not always set this
80 && document.uri.scheme !== 'svn'; 80 // to something different than 'file' (see ongoing bug: #4608)
81 return document.languageId === 'rust' && document.uri.scheme === 'file';
81} 82}
82 83
83export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { 84export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor {