Skip to content

Commit

Permalink
Merge pull request #758 from jupyter-lsp/fix-jumping-with-at
Browse files Browse the repository at this point in the history
Backport "Fix jumping to dependencies in node modules" on 3.x
  • Loading branch information
krassowski authored Mar 20, 2022
2 parents 162b397 + 2de4d9e commit 30c5932
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/jupyterlab-lsp/src/features/jump_to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,12 @@ export class CMJumpToDefinition extends CodeMirrorIntegration {
// can it be resolved vs our guessed server root?
let contents_path = uri_to_contents_path(uri);

if (contents_path == null && uri.startsWith('file://')) {
contents_path = decodeURI(uri.slice(7));
if (contents_path == null) {
if (uri.startsWith('file://')) {
contents_path = decodeURIComponent(uri.slice(7));
} else {
contents_path = decodeURIComponent(uri);
}
}

if (contents_path === null) {
Expand Down
3 changes: 2 additions & 1 deletion packages/jupyterlab-lsp/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ export function uri_to_contents_path(child: string, parent?: string) {
return null;
}
if (child.startsWith(parent)) {
return decodeURI(child.replace(parent, ''));
// 'decodeURIComponent' is needed over 'decodeURI' for '@' in TS/JS paths
return decodeURIComponent(child.replace(parent, ''));
}
return null;
}
Expand Down

0 comments on commit 30c5932

Please sign in to comment.