aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/inlay_hints.ts
diff options
context:
space:
mode:
authorJulien Roncaglia <[email protected]>2020-03-01 15:46:32 +0000
committerJulien Roncaglia <[email protected]>2020-03-01 15:54:56 +0000
commitb95756d21b7988f067d1d5d6448dbe46118f972f (patch)
tree4ef0f29e9bdab42a4bcd53e66f241a6429d77af9 /editors/code/src/inlay_hints.ts
parent6db2da4993d3956fc7c8ebf152963a132611426a (diff)
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.
Diffstat (limited to 'editors/code/src/inlay_hints.ts')
-rw-r--r--editors/code/src/inlay_hints.ts11
1 files changed, 10 insertions, 1 deletions
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';
4import { Ctx } from './ctx'; 4import { Ctx } from './ctx';
5import { log, sendRequestWithRetry } from './util'; 5import { log, sendRequestWithRetry } from './util';
6 6
7const noInlayUriSchemes = ['git', 'svn'];
8
7export function activateInlayHints(ctx: Ctx) { 9export function activateInlayHints(ctx: Ctx) {
8 const hintsUpdater = new HintsUpdater(ctx); 10 const hintsUpdater = new HintsUpdater(ctx);
9 vscode.window.onDidChangeVisibleTextEditors( 11 vscode.window.onDidChangeVisibleTextEditors(
@@ -90,7 +92,14 @@ class HintsUpdater {
90 92
91 private get allEditors(): vscode.TextEditor[] { 93 private get allEditors(): vscode.TextEditor[] {
92 return vscode.window.visibleTextEditors.filter( 94 return vscode.window.visibleTextEditors.filter(
93 editor => editor.document.languageId === 'rust', 95 editor => {
96 if (editor.document.languageId !== 'rust') {
97 return false;
98 }
99 const scheme = editor.document.uri.scheme;
100 const hasBlacklistedScheme = noInlayUriSchemes.some(s => s === scheme);
101 return !hasBlacklistedScheme;
102 },
94 ); 103 );
95 } 104 }
96 105