45 lines
No EOL
1.7 KiB
JavaScript
45 lines
No EOL
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.activate = activate;
|
|
exports.deactivate = deactivate;
|
|
// File: client/src/extension.ts
|
|
const path = require("path");
|
|
const vscode_1 = require("vscode");
|
|
const node_1 = require("vscode-languageclient/node");
|
|
let client;
|
|
function activate(context) {
|
|
// The server is implemented in node
|
|
const serverModule = context.asAbsolutePath(path.join('server', 'out', 'server.js'));
|
|
// The debug options for the server
|
|
const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };
|
|
// If the extension is launched in debug mode then the debug server options are used
|
|
// Otherwise the run options are used
|
|
const serverOptions = {
|
|
run: { module: serverModule, transport: node_1.TransportKind.ipc },
|
|
debug: {
|
|
module: serverModule,
|
|
transport: node_1.TransportKind.ipc,
|
|
options: debugOptions
|
|
}
|
|
};
|
|
// Options to control the language client
|
|
const clientOptions = {
|
|
// Register the server for Blueprint documents
|
|
documentSelector: [{ scheme: 'file', language: 'blueprint' }],
|
|
synchronize: {
|
|
// Notify the server about file changes to '.bp files contained in the workspace
|
|
fileEvents: vscode_1.workspace.createFileSystemWatcher('**/*.bp')
|
|
}
|
|
};
|
|
// Create and start the client
|
|
client = new node_1.LanguageClient('blueprintLanguageServer', 'Blueprint Language Server', serverOptions, clientOptions);
|
|
// Start the client. This will also launch the server
|
|
client.start();
|
|
}
|
|
function deactivate() {
|
|
if (!client) {
|
|
return undefined;
|
|
}
|
|
return client.stop();
|
|
}
|
|
//# sourceMappingURL=extension.js.map
|