Upsilon-VsCode/Client/out/extension.js

82 lines
3.2 KiB
JavaScript
Raw Normal View History

2018-11-25 21:19:02 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
const vscode = require("vscode");
const languageClient = require("vscode-languageclient");
const path = require("path");
const fs = require("fs");
// Defines the search path of your language server DLL. (.NET Core)
const languageServerPaths = [
"server/DemoLanguageServer.dll",
"../UpsilonLanguageServer/UpsilonLanguageServer/bin/Debug/netcoreapp2.1/UpsilonLanguageServer.dll"
];
function activateLanguageServer(context) {
// The server is implemented in an executable application.
let serverModule = null;
for (let p of languageServerPaths) {
p = context.asAbsolutePath(p);
// console.log(p);
if (fs.existsSync(p)) {
serverModule = p;
break;
}
}
if (!serverModule)
throw new URIError("Cannot find the language server module.");
let workPath = path.dirname(serverModule);
console.log(`Use ${serverModule} as server module.`);
console.log(`Work path: ${workPath}.`);
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
let serverOptions = {
run: {
command: "dotnet",
args: [serverModule],
options: { cwd: workPath }
},
debug: {
command: "dotnet",
args: [serverModule, "--debug"],
options: { cwd: workPath }
}
};
// Options to control the language client
let clientOptions = {
// Register the server for plain text documents
documentSelector: [
{
language: "upsilon",
scheme: "file"
}
],
synchronize: {
// Synchronize the setting section 'languageServerExample' to the server
configurationSection: "upsilonLanguageServer",
// Notify the server about file changes to '.clientrc files contain in the workspace
fileEvents: [
vscode.workspace.createFileSystemWatcher("**/.clientrc"),
vscode.workspace.createFileSystemWatcher("**/.yup"),
vscode.workspace.createFileSystemWatcher("**/.lua")
]
}
};
// Create the language client and start the client.
let client = new languageClient.LanguageClient("upsilonLanguageServer", "Upsilon Language Server", serverOptions, clientOptions);
let disposable = client.start();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(disposable);
}
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
function activate(context) {
console.log("Upsilon extension is now activated.");
activateLanguageServer(context);
}
exports.activate = activate;
// this method is called when your extension is deactivated
function deactivate() { }
exports.deactivate = deactivate;
6;
//# sourceMappingURL=extension.js.map