Skip to content

Commit 14ece08

Browse files
committed
Fix jumping to dependencies in node modules
1 parent 00f2a4e commit 14ece08

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/jupyterlab-lsp/src/features/jump_to.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,12 @@ export class CMJumpToDefinition extends CodeMirrorIntegration {
215215
private _resolvePath(uri: string): string | null {
216216
let contentsPath = uri_to_contents_path(uri);
217217

218-
if (contentsPath == null && uri.startsWith('file://')) {
219-
contentsPath = decodeURI(uri.slice(7));
218+
if (contentsPath == null) {
219+
if (uri.startsWith('file://')) {
220+
contentsPath = decodeURIComponent(uri.slice(7));
221+
} else {
222+
contentsPath = decodeURIComponent(uri);
223+
}
220224
}
221225
return contentsPath;
222226
}

packages/jupyterlab-lsp/src/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ export function uri_to_contents_path(child: string, parent?: string) {
155155
return null;
156156
}
157157
if (child.startsWith(parent)) {
158-
return decodeURI(child.replace(parent, ''));
158+
// 'decodeURIComponent' is needed over 'decodeURI' for '@' in TS/JS paths
159+
return decodeURIComponent(child.replace(parent, ''));
159160
}
160161
return null;
161162
}

0 commit comments

Comments
 (0)