diff --git a/tools/lsp/vscode-plugin/.vscode/launch.json b/tools/lsp/vscode-plugin/.vscode/launch.json new file mode 100644 index 000000000..08bd36376 --- /dev/null +++ b/tools/lsp/vscode-plugin/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + "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" + } + } + ] +} diff --git a/tools/lsp/vscode-plugin/.vscode/settings.json b/tools/lsp/vscode-plugin/.vscode/settings.json new file mode 100644 index 000000000..f5251c3c6 --- /dev/null +++ b/tools/lsp/vscode-plugin/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "editor.insertSpaces": true, + "typescript.tsc.autoDetect": "off", + "typescript.preferences.quoteStyle": "single" +} diff --git a/tools/lsp/vscode-plugin/.vscode/tasks.json b/tools/lsp/vscode-plugin/.vscode/tasks.json new file mode 100644 index 000000000..9ac6a44d7 --- /dev/null +++ b/tools/lsp/vscode-plugin/.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" + ] + } + ] +} diff --git a/tools/lsp/vscode-plugin/.vscodeignore b/tools/lsp/vscode-plugin/.vscodeignore new file mode 100644 index 000000000..2ca7fc371 --- /dev/null +++ b/tools/lsp/vscode-plugin/.vscodeignore @@ -0,0 +1,14 @@ +.vscode/** +**/*.ts +**/*.map +.gitignore +**/tsconfig.json +**/tsconfig.base.json +contributing.md +.travis.yml +client/node_modules/** +!client/node_modules/vscode-jsonrpc/** +!client/node_modules/vscode-languageclient/** +!client/node_modules/vscode-languageserver-protocol/** +!client/node_modules/vscode-languageserver-types/** +!client/node_modules/semver/** diff --git a/tools/lsp/vscode-plugin/README.md b/tools/lsp/vscode-plugin/README.md new file mode 100644 index 000000000..692f1cfe7 --- /dev/null +++ b/tools/lsp/vscode-plugin/README.md @@ -0,0 +1,36 @@ +# LIGO VSCode Plugin + +This plugin is an LSP implementation for the LIGO language family. + +Currently, it is highly experimental and may contain bugs. On MacOS and Windows, only syntax highlighting is supported yet. + +## Functionality +Code navigation + +- [x] Jump to definition +- [x] Find references +- [x] Folding range +- [ ] Selection range +- [ ] Jump to type definition +- [ ] Document symbols +- [ ] Workspace symbols +- [ ] Document highlights + +Diagnostics + +- [x] Parser diagnostics +- [ ] Extended diagnostics + +Code editing + +- [ ] Hover suggestions +- [ ] Code actions (refactor, rename, etc.) +- [x] Code completion for variable names +- [ ] Code completion for record fields and constructors +- [ ] Signature help + +Formatting + +- [ ] Whole document formatting +- [ ] On-type formatting +- [ ] Document range formatting diff --git a/tools/lsp/vscode-plugin/client/package-lock.json b/tools/lsp/vscode-plugin/client/package-lock.json new file mode 100644 index 000000000..c89836e9f --- /dev/null +++ b/tools/lsp/vscode-plugin/client/package-lock.json @@ -0,0 +1,41 @@ +{ + "name": "ligo-lsp-client", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/vscode": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.47.0.tgz", + "integrity": "sha512-nJA37ykkz9FYA0ZOQUSc3OZnhuzEW2vUhUEo4MiduUo82jGwwcLfyvmgd/Q7b0WrZAAceojGhZybg319L24bTA==", + "dev": true + }, + "vscode-jsonrpc": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz", + "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" + }, + "vscode-languageclient": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-4.4.2.tgz", + "integrity": "sha512-9TUzsg1UM6n1UEyPlWbDf7tK1wJAK7UGFRmGDN8sz4KmbbDiVRh6YicaB/5oRSVTpuV47PdJpYlOl3SJ0RiK1Q==", + "requires": { + "vscode-languageserver-protocol": "^3.10.3" + } + }, + "vscode-languageserver-protocol": { + "version": "3.15.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.3.tgz", + "integrity": "sha512-zrMuwHOAQRhjDSnflWdJG+O2ztMWss8GqUUB8dXLR/FPenwkiBNkMIJJYfSN6sgskvsF0rHAoBowNQfbyZnnvw==", + "requires": { + "vscode-jsonrpc": "^5.0.1", + "vscode-languageserver-types": "3.15.1" + } + }, + "vscode-languageserver-types": { + "version": "3.15.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz", + "integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==" + } + } +} diff --git a/tools/lsp/vscode-plugin/client/package.json b/tools/lsp/vscode-plugin/client/package.json new file mode 100644 index 000000000..062ccf02b --- /dev/null +++ b/tools/lsp/vscode-plugin/client/package.json @@ -0,0 +1,21 @@ +{ + "name": "ligo-lsp-client", + "description": "VSCode language server client for LIGO", + "author": "Serokell", + "license": "MIT", + "version": "0.1.0", + "publisher": "LigoLang", + "repository": { + "type": "git", + "url": "https://gitlab.com/ligolang/ligo" + }, + "engines": { + "vscode": "^1.23.0" + }, + "dependencies": { + "vscode-languageclient": "^4.1.4" + }, + "devDependencies": { + "@types/vscode": "^1.47.0" + } +} diff --git a/tools/lsp/vscode-plugin/client/src/extension.ts b/tools/lsp/vscode-plugin/client/src/extension.ts new file mode 100644 index 000000000..81dc395fc --- /dev/null +++ b/tools/lsp/vscode-plugin/client/src/extension.ts @@ -0,0 +1,54 @@ +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ + +import * as path from 'path'; +import { ExtensionContext } from 'vscode'; + +import { + LanguageClient, + LanguageClientOptions, + ServerOptions, + TransportKind +} from 'vscode-languageclient'; + +let client: LanguageClient; + +export function activate(context: ExtensionContext) { + let serverOptions: ServerOptions = { + command: `${context.extensionPath}/bin/squirrel` + }; + + // Options to control the language client + let clientOptions: LanguageClientOptions = { + // Register the server for plain text documents + documentSelector: [ + { scheme: 'file', language: 'ligo' }, + { scheme: 'file', language: 'religo' } + ], + synchronize: { + // Notify the server about file changes to '.clientrc files contained in the workspace + // fileEvents: workspace.createFileSystemWatcher('**/.clientrc') + } + }; + + // Create the language client and start the client. + client = new LanguageClient( + 'ligoLanguageServer', + 'LIGO Language Server', + serverOptions, + clientOptions + ); + + console.log('Starting the client...') + // Start the client. This will also launch the server + client.start(); +} + +export function deactivate(): Thenable | undefined { + if (!client) { + return undefined; + } + return client.stop(); +} diff --git a/tools/lsp/vscode-plugin/client/tsconfig.json b/tools/lsp/vscode-plugin/client/tsconfig.json new file mode 100644 index 000000000..4506f7235 --- /dev/null +++ b/tools/lsp/vscode-plugin/client/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "outDir": "out", + "rootDir": "src", + "sourceMap": true + }, + "include": ["src"], + "exclude": ["node_modules", ".vscode-test"] +} diff --git a/tools/lsp/vscode-plugin/logo.png b/tools/lsp/vscode-plugin/logo.png new file mode 100644 index 000000000..bae9ac7f7 Binary files /dev/null and b/tools/lsp/vscode-plugin/logo.png differ diff --git a/tools/lsp/vscode-plugin/package-lock.json b/tools/lsp/vscode-plugin/package-lock.json new file mode 100644 index 000000000..2419cd5c8 --- /dev/null +++ b/tools/lsp/vscode-plugin/package-lock.json @@ -0,0 +1,317 @@ +{ + "name": "ligo-vscode", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@types/node": { + "version": "8.10.52", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.52.tgz", + "integrity": "sha512-2RbW7WXeLex6RI+kQSxq6Ym0GiVcODeQ4Km7MnnTX5BHdOGQnqVa+s6AUmAW+OFYAJ8wv9QxvNZXm7/kBdGTVw==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "resolve": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.1.tgz", + "integrity": "sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, + "tslint": { + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz", + "integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.13.0", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "typescript": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", + "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/tools/lsp/vscode-plugin/package.json b/tools/lsp/vscode-plugin/package.json new file mode 100644 index 000000000..7890ef574 --- /dev/null +++ b/tools/lsp/vscode-plugin/package.json @@ -0,0 +1,78 @@ +{ + "name": "ligo-vscode", + "description": "LIGO VSCode extension includes syntax highlighting, and a language server for LIGO.", + "author": "Serokell", + "license": "MIT", + "version": "0.1.0", + "repository": { + "type": "git", + "url": "https://gitlab.com/ligolang/ligo" + }, + "publisher": "LigoLang", + "categories": [ + "Programming Languages" + ], + "keywords": [], + "engines": { + "vscode": "^1.43.0" + }, + "activationEvents": [ + "onLanguage:ligo", + "onLanguage:mligo", + "onLanguage:religo" + ], + "icon": "logo.png", + "main": "./client/out/extension", + "contributes": { + "languages": [ + { + "id": "ligo", + "aliases": ["PascaLIGO"], + "extensions": ["ligo"], + "configuration": "./syntaxes/ligo.configuration.json" + }, + { + "id": "religo", + "aliases": ["ReasonLIGO"], + "extensions": ["religo"], + "configuration": "./syntaxes/religo.configuration.json" + } + ], + "grammars": [ + { + "language": "ligo", + "scopeName": "source.ligo", + "path": "./syntaxes/ligo.tmLanguage.json" + }, + { + "language": "religo", + "scopeName": "source.religo", + "path": "./syntaxes/religo.tmLanguage.json" + } + ], + "configuration": { + "type": "object", + "title": "LIGO LSP Configuration", + "properties": { + "ligoLanguageServer.maxNumberOfProblems": { + "scope": "resource", + "type": "number", + "default": 100, + "description": "Controls the maximum number of problems produced by the server." + } + } + } + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -b", + "watch": "tsc -b -w", + "postinstall": "cd client && npm install && cd .." + }, + "devDependencies": { + "@types/node": "^8.10.52", + "tslint": "^5.16.0", + "typescript": "next" + }, + "dependencies": {} +} diff --git a/tools/lsp/vscode-plugin/syntaxes/ligo.configuration.json b/tools/lsp/vscode-plugin/syntaxes/ligo.configuration.json new file mode 100644 index 000000000..e7df28b9f --- /dev/null +++ b/tools/lsp/vscode-plugin/syntaxes/ligo.configuration.json @@ -0,0 +1,29 @@ +{ + "comments": { + "lineComment": "//", + "blockComment": [ "(*", "*)" ] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"], + ["(*", "*)"], + ["begin", "end"] + ], + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"], + ["(*", "*)"], + ["begin", "end"] + ] +} diff --git a/tools/lsp/vscode-plugin/syntaxes/ligo.tmLanguage.json b/tools/lsp/vscode-plugin/syntaxes/ligo.tmLanguage.json new file mode 100644 index 000000000..b13d3c515 --- /dev/null +++ b/tools/lsp/vscode-plugin/syntaxes/ligo.tmLanguage.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "ligo", + "patterns": [ + { "include": "#controlkeywords" }, + { "include": "#function" }, + { "include": "#strings" }, + { "include": "#comment" }, + { "include": "#multilineComment" }, + { "include": "#singlequotes" }, + { "include": "#type" }, + { "include": "#typeDeclaration" }, + { "include": "#otherkeywords" }, + { "include": "#variableInit" }, + { "include": "#variableDeclaration" } + ], + "repository": { + "controlkeywords": { + "patterns": [{ + "name": "keyword.control.ligo", + "match": "\\b(if|while|for|return|nil|remove|from|else|then|None|Some|True|False|Unit|skip)\\b" + }] + }, + "otherkeywords": { + "patterns": [{ + "name": "keyword.other.ligo", + "match": "\\b(case|with|is|function|var|const|type|end|begin|block|sender|source|amount|balance|now)\\b" + }] + }, + "function": { + "patterns": [ + { + "name": "entity.name.function.ligo", + "match": "(?!with\\b)\\b\\w+ ?(?=\\()" + } + ] + }, + "strings": { + "name": "string.quoted.double.ligo", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.ligo", + "match": "\\\\." + } + ] + }, + "singlequotes" : { + "name": "string.quoted.single.ligo", + "begin": "\\'", + "end": "\\'", + "patterns" : [] + }, + "comment": { + "patterns": [ + { + "name": "comment.line.double-slash.ligo", + "match": "(//.*)" + } + ] + }, + "multilineComment" : { + "name" : "comment.line.double-slash.ligo", + "begin" : "\\(\\*", + "end" : "\\*\\)", + "patterns" : [] + }, + "type" : { + "patterns" : [ + { + "name" : "support.type.ligo", + "match": "\\b(bool|int|unit|string|nat|tez|map|timestamp|signature|key|big_map|list|set|record|address|option)\\b" + } + ] + }, + "typeDeclaration" : { + "patterns" : [ + { + "name" : "support.type.ligo", + "match": "\\w+ ?(?= is )" + } + ] + }, + "variableInit" : { + "patterns" : [ + { + "name" : "support.variable.ligo", + "match": "\\w+ ?(?=\\:\\=)" + } + ] + }, + "variableDeclaration" : { + "patterns" : [ + { + "name" : "support.variable.ligo", + "match": "\\w+ ?(?=\\:)" + } + ] + } + }, + "scopeName": "source.ligo" +} diff --git a/tools/lsp/vscode-plugin/syntaxes/religo.configuration.json b/tools/lsp/vscode-plugin/syntaxes/religo.configuration.json new file mode 100644 index 000000000..98b2e769a --- /dev/null +++ b/tools/lsp/vscode-plugin/syntaxes/religo.configuration.json @@ -0,0 +1,25 @@ +{ + "comments": { + "lineComment": "//", + "blockComment": [ "/*", "*/" ] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ], + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ] +} diff --git a/tools/lsp/vscode-plugin/syntaxes/religo.tmLanguage.json b/tools/lsp/vscode-plugin/syntaxes/religo.tmLanguage.json new file mode 100644 index 000000000..19108d6f5 --- /dev/null +++ b/tools/lsp/vscode-plugin/syntaxes/religo.tmLanguage.json @@ -0,0 +1,94 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "religo", + "scopeName": "source.religo", + "patterns": [ + { "include": "#controlkeywords" }, + { "include": "#strings" }, + { "include": "#comment" }, + { "include": "#multilineComment" }, + { "include": "#singlequotes" }, + { "include": "#type" }, + { "include": "#typeDeclaration" }, + { "include": "#otherkeywords" }, + { "include": "#variableInit" }, + { "include": "#variableDeclaration" } + ], + "repository": { + "controlkeywords": { + "patterns": [{ + "name": "keyword.control.religo", + "match": "\\b(if|then|else|remove|from|None|Some|true|false|skip)\\b" + }] + }, + "otherkeywords": { + "patterns": [{ + "name": "keyword.other.religo", + "match": "\\b(let|rec|switch|type|sender|source|amount|balance|now)\\b" + }] + }, + "strings": { + "name": "string.quoted.double.religo", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.religo", + "match": "\\\\." + } + ] + }, + "singlequotes" : { + "name": "string.quoted.single.religo", + "begin": "'", + "end": "'", + "patterns" : [] + }, + "comment": { + "patterns": [ + { + "name": "comment.line.double-slash.religo", + "match": "(//.*)" + } + ] + }, + "multilineComment" : { + "name" : "comment.line.double-slash.religo", + "begin" : "/\\*", + "end" : "\\*/", + "patterns" : [] + }, + "type" : { + "patterns" : [ + { + "name" : "support.type.religo", + "match": "\\b(bool|int|unit|string|nat|tez|map|timestamp|signature|key|big_map|list|set|record|address|option)\\b" + } + ] + }, + "typeDeclaration" : { + "patterns" : [ + { + "name" : "support.type.religo", + "match": "(?=type +)\\w+? +(?=\\=)" + } + ] + }, + "variableInit" : { + "patterns" : [ + { + "name" : "support.variable.religo", + "match": "(?=let +)\\w+(?= +\\:\\=)" + } + ] + }, + "variableDeclaration" : { + "patterns" : [ + { + "name" : "support.variable.religo", + "match": "\\w+(?= +\\:)" + } + ] + } + } +} diff --git a/tools/lsp/vscode-plugin/tsconfig.json b/tools/lsp/vscode-plugin/tsconfig.json new file mode 100644 index 000000000..8780b70b7 --- /dev/null +++ b/tools/lsp/vscode-plugin/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "outDir": "out", + "rootDir": "src", + "sourceMap": true + }, + "include": [ + "src" + ], + "exclude": [ + "node_modules", + ".vscode-test" + ], + "references": [ + { "path": "./client" } + ] +}