Skip to content

Commit

Permalink
Let doc uris on win to be escaped. Only up case drive letter
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Jul 18, 2023
1 parent 36e853e commit 5717fd0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions vscode-extensions/vscode-spring-boot/lib/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,16 @@ export function activate(context: VSCode.ExtensionContext): Thenable<ExtensionAP
* It comes in as "file:///c%3A/Users/ab/spring-petclinic/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java"
*
* While symbols index would have this uri instead:
* - "file:///C:/Users/ab/spring-petclinic/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java"
* - "file:///C%3A/Users/ab/spring-petclinic/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java"
*
* i.e. lower vs upper case drive letter and escaped drive colon
* i.e. lower vs upper case drive letter
*/
if (OS.platform() === "win32" && uri.scheme === 'file') {
let uriStr = uri.toString(true);
const idx = uriStr.indexOf(':', 5);
if (idx > 5 && idx < 10) {
uriStr = `${uriStr.substring(0, idx - 1)}${uriStr.charAt(idx - 1).toUpperCase()}${uriStr.substring(idx)}`
let uriStr = uri.toString();
let idx = 5; // skip through `file:
for (; idx < uriStr.length - 1 && uriStr.charAt(idx) === '/'; idx++) {}
if (idx < uriStr.length - 1) {
uriStr = `${uriStr.substring(0, idx)}${uriStr.charAt(idx).toUpperCase()}${uriStr.substring(idx + 1)}`
}
return uriStr;
}
Expand Down

0 comments on commit 5717fd0

Please sign in to comment.