diff options
author | Julien Roncaglia <[email protected]> | 2020-03-01 15:46:32 +0000 |
---|---|---|
committer | Julien Roncaglia <[email protected]> | 2020-03-01 15:54:56 +0000 |
commit | b95756d21b7988f067d1d5d6448dbe46118f972f (patch) | |
tree | 4ef0f29e9bdab42a4bcd53e66f241a6429d77af9 /editors/code/src | |
parent | 6db2da4993d3956fc7c8ebf152963a132611426a (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')
-rw-r--r-- | editors/code/src/inlay_hints.ts | 11 |
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'; | |||
4 | import { Ctx } from './ctx'; | 4 | import { Ctx } from './ctx'; |
5 | import { log, sendRequestWithRetry } from './util'; | 5 | import { log, sendRequestWithRetry } from './util'; |
6 | 6 | ||
7 | const noInlayUriSchemes = ['git', 'svn']; | ||
8 | |||
7 | export function activateInlayHints(ctx: Ctx) { | 9 | export 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 | ||