Skip to content

Commit

Permalink
chore(typescript-plugin): normalize path when search project
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Apr 22, 2024
1 parent 0bbdb66 commit 81f60fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/typescript-plugin/lib/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function startNamedPipeServer(
const text = data.toString();
const request: Request = JSON.parse(text);
const fileName = request.args[0];
const project = getProject(fileName);
const project = getProject(ts.server.toNormalizedPath(fileName));
if (request.type === 'projectInfoForFile') {
connection.write(
JSON.stringify(
Expand Down Expand Up @@ -154,9 +154,9 @@ export const projects = new Map<ts.server.Project, {
vueOptions: VueCompilerOptions;
}>();

function getProject(fileName: string) {
function getProject(filename: ts.server.NormalizedPath) {
for (const [project, data] of projects) {
if (project.containsFile(fileName as ts.server.NormalizedPath)) {
if (project.containsFile(filename)) {
return data;
}
}
Expand Down

0 comments on commit 81f60fc

Please sign in to comment.