Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport "Fix jumping to dependencies in node modules" on 3.x #758

Merged
merged 3 commits into from
Mar 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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