mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 05:41:22 -06:00
When sending typings request use project's current directory as project root path
This ensures that we arent picking typings from folder different from the current directory for the project
This commit is contained in:
parent
90a1df9d92
commit
667751df2a
@ -6503,7 +6503,7 @@ namespace ts.projectSystem {
|
||||
path: `${currentDirectory}/package.json`,
|
||||
content: JSON.stringify({
|
||||
devDependencies: {
|
||||
"pkgcurrentdirectory": ""
|
||||
pkgcurrentdirectory: ""
|
||||
},
|
||||
})
|
||||
};
|
||||
@ -6555,6 +6555,9 @@ namespace ts.projectSystem {
|
||||
|
||||
// Ensure that we use result from types cache when getting ls
|
||||
assert.isDefined(project.getLanguageService());
|
||||
|
||||
// Verify that the pkgcurrentdirectory from the current directory isnt picked up
|
||||
checkProjectActualFiles(project, [file.path]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -34,19 +34,6 @@ namespace ts.server {
|
||||
export type Types = Msg;
|
||||
}
|
||||
|
||||
function getProjectRootPath(project: Project): Path {
|
||||
switch (project.projectKind) {
|
||||
case ProjectKind.Configured:
|
||||
return <Path>getDirectoryPath(project.getProjectName());
|
||||
case ProjectKind.Inferred:
|
||||
// TODO: fixme
|
||||
return <Path>"";
|
||||
case ProjectKind.External:
|
||||
const projectName = normalizeSlashes(project.getProjectName());
|
||||
return <Path>getDirectoryPath(projectName);
|
||||
}
|
||||
}
|
||||
|
||||
export function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings {
|
||||
return {
|
||||
projectName: project.getProjectName(),
|
||||
@ -54,7 +41,7 @@ namespace ts.server {
|
||||
compilerOptions: project.getCompilationSettings(),
|
||||
typeAcquisition,
|
||||
unresolvedImports,
|
||||
projectRootPath: getProjectRootPath(project),
|
||||
projectRootPath: project.getCurrentDirectory() as Path,
|
||||
cachePath,
|
||||
kind: "discover"
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user