mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Partially fix displaying inlay hints in Github PR diff views
This commit is contained in:
parent
e3280eb4ae
commit
3c749b6224
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user