Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 667751d

Browse filesBrowse files
committed
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
1 parent 90a1df9 commit 667751d
Copy full SHA for 667751d

2 files changed

+5-15Lines changed: 5 additions & 15 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/harness/unittests/tsserverProjectSystem.ts‎

Copy file name to clipboardExpand all lines: src/harness/unittests/tsserverProjectSystem.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6503,7 +6503,7 @@ namespace ts.projectSystem {
65036503
path: `${currentDirectory}/package.json`,
65046504
content: JSON.stringify({
65056505
devDependencies: {
6506-
"pkgcurrentdirectory": ""
6506+
pkgcurrentdirectory: ""
65076507
},
65086508
})
65096509
};
@@ -6555,6 +6555,9 @@ namespace ts.projectSystem {
65556555

65566556
// Ensure that we use result from types cache when getting ls
65576557
assert.isDefined(project.getLanguageService());
6558+
6559+
// Verify that the pkgcurrentdirectory from the current directory isnt picked up
6560+
checkProjectActualFiles(project, [file.path]);
65586561
});
65596562
});
65606563
}
Collapse file

‎src/server/utilities.ts‎

Copy file name to clipboardExpand all lines: src/server/utilities.ts
+1-14Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,14 @@ namespace ts.server {
3434
export type Types = Msg;
3535
}
3636

37-
function getProjectRootPath(project: Project): Path {
38-
switch (project.projectKind) {
39-
case ProjectKind.Configured:
40-
return <Path>getDirectoryPath(project.getProjectName());
41-
case ProjectKind.Inferred:
42-
// TODO: fixme
43-
return <Path>"";
44-
case ProjectKind.External:
45-
const projectName = normalizeSlashes(project.getProjectName());
46-
return <Path>getDirectoryPath(projectName);
47-
}
48-
}
49-
5037
export function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings {
5138
return {
5239
projectName: project.getProjectName(),
5340
fileNames: project.getFileNames(/*excludeFilesFromExternalLibraries*/ true, /*excludeConfigFiles*/ true).concat(project.getExcludedFiles() as NormalizedPath[]),
5441
compilerOptions: project.getCompilationSettings(),
5542
typeAcquisition,
5643
unresolvedImports,
57-
projectRootPath: getProjectRootPath(project),
44+
projectRootPath: project.getCurrentDirectory() as Path,
5845
cachePath,
5946
kind: "discover"
6047
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.