Initial commit
This commit is contained in:
18
Client/.vscode/launch.json
vendored
Normal file
18
Client/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"name": "Launch Client",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
|
||||
"outFiles": ["${workspaceRoot}/client/out/**/*.js"],
|
||||
"preLaunchTask": {
|
||||
"type": "npm",
|
||||
"script": "watch"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
29
Client/.vscode/tasks.json
vendored
Normal file
29
Client/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "compile",
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"panel": "dedicated",
|
||||
"reveal": "never"
|
||||
},
|
||||
"problemMatcher": ["$tsc"]
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"isBackground": true,
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"presentation": {
|
||||
"panel": "dedicated",
|
||||
"reveal": "never"
|
||||
},
|
||||
"problemMatcher": ["$tsc-watch"]
|
||||
}
|
||||
]
|
||||
}
|
||||
82
Client/out/extension.js
Normal file
82
Client/out/extension.js
Normal file
@@ -0,0 +1,82 @@
|
||||
"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
|
||||
1
Client/out/extension.js.map
Normal file
1
Client/out/extension.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,6DAA6D;AAC7D,8EAA8E;AAE9E,iCAAiC;AACjC,wDAAwD;AACxD,6BAA6B;AAC7B,yBAAyB;AAEzB,mEAAmE;AACnE,MAAM,mBAAmB,GAAG;IAC1B,+BAA+B;IAC/B,kGAAkG;CACnG,CAAC;AAEF,SAAS,sBAAsB,CAAC,OAAgC;IAC9D,0DAA0D;IAC1D,IAAI,YAAY,GAAW,IAAI,CAAC;IAChC,KAAK,IAAI,CAAC,IAAI,mBAAmB,EAAE;QACjC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QAC9B,kBAAkB;QAClB,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;YACpB,YAAY,GAAG,CAAC,CAAC;YACjB,MAAM;SACP;KACF;IACD,IAAI,CAAC,YAAY;QACf,MAAM,IAAI,QAAQ,CAAC,yCAAyC,CAAC,CAAC;IAChE,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,OAAO,YAAY,oBAAoB,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,cAAc,QAAQ,GAAG,CAAC,CAAC;IAEvC,oFAAoF;IACpF,qCAAqC;IACrC,IAAI,a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AC;AAA/B,gCAA+B;AAC/B,CAAC,CAAC"}
|
||||
2138
Client/package-lock.json
generated
Normal file
2138
Client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
64
Client/package.json
Normal file
64
Client/package.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "upsilon-language-extension",
|
||||
"version": "1.0.0",
|
||||
"engines": {
|
||||
"vscode": "^1.29.1"
|
||||
},
|
||||
"activationEvents": [
|
||||
"onLanguage:upsilon"
|
||||
],
|
||||
"main": "./out/extension",
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "upsilon",
|
||||
"aliases": [
|
||||
"Upsilon"
|
||||
],
|
||||
"extensions": [
|
||||
".yup",
|
||||
".lua"
|
||||
]
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
"type": "object",
|
||||
"title": "Example configuration",
|
||||
"properties": {
|
||||
"upsilonLanguageServer.maxNumberOfProblems": {
|
||||
"type": "number",
|
||||
"default": 100,
|
||||
"description": "Controls the maximum number of problems produced by the server."
|
||||
},
|
||||
"upsilonLanguageServer.trace.server": {
|
||||
"scope": "window",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"off",
|
||||
"messages",
|
||||
"verbose"
|
||||
],
|
||||
"default": "off",
|
||||
"description": "Traces the communication between VSCode and the upsilonLanguageServer service."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "vscode-install && npm run compile",
|
||||
"compile": "tsc -b",
|
||||
"watch": "tsc -b -w",
|
||||
"postinstall": "cd client && npm install && cd ../server && npm install && cd ..",
|
||||
"test": "sh ./scripts/e2e.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-languageclient": "^4.1.4",
|
||||
"vscode": "^1.1.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.12.10",
|
||||
"vscode": "^1.1.21",
|
||||
"tslint": "^5.11.0",
|
||||
"typescript": "^3.1.3"
|
||||
}
|
||||
}
|
||||
91
Client/src/extension.ts
Normal file
91
Client/src/extension.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
// The module 'vscode' contains the VS Code extensibility API
|
||||
// Import the module and reference it with the alias vscode in your code below
|
||||
|
||||
import * as vscode from "vscode";
|
||||
import * as languageClient from "vscode-languageclient";
|
||||
import * as path from "path";
|
||||
import * as fs from "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: vscode.ExtensionContext) {
|
||||
// The server is implemented in an executable application.
|
||||
let serverModule: string = 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: languageClient.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: languageClient.LanguageClientOptions = {
|
||||
// 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
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
console.log("Upsilon extension is now activated.");
|
||||
activateLanguageServer(context);
|
||||
}
|
||||
|
||||
// this method is called when your extension is deactivated
|
||||
export function deactivate() {}
|
||||
6;
|
||||
12
Client/tsconfig.json
Normal file
12
Client/tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"outDir": "out",
|
||||
"rootDir": "src",
|
||||
"lib": ["es6"],
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", ".vscode-test"]
|
||||
}
|
||||
1
Client/vscode-extension-samples
Submodule
1
Client/vscode-extension-samples
Submodule
Submodule Client/vscode-extension-samples added at fc3c2f9dae
Reference in New Issue
Block a user