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

Last change on this file was ebe0f0d, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Added basic language server which now properly communicates with the client

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[b52abe0]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 = {
[ebe0f0d]25                run: { command: 'cfa-ls', transport: vscode_lc.TransportKind.stdio },
[b52abe0]26                debug: {
27                        command: 'cfa-ls',
[ebe0f0d]28                        transport: vscode_lc.TransportKind.stdio,
[b52abe0]29                        options: debugOptions
30                }
31        };
32
33        // Options to control the language client
[ebe0f0d]34        let selector = [{ scheme: 'file', language: 'cforall' }];
[b52abe0]35        let clientOptions = {
[ebe0f0d]36                // Register the server for cforall documents
37                documentSelector: selector
[b52abe0]38        };
39
40        // Create the language client and start the client.
41        client = new vscode_lc.LanguageClient(
[ebe0f0d]42                'cforall',
[b52abe0]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.