Skip to content

Commit

Permalink
Add 'restartServer' command, refactor cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
jiribenes committed Aug 10, 2024
1 parent 6117487 commit 71a45bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@
"category": "Effekt",
"command": "effekt.checkForUpdates",
"title": "Check for Effekt Updates"
},
{
"category": "Effekt",
"command": "effekt.restartServer",
"title": "Restart LSP Server"
}
],
"keybindings": [
Expand Down
19 changes: 14 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@ import * as net from 'net';
let client: LanguageClient;
let effektManager: EffektManager;

function registerCommands(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand('effekt.checkForUpdates', async () => {
await effektManager.checkAndInstallEffekt();
}),
vscode.commands.registerCommand('effekt.restartServer', async () => {
await client.stop();
client.start();
})
);
}

export async function activate(context: vscode.ExtensionContext) {
effektManager = new EffektManager();

const effektVersion = await effektManager.checkAndInstallEffekt();
if (!effektVersion) {
vscode.window.showWarningMessage('Effekt is not installed. LSP features may not work correctly.');
}

// Register the command to check for updates
let disposable = vscode.commands.registerCommand('effekt.checkForUpdates', async () => {
await effektManager.checkAndInstallEffekt();
});
context.subscriptions.push(disposable);
registerCommands(context);

const config = vscode.workspace.getConfiguration("effekt");

Expand Down

0 comments on commit 71a45bc

Please sign in to comment.