Skip to content

Commit

Permalink
fix(monaco): correct package name resolve (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Mar 5, 2024
1 parent f041c79 commit 674a7a0
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 674a7a0

Please sign in to comment.