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

fix(monaco): correct package name resolve #149

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/monaco/lib/ata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function activateAutomaticTypeAcquisition(env: ServiceEnvironment, onFetc
}

if (fileName.startsWith('/node_modules/')) {
const path = uri.substring('/node_modules/'.length);
const path = fileName.substring('/node_modules/'.length);
return await _stat(path);
}
},
Expand All @@ -57,7 +57,7 @@ export function activateAutomaticTypeAcquisition(env: ServiceEnvironment, onFetc

if (fileName.startsWith('/node_modules/')) {

const path = uri.substring('/node_modules/'.length);
const path = fileName.substring('/node_modules/'.length);

return await _readFile(path);
}
Expand All @@ -68,7 +68,7 @@ export function activateAutomaticTypeAcquisition(env: ServiceEnvironment, onFetc

if (fileName.startsWith('/node_modules/')) {

const path = uri.substring('/node_modules/'.length);
const path = fileName.substring('/node_modules/'.length);

return _readDirectory(path);
}
Expand Down Expand Up @@ -237,10 +237,10 @@ export function activateAutomaticTypeAcquisition(env: ServiceEnvironment, onFetc
const parts = path.split('/');
let pkgName = parts[0];
if (pkgName.startsWith('@')) {
if (parts.length < 2 || !parts[1]) {
if (!parts[1]) {
return undefined;
}
pkgName += '/' + parts[2];
pkgName += '/' + parts[1];
}
return pkgName;
}
Expand Down