From 1d9b585c62dc92889380c9ae130d15ce7f9b08d4 Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sun, 15 Dec 2019 15:07:33 +0200 Subject: make drive comparison case-insensitive. --- editors/code/src/notifications/publish_decorations.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'editors') diff --git a/editors/code/src/notifications/publish_decorations.ts b/editors/code/src/notifications/publish_decorations.ts index 00ffb7776..120eabbc6 100644 --- a/editors/code/src/notifications/publish_decorations.ts +++ b/editors/code/src/notifications/publish_decorations.ts @@ -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); } -- cgit v1.2.3 From 324cbe839f3110bd4d51726d5a7afe29808ade02 Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sun, 15 Dec 2019 16:51:57 +0200 Subject: Lowercase drive letters on windows before sending to extension. --- editors/code/src/notifications/publish_decorations.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'editors') diff --git a/editors/code/src/notifications/publish_decorations.ts b/editors/code/src/notifications/publish_decorations.ts index 120eabbc6..4441e2b28 100644 --- a/editors/code/src/notifications/publish_decorations.ts +++ b/editors/code/src/notifications/publish_decorations.ts @@ -15,8 +15,7 @@ export function handle(params: PublishDecorationsParams) { // 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 + return unescapedUri === params.uri } ); -- cgit v1.2.3 From 498a7912e923ad8ce349f6874568373f430e9602 Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sun, 15 Dec 2019 16:55:39 +0200 Subject: fixed comment --- editors/code/src/notifications/publish_decorations.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'editors') diff --git a/editors/code/src/notifications/publish_decorations.ts b/editors/code/src/notifications/publish_decorations.ts index 4441e2b28..2ccd2d585 100644 --- a/editors/code/src/notifications/publish_decorations.ts +++ b/editors/code/src/notifications/publish_decorations.ts @@ -12,9 +12,8 @@ export function handle(params: PublishDecorationsParams) { const targetEditor = vscode.window.visibleTextEditors.find( editor => { const unescapedUri = unescape(editor.document.uri.toString()); - // Unescaped URI should be something like: + // Unescaped URI looks 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. return unescapedUri === params.uri } ); -- cgit v1.2.3 From 75353753cdcb993c277ce1d8bb366c708eabe2c6 Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sun, 15 Dec 2019 17:10:39 +0200 Subject: `npm run fix` --- editors/code/src/notifications/publish_decorations.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'editors') diff --git a/editors/code/src/notifications/publish_decorations.ts b/editors/code/src/notifications/publish_decorations.ts index 2ccd2d585..f23e286ad 100644 --- a/editors/code/src/notifications/publish_decorations.ts +++ b/editors/code/src/notifications/publish_decorations.ts @@ -9,14 +9,12 @@ export interface PublishDecorationsParams { } export function handle(params: PublishDecorationsParams) { - const targetEditor = vscode.window.visibleTextEditors.find( - editor => { - const unescapedUri = unescape(editor.document.uri.toString()); - // Unescaped URI looks like: - // file:///c:/Workspace/ra-test/src/main.rs - return unescapedUri === params.uri - } - ); + const targetEditor = vscode.window.visibleTextEditors.find(editor => { + const unescapedUri = unescape(editor.document.uri.toString()); + // Unescaped URI looks like: + // file:///c:/Workspace/ra-test/src/main.rs + return unescapedUri === params.uri; + }); if (!Server.config.highlightingOn || !targetEditor) { return; -- cgit v1.2.3