release
This commit is contained in:
commit
47f67eea8c
43 changed files with 5819 additions and 0 deletions
60
extension/client/src/extension.ts
Normal file
60
extension/client/src/extension.ts
Normal file
|
@ -0,0 +1,60 @@
|
|||
// File: client/src/extension.ts
|
||||
import * as path from 'path';
|
||||
import { workspace, ExtensionContext } from 'vscode';
|
||||
import {
|
||||
LanguageClient,
|
||||
LanguageClientOptions,
|
||||
ServerOptions,
|
||||
TransportKind
|
||||
} from 'vscode-languageclient/node';
|
||||
|
||||
let client: LanguageClient;
|
||||
|
||||
export function activate(context: ExtensionContext) {
|
||||
// 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: ServerOptions = {
|
||||
run: { module: serverModule, transport: TransportKind.ipc },
|
||||
debug: {
|
||||
module: serverModule,
|
||||
transport: TransportKind.ipc,
|
||||
options: debugOptions
|
||||
}
|
||||
};
|
||||
|
||||
// Options to control the language client
|
||||
const clientOptions: LanguageClientOptions = {
|
||||
// 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: workspace.createFileSystemWatcher('**/*.bp')
|
||||
}
|
||||
};
|
||||
|
||||
// Create and start the client
|
||||
client = new LanguageClient(
|
||||
'blueprintLanguageServer',
|
||||
'Blueprint Language Server',
|
||||
serverOptions,
|
||||
clientOptions
|
||||
);
|
||||
|
||||
// Start the client. This will also launch the server
|
||||
client.start();
|
||||
}
|
||||
|
||||
export function deactivate(): Thenable<void> | undefined {
|
||||
if (!client) {
|
||||
return undefined;
|
||||
}
|
||||
return client.stop();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue