From b95756d21b7988f067d1d5d6448dbe46118f972f Mon Sep 17 00:00:00 2001 From: Julien Roncaglia Date: Sun, 1 Mar 2020 16:46:32 +0100 Subject: Remove inlay in diff views If the left side of a diff view that contain the old version of the file apply inlays they are misplaced. The detection is done by blacklisting the url schemes used by git and subversion scm extensions. --- editors/code/src/inlay_hints.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index 6871bc111..46e5f7c0d 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts @@ -4,6 +4,8 @@ import * as ra from './rust-analyzer-api'; import { Ctx } from './ctx'; import { log, sendRequestWithRetry } from './util'; +const noInlayUriSchemes = ['git', 'svn']; + export function activateInlayHints(ctx: Ctx) { const hintsUpdater = new HintsUpdater(ctx); vscode.window.onDidChangeVisibleTextEditors( @@ -90,7 +92,14 @@ class HintsUpdater { private get allEditors(): vscode.TextEditor[] { return vscode.window.visibleTextEditors.filter( - editor => editor.document.languageId === 'rust', + editor => { + if (editor.document.languageId !== 'rust') { + return false; + } + const scheme = editor.document.uri.scheme; + const hasBlacklistedScheme = noInlayUriSchemes.some(s => s === scheme); + return !hasBlacklistedScheme; + }, ); } -- cgit v1.2.3