diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-03 13:45:26 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-03 13:45:26 +0000 |
commit | b55d22e06095821eaf588786663d3b2b946e8549 (patch) | |
tree | 72c430f62b2d238ceee60b2441796fff5483161f /editors/code/src/util.ts | |
parent | 0cb387c36257a2811046f1ed65e59f83a1ea03bc (diff) | |
parent | 2f54c1d653d46831eeb7d691c5f25b78ca63378a (diff) |
Merge #3388
3388: Remove inlay hint in diff views r=matklad a=vbfox
If the left side of a diff view that contain the old version of the file apply inlays they are misplaced and produce a weird display:
![image](https://user-images.githubusercontent.com/131878/75628802-b1ac1900-5bdc-11ea-8c26-6722d8e38371.png)
After the change:
![image](https://user-images.githubusercontent.com/131878/75628831-e91ac580-5bdc-11ea-9039-c6b4ffbdb2be.png)
The detection is done by blacklisting the url schemes used by git and subversion scm extensions, whitelisting `file` is also possible but neither is perfect as VSCode now support both pluggable scm extensions and pluggable remote filesystems. But I suspect that the list of scm extensions is more easily manageable.
**Note**: I can rebase on #3378 if needed as it touches the same lines of code
Co-authored-by: Julien Roncaglia <[email protected]>
Diffstat (limited to 'editors/code/src/util.ts')
-rw-r--r-- | editors/code/src/util.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index f56c6bada..7c95769bb 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as lc from "vscode-languageclient"; | 1 | import * as lc from "vscode-languageclient"; |
2 | import * as vscode from "vscode"; | 2 | import * as vscode from "vscode"; |
3 | import { strict as nativeAssert } from "assert"; | 3 | import { strict as nativeAssert } from "assert"; |
4 | import { TextDocument } from "vscode"; | ||
4 | 5 | ||
5 | export function assert(condition: boolean, explanation: string): asserts condition { | 6 | export function assert(condition: boolean, explanation: string): asserts condition { |
6 | try { | 7 | try { |
@@ -65,3 +66,10 @@ export async function sendRequestWithRetry<TParam, TRet>( | |||
65 | function sleep(ms: number) { | 66 | function sleep(ms: number) { |
66 | return new Promise(resolve => setTimeout(resolve, ms)); | 67 | return new Promise(resolve => setTimeout(resolve, ms)); |
67 | } | 68 | } |
69 | |||
70 | export function isRustDocument(document: TextDocument) { | ||
71 | return document.languageId === 'rust' | ||
72 | // SCM diff views have the same URI as the on-disk document but not the same content | ||
73 | && document.uri.scheme !== 'git' | ||
74 | && document.uri.scheme !== 'svn'; | ||
75 | } \ No newline at end of file | ||