extension.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. import * as path from 'path';
  3. import { workspace, Disposable, ExtensionContext } from 'vscode';
  4. import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind } from 'vscode-languageclient';
  5. export function activate(context: ExtensionContext) {
  6. let serverPath = context.asAbsolutePath(path.join('.', 'vhdltool-wrapper.sh'));
  7. // If the extension is launched in debug mode then the debug server options are used
  8. // Otherwise the run options are used
  9. let serverOptions: ServerOptions = {
  10. run: { command: serverPath },
  11. debug: { command: serverPath }
  12. }
  13. // Options to control the language client
  14. let clientOptions: LanguageClientOptions = {
  15. // Register the server for VHDL files
  16. documentSelector: ['vhdl'],
  17. }
  18. // Create the language client and start the client.
  19. let disposable = new LanguageClient('vhdltool', 'Language Server VHDL', serverOptions, clientOptions).start();
  20. // Push the disposable to the context's subscriptions so that the client can be deactivated on extension deactivation
  21. context.subscriptions.push(disposable);
  22. }