make drive comparison case-insensitive.

This commit is contained in:
Omer Ben-Amram 2019-12-15 15:07:33 +02:00
parent 6cbd8a4a4b
commit 1d9b585c62

View file

@ -10,10 +10,19 @@ export interface PublishDecorationsParams {
export function handle(params: PublishDecorationsParams) {
const targetEditor = vscode.window.visibleTextEditors.find(
editor => editor.document.uri.toString() === params.uri,
editor => {
const unescapedUri = unescape(editor.document.uri.toString());
// Unescaped URI should be something like:
// file:///c:/Workspace/ra-test/src/main.rs
// RA server might send it with the drive letter uppercased, so we force only the drive letter to lowercase.
const uriWithLowercasedDrive = params.uri.substr(0, 8) + params.uri[8].toLowerCase() + params.uri.substr(9);
return unescapedUri === uriWithLowercasedDrive
}
);
if (!Server.config.highlightingOn || !targetEditor) {
return;
}
Server.highlighter.setHighlights(targetEditor, params.decorations);
}