diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000000000000000000000000000000000..63239eafd320070ebb79b03696f2f1da9f2b5b17 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +node_modules/** +client/node_modules/** +client/out/** +server/node_modules/** +server/out/** \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000000000000000000000000000000000000..4af7c61b86066e0a6874a10e190679f916b3b2e8 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "env": { + "node": true + }, + "rules": { + "semi": "error", + "no-extra-semi": "warn", + "curly": "warn", + "quotes": ["error", "single", { "allowTemplateLiterals": true } ], + "eqeqeq": "error", + "indent": ["warn", "tab", { "SwitchCase": 1 } ] + } +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 7bc18a44754cda0c5a17ab669509145e9769c249..53fe86e85acd7e15db5494c61d787f97fa64a57b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,18 +1,44 @@ -// A launch configuration that launches the extension inside a new window -// Use IntelliSense to learn about possible attributes. -// Hover to view descriptions of existing attributes. -// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +// A launch configuration that compiles the extension and then opens it inside a new window { "version": "0.2.0", - "configurations": [ - { - "name": "Extension", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" - ] - } - ] -} \ No newline at end of file + "configurations": [ + { + "type": "extensionHost", + "request": "launch", + "name": "Launch Client", + "runtimeExecutable": "${execPath}", + "args": ["--extensionDevelopmentPath=${workspaceRoot}"], + "outFiles": ["${workspaceRoot}/client/out/**/*.js"], + "preLaunchTask": { + "type": "npm", + "script": "watch" + } + }, + { + "type": "node", + "request": "attach", + "name": "Attach to Server", + "port": 6009, + "restart": true, + "outFiles": ["${workspaceRoot}/server/out/**/*.js"] + }, + { + "name": "Language Server E2E Test", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceRoot}", + "--extensionTestsPath=${workspaceRoot}/client/out/test/index", + "${workspaceRoot}/client/testFixture" + ], + "outFiles": ["${workspaceRoot}/client/out/test/**/*.js"] + } + ], + "compounds": [ + { + "name": "Client + Server", + "configurations": ["Launch Client", "Attach to Server"] + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..4d7c850f19793b0b5b23999d7bd63aa751d51b5f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "editor.insertSpaces": false, + "tslint.enable": true, + "typescript.tsc.autoDetect": "off", + "typescript.preferences.quoteStyle": "single", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000000000000000000000000000000000..5efd8048880a1897e9014a322538e00db30def48 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,33 @@ +{ + "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" + ] + } + ] +} \ No newline at end of file diff --git a/client/package.json b/client/package.json index 439aaaff36363e410b607245a8ecabd8db76464b..0be8941459472b3171b11faec3ca4b3b4e5b1324 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "lsp-b-eventb-client", - "description": "VSCode part of a language server", + "description": "client part of the language pack", "author": "Sebastian Stock", "license": "MIT", "version": "0.0.1", diff --git a/client/src/extension.ts b/client/src/extension.ts index d541e27caacb6c55752939946d8e861fd706cf42..ddaf6c6bfc2800857a72c503af445c14aaf8fc8f 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -17,6 +17,7 @@ let client: LanguageClient; export function activate(context: ExtensionContext) { // The server is implemented in node + console.log("test") let serverModule = context.asAbsolutePath( path.join('server', 'out', 'server.js') ); @@ -55,6 +56,7 @@ export function activate(context: ExtensionContext) { // Start the client. This will also launch the server client.start(); + console.log("Client started") } export function deactivate(): Thenable<void> | undefined { diff --git a/language-configuration.json b/language-configuration.json deleted file mode 100644 index 8f162a0c45f2c0a4867ff1f967d7e5ec33062482..0000000000000000000000000000000000000000 --- a/language-configuration.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "comments": { - // symbol used for single line comment. Remove this entry if your language does not support line comments - "lineComment": "//", - // symbols used for start and end a block comment. Remove this entry if your language does not support block comments - "blockComment": [ "/*", "*/" ] - }, - // symbols used as brackets - "brackets": [ - ["{", "}"], - ["[", "]"], - ["(", ")"] - ], - // symbols that are auto closed when typing - "autoClosingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["\"", "\""], - ["'", "'"] - ], - // symbols that can be used to surround a selection - "surroundingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["\"", "\""], - ["'", "'"] - ] -} \ No newline at end of file diff --git a/package.json b/package.json index 7d469805b8a2e60738426083de988d8d8642ee27..688cdcfc175bde205be5325a5c5f6702c35ee59b 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "b-eventb-language-extension", - "displayName": "-beventb language extension", - "description": "compiler support for b and eventb via prob", + "displayName": "b-eventb language extension", + "description": "compiler support for b and eventb via ProB", "version": "0.0.1", "publisher": "SeeBasTStick", - "icon": "prob_logo.png", + "icon": "prob2-ui.png", "author": "Sebastian Stock", "repository": { "type": "git", @@ -16,17 +16,59 @@ "categories": [ "Programming Languages" ], - "contributes": { - "languages": [{ - "id": "b", - "aliases": ["B", "b"], - "extensions": [".mch",".imp",".ref",".eventb"], - "configuration": "./language-configuration.json" - }], - "grammars": [{ - "language": "b", - "scopeName": "", - "path": "./syntaxes/b.tmLanguage.json" - }] - } + "keywords": [ + "multi-root ready" + ], + "activationEvents": [ + "onLanguage:plaintext" + ], + "main": "./client/out/extension", + "contributes": { + "configuration": { + "type": "object", + "title": "Example configuration", + "properties": { + "languageServerExample.maxNumberOfProblems": { + "scope": "resource", + "type": "number", + "default": 100, + "description": "Controls the maximum number of problems produced by the server." + }, + "languageServerExample.trace.server": { + "scope": "window", + "type": "string", + "enum": [ + "off", + "messages", + "verbose" + ], + "default": "off", + "description": "Traces the communication between VS Code and the language server." + } + } + } + }, + "scripts": { + "vscode:prepublish": "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" + }, + "devDependencies": { + "@types/mocha": "^5.2.7", + "@types/node": "^12.12.38", + "@typescript-eslint/parser": "^2.3.0", + "eslint": "^6.4.0", + "mocha": "^6.2.2", + "typescript": "^3.8.3" + }, + "dependencies": { + "@types/ndjson": "^1.5.0", + "@types/stream-to-array": "^2.3.0", + "ndjson": "^1.5.0", + "path": "^0.12.7", + "stream-to-array": "^2.3.0", + "vscode-uri": "^2.1.1" + } } \ No newline at end of file diff --git a/server/src/server.ts b/server/src/server.ts index 709a54c8f99ab84fa6e3506172e4bb87d653ade4..3405ef7fd1b2fe970ca942642ef4c1e11619a3d7 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -7,7 +7,6 @@ import { createConnection, TextDocuments, Diagnostic, - DiagnosticSeverity, ProposedFeatures, InitializeParams, DidChangeConfigurationNotification, diff --git a/syntaxes/b.tmLanguage.json b/syntaxes/b.tmLanguage.json deleted file mode 100644 index de0a4570664b2d9958fd5b358a4f846d22a26dd8..0000000000000000000000000000000000000000 --- a/syntaxes/b.tmLanguage.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", - "name": "B", - "patterns": [ - { - "include": "#keywords" - }, - { - "include": "#strings" - } - ], - "repository": { - "keywords": { - "patterns": [{ - "name": "keyword.control.b", - "match": "\\b(if|while|for|return)\\b" - }] - }, - "strings": { - "name": "string.quoted.double.b", - "begin": "\"", - "end": "\"", - "patterns": [ - { - "name": "constant.character.escape.b", - "match": "\\\\." - } - ] - } - }, - "scopeName": "" -} \ No newline at end of file