Skip to content

Commit

Permalink
refactor(util): add workaround for jdt uri on win32
Browse files Browse the repository at this point in the history
  • Loading branch information
chemzqm committed Dec 21, 2020
1 parent f09ba2b commit bf94769
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export function wait(ms: number): Promise<any> {

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}`
Expand Down
3 changes: 3 additions & 0 deletions src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}
Expand Down

0 comments on commit bf94769

Please sign in to comment.