fix(lsp): preserve workspace cancellation reason

This commit is contained in:
Tianyi Cui
2026-07-29 10:17:45 +08:00
parent 098f826001
commit 4d63552d00
2 changed files with 24 additions and 1 deletions

View File

@@ -42,7 +42,10 @@ export async function canonicalizeWorkspace(
throw new Error(`workspace root "${workspaceRoot}" cannot be resolved: ${messageOf(error)}`, { cause: error })
}
throwIfAborted(signal)
const info = await fs.stat(target, signal)
const info = await fs.stat(target, signal).catch((error: unknown) => {
throwIfAborted(signal)
throw error
})
throwIfAborted(signal)
if (info?.type !== 'directory') {
throw new Error(`workspace root "${workspaceRoot}" is not a directory`)