source: tools/vscode/uwaterloo.cforall-0.1.0/client/main.js @ b797d978

ADTast-experimental
Last change on this file since b797d978 was ebe0f0d, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Added basic language server which now properly communicates with the client

  • Property mode set to 100644
File size: 1.7 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3// The module 'vscode' contains the VS Code extensibility API
4// Import the module and reference it with the alias vscode in your code below
5const path = require("path");
6const vscode = require("vscode");
7
8
9const vscode_lc = require('vscode-languageclient');
10
11let client = {}
12
13// this method is called when your extension is activated
14// your extension is activated the very first time the command is executed
15function activate(context) {
16        vscode.window.showInformationMessage('Cforall Extension Starting');
17
18        // The debug options for the server
19        // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
20        let debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };
21
22        // If the extension is launched in debug mode then the debug server options are used
23        // Otherwise the run options are used
24        let serverOptions = {
25                run: { command: 'cfa-ls', transport: vscode_lc.TransportKind.stdio },
26                debug: {
27                        command: 'cfa-ls',
28                        transport: vscode_lc.TransportKind.stdio,
29                        options: debugOptions
30                }
31        };
32
33        // Options to control the language client
34        let selector = [{ scheme: 'file', language: 'cforall' }];
35        let clientOptions = {
36                // Register the server for cforall documents
37                documentSelector: selector
38        };
39
40        // Create the language client and start the client.
41        client = new vscode_lc.LanguageClient(
42                'cforall',
43                'Cforall Language Server',
44                serverOptions,
45                clientOptions
46        );
47
48        // Start the client. This will also launch the server
49        client.start();
50
51}
52exports.activate = activate;
53
54// this method is called when your extension is deactivated
55function deactivate() { }
56exports.deactivate = deactivate;
Note: See TracBrowser for help on using the repository browser.