Skip to content

Commit

Permalink
make vscode extension set rust-analyzer automatically (#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjitjhala authored Dec 4, 2024
1 parent f04951f commit b3bd9e7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ const checkerPath = "log/checker";
// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

// Configure vscode so rust-analyzer generates `flux` errors on save
const rustAnalyzerConfig = vscode.workspace.getConfiguration('rust-analyzer');
rustAnalyzerConfig.update(
'check.overrideCommand',
["cargo", "flux", "--workspace", "--message-format=json-diagnostic-rendered-ansi"],
vscode.ConfigurationTarget.Workspace
).then(() => {
vscode.window.showInformationMessage('Flux checking enabled');
}, (error) => {
vscode.window.showErrorMessage(`Failed to update configuration: ${error}`);
});


const workspaceFolders = vscode.workspace.workspaceFolders;
if (!workspaceFolders) { return []; }

Expand Down

0 comments on commit b3bd9e7

Please sign in to comment.