Skip to content

Commit

Permalink
Fix jumping to dependencies in node modules
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Jan 1, 2022
1 parent 00f2a4e commit 14ece08
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 @@ -215,8 +215,12 @@ export class CMJumpToDefinition extends CodeMirrorIntegration {
private _resolvePath(uri: string): string | null {
let contentsPath = uri_to_contents_path(uri);

if (contentsPath == null && uri.startsWith('file://')) {
contentsPath = decodeURI(uri.slice(7));
if (contentsPath == null) {
if (uri.startsWith('file://')) {
contentsPath = decodeURIComponent(uri.slice(7));
} else {
contentsPath = decodeURIComponent(uri);
}
}
return contentsPath;
}
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 14ece08

Please sign in to comment.