From 3c749b6224282e18db264b1e2e6f19f14b5c0a26 Mon Sep 17 00:00:00 2001 From: veetaha Date: Tue, 26 May 2020 22:51:04 +0300 Subject: Partially fix displaying inlay hints in Github PR diff views --- editors/code/src/util.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'editors/code/src') 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" }; export type RustEditor = vscode.TextEditor & { document: RustDocument }; export function isRustDocument(document: vscode.TextDocument): document is RustDocument { - 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'; + // Prevent corrupted text (particularly via inlay hints) in diff views + // by allowing only `file` schemes + // unfortunately extensions that use diff views not always set this + // to something different than 'file' (see ongoing bug: #4608) + return document.languageId === 'rust' && document.uri.scheme === 'file'; } export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { -- cgit v1.2.3