Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 793ba06

Browse files
committed
catch exceptions reading config file
1 parent 900f4a3 commit 793ba06

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,13 @@ class RustLanguageClient extends AutoLanguageClient {
452452
// Don't build straight after initialize, wait for first `workspace/didChangeConfiguration`
453453
params.initializationOptions.omitInitBuild = true
454454

455-
let rlsConfigPath = path.join(projectPath, "rust-analyzer.json")
456-
let options = fs.readFileSync(rlsConfigPath)
457-
Object.assign(params.initializationOptions, JSON.parse(options))
455+
try {
456+
let rlsConfigPath = path.join(projectPath, "rust-analyzer.json")
457+
let options = fs.readFileSync(rlsConfigPath)
458+
Object.assign(params.initializationOptions, JSON.parse(options))
459+
} catch(e) {
460+
console.warn("Could not read config file")
461+
}
458462

459463
return params
460464
}

0 commit comments

Comments
 (0)