pr 08 lsp
This commit is contained in:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user