Skip to content

Commit

Permalink
fix: don't crash on ENOENT when looking up realPath (#183)
Browse files Browse the repository at this point in the history
Fixes #182
  • Loading branch information
wkillerud authored Jul 25, 2024
1 parent d2e9977 commit fb3775b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/language-server/src/node-file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ export class NodeFileSystem implements FileSystemProvider {
}

async realPath(uri: URI): Promise<URI> {
const fsPath = await promises.realpath(uri.fsPath);
return URI.file(fsPath);
try {
const fsPath = await promises.realpath(uri.fsPath);
return URI.file(fsPath);
} catch (e) {
// Not all links we get here point to real files or symlinks on disk.
// Fall back to returning the same URI (#184).
return uri;
}
}

async stat(uri: URI): Promise<FileStat> {
Expand Down

0 comments on commit fb3775b

Please sign in to comment.