From bf947691c214deaf05d3e2dc82ff6d51b9121c17 Mon Sep 17 00:00:00 2001 From: Qiming Zhao Date: Mon, 21 Dec 2020 15:42:55 +0800 Subject: [PATCH] refactor(util): add workaround for jdt uri on win32 --- src/util/index.ts | 3 ++- src/workspace.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/index.ts b/src/util/index.ts index bcfeddd2d23..6c5760fa924 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -27,7 +27,8 @@ export function wait(ms: number): Promise { export function getUri(fullpath: string, id: number, buftype: string, isCygwin: boolean): string { if (!fullpath) return `untitled:${id}` - if (platform.isWindows && !isCygwin) fullpath = path.win32.normalize(fullpath) + // https://github.com/neoclide/coc-java/issues/82 + if (platform.isWindows && !isCygwin && !fullpath.startsWith('jdt://')) fullpath = path.win32.normalize(fullpath) if (path.isAbsolute(fullpath)) return URI.file(fullpath).toString() if (isuri.isValid(fullpath)) return URI.parse(fullpath).toString() if (buftype != '') return `${buftype}:${id}` diff --git a/src/workspace.ts b/src/workspace.ts index 88b00aa095a..d400cda9026 100644 --- a/src/workspace.ts +++ b/src/workspace.ts @@ -820,6 +820,9 @@ export class Workspace implements IWorkspace { let bufname = fixDriver(path.normalize(fsPath)) await this.nvim.call('coc#util#jump', [jumpCommand, bufname, pos]) } else { + if (os.platform() == 'win32') { + uri = uri.replace(/\/?/, '?') + } await this.nvim.call('coc#util#jump', [jumpCommand, uri, pos]) } }