Skip to content

Commit eaab61b

Browse files
committed
fix(lsp): normalize Windows shim paths
1 parent 745c17e commit eaab61b

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/lsp/src/server/typescript.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,14 @@ function resolvePackageBin(packageRoot: string, name: string): string | undefine
6161
? shim
6262
: undefined
6363
}
64-
const wrapper = fs.readFileSync(shim, 'utf8').replaceAll('\\', '/')
65-
const relativeFromBin = path.relative(path.dirname(shim), target).replaceAll('\\', '/')
66-
return wrapper.includes(relativeFromBin) || wrapper.includes(target.replaceAll('\\', '/'))
64+
const normalizeShimPath = (value: string): string => {
65+
const normalized = value.replaceAll('\\', '/')
66+
return process.platform === 'win32' ? normalized.toLowerCase() : normalized
67+
}
68+
const wrapper = normalizeShimPath(fs.readFileSync(shim, 'utf8'))
69+
const relativeFromBin = normalizeShimPath(path.relative(path.dirname(shim), target))
70+
const normalizedTarget = normalizeShimPath(target)
71+
return wrapper.includes(relativeFromBin) || wrapper.includes(normalizedTarget)
6772
? shim
6873
: undefined
6974
}

0 commit comments

Comments
 (0)