pr 08 lsp

This commit is contained in:
2026-03-24 13:40:29 +00:00
parent 06b49cf433
commit 5cf77359fb
9 changed files with 7570 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import * as vscode from "vscode";
import { LanguageClient, LanguageClientOptions, ServerOptions } from "vscode-languageclient/node";
let client: LanguageClient | undefined;
export function activate(context: vscode.ExtensionContext) {
const cfg = vscode.workspace.getConfiguration("prometeuPbs");
const serverPath = cfg.get<string>("serverPath");
if (!serverPath) {
vscode.window.showErrorMessage(
"Prometeu PBS: configure 'prometeuPbs.serverPath' com o caminho do bin prometeu-lsp."
);
return;
}
const serverOptions: ServerOptions = {
command: serverPath,
args: []
};
const clientOptions: LanguageClientOptions = {
documentSelector: [{ scheme: "file", language: "pbs" }]
};
client = new LanguageClient("prometeuPbsLsp", "Prometeu PBS LSP", serverOptions, clientOptions);
// ✅ O client é “parável” no deactivate, não o start() Promise
context.subscriptions.push({
dispose: () => {
void client?.stop();
}
});
void client.start();
}
export function deactivate(): Thenable<void> | undefined {
return client?.stop();
}