[fix] updates

This commit is contained in:
2025-07-19 18:50:14 +01:00
parent b2014942b6
commit 6f5357ea5c
4 changed files with 2967 additions and 4727 deletions

View File

@@ -4,8 +4,8 @@
* ------------------------------------------------------------------------------------------ */
import * as path from 'path';
import { commands } from 'vscode';
import type { ExtensionContext } from 'vscode';
import { commands, tasks, workspace } from 'vscode';
import type { Disposable, ExtensionContext } from 'vscode';
import {
LanguageClient,
LanguageClientOptions,
@@ -13,9 +13,12 @@ import {
TransportKind,
} from 'vscode-languageclient';
import { CompileBranFlakesCommand } from './command/CompileBranFlakesCommand';
import { CustomExecutionTaskProvider } from './task/CustomExecutionTerminal';
let client: LanguageClient;
let bfRunTaskProvider: Disposable;
export function activate(context: ExtensionContext) {
// The server is implemented in node
let serverModule = context.asAbsolutePath(
@@ -48,10 +51,13 @@ export function activate(context: ExtensionContext) {
commands.registerCommand(
branFlakesCommand.getCommandName(),
branFlakesCommand.getCommandHandler()
)
),
);
}
// Create the language client and start the client.
client = new LanguageClient(
'brainfucklanguageserver',
@@ -62,11 +68,16 @@ export function activate(context: ExtensionContext) {
// Start the client. This will also launch the server
client.start();
const workspaceRoot = (workspace.workspaceFolders && (workspace.workspaceFolders.length > 0))
? workspace.workspaceFolders[0].uri.fsPath : undefined;
bfRunTaskProvider = tasks.registerTaskProvider(CustomExecutionTaskProvider.type, new CustomExecutionTaskProvider(workspaceRoot, undefined));
}
export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
bfRunTaskProvider?.dispose();
client?.stop();
}