Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Show an error if VS Code doesn't have permission to write on the work…
Browse files Browse the repository at this point in the history
…ing folder (#867)
  • Loading branch information
vinistock authored Nov 1, 2023
1 parent 80d8262 commit f105bef
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ export default class Client implements ClientInterface {
return;
}

try {
fs.accessSync(this.workingFolder, fs.constants.W_OK);
} catch (error: any) {
this.state = ServerState.Error;

vscode.window.showErrorMessage(
`Directory ${this.workingFolder} is not writable. The Ruby LSP server needs to be able to create a .ruby-lsp
directory to function appropriately. Consider switching to a directory for which VS Code has write permissions`,
);

return;
}

this.state = ServerState.Starting;

try {
Expand Down

0 comments on commit f105bef

Please sign in to comment.