├── LICENSE ├── README.md ├── client ├── package-lock.json ├── package.json ├── src │ └── extension.ts └── tsconfig.json ├── language-configuration.json ├── package-lock.json ├── package.json ├── server ├── package-lock.json ├── package.json ├── src │ └── server.ts └── tsconfig.json ├── syntaxes └── lpython.tmLanguage.json └── tsconfig.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 lcompilers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lpython-vscode-extension 2 | LPython extension for VSCode 3 | 4 | 5 | 6 | There are no pre-packaged versions of this extension, but will be packaging the extension to VS Code market place very soon. 7 | 8 | ## Key Features 9 | 10 | 1. Linting: highlights errors and warnings in your LPython code which helps you to identify and correct programming errors. 11 | 2. Document Symbol Lookup: You can navigate symbols inside a file with `Ctrl + Shift + O`. By typing `:` the symbols are grouped by category. Press Up or Down and navigate to the place you want. 12 | 3. Syntax Highlight: Coloring and styling of source code displayed in vscode editor using [TextMate grammars](https://macromates.com/manual/en/language_grammars). 13 | 14 | ## Language Server 15 | 16 | - The Language Server is written in TypeScript, which uses [Microsoft’s official language server module](https://github.com/microsoft/vscode-languageserver-node). 17 | - Communication between the language server and LPython Compiler is done with 18 | ```bash 19 | const stdout = await runCompiler(text, "", settings); 20 | ``` 21 | 22 | ## Usage 23 | 24 | 1. Install LPython: Refer to [lpython documentation](https://github.com/lcompilers/lpython#installation) (build as usual, but ensure `-DWITH_LSP=yes` in cmake). 25 | 26 | 2. Install npm, for example via Conda: 27 | ``` 28 | conda create -n npm nodejs 29 | conda activate npm 30 | ``` 31 | 32 | 3. Clone the repository: 33 | ```bash 34 | git clone https://github.com/lcompilers/lpython-vscode-extension 35 | ``` 36 | 37 | 4. Build the extension: 38 | ```bash 39 | cd lpython-vscode-extension && npm install && npm run compile 40 | ``` 41 | 42 | 5. Create the package locally: 43 | ```bash 44 | npm install vsce -g 45 | vsce package 46 | ``` 47 | Say "Y" to the question "Using `*` activation is usually a bad idea as it impacts performance. Do you want to continue?". 48 | 49 | This will generate a `lpython-1.0.0.vsix` file in your current directory, which 50 | can then be imported as an extension in VSCode: 51 | * Go to extensions (on the left) 52 | * Click on the `...` on the top right 53 | * Click on "Install from VSIX" and select the `lpython-1.0.0.vsix` 54 | 55 | If you have the `lpython` binary in your `$PATH` then everything should just 56 | work. If you do not, then you have to tell the extension where to find it: 57 | 58 | * Select the `lpython` extension in your installed extensions 59 | * Click on the Settings button -> Extension Settings 60 | * Search for "lpython" 61 | * Change "LPython Language Server › Compiler: Executable Path" to the correct 62 | path to the `lpython` binary on your system 63 | 64 | 65 | 66 | The extension should now work. Create a new file `a.py` and put `x = 5` in 67 | there. The `x` should get highlighted with an error message that `x` is not 68 | declared (you have to change it to `x: i32 = 5` to work). 69 | 70 | 71 | 72 | ## Contributing 73 | 74 | We welcome contributions from anyone, even if you are new to open source. 75 | 76 | 1. To contribute, submit a PR against your repository at: https://github.com/lcompilers/lpython-vscode-extension 77 | 2. Please report any bugs you may find at our issue tracker: https://github.com/lcompilers/lpython-vscode-extension/issues 78 | 79 | We welcome all changes, big or small! 80 | 81 | Here is how to develop this extension: 82 | ``` 83 | conda create -n npm nodejs 84 | conda activate npm 85 | git clone https://github.com/lcompilers/lpython-vscode-extension 86 | cd lpython-vscode-extension && npm install && npm run compile 87 | ``` 88 | 89 | The go to VSCode and: 90 | 91 | * Ctrl-Shift-D (Command-Shift-D on macOS) 92 | * Click on "Run and Debug" 93 | * Select "VSCode Extension Development"; a new VSCode window will pop up with 94 | the extension already running in it. 95 | -------------------------------------------------------------------------------- /client/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lpython-client", 3 | "version": "0.0.1", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "lpython-client", 9 | "version": "0.0.1", 10 | "license": "MIT", 11 | "dependencies": { 12 | "vscode-languageclient": "^7.0.0" 13 | }, 14 | "devDependencies": { 15 | "@types/vscode": "^1.63.0", 16 | "@vscode/test-electron": "^2.1.2" 17 | }, 18 | "engines": { 19 | "vscode": "^1.63.0" 20 | } 21 | }, 22 | "node_modules/@tootallnate/once": { 23 | "version": "1.1.2", 24 | "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", 25 | "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", 26 | "dev": true, 27 | "engines": { 28 | "node": ">= 6" 29 | } 30 | }, 31 | "node_modules/@types/vscode": { 32 | "version": "1.64.0", 33 | "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.64.0.tgz", 34 | "integrity": "sha512-bSlAWz5WtcSL3cO9tAT/KpEH9rv5OBnm93OIIFwdCshaAiqr2bp1AUyEwW9MWeCvZBHEXc3V0fTYVdVyzDNwHA==", 35 | "dev": true 36 | }, 37 | "node_modules/@vscode/test-electron": { 38 | "version": "2.1.2", 39 | "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.1.2.tgz", 40 | "integrity": "sha512-INjJ0YA9RgR1B/xBl8P4sxww4Dy2996f4Xn5oGTFfC0c2Mm45y/1Id8xmfuoba6tR5i8zZaUIHfEYWe7Rt4uZA==", 41 | "dev": true, 42 | "dependencies": { 43 | "http-proxy-agent": "^4.0.1", 44 | "https-proxy-agent": "^5.0.0", 45 | "rimraf": "^3.0.2", 46 | "unzipper": "^0.10.11" 47 | }, 48 | "engines": { 49 | "node": ">=8.9.3" 50 | } 51 | }, 52 | "node_modules/@vscode/test-electron/node_modules/agent-base": { 53 | "version": "6.0.2", 54 | "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", 55 | "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", 56 | "dev": true, 57 | "dependencies": { 58 | "debug": "4" 59 | }, 60 | "engines": { 61 | "node": ">= 6.0.0" 62 | } 63 | }, 64 | "node_modules/@vscode/test-electron/node_modules/debug": { 65 | "version": "4.3.2", 66 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", 67 | "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", 68 | "dev": true, 69 | "dependencies": { 70 | "ms": "2.1.2" 71 | }, 72 | "engines": { 73 | "node": ">=6.0" 74 | }, 75 | "peerDependenciesMeta": { 76 | "supports-color": { 77 | "optional": true 78 | } 79 | } 80 | }, 81 | "node_modules/@vscode/test-electron/node_modules/http-proxy-agent": { 82 | "version": "4.0.1", 83 | "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", 84 | "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", 85 | "dev": true, 86 | "dependencies": { 87 | "@tootallnate/once": "1", 88 | "agent-base": "6", 89 | "debug": "4" 90 | }, 91 | "engines": { 92 | "node": ">= 6" 93 | } 94 | }, 95 | "node_modules/@vscode/test-electron/node_modules/https-proxy-agent": { 96 | "version": "5.0.0", 97 | "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", 98 | "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", 99 | "dev": true, 100 | "dependencies": { 101 | "agent-base": "6", 102 | "debug": "4" 103 | }, 104 | "engines": { 105 | "node": ">= 6" 106 | } 107 | }, 108 | "node_modules/@vscode/test-electron/node_modules/ms": { 109 | "version": "2.1.2", 110 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 111 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 112 | "dev": true 113 | }, 114 | "node_modules/@vscode/test-electron/node_modules/rimraf": { 115 | "version": "3.0.2", 116 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", 117 | "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", 118 | "dev": true, 119 | "dependencies": { 120 | "glob": "^7.1.3" 121 | }, 122 | "bin": { 123 | "rimraf": "bin.js" 124 | }, 125 | "funding": { 126 | "url": "https://github.com/sponsors/isaacs" 127 | } 128 | }, 129 | "node_modules/balanced-match": { 130 | "version": "1.0.0", 131 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 132 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 133 | }, 134 | "node_modules/big-integer": { 135 | "version": "1.6.48", 136 | "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", 137 | "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", 138 | "dev": true, 139 | "engines": { 140 | "node": ">=0.6" 141 | } 142 | }, 143 | "node_modules/binary": { 144 | "version": "0.3.0", 145 | "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", 146 | "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", 147 | "dev": true, 148 | "dependencies": { 149 | "buffers": "~0.1.1", 150 | "chainsaw": "~0.1.0" 151 | }, 152 | "engines": { 153 | "node": "*" 154 | } 155 | }, 156 | "node_modules/bluebird": { 157 | "version": "3.4.7", 158 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", 159 | "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=", 160 | "dev": true 161 | }, 162 | "node_modules/brace-expansion": { 163 | "version": "1.1.11", 164 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 165 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 166 | "dependencies": { 167 | "balanced-match": "^1.0.0", 168 | "concat-map": "0.0.1" 169 | } 170 | }, 171 | "node_modules/buffer-indexof-polyfill": { 172 | "version": "1.0.2", 173 | "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", 174 | "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", 175 | "dev": true, 176 | "engines": { 177 | "node": ">=0.10" 178 | } 179 | }, 180 | "node_modules/buffers": { 181 | "version": "0.1.1", 182 | "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", 183 | "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", 184 | "dev": true, 185 | "engines": { 186 | "node": ">=0.2.0" 187 | } 188 | }, 189 | "node_modules/chainsaw": { 190 | "version": "0.1.0", 191 | "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", 192 | "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", 193 | "dev": true, 194 | "dependencies": { 195 | "traverse": ">=0.3.0 <0.4" 196 | }, 197 | "engines": { 198 | "node": "*" 199 | } 200 | }, 201 | "node_modules/concat-map": { 202 | "version": "0.0.1", 203 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 204 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 205 | }, 206 | "node_modules/core-util-is": { 207 | "version": "1.0.2", 208 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 209 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 210 | "dev": true 211 | }, 212 | "node_modules/duplexer2": { 213 | "version": "0.1.4", 214 | "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", 215 | "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", 216 | "dev": true, 217 | "dependencies": { 218 | "readable-stream": "^2.0.2" 219 | } 220 | }, 221 | "node_modules/fs.realpath": { 222 | "version": "1.0.0", 223 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 224 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 225 | "dev": true 226 | }, 227 | "node_modules/fstream": { 228 | "version": "1.0.12", 229 | "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", 230 | "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", 231 | "dev": true, 232 | "dependencies": { 233 | "graceful-fs": "^4.1.2", 234 | "inherits": "~2.0.0", 235 | "mkdirp": ">=0.5 0", 236 | "rimraf": "2" 237 | }, 238 | "engines": { 239 | "node": ">=0.6" 240 | } 241 | }, 242 | "node_modules/glob": { 243 | "version": "7.1.6", 244 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", 245 | "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", 246 | "dev": true, 247 | "dependencies": { 248 | "fs.realpath": "^1.0.0", 249 | "inflight": "^1.0.4", 250 | "inherits": "2", 251 | "minimatch": "^3.0.4", 252 | "once": "^1.3.0", 253 | "path-is-absolute": "^1.0.0" 254 | }, 255 | "engines": { 256 | "node": "*" 257 | }, 258 | "funding": { 259 | "url": "https://github.com/sponsors/isaacs" 260 | } 261 | }, 262 | "node_modules/graceful-fs": { 263 | "version": "4.2.6", 264 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", 265 | "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", 266 | "dev": true 267 | }, 268 | "node_modules/inflight": { 269 | "version": "1.0.6", 270 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 271 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 272 | "dev": true, 273 | "dependencies": { 274 | "once": "^1.3.0", 275 | "wrappy": "1" 276 | } 277 | }, 278 | "node_modules/inherits": { 279 | "version": "2.0.4", 280 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 281 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 282 | "dev": true 283 | }, 284 | "node_modules/isarray": { 285 | "version": "1.0.0", 286 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 287 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 288 | "dev": true 289 | }, 290 | "node_modules/listenercount": { 291 | "version": "1.0.1", 292 | "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", 293 | "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc=", 294 | "dev": true 295 | }, 296 | "node_modules/lru-cache": { 297 | "version": "6.0.0", 298 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", 299 | "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", 300 | "dependencies": { 301 | "yallist": "^4.0.0" 302 | }, 303 | "engines": { 304 | "node": ">=10" 305 | } 306 | }, 307 | "node_modules/minimatch": { 308 | "version": "3.0.4", 309 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 310 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 311 | "dependencies": { 312 | "brace-expansion": "^1.1.7" 313 | }, 314 | "engines": { 315 | "node": "*" 316 | } 317 | }, 318 | "node_modules/minimist": { 319 | "version": "1.2.6", 320 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", 321 | "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", 322 | "dev": true 323 | }, 324 | "node_modules/mkdirp": { 325 | "version": "0.5.5", 326 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", 327 | "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", 328 | "dev": true, 329 | "dependencies": { 330 | "minimist": "^1.2.5" 331 | }, 332 | "bin": { 333 | "mkdirp": "bin/cmd.js" 334 | } 335 | }, 336 | "node_modules/once": { 337 | "version": "1.4.0", 338 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 339 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 340 | "dev": true, 341 | "dependencies": { 342 | "wrappy": "1" 343 | } 344 | }, 345 | "node_modules/path-is-absolute": { 346 | "version": "1.0.1", 347 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 348 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 349 | "dev": true, 350 | "engines": { 351 | "node": ">=0.10.0" 352 | } 353 | }, 354 | "node_modules/process-nextick-args": { 355 | "version": "2.0.1", 356 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 357 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", 358 | "dev": true 359 | }, 360 | "node_modules/readable-stream": { 361 | "version": "2.3.7", 362 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 363 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 364 | "dev": true, 365 | "dependencies": { 366 | "core-util-is": "~1.0.0", 367 | "inherits": "~2.0.3", 368 | "isarray": "~1.0.0", 369 | "process-nextick-args": "~2.0.0", 370 | "safe-buffer": "~5.1.1", 371 | "string_decoder": "~1.1.1", 372 | "util-deprecate": "~1.0.1" 373 | } 374 | }, 375 | "node_modules/rimraf": { 376 | "version": "2.7.1", 377 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", 378 | "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", 379 | "dev": true, 380 | "dependencies": { 381 | "glob": "^7.1.3" 382 | }, 383 | "bin": { 384 | "rimraf": "bin.js" 385 | } 386 | }, 387 | "node_modules/safe-buffer": { 388 | "version": "5.1.2", 389 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 390 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 391 | "dev": true 392 | }, 393 | "node_modules/semver": { 394 | "version": "7.3.4", 395 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", 396 | "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", 397 | "dependencies": { 398 | "lru-cache": "^6.0.0" 399 | }, 400 | "bin": { 401 | "semver": "bin/semver.js" 402 | }, 403 | "engines": { 404 | "node": ">=10" 405 | } 406 | }, 407 | "node_modules/setimmediate": { 408 | "version": "1.0.5", 409 | "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", 410 | "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", 411 | "dev": true 412 | }, 413 | "node_modules/string_decoder": { 414 | "version": "1.1.1", 415 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 416 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 417 | "dev": true, 418 | "dependencies": { 419 | "safe-buffer": "~5.1.0" 420 | } 421 | }, 422 | "node_modules/traverse": { 423 | "version": "0.3.9", 424 | "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", 425 | "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", 426 | "dev": true, 427 | "engines": { 428 | "node": "*" 429 | } 430 | }, 431 | "node_modules/unzipper": { 432 | "version": "0.10.11", 433 | "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.11.tgz", 434 | "integrity": "sha512-+BrAq2oFqWod5IESRjL3S8baohbevGcVA+teAIOYWM3pDVdseogqbzhhvvmiyQrUNKFUnDMtELW3X8ykbyDCJw==", 435 | "dev": true, 436 | "dependencies": { 437 | "big-integer": "^1.6.17", 438 | "binary": "~0.3.0", 439 | "bluebird": "~3.4.1", 440 | "buffer-indexof-polyfill": "~1.0.0", 441 | "duplexer2": "~0.1.4", 442 | "fstream": "^1.0.12", 443 | "graceful-fs": "^4.2.2", 444 | "listenercount": "~1.0.1", 445 | "readable-stream": "~2.3.6", 446 | "setimmediate": "~1.0.4" 447 | } 448 | }, 449 | "node_modules/util-deprecate": { 450 | "version": "1.0.2", 451 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 452 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 453 | "dev": true 454 | }, 455 | "node_modules/vscode-jsonrpc": { 456 | "version": "6.0.0", 457 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", 458 | "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==", 459 | "engines": { 460 | "node": ">=8.0.0 || >=10.0.0" 461 | } 462 | }, 463 | "node_modules/vscode-languageclient": { 464 | "version": "7.0.0", 465 | "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.0.0.tgz", 466 | "integrity": "sha512-P9AXdAPlsCgslpP9pRxYPqkNYV7Xq8300/aZDpO35j1fJm/ncize8iGswzYlcvFw5DQUx4eVk+KvfXdL0rehNg==", 467 | "dependencies": { 468 | "minimatch": "^3.0.4", 469 | "semver": "^7.3.4", 470 | "vscode-languageserver-protocol": "3.16.0" 471 | }, 472 | "engines": { 473 | "vscode": "^1.52.0" 474 | } 475 | }, 476 | "node_modules/vscode-languageserver-protocol": { 477 | "version": "3.16.0", 478 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", 479 | "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", 480 | "dependencies": { 481 | "vscode-jsonrpc": "6.0.0", 482 | "vscode-languageserver-types": "3.16.0" 483 | } 484 | }, 485 | "node_modules/vscode-languageserver-types": { 486 | "version": "3.16.0", 487 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", 488 | "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" 489 | }, 490 | "node_modules/wrappy": { 491 | "version": "1.0.2", 492 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 493 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 494 | "dev": true 495 | }, 496 | "node_modules/yallist": { 497 | "version": "4.0.0", 498 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", 499 | "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" 500 | } 501 | }, 502 | "dependencies": { 503 | "@tootallnate/once": { 504 | "version": "1.1.2", 505 | "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", 506 | "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", 507 | "dev": true 508 | }, 509 | "@types/vscode": { 510 | "version": "1.64.0", 511 | "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.64.0.tgz", 512 | "integrity": "sha512-bSlAWz5WtcSL3cO9tAT/KpEH9rv5OBnm93OIIFwdCshaAiqr2bp1AUyEwW9MWeCvZBHEXc3V0fTYVdVyzDNwHA==", 513 | "dev": true 514 | }, 515 | "@vscode/test-electron": { 516 | "version": "2.1.2", 517 | "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.1.2.tgz", 518 | "integrity": "sha512-INjJ0YA9RgR1B/xBl8P4sxww4Dy2996f4Xn5oGTFfC0c2Mm45y/1Id8xmfuoba6tR5i8zZaUIHfEYWe7Rt4uZA==", 519 | "dev": true, 520 | "requires": { 521 | "http-proxy-agent": "^4.0.1", 522 | "https-proxy-agent": "^5.0.0", 523 | "rimraf": "^3.0.2", 524 | "unzipper": "^0.10.11" 525 | }, 526 | "dependencies": { 527 | "agent-base": { 528 | "version": "6.0.2", 529 | "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", 530 | "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", 531 | "dev": true, 532 | "requires": { 533 | "debug": "4" 534 | } 535 | }, 536 | "debug": { 537 | "version": "4.3.2", 538 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", 539 | "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", 540 | "dev": true, 541 | "requires": { 542 | "ms": "2.1.2" 543 | } 544 | }, 545 | "http-proxy-agent": { 546 | "version": "4.0.1", 547 | "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", 548 | "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", 549 | "dev": true, 550 | "requires": { 551 | "@tootallnate/once": "1", 552 | "agent-base": "6", 553 | "debug": "4" 554 | } 555 | }, 556 | "https-proxy-agent": { 557 | "version": "5.0.0", 558 | "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", 559 | "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", 560 | "dev": true, 561 | "requires": { 562 | "agent-base": "6", 563 | "debug": "4" 564 | } 565 | }, 566 | "ms": { 567 | "version": "2.1.2", 568 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 569 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 570 | "dev": true 571 | }, 572 | "rimraf": { 573 | "version": "3.0.2", 574 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", 575 | "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", 576 | "dev": true, 577 | "requires": { 578 | "glob": "^7.1.3" 579 | } 580 | } 581 | } 582 | }, 583 | "balanced-match": { 584 | "version": "1.0.0", 585 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 586 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 587 | }, 588 | "big-integer": { 589 | "version": "1.6.48", 590 | "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", 591 | "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", 592 | "dev": true 593 | }, 594 | "binary": { 595 | "version": "0.3.0", 596 | "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", 597 | "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", 598 | "dev": true, 599 | "requires": { 600 | "buffers": "~0.1.1", 601 | "chainsaw": "~0.1.0" 602 | } 603 | }, 604 | "bluebird": { 605 | "version": "3.4.7", 606 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", 607 | "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=", 608 | "dev": true 609 | }, 610 | "brace-expansion": { 611 | "version": "1.1.11", 612 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 613 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 614 | "requires": { 615 | "balanced-match": "^1.0.0", 616 | "concat-map": "0.0.1" 617 | } 618 | }, 619 | "buffer-indexof-polyfill": { 620 | "version": "1.0.2", 621 | "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", 622 | "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", 623 | "dev": true 624 | }, 625 | "buffers": { 626 | "version": "0.1.1", 627 | "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", 628 | "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", 629 | "dev": true 630 | }, 631 | "chainsaw": { 632 | "version": "0.1.0", 633 | "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", 634 | "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", 635 | "dev": true, 636 | "requires": { 637 | "traverse": ">=0.3.0 <0.4" 638 | } 639 | }, 640 | "concat-map": { 641 | "version": "0.0.1", 642 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 643 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 644 | }, 645 | "core-util-is": { 646 | "version": "1.0.2", 647 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 648 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 649 | "dev": true 650 | }, 651 | "duplexer2": { 652 | "version": "0.1.4", 653 | "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", 654 | "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", 655 | "dev": true, 656 | "requires": { 657 | "readable-stream": "^2.0.2" 658 | } 659 | }, 660 | "fs.realpath": { 661 | "version": "1.0.0", 662 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 663 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 664 | "dev": true 665 | }, 666 | "fstream": { 667 | "version": "1.0.12", 668 | "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", 669 | "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", 670 | "dev": true, 671 | "requires": { 672 | "graceful-fs": "^4.1.2", 673 | "inherits": "~2.0.0", 674 | "mkdirp": ">=0.5 0", 675 | "rimraf": "2" 676 | } 677 | }, 678 | "glob": { 679 | "version": "7.1.6", 680 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", 681 | "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", 682 | "dev": true, 683 | "requires": { 684 | "fs.realpath": "^1.0.0", 685 | "inflight": "^1.0.4", 686 | "inherits": "2", 687 | "minimatch": "^3.0.4", 688 | "once": "^1.3.0", 689 | "path-is-absolute": "^1.0.0" 690 | } 691 | }, 692 | "graceful-fs": { 693 | "version": "4.2.6", 694 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", 695 | "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", 696 | "dev": true 697 | }, 698 | "inflight": { 699 | "version": "1.0.6", 700 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 701 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 702 | "dev": true, 703 | "requires": { 704 | "once": "^1.3.0", 705 | "wrappy": "1" 706 | } 707 | }, 708 | "inherits": { 709 | "version": "2.0.4", 710 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 711 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 712 | "dev": true 713 | }, 714 | "isarray": { 715 | "version": "1.0.0", 716 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 717 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 718 | "dev": true 719 | }, 720 | "listenercount": { 721 | "version": "1.0.1", 722 | "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", 723 | "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc=", 724 | "dev": true 725 | }, 726 | "lru-cache": { 727 | "version": "6.0.0", 728 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", 729 | "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", 730 | "requires": { 731 | "yallist": "^4.0.0" 732 | } 733 | }, 734 | "minimatch": { 735 | "version": "3.0.4", 736 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 737 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 738 | "requires": { 739 | "brace-expansion": "^1.1.7" 740 | } 741 | }, 742 | "minimist": { 743 | "version": "1.2.6", 744 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", 745 | "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", 746 | "dev": true 747 | }, 748 | "mkdirp": { 749 | "version": "0.5.5", 750 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", 751 | "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", 752 | "dev": true, 753 | "requires": { 754 | "minimist": "^1.2.5" 755 | } 756 | }, 757 | "once": { 758 | "version": "1.4.0", 759 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 760 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 761 | "dev": true, 762 | "requires": { 763 | "wrappy": "1" 764 | } 765 | }, 766 | "path-is-absolute": { 767 | "version": "1.0.1", 768 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 769 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 770 | "dev": true 771 | }, 772 | "process-nextick-args": { 773 | "version": "2.0.1", 774 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 775 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", 776 | "dev": true 777 | }, 778 | "readable-stream": { 779 | "version": "2.3.7", 780 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 781 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 782 | "dev": true, 783 | "requires": { 784 | "core-util-is": "~1.0.0", 785 | "inherits": "~2.0.3", 786 | "isarray": "~1.0.0", 787 | "process-nextick-args": "~2.0.0", 788 | "safe-buffer": "~5.1.1", 789 | "string_decoder": "~1.1.1", 790 | "util-deprecate": "~1.0.1" 791 | } 792 | }, 793 | "rimraf": { 794 | "version": "2.7.1", 795 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", 796 | "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", 797 | "dev": true, 798 | "requires": { 799 | "glob": "^7.1.3" 800 | } 801 | }, 802 | "safe-buffer": { 803 | "version": "5.1.2", 804 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 805 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 806 | "dev": true 807 | }, 808 | "semver": { 809 | "version": "7.3.4", 810 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", 811 | "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", 812 | "requires": { 813 | "lru-cache": "^6.0.0" 814 | } 815 | }, 816 | "setimmediate": { 817 | "version": "1.0.5", 818 | "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", 819 | "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", 820 | "dev": true 821 | }, 822 | "string_decoder": { 823 | "version": "1.1.1", 824 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 825 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 826 | "dev": true, 827 | "requires": { 828 | "safe-buffer": "~5.1.0" 829 | } 830 | }, 831 | "traverse": { 832 | "version": "0.3.9", 833 | "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", 834 | "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", 835 | "dev": true 836 | }, 837 | "unzipper": { 838 | "version": "0.10.11", 839 | "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.11.tgz", 840 | "integrity": "sha512-+BrAq2oFqWod5IESRjL3S8baohbevGcVA+teAIOYWM3pDVdseogqbzhhvvmiyQrUNKFUnDMtELW3X8ykbyDCJw==", 841 | "dev": true, 842 | "requires": { 843 | "big-integer": "^1.6.17", 844 | "binary": "~0.3.0", 845 | "bluebird": "~3.4.1", 846 | "buffer-indexof-polyfill": "~1.0.0", 847 | "duplexer2": "~0.1.4", 848 | "fstream": "^1.0.12", 849 | "graceful-fs": "^4.2.2", 850 | "listenercount": "~1.0.1", 851 | "readable-stream": "~2.3.6", 852 | "setimmediate": "~1.0.4" 853 | } 854 | }, 855 | "util-deprecate": { 856 | "version": "1.0.2", 857 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 858 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 859 | "dev": true 860 | }, 861 | "vscode-jsonrpc": { 862 | "version": "6.0.0", 863 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", 864 | "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==" 865 | }, 866 | "vscode-languageclient": { 867 | "version": "7.0.0", 868 | "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.0.0.tgz", 869 | "integrity": "sha512-P9AXdAPlsCgslpP9pRxYPqkNYV7Xq8300/aZDpO35j1fJm/ncize8iGswzYlcvFw5DQUx4eVk+KvfXdL0rehNg==", 870 | "requires": { 871 | "minimatch": "^3.0.4", 872 | "semver": "^7.3.4", 873 | "vscode-languageserver-protocol": "3.16.0" 874 | } 875 | }, 876 | "vscode-languageserver-protocol": { 877 | "version": "3.16.0", 878 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", 879 | "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", 880 | "requires": { 881 | "vscode-jsonrpc": "6.0.0", 882 | "vscode-languageserver-types": "3.16.0" 883 | } 884 | }, 885 | "vscode-languageserver-types": { 886 | "version": "3.16.0", 887 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", 888 | "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" 889 | }, 890 | "wrappy": { 891 | "version": "1.0.2", 892 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 893 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 894 | "dev": true 895 | }, 896 | "yallist": { 897 | "version": "4.0.0", 898 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", 899 | "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" 900 | } 901 | } 902 | } 903 | -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lpython-client", 3 | "description": "VSCode part of LPython Language Server", 4 | "author": "LCompilers", 5 | "license": "MIT", 6 | "version": "0.0.1", 7 | "publisher": "vscode", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/lcompilers/lpython-vscode-extension" 11 | }, 12 | "engines": { 13 | "vscode": "^1.63.0" 14 | }, 15 | "dependencies": { 16 | "vscode-languageclient": "^7.0.0" 17 | }, 18 | "devDependencies": { 19 | "@types/vscode": "^1.63.0", 20 | "@vscode/test-electron": "^2.1.2" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /client/src/extension.ts: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | * ------------------------------------------------------------------------------------------ */ 5 | 6 | import * as path from 'path'; 7 | import { workspace, ExtensionContext } from 'vscode'; 8 | 9 | import { 10 | LanguageClient, 11 | LanguageClientOptions, 12 | ServerOptions, 13 | TransportKind 14 | } from 'vscode-languageclient/node'; 15 | 16 | let client: LanguageClient; 17 | 18 | export function activate(context: ExtensionContext) { 19 | // The server is implemented in node 20 | const serverModule = context.asAbsolutePath( 21 | path.join('out', 'server', 'src', 'server.js') 22 | ); 23 | // The debug options for the server 24 | // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging 25 | const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] }; 26 | 27 | // If the extension is launched in debug mode then the debug server options are used 28 | // Otherwise the run options are used 29 | const serverOptions: ServerOptions = { 30 | run: { module: serverModule, transport: TransportKind.ipc }, 31 | debug: { 32 | module: serverModule, 33 | transport: TransportKind.ipc, 34 | options: debugOptions 35 | } 36 | }; 37 | 38 | // Options to control the language client 39 | const clientOptions: LanguageClientOptions = { 40 | // Register the server for plain text documents 41 | documentSelector: [{ scheme: 'file', language: 'LPython' }], 42 | synchronize: { 43 | // Notify the server about file changes to '.clientrc files contained in the workspace 44 | fileEvents: workspace.createFileSystemWatcher('**/.clientrc') 45 | } 46 | }; 47 | 48 | // Create the language client and start the client. 49 | client = new LanguageClient( 50 | 'LPythonLanguageServer', 51 | 'LPython language server', 52 | serverOptions, 53 | clientOptions 54 | ); 55 | 56 | // Start the client. This will also launch the server 57 | client.start(); 58 | } 59 | 60 | export function deactivate(): Thenable | undefined { 61 | if (!client) { 62 | return undefined; 63 | } 64 | return client.stop(); 65 | } -------------------------------------------------------------------------------- /client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2020", 5 | "lib": ["es2020"], 6 | "outDir": "out", 7 | "rootDir": "src", 8 | "sourceMap": true 9 | }, 10 | "include": ["src"], 11 | "exclude": ["node_modules", ".vscode-test"] 12 | } 13 | -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "#", 4 | "blockComment": [ "\"\"\"", "\"\"\"" ] 5 | }, 6 | "brackets": [ 7 | ["{", "}"], 8 | ["[", "]"], 9 | ["(", ")"] 10 | ], 11 | "autoClosingPairs": [ 12 | { "open": "{", "close": "}" }, 13 | { "open": "[", "close": "]" }, 14 | { "open": "(", "close": ")" }, 15 | { "open": "\"", "close": "\"", "notIn": ["string"] }, 16 | { "open": "r\"", "close": "\"", "notIn": ["string", "comment"] }, 17 | { "open": "R\"", "close": "\"", "notIn": ["string", "comment"] }, 18 | { "open": "u\"", "close": "\"", "notIn": ["string", "comment"] }, 19 | { "open": "U\"", "close": "\"", "notIn": ["string", "comment"] }, 20 | { "open": "f\"", "close": "\"", "notIn": ["string", "comment"] }, 21 | { "open": "F\"", "close": "\"", "notIn": ["string", "comment"] }, 22 | { "open": "b\"", "close": "\"", "notIn": ["string", "comment"] }, 23 | { "open": "B\"", "close": "\"", "notIn": ["string", "comment"] }, 24 | { "open": "'", "close": "'", "notIn": ["string", "comment"] }, 25 | { "open": "r'", "close": "'", "notIn": ["string", "comment"] }, 26 | { "open": "R'", "close": "'", "notIn": ["string", "comment"] }, 27 | { "open": "u'", "close": "'", "notIn": ["string", "comment"] }, 28 | { "open": "U'", "close": "'", "notIn": ["string", "comment"] }, 29 | { "open": "f'", "close": "'", "notIn": ["string", "comment"] }, 30 | { "open": "F'", "close": "'", "notIn": ["string", "comment"] }, 31 | { "open": "b'", "close": "'", "notIn": ["string", "comment"] }, 32 | { "open": "B'", "close": "'", "notIn": ["string", "comment"] }, 33 | { "open": "`", "close": "`", "notIn": ["string"] } 34 | ], 35 | "surroundingPairs": [ 36 | ["{", "}"], 37 | ["[", "]"], 38 | ["(", ")"], 39 | ["\"", "\""], 40 | ["'", "'"], 41 | ["`", "`"] 42 | ], 43 | "folding": { 44 | "offSide": true, 45 | "markers": { 46 | "start": "^\\s*#\\s*region\\b", 47 | "end": "^\\s*#\\s*endregion\\b" 48 | } 49 | }, 50 | "onEnterRules": [ 51 | { 52 | "beforeText": "^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$", 53 | "action": { "indent": "indent" } 54 | } 55 | ] 56 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lpython", 3 | "description": "LPython Language Server", 4 | "author": "LCompilers", 5 | "license": "MIT", 6 | "version": "1.0.0", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/lcompilers/lpython-vscode-extension" 10 | }, 11 | "publisher": "LPython", 12 | "categories": [], 13 | "keywords": [ 14 | "multi-root ready" 15 | ], 16 | "engines": { 17 | "vscode": "^1.63.0" 18 | }, 19 | "activationEvents": [ 20 | "*" 21 | ], 22 | "main": "./out/client/src/extension.js", 23 | "contributes": { 24 | "languages": [ 25 | { 26 | "id": "LPython", 27 | "aliases": [ 28 | "lpython", 29 | "python" 30 | ], 31 | "extensions": [ 32 | ".py" 33 | ], 34 | "configuration": "./language-configuration.json" 35 | } 36 | ], 37 | "grammars": [ 38 | { 39 | "language": "LPython", 40 | "scopeName": "source.lpython", 41 | "path": "./syntaxes/lpython.tmLanguage.json" 42 | } 43 | ], 44 | "configuration": { 45 | "type": "object", 46 | "title": "Example configuration", 47 | "properties": { 48 | "LPythonLanguageServer.maxNumberOfProblems": { 49 | "scope": "resource", 50 | "type": "number", 51 | "default": 100, 52 | "description": "Controls the maximum number of problems produced by the server." 53 | }, 54 | "LPythonLanguageServer.trace.server": { 55 | "scope": "window", 56 | "type": "string", 57 | "enum": [ 58 | "off", 59 | "messages", 60 | "verbose" 61 | ], 62 | "default": "off", 63 | "description": "Traces the communication between VS Code and the language server." 64 | }, 65 | "LPythonLanguageServer.compiler.executablePath": { 66 | "scope": "resource", 67 | "type": "string", 68 | "default": "lpython", 69 | "description": "The path to the LPython compiler executable." 70 | } 71 | } 72 | } 73 | }, 74 | "scripts": { 75 | "update-grammar": "node ../node_modules/vscode-grammar-updater/bin MagicStack/MagicPython grammars/MagicPython.tmLanguage ./syntaxes/MagicPython.tmLanguage.json grammars/MagicRegExp.tmLanguage ./syntaxes/MagicRegExp.tmLanguage.json", 76 | "vscode:prepublish": "npm run compile", 77 | "esbuild-base": "esbuild server/src/server.ts client/src/extension.ts --bundle --outdir=out --external:vscode --format=cjs --platform=node", 78 | "esbuild": "npm run esbuild-base -- --sourcemap --minify", 79 | "compile": "npm run esbuild", 80 | "install-code-dep": "code --install-extension connor4312.esbuild-problem-matchers && code --install-extension dbaeumer.vscode-eslint", 81 | "install": "cd server && npm install && cd ../client && npm install && cd .. && npm run install-code-dep", 82 | "watch": "npm run esbuild-base -- --sourcemap --watch", 83 | "lint": "npx eslint ./client/src ./server/src --ext .ts,.tsx" 84 | }, 85 | "devDependencies": { 86 | "@types/mocha": "^9.1.0", 87 | "@types/node": "^16.11.7", 88 | "@typescript-eslint/eslint-plugin": "^5.30.0", 89 | "@typescript-eslint/parser": "^5.30.0", 90 | "eslint": "^8.13.0", 91 | "mocha": "^9.2.1", 92 | "typescript": "^4.7.2", 93 | "esbuild": "^0.14.42" 94 | }, 95 | "dependencies": { 96 | "tmp": "^0.2.1" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /server/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lpython-server", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "lpython-server", 9 | "version": "1.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "vscode-languageserver": "^7.0.0", 13 | "vscode-languageserver-textdocument": "^1.0.4" 14 | }, 15 | "devDependencies": { 16 | "@types/tmp": "^0.2.3" 17 | }, 18 | "engines": { 19 | "node": "*" 20 | } 21 | }, 22 | "node_modules/@types/tmp": { 23 | "version": "0.2.3", 24 | "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.3.tgz", 25 | "integrity": "sha512-dDZH/tXzwjutnuk4UacGgFRwV+JSLaXL1ikvidfJprkb7L9Nx1njcRHHmi3Dsvt7pgqqTEeucQuOrWHPFgzVHA==", 26 | "dev": true 27 | }, 28 | "node_modules/vscode-jsonrpc": { 29 | "version": "6.0.0", 30 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", 31 | "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==", 32 | "engines": { 33 | "node": ">=8.0.0 || >=10.0.0" 34 | } 35 | }, 36 | "node_modules/vscode-languageserver": { 37 | "version": "7.0.0", 38 | "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz", 39 | "integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==", 40 | "dependencies": { 41 | "vscode-languageserver-protocol": "3.16.0" 42 | }, 43 | "bin": { 44 | "installServerIntoExtension": "bin/installServerIntoExtension" 45 | } 46 | }, 47 | "node_modules/vscode-languageserver-protocol": { 48 | "version": "3.16.0", 49 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", 50 | "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", 51 | "dependencies": { 52 | "vscode-jsonrpc": "6.0.0", 53 | "vscode-languageserver-types": "3.16.0" 54 | } 55 | }, 56 | "node_modules/vscode-languageserver-textdocument": { 57 | "version": "1.0.4", 58 | "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.4.tgz", 59 | "integrity": "sha512-/xhqXP/2A2RSs+J8JNXpiiNVvvNM0oTosNVmQnunlKvq9o4mupHOBAnnzH0lwIPKazXKvAKsVp1kr+H/K4lgoQ==" 60 | }, 61 | "node_modules/vscode-languageserver-types": { 62 | "version": "3.16.0", 63 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", 64 | "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" 65 | } 66 | }, 67 | "dependencies": { 68 | "@types/tmp": { 69 | "version": "0.2.3", 70 | "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.3.tgz", 71 | "integrity": "sha512-dDZH/tXzwjutnuk4UacGgFRwV+JSLaXL1ikvidfJprkb7L9Nx1njcRHHmi3Dsvt7pgqqTEeucQuOrWHPFgzVHA==", 72 | "dev": true 73 | }, 74 | "vscode-jsonrpc": { 75 | "version": "6.0.0", 76 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", 77 | "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==" 78 | }, 79 | "vscode-languageserver": { 80 | "version": "7.0.0", 81 | "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz", 82 | "integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==", 83 | "requires": { 84 | "vscode-languageserver-protocol": "3.16.0" 85 | } 86 | }, 87 | "vscode-languageserver-protocol": { 88 | "version": "3.16.0", 89 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", 90 | "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", 91 | "requires": { 92 | "vscode-jsonrpc": "6.0.0", 93 | "vscode-languageserver-types": "3.16.0" 94 | } 95 | }, 96 | "vscode-languageserver-textdocument": { 97 | "version": "1.0.4", 98 | "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.4.tgz", 99 | "integrity": "sha512-/xhqXP/2A2RSs+J8JNXpiiNVvvNM0oTosNVmQnunlKvq9o4mupHOBAnnzH0lwIPKazXKvAKsVp1kr+H/K4lgoQ==" 100 | }, 101 | "vscode-languageserver-types": { 102 | "version": "3.16.0", 103 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", 104 | "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lpython-server", 3 | "description": "LPython Language Server in node", 4 | "version": "1.0.0", 5 | "author": "LCompilers", 6 | "license": "MIT", 7 | "engines": { 8 | "node": "*" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/lcompilers/lpython-vscode-extension" 13 | }, 14 | "dependencies": { 15 | "vscode-languageserver": "^7.0.0", 16 | "vscode-languageserver-textdocument": "^1.0.4" 17 | }, 18 | "scripts": {}, 19 | "devDependencies": { 20 | "@types/tmp": "^0.2.3" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /server/src/server.ts: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | * ------------------------------------------------------------------------------------------ */ 5 | import { 6 | createConnection, 7 | TextDocuments, 8 | Diagnostic, 9 | ProposedFeatures, 10 | InitializeParams, 11 | DidChangeConfigurationNotification, 12 | TextDocumentSyncKind, 13 | InitializeResult, 14 | SymbolInformation, 15 | SymbolKind, 16 | } from 'vscode-languageserver/node'; 17 | 18 | import { 19 | TextDocument 20 | } from 'vscode-languageserver-textdocument'; 21 | 22 | import { Position } from 'vscode-languageserver-protocol'; 23 | 24 | // Create a connection for the server, using Node's IPC as a transport. 25 | // Also include all preview / proposed LSP features. 26 | const connection = createConnection(ProposedFeatures.all); 27 | 28 | // Create a simple text document manager. 29 | const documents: TextDocuments = new TextDocuments(TextDocument); 30 | 31 | let hasConfigurationCapability = false; 32 | let hasWorkspaceFolderCapability = false; 33 | let hasDiagnosticRelatedInformationCapability = false; 34 | 35 | import fs = require('fs'); 36 | import tmp = require('tmp'); 37 | // import path = require('path'); 38 | 39 | import util = require('node:util'); 40 | import { TextEncoder } from 'node:util'; 41 | // import { Console } from 'console'; 42 | // eslint-disable-next-line @typescript-eslint/no-var-requires 43 | const exec = util.promisify(require('node:child_process').exec); 44 | 45 | const tmpFile = tmp.fileSync(); 46 | 47 | connection.onInitialize((params: InitializeParams) => { 48 | const capabilities = params.capabilities; 49 | // Does the client support the `workspace/configuration` request? 50 | // If not, we fall back using global settings. 51 | hasConfigurationCapability = !!( 52 | capabilities.workspace && !!capabilities.workspace.configuration 53 | ); 54 | hasWorkspaceFolderCapability = !!( 55 | capabilities.workspace && !!capabilities.workspace.workspaceFolders 56 | ); 57 | hasDiagnosticRelatedInformationCapability = !!( 58 | capabilities.textDocument && 59 | capabilities.textDocument.publishDiagnostics && 60 | capabilities.textDocument.publishDiagnostics.relatedInformation 61 | ); 62 | const result: InitializeResult = { 63 | capabilities: { 64 | textDocumentSync: TextDocumentSyncKind.Incremental, 65 | documentSymbolProvider: true, 66 | } 67 | }; 68 | if (hasWorkspaceFolderCapability) { 69 | result.capabilities.workspace = { 70 | workspaceFolders: { 71 | supported: true 72 | } 73 | }; 74 | } 75 | // console.log('LPython language server initialized'); 76 | return result; 77 | }); 78 | 79 | connection.onInitialized(() => { 80 | if (hasConfigurationCapability) { 81 | // Register for all configuration changes. 82 | connection.client.register(DidChangeConfigurationNotification.type, undefined); 83 | } 84 | if (hasWorkspaceFolderCapability) { 85 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 86 | connection.workspace.onDidChangeWorkspaceFolders(_event => { 87 | // connection.console.log('Workspace folder change event received.'); 88 | }); 89 | } 90 | }); 91 | 92 | // The example settings 93 | interface ExampleSettings { 94 | maxNumberOfProblems: number; 95 | compiler: { 96 | executablePath: string; 97 | }; 98 | } 99 | 100 | // The global settings, used when the `workspace/configuration` request is not supported by the client. 101 | // Please note that this is not the case when using this server with the client provided in this example 102 | // but could happen with other clients. 103 | const defaultSettings: ExampleSettings = { maxNumberOfProblems: 1000, compiler: { executablePath: "lpython" } }; 104 | let globalSettings: ExampleSettings = defaultSettings; 105 | 106 | // Cache the settings of all open documents 107 | const documentSettings: Map> = new Map(); 108 | 109 | connection.onDocumentSymbol(async (request) => { 110 | const document = documents.get(request.textDocument.uri); 111 | const settings = await getDocumentSettings(request.textDocument.uri); 112 | const text = document?.getText(); 113 | const symbols: SymbolInformation[] = []; 114 | if (typeof text == "string") { 115 | const stdout = await runCompiler(text, "--show-document-symbols ", settings); 116 | const obj = JSON.parse(stdout); 117 | for (let i=0; i { 139 | // console.log("onDidChangeConfiguration, hasConfigurationCapability: " + hasConfigurationCapability); 140 | // console.log("change is " + JSON.stringify(change)); 141 | if (hasConfigurationCapability) { 142 | // Reset all cached document settings 143 | documentSettings.clear(); 144 | } else { 145 | globalSettings = ( 146 | (change.settings.LPythonLanguageServer || defaultSettings) 147 | ); 148 | } 149 | 150 | // Revalidate all open text documents 151 | documents.all().forEach(validateTextDocument); 152 | }); 153 | 154 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 155 | function getDocumentSettings(resource: string): Thenable { 156 | if (!hasConfigurationCapability) { 157 | return Promise.resolve(globalSettings); 158 | } 159 | let result = documentSettings.get(resource); 160 | if (!result) { 161 | result = connection.workspace.getConfiguration({ 162 | scopeUri: resource, 163 | section: 'LPythonLanguageServer' 164 | }); 165 | documentSettings.set(resource, result); 166 | } 167 | return result; 168 | } 169 | 170 | // Only keep settings for open documents 171 | documents.onDidClose(e => { 172 | documentSettings.delete(e.document.uri); 173 | }); 174 | 175 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 176 | function throttle(fn: (...args: any) => void, delay: number) { 177 | let shouldWait = false; 178 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 179 | let waitingArgs: any | null; 180 | const timeoutFunc = () => { 181 | if (waitingArgs == null) { 182 | shouldWait = false; 183 | } else { 184 | fn(...waitingArgs); 185 | waitingArgs = null; 186 | setTimeout(timeoutFunc, delay); 187 | } 188 | }; 189 | 190 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 191 | return (...args: any) => { 192 | if (shouldWait) { 193 | waitingArgs = args; 194 | return; 195 | } 196 | 197 | fn(...args); 198 | shouldWait = true; 199 | 200 | setTimeout(timeoutFunc, delay); 201 | }; 202 | } 203 | 204 | // The content of a text document has changed. This event is emitted 205 | // when the text document first opened or when its content has changed. 206 | documents.onDidChangeContent(( 207 | () => { 208 | const throttledValidateTextDocument = throttle(validateTextDocument, 500); 209 | return (change) => { 210 | throttledValidateTextDocument(change.document); 211 | }; 212 | } 213 | )()); 214 | 215 | async function runCompiler(text: string, flags: string, settings: ExampleSettings): Promise { 216 | try { 217 | fs.writeFileSync(tmpFile.name, text); 218 | } catch (error) { 219 | console.log(error); 220 | } 221 | let stdout: string; 222 | try { 223 | const output = await exec(`${settings.compiler.executablePath} ${flags} ${tmpFile.name}`); 224 | // console.log(output); 225 | stdout = output.stdout; 226 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 227 | } catch (e: any) { 228 | stdout = e.stdout; 229 | if (e.signal != null) { 230 | console.log("compile failed: "); 231 | console.log(e); 232 | } else { 233 | console.log("Error:", e); 234 | } 235 | } 236 | return stdout; 237 | } 238 | 239 | async function validateTextDocument(textDocument: TextDocument): Promise { 240 | console.time('validateTextDocument'); 241 | if (!hasDiagnosticRelatedInformationCapability) { 242 | console.error('Trying to validate a document with no diagnostic capability'); 243 | return; 244 | } 245 | // // In this simple example we get the settings for every validate run. 246 | const settings = await getDocumentSettings(textDocument.uri); 247 | // The validator creates diagnostics for all uppercase words length 2 and more 248 | const text = textDocument.getText(); 249 | const stdout = await runCompiler(text, "--show-errors ", settings); 250 | const obj = JSON.parse(stdout); 251 | const diagnostics: Diagnostic[] = []; 252 | if (obj.diagnostics) { 253 | const diagnostic: Diagnostic = { 254 | severity: 2, 255 | range: { 256 | start: Position.create(obj.diagnostics[0].range.start.line, obj.diagnostics[0].range.start.character), 257 | end: Position.create(obj.diagnostics[0].range.end.line, obj.diagnostics[0].range.end.character), 258 | }, 259 | message: obj.diagnostics[0].message, 260 | source: "lpyth" 261 | }; 262 | diagnostics.push(diagnostic); 263 | } 264 | // console.log(diagnostics); 265 | // Send the computed diagnostics to VSCode. 266 | connection.sendDiagnostics({ uri: textDocument.uri, diagnostics }); 267 | console.timeEnd('validateTextDocument'); 268 | } 269 | 270 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 271 | connection.onDidChangeWatchedFiles(_change => { 272 | // Monitored files have change in VSCode 273 | connection.console.log('We received an file change event'); 274 | }); 275 | 276 | // Make the text document manager listen on the connection 277 | // for open, change and close text document events 278 | documents.listen(connection); 279 | 280 | // Listen on the connection 281 | connection.listen(); 282 | -------------------------------------------------------------------------------- /server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "lib": ["es2020"], 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "sourceMap": true, 8 | "strict": true, 9 | "outDir": "out", 10 | "rootDir": "src" 11 | }, 12 | "include": ["src"], 13 | "exclude": ["node_modules", ".vscode-test"] 14 | } 15 | -------------------------------------------------------------------------------- /syntaxes/lpython.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lpython", 3 | "scopeName": "source.lpython", 4 | "patterns": [ 5 | { 6 | "include": "#statement" 7 | }, 8 | { 9 | "include": "#expression" 10 | } 11 | ], 12 | "repository": { 13 | "impossible": { 14 | "comment": "This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a match to fail and move to the next token.", 15 | "match": "$.^" 16 | }, 17 | "statement": { 18 | "patterns": [ 19 | { 20 | "include": "#import" 21 | }, 22 | { 23 | "include": "#class-declaration" 24 | }, 25 | { 26 | "include": "#function-declaration" 27 | }, 28 | { 29 | "include": "#generator" 30 | }, 31 | { 32 | "include": "#statement-keyword" 33 | }, 34 | { 35 | "include": "#assignment-operator" 36 | }, 37 | { 38 | "include": "#decorator" 39 | }, 40 | { 41 | "include": "#docstring-statement" 42 | }, 43 | { 44 | "include": "#semicolon" 45 | } 46 | ] 47 | }, 48 | "semicolon": { 49 | "patterns": [ 50 | { 51 | "name": "invalid.deprecated.semicolon.lpython", 52 | "match": "\\;$" 53 | } 54 | ] 55 | }, 56 | "comments": { 57 | "patterns": [ 58 | { 59 | "name": "comment.line.number-sign.lpython", 60 | "contentName": "meta.typehint.comment.lpython", 61 | "begin": "(?x)\n (?:\n \\# \\s* (type:)\n \\s*+ (?# we want `\\s*+` which is possessive quantifier since\n we do not actually want to backtrack when matching\n whitespace here)\n (?! $ | \\#)\n )\n", 62 | "end": "(?:$|(?=\\#))", 63 | "beginCaptures": { 64 | "0": { 65 | "name": "meta.typehint.comment.lpython" 66 | }, 67 | "1": { 68 | "name": "comment.typehint.directive.notation.lpython" 69 | } 70 | }, 71 | "patterns": [ 72 | { 73 | "name": "comment.typehint.ignore.notation.lpython", 74 | "match": "(?x)\n \\G ignore\n (?= \\s* (?: $ | \\#))\n" 75 | }, 76 | { 77 | "name": "comment.typehint.type.notation.lpython", 78 | "match": "(?x)\n (?))" 83 | }, 84 | { 85 | "name": "comment.typehint.variable.notation.lpython", 86 | "match": "([[:alpha:]_]\\w*)" 87 | } 88 | ] 89 | }, 90 | { 91 | "include": "#comments-base" 92 | } 93 | ] 94 | }, 95 | "docstring-statement": { 96 | "begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", 97 | "comment": "the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring", 98 | "end": "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", 99 | "patterns": [ 100 | { 101 | "include": "#docstring" 102 | } 103 | ] 104 | }, 105 | "docstring": { 106 | "patterns": [ 107 | { 108 | "name": "string.quoted.docstring.multi.lpython", 109 | "begin": "(\\'\\'\\'|\\\"\\\"\\\")", 110 | "end": "(\\1)", 111 | "beginCaptures": { 112 | "1": { 113 | "name": "punctuation.definition.string.begin.lpython" 114 | } 115 | }, 116 | "endCaptures": { 117 | "1": { 118 | "name": "punctuation.definition.string.end.lpython" 119 | } 120 | }, 121 | "patterns": [ 122 | { 123 | "include": "#docstring-prompt" 124 | }, 125 | { 126 | "include": "#codetags" 127 | }, 128 | { 129 | "include": "#docstring-guts-unicode" 130 | } 131 | ] 132 | }, 133 | { 134 | "name": "string.quoted.docstring.raw.multi.lpython", 135 | "begin": "([rR])(\\'\\'\\'|\\\"\\\"\\\")", 136 | "end": "(\\2)", 137 | "beginCaptures": { 138 | "1": { 139 | "name": "storage.type.string.lpython" 140 | }, 141 | "2": { 142 | "name": "punctuation.definition.string.begin.lpython" 143 | } 144 | }, 145 | "endCaptures": { 146 | "1": { 147 | "name": "punctuation.definition.string.end.lpython" 148 | } 149 | }, 150 | "patterns": [ 151 | { 152 | "include": "#string-consume-escape" 153 | }, 154 | { 155 | "include": "#docstring-prompt" 156 | }, 157 | { 158 | "include": "#codetags" 159 | } 160 | ] 161 | }, 162 | { 163 | "name": "string.quoted.docstring.single.lpython", 164 | "begin": "(\\'|\\\")", 165 | "end": "(\\1)|(\\n)", 166 | "beginCaptures": { 167 | "1": { 168 | "name": "punctuation.definition.string.begin.lpython" 169 | } 170 | }, 171 | "endCaptures": { 172 | "1": { 173 | "name": "punctuation.definition.string.end.lpython" 174 | }, 175 | "2": { 176 | "name": "invalid.illegal.newline.lpython" 177 | } 178 | }, 179 | "patterns": [ 180 | { 181 | "include": "#codetags" 182 | }, 183 | { 184 | "include": "#docstring-guts-unicode" 185 | } 186 | ] 187 | }, 188 | { 189 | "name": "string.quoted.docstring.raw.single.lpython", 190 | "begin": "([rR])(\\'|\\\")", 191 | "end": "(\\2)|(\\n)", 192 | "beginCaptures": { 193 | "1": { 194 | "name": "storage.type.string.lpython" 195 | }, 196 | "2": { 197 | "name": "punctuation.definition.string.begin.lpython" 198 | } 199 | }, 200 | "endCaptures": { 201 | "1": { 202 | "name": "punctuation.definition.string.end.lpython" 203 | }, 204 | "2": { 205 | "name": "invalid.illegal.newline.lpython" 206 | } 207 | }, 208 | "patterns": [ 209 | { 210 | "include": "#string-consume-escape" 211 | }, 212 | { 213 | "include": "#codetags" 214 | } 215 | ] 216 | } 217 | ] 218 | }, 219 | "docstring-guts-unicode": { 220 | "patterns": [ 221 | { 222 | "include": "#escape-sequence-unicode" 223 | }, 224 | { 225 | "include": "#escape-sequence" 226 | }, 227 | { 228 | "include": "#string-line-continuation" 229 | } 230 | ] 231 | }, 232 | "docstring-prompt": { 233 | "match": "(?x)\n (?:\n (?:^|\\G) \\s* (?# '\\G' is necessary for ST)\n ((?:>>>|\\.\\.\\.) \\s) (?=\\s*\\S)\n )\n", 234 | "captures": { 235 | "1": { 236 | "name": "keyword.control.flow.lpython" 237 | } 238 | } 239 | }, 240 | "statement-keyword": { 241 | "patterns": [ 242 | { 243 | "name": "storage.type.function.lpython", 244 | "match": "\\b((async\\s+)?\\s*def)\\b" 245 | }, 246 | { 247 | "name": "keyword.control.flow.lpython", 248 | "comment": "if `as` is eventually followed by `:` or line continuation\nit's probably control flow like:\n with foo as bar, \\\n Foo as Bar:\n try:\n do_stuff()\n except Exception as e:\n pass\n", 249 | "match": "\\b(?>= | //= | \\*\\*=\n | \\+= | -= | /= | @=\n | \\*= | %= | ~= | \\^= | &= | \\|=\n | =(?!=)\n" 542 | }, 543 | "operator": { 544 | "match": "(?x)\n \\b(?> | & | \\| | \\^ | ~) (?# 3)\n\n | (\\*\\* | \\* | \\+ | - | % | // | / | @) (?# 4)\n\n | (!= | == | >= | <= | < | >) (?# 5)\n", 545 | "captures": { 546 | "1": { 547 | "name": "keyword.operator.logical.lpython" 548 | }, 549 | "2": { 550 | "name": "keyword.control.flow.lpython" 551 | }, 552 | "3": { 553 | "name": "keyword.operator.bitwise.lpython" 554 | }, 555 | "4": { 556 | "name": "keyword.operator.arithmetic.lpython" 557 | }, 558 | "5": { 559 | "name": "keyword.operator.comparison.lpython" 560 | } 561 | } 562 | }, 563 | "punctuation": { 564 | "patterns": [ 565 | { 566 | "name": "punctuation.separator.colon.lpython", 567 | "match": ":" 568 | }, 569 | { 570 | "name": "punctuation.separator.element.lpython", 571 | "match": "," 572 | } 573 | ] 574 | }, 575 | "literal": { 576 | "patterns": [ 577 | { 578 | "name": "constant.language.lpython", 579 | "match": "\\b(True|False|None|NotImplemented|Ellipsis)\\b" 580 | }, 581 | { 582 | "include": "#number" 583 | } 584 | ] 585 | }, 586 | "number": { 587 | "name": "constant.numeric.lpython", 588 | "patterns": [ 589 | { 590 | "include": "#number-float" 591 | }, 592 | { 593 | "include": "#number-dec" 594 | }, 595 | { 596 | "include": "#number-hex" 597 | }, 598 | { 599 | "include": "#number-oct" 600 | }, 601 | { 602 | "include": "#number-bin" 603 | }, 604 | { 605 | "include": "#number-long" 606 | }, 607 | { 608 | "name": "invalid.illegal.name.lpython", 609 | "match": "\\b[0-9]+\\w+" 610 | } 611 | ] 612 | }, 613 | "number-float": { 614 | "name": "constant.numeric.float.lpython", 615 | "match": "(?x)\n (?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", 898 | "captures": { 899 | "1": { 900 | "name": "constant.character.format.placeholder.other.lpython" 901 | }, 902 | "3": { 903 | "name": "storage.type.format.lpython" 904 | }, 905 | "4": { 906 | "name": "storage.type.format.lpython" 907 | } 908 | } 909 | }, 910 | { 911 | "name": "meta.format.brace.lpython", 912 | "match": "(?x)\n (\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n (:)\n [^'\"{}\\n]* (?:\n \\{ [^'\"}\\n]*? \\} [^'\"{}\\n]*\n )*\n }\n )\n", 913 | "captures": { 914 | "1": { 915 | "name": "constant.character.format.placeholder.other.lpython" 916 | }, 917 | "3": { 918 | "name": "storage.type.format.lpython" 919 | }, 920 | "4": { 921 | "name": "storage.type.format.lpython" 922 | } 923 | } 924 | } 925 | ] 926 | }, 927 | "fstring-formatting": { 928 | "patterns": [ 929 | { 930 | "include": "#fstring-formatting-braces" 931 | }, 932 | { 933 | "include": "#fstring-formatting-singe-brace" 934 | } 935 | ] 936 | }, 937 | "fstring-formatting-singe-brace": { 938 | "name": "invalid.illegal.brace.lpython", 939 | "match": "(}(?!}))" 940 | }, 941 | "import": { 942 | "comment": "Import statements used to correctly mark `from`, `import`, and `as`\n", 943 | "patterns": [ 944 | { 945 | "begin": "\\b(?)", 1404 | "end": "(?=:)", 1405 | "beginCaptures": { 1406 | "1": { 1407 | "name": "punctuation.separator.annotation.result.lpython" 1408 | } 1409 | }, 1410 | "patterns": [ 1411 | { 1412 | "include": "#expression" 1413 | } 1414 | ] 1415 | }, 1416 | "item-access": { 1417 | "patterns": [ 1418 | { 1419 | "name": "meta.item-access.lpython", 1420 | "begin": "(?x)\n \\b(?=\n [[:alpha:]_]\\w* \\s* \\[\n )\n", 1421 | "end": "(\\])", 1422 | "endCaptures": { 1423 | "1": { 1424 | "name": "punctuation.definition.arguments.end.lpython" 1425 | } 1426 | }, 1427 | "patterns": [ 1428 | { 1429 | "include": "#item-name" 1430 | }, 1431 | { 1432 | "include": "#item-index" 1433 | }, 1434 | { 1435 | "include": "#expression" 1436 | } 1437 | ] 1438 | } 1439 | ] 1440 | }, 1441 | "item-name": { 1442 | "patterns": [ 1443 | { 1444 | "include": "#special-variables" 1445 | }, 1446 | { 1447 | "include": "#builtin-functions" 1448 | }, 1449 | { 1450 | "include": "#special-names" 1451 | }, 1452 | { 1453 | "name": "meta.indexed-name.lpython", 1454 | "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n" 1455 | } 1456 | ] 1457 | }, 1458 | "item-index": { 1459 | "begin": "(\\[)", 1460 | "end": "(?=\\])", 1461 | "beginCaptures": { 1462 | "1": { 1463 | "name": "punctuation.definition.arguments.begin.lpython" 1464 | } 1465 | }, 1466 | "contentName": "meta.item-access.arguments.lpython", 1467 | "patterns": [ 1468 | { 1469 | "name": "punctuation.separator.slice.lpython", 1470 | "match": ":" 1471 | }, 1472 | { 1473 | "include": "#expression" 1474 | } 1475 | ] 1476 | }, 1477 | "decorator": { 1478 | "name": "meta.function.decorator.lpython", 1479 | "begin": "(?x)\n ^\\s*\n ((@)) \\s* (?=[[:alpha:]_]\\w*)\n", 1480 | "end": "(?x)\n ( \\) )\n # trailing whitespace and comments are legal\n (?: (.*?) (?=\\s*(?:\\#|$)) )\n | (?=\\n|\\#)\n", 1481 | "beginCaptures": { 1482 | "1": { 1483 | "name": "entity.name.function.decorator.lpython" 1484 | }, 1485 | "2": { 1486 | "name": "punctuation.definition.decorator.lpython" 1487 | } 1488 | }, 1489 | "endCaptures": { 1490 | "1": { 1491 | "name": "punctuation.definition.arguments.end.lpython" 1492 | }, 1493 | "2": { 1494 | "name": "invalid.illegal.decorator.lpython" 1495 | } 1496 | }, 1497 | "patterns": [ 1498 | { 1499 | "include": "#decorator-name" 1500 | }, 1501 | { 1502 | "include": "#function-arguments" 1503 | } 1504 | ] 1505 | }, 1506 | "decorator-name": { 1507 | "patterns": [ 1508 | { 1509 | "include": "#builtin-callables" 1510 | }, 1511 | { 1512 | "include": "#illegal-object-name" 1513 | }, 1514 | { 1515 | "name": "entity.name.function.decorator.lpython", 1516 | "match": "(?x)\n ([[:alpha:]_]\\w*) | (\\.)\n", 1517 | "captures": { 1518 | "2": { 1519 | "name": "punctuation.separator.period.lpython" 1520 | } 1521 | } 1522 | }, 1523 | { 1524 | "include": "#line-continuation" 1525 | }, 1526 | { 1527 | "name": "invalid.illegal.decorator.lpython", 1528 | "match": "(?x)\n \\s* ([^([:alpha:]\\s_\\.#\\\\] .*?) (?=\\#|$)\n", 1529 | "captures": { 1530 | "1": { 1531 | "name": "invalid.illegal.decorator.lpython" 1532 | } 1533 | } 1534 | } 1535 | ] 1536 | }, 1537 | "call-wrapper-inheritance": { 1538 | "comment": "same as a function call, but in inheritance context", 1539 | "name": "meta.function-call.lpython", 1540 | "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n", 1541 | "end": "(\\))", 1542 | "endCaptures": { 1543 | "1": { 1544 | "name": "punctuation.definition.arguments.end.lpython" 1545 | } 1546 | }, 1547 | "patterns": [ 1548 | { 1549 | "include": "#inheritance-name" 1550 | }, 1551 | { 1552 | "include": "#function-arguments" 1553 | } 1554 | ] 1555 | }, 1556 | "inheritance-name": { 1557 | "patterns": [ 1558 | { 1559 | "include": "#lambda-incomplete" 1560 | }, 1561 | { 1562 | "include": "#builtin-possible-callables" 1563 | }, 1564 | { 1565 | "include": "#inheritance-identifier" 1566 | } 1567 | ] 1568 | }, 1569 | "function-call": { 1570 | "name": "meta.function-call.lpython", 1571 | "comment": "Regular function call of the type \"name(args)\"", 1572 | "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n", 1573 | "end": "(\\))", 1574 | "endCaptures": { 1575 | "1": { 1576 | "name": "punctuation.definition.arguments.end.lpython" 1577 | } 1578 | }, 1579 | "patterns": [ 1580 | { 1581 | "include": "#special-variables" 1582 | }, 1583 | { 1584 | "include": "#function-name" 1585 | }, 1586 | { 1587 | "include": "#function-arguments" 1588 | } 1589 | ] 1590 | }, 1591 | "function-name": { 1592 | "patterns": [ 1593 | { 1594 | "include": "#builtin-possible-callables" 1595 | }, 1596 | { 1597 | "comment": "Some color schemas support meta.function-call.generic scope", 1598 | "name": "meta.function-call.generic.lpython", 1599 | "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n" 1600 | } 1601 | ] 1602 | }, 1603 | "function-arguments": { 1604 | "begin": "(\\()", 1605 | "end": "(?=\\))(?!\\)\\s*\\()", 1606 | "beginCaptures": { 1607 | "1": { 1608 | "name": "punctuation.definition.arguments.begin.lpython" 1609 | } 1610 | }, 1611 | "contentName": "meta.function-call.arguments.lpython", 1612 | "patterns": [ 1613 | { 1614 | "name": "punctuation.separator.arguments.lpython", 1615 | "match": "(,)" 1616 | }, 1617 | { 1618 | "match": "(?x)\n (?:(?<=[,(])|^) \\s* (\\*{1,2})\n", 1619 | "captures": { 1620 | "1": { 1621 | "name": "keyword.operator.unpacking.arguments.lpython" 1622 | } 1623 | } 1624 | }, 1625 | { 1626 | "include": "#lambda-incomplete" 1627 | }, 1628 | { 1629 | "include": "#illegal-names" 1630 | }, 1631 | { 1632 | "match": "\\b([[:alpha:]_]\\w*)\\s*(=)(?!=)", 1633 | "captures": { 1634 | "1": { 1635 | "name": "variable.parameter.function-call.lpython" 1636 | }, 1637 | "2": { 1638 | "name": "keyword.operator.assignment.lpython" 1639 | } 1640 | } 1641 | }, 1642 | { 1643 | "name": "keyword.operator.assignment.lpython", 1644 | "match": "=(?!=)" 1645 | }, 1646 | { 1647 | "include": "#expression" 1648 | }, 1649 | { 1650 | "match": "\\s*(\\))\\s*(\\()", 1651 | "captures": { 1652 | "1": { 1653 | "name": "punctuation.definition.arguments.end.lpython" 1654 | }, 1655 | "2": { 1656 | "name": "punctuation.definition.arguments.begin.lpython" 1657 | } 1658 | } 1659 | } 1660 | ] 1661 | }, 1662 | "builtin-callables": { 1663 | "patterns": [ 1664 | { 1665 | "include": "#illegal-names" 1666 | }, 1667 | { 1668 | "include": "#illegal-object-name" 1669 | }, 1670 | { 1671 | "include": "#builtin-exceptions" 1672 | }, 1673 | { 1674 | "include": "#builtin-functions" 1675 | }, 1676 | { 1677 | "include": "#builtin-types" 1678 | } 1679 | ] 1680 | }, 1681 | "builtin-possible-callables": { 1682 | "patterns": [ 1683 | { 1684 | "include": "#builtin-callables" 1685 | }, 1686 | { 1687 | "include": "#magic-names" 1688 | } 1689 | ] 1690 | }, 1691 | "builtin-exceptions": { 1692 | "name": "support.type.exception.lpython", 1693 | "match": "(?x) (?" 1800 | }, 1801 | "regexp-base-expression": { 1802 | "patterns": [ 1803 | { 1804 | "include": "#regexp-quantifier" 1805 | }, 1806 | { 1807 | "include": "#regexp-base-common" 1808 | } 1809 | ] 1810 | }, 1811 | "fregexp-base-expression": { 1812 | "patterns": [ 1813 | { 1814 | "include": "#fregexp-quantifier" 1815 | }, 1816 | { 1817 | "include": "#fstring-formatting-braces" 1818 | }, 1819 | { 1820 | "match": "\\{.*?\\}" 1821 | }, 1822 | { 1823 | "include": "#regexp-base-common" 1824 | } 1825 | ] 1826 | }, 1827 | "fstring-formatting-braces": { 1828 | "patterns": [ 1829 | { 1830 | "comment": "empty braces are illegal", 1831 | "match": "({)(\\s*?)(})", 1832 | "captures": { 1833 | "1": { 1834 | "name": "constant.character.format.placeholder.other.lpython" 1835 | }, 1836 | "2": { 1837 | "name": "invalid.illegal.brace.lpython" 1838 | }, 1839 | "3": { 1840 | "name": "constant.character.format.placeholder.other.lpython" 1841 | } 1842 | } 1843 | }, 1844 | { 1845 | "name": "constant.character.escape.lpython", 1846 | "match": "({{|}})" 1847 | } 1848 | ] 1849 | }, 1850 | "regexp-base-common": { 1851 | "patterns": [ 1852 | { 1853 | "name": "support.other.match.any.regexp", 1854 | "match": "\\." 1855 | }, 1856 | { 1857 | "name": "support.other.match.begin.regexp", 1858 | "match": "\\^" 1859 | }, 1860 | { 1861 | "name": "support.other.match.end.regexp", 1862 | "match": "\\$" 1863 | }, 1864 | { 1865 | "name": "keyword.operator.quantifier.regexp", 1866 | "match": "[+*?]\\??" 1867 | }, 1868 | { 1869 | "name": "keyword.operator.disjunction.regexp", 1870 | "match": "\\|" 1871 | }, 1872 | { 1873 | "include": "#regexp-escape-sequence" 1874 | } 1875 | ] 1876 | }, 1877 | "regexp-quantifier": { 1878 | "name": "keyword.operator.quantifier.regexp", 1879 | "match": "(?x)\n \\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\n" 1880 | }, 1881 | "fregexp-quantifier": { 1882 | "name": "keyword.operator.quantifier.regexp", 1883 | "match": "(?x)\n \\{\\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\\}\n" 1884 | }, 1885 | "regexp-backreference-number": { 1886 | "name": "meta.backreference.regexp", 1887 | "match": "(\\\\[1-9]\\d?)", 1888 | "captures": { 1889 | "1": { 1890 | "name": "entity.name.tag.backreference.regexp" 1891 | } 1892 | } 1893 | }, 1894 | "regexp-backreference": { 1895 | "name": "meta.backreference.named.regexp", 1896 | "match": "(?x)\n (\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))\n", 1897 | "captures": { 1898 | "1": { 1899 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.begin.regexp" 1900 | }, 1901 | "2": { 1902 | "name": "entity.name.tag.named.backreference.regexp" 1903 | }, 1904 | "3": { 1905 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.end.regexp" 1906 | } 1907 | } 1908 | }, 1909 | "regexp-flags": { 1910 | "name": "storage.modifier.flag.regexp", 1911 | "match": "\\(\\?[aiLmsux]+\\)" 1912 | }, 1913 | "regexp-escape-special": { 1914 | "name": "support.other.escape.special.regexp", 1915 | "match": "\\\\([AbBdDsSwWZ])" 1916 | }, 1917 | "regexp-escape-character": { 1918 | "name": "constant.character.escape.regexp", 1919 | "match": "(?x)\n \\\\ (\n x[0-9A-Fa-f]{2}\n | 0[0-7]{1,2}\n | [0-7]{3}\n )\n" 1920 | }, 1921 | "regexp-escape-unicode": { 1922 | "name": "constant.character.unicode.regexp", 1923 | "match": "(?x)\n \\\\ (\n u[0-9A-Fa-f]{4}\n | U[0-9A-Fa-f]{8}\n )\n" 1924 | }, 1925 | "regexp-escape-catchall": { 1926 | "name": "constant.character.escape.regexp", 1927 | "match": "\\\\(.|\\n)" 1928 | }, 1929 | "regexp-escape-sequence": { 1930 | "patterns": [ 1931 | { 1932 | "include": "#regexp-escape-special" 1933 | }, 1934 | { 1935 | "include": "#regexp-escape-character" 1936 | }, 1937 | { 1938 | "include": "#regexp-escape-unicode" 1939 | }, 1940 | { 1941 | "include": "#regexp-backreference-number" 1942 | }, 1943 | { 1944 | "include": "#regexp-escape-catchall" 1945 | } 1946 | ] 1947 | }, 1948 | "regexp-charecter-set-escapes": { 1949 | "patterns": [ 1950 | { 1951 | "name": "constant.character.escape.regexp", 1952 | "match": "\\\\[abfnrtv\\\\]" 1953 | }, 1954 | { 1955 | "include": "#regexp-escape-special" 1956 | }, 1957 | { 1958 | "name": "constant.character.escape.regexp", 1959 | "match": "\\\\([0-7]{1,3})" 1960 | }, 1961 | { 1962 | "include": "#regexp-escape-character" 1963 | }, 1964 | { 1965 | "include": "#regexp-escape-unicode" 1966 | }, 1967 | { 1968 | "include": "#regexp-escape-catchall" 1969 | } 1970 | ] 1971 | }, 1972 | "codetags": { 1973 | "match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)", 1974 | "captures": { 1975 | "1": { 1976 | "name": "keyword.codetag.notation.lpython" 1977 | } 1978 | } 1979 | }, 1980 | "comments-base": { 1981 | "name": "comment.line.number-sign.lpython", 1982 | "begin": "(\\#)", 1983 | "beginCaptures": { 1984 | "1": { 1985 | "name": "punctuation.definition.comment.lpython" 1986 | } 1987 | }, 1988 | "end": "($)", 1989 | "patterns": [ 1990 | { 1991 | "include": "#codetags" 1992 | } 1993 | ] 1994 | }, 1995 | "comments-string-single-three": { 1996 | "name": "comment.line.number-sign.lpython", 1997 | "begin": "(\\#)", 1998 | "beginCaptures": { 1999 | "1": { 2000 | "name": "punctuation.definition.comment.lpython" 2001 | } 2002 | }, 2003 | "end": "($|(?='''))", 2004 | "patterns": [ 2005 | { 2006 | "include": "#codetags" 2007 | } 2008 | ] 2009 | }, 2010 | "comments-string-double-three": { 2011 | "name": "comment.line.number-sign.lpython", 2012 | "begin": "(\\#)", 2013 | "beginCaptures": { 2014 | "1": { 2015 | "name": "punctuation.definition.comment.lpython" 2016 | } 2017 | }, 2018 | "end": "($|(?=\"\"\"))", 2019 | "patterns": [ 2020 | { 2021 | "include": "#codetags" 2022 | } 2023 | ] 2024 | }, 2025 | "single-one-regexp-expression": { 2026 | "patterns": [ 2027 | { 2028 | "include": "#regexp-base-expression" 2029 | }, 2030 | { 2031 | "include": "#single-one-regexp-character-set" 2032 | }, 2033 | { 2034 | "include": "#single-one-regexp-comments" 2035 | }, 2036 | { 2037 | "include": "#regexp-flags" 2038 | }, 2039 | { 2040 | "include": "#single-one-regexp-named-group" 2041 | }, 2042 | { 2043 | "include": "#regexp-backreference" 2044 | }, 2045 | { 2046 | "include": "#single-one-regexp-lookahead" 2047 | }, 2048 | { 2049 | "include": "#single-one-regexp-lookahead-negative" 2050 | }, 2051 | { 2052 | "include": "#single-one-regexp-lookbehind" 2053 | }, 2054 | { 2055 | "include": "#single-one-regexp-lookbehind-negative" 2056 | }, 2057 | { 2058 | "include": "#single-one-regexp-conditional" 2059 | }, 2060 | { 2061 | "include": "#single-one-regexp-parentheses-non-capturing" 2062 | }, 2063 | { 2064 | "include": "#single-one-regexp-parentheses" 2065 | } 2066 | ] 2067 | }, 2068 | "single-one-regexp-character-set": { 2069 | "patterns": [ 2070 | { 2071 | "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n" 2072 | }, 2073 | { 2074 | "name": "meta.character.set.regexp", 2075 | "begin": "(\\[)(\\^)?(\\])?", 2076 | "end": "(\\]|(?=\\'))|((?=(?)\n", 2111 | "end": "(\\)|(?=\\'))|((?=(?)\n", 2415 | "end": "(\\)|(?=\\'\\'\\'))", 2416 | "beginCaptures": { 2417 | "1": { 2418 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" 2419 | }, 2420 | "2": { 2421 | "name": "entity.name.tag.named.group.regexp" 2422 | } 2423 | }, 2424 | "endCaptures": { 2425 | "1": { 2426 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" 2427 | }, 2428 | "2": { 2429 | "name": "invalid.illegal.newline.lpython" 2430 | } 2431 | }, 2432 | "patterns": [ 2433 | { 2434 | "include": "#single-three-regexp-expression" 2435 | }, 2436 | { 2437 | "include": "#comments-string-single-three" 2438 | } 2439 | ] 2440 | }, 2441 | "single-three-regexp-comments": { 2442 | "name": "comment.regexp", 2443 | "begin": "\\(\\?#", 2444 | "end": "(\\)|(?=\\'\\'\\'))", 2445 | "beginCaptures": { 2446 | "0": { 2447 | "name": "punctuation.comment.begin.regexp" 2448 | } 2449 | }, 2450 | "endCaptures": { 2451 | "1": { 2452 | "name": "punctuation.comment.end.regexp" 2453 | }, 2454 | "2": { 2455 | "name": "invalid.illegal.newline.lpython" 2456 | } 2457 | }, 2458 | "patterns": [ 2459 | { 2460 | "include": "#codetags" 2461 | } 2462 | ] 2463 | }, 2464 | "single-three-regexp-lookahead": { 2465 | "begin": "(\\()\\?=", 2466 | "end": "(\\)|(?=\\'\\'\\'))", 2467 | "beginCaptures": { 2468 | "0": { 2469 | "name": "keyword.operator.lookahead.regexp" 2470 | }, 2471 | "1": { 2472 | "name": "punctuation.parenthesis.lookahead.begin.regexp" 2473 | } 2474 | }, 2475 | "endCaptures": { 2476 | "1": { 2477 | "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" 2478 | }, 2479 | "2": { 2480 | "name": "invalid.illegal.newline.lpython" 2481 | } 2482 | }, 2483 | "patterns": [ 2484 | { 2485 | "include": "#single-three-regexp-expression" 2486 | }, 2487 | { 2488 | "include": "#comments-string-single-three" 2489 | } 2490 | ] 2491 | }, 2492 | "single-three-regexp-lookahead-negative": { 2493 | "begin": "(\\()\\?!", 2494 | "end": "(\\)|(?=\\'\\'\\'))", 2495 | "beginCaptures": { 2496 | "0": { 2497 | "name": "keyword.operator.lookahead.negative.regexp" 2498 | }, 2499 | "1": { 2500 | "name": "punctuation.parenthesis.lookahead.begin.regexp" 2501 | } 2502 | }, 2503 | "endCaptures": { 2504 | "1": { 2505 | "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" 2506 | }, 2507 | "2": { 2508 | "name": "invalid.illegal.newline.lpython" 2509 | } 2510 | }, 2511 | "patterns": [ 2512 | { 2513 | "include": "#single-three-regexp-expression" 2514 | }, 2515 | { 2516 | "include": "#comments-string-single-three" 2517 | } 2518 | ] 2519 | }, 2520 | "single-three-regexp-lookbehind": { 2521 | "begin": "(\\()\\?<=", 2522 | "end": "(\\)|(?=\\'\\'\\'))", 2523 | "beginCaptures": { 2524 | "0": { 2525 | "name": "keyword.operator.lookbehind.regexp" 2526 | }, 2527 | "1": { 2528 | "name": "punctuation.parenthesis.lookbehind.begin.regexp" 2529 | } 2530 | }, 2531 | "endCaptures": { 2532 | "1": { 2533 | "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" 2534 | }, 2535 | "2": { 2536 | "name": "invalid.illegal.newline.lpython" 2537 | } 2538 | }, 2539 | "patterns": [ 2540 | { 2541 | "include": "#single-three-regexp-expression" 2542 | }, 2543 | { 2544 | "include": "#comments-string-single-three" 2545 | } 2546 | ] 2547 | }, 2548 | "single-three-regexp-lookbehind-negative": { 2549 | "begin": "(\\()\\?)\n", 2740 | "end": "(\\)|(?=\"))|((?=(?)\n", 3044 | "end": "(\\)|(?=\"\"\"))", 3045 | "beginCaptures": { 3046 | "1": { 3047 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" 3048 | }, 3049 | "2": { 3050 | "name": "entity.name.tag.named.group.regexp" 3051 | } 3052 | }, 3053 | "endCaptures": { 3054 | "1": { 3055 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" 3056 | }, 3057 | "2": { 3058 | "name": "invalid.illegal.newline.lpython" 3059 | } 3060 | }, 3061 | "patterns": [ 3062 | { 3063 | "include": "#double-three-regexp-expression" 3064 | }, 3065 | { 3066 | "include": "#comments-string-double-three" 3067 | } 3068 | ] 3069 | }, 3070 | "double-three-regexp-comments": { 3071 | "name": "comment.regexp", 3072 | "begin": "\\(\\?#", 3073 | "end": "(\\)|(?=\"\"\"))", 3074 | "beginCaptures": { 3075 | "0": { 3076 | "name": "punctuation.comment.begin.regexp" 3077 | } 3078 | }, 3079 | "endCaptures": { 3080 | "1": { 3081 | "name": "punctuation.comment.end.regexp" 3082 | }, 3083 | "2": { 3084 | "name": "invalid.illegal.newline.lpython" 3085 | } 3086 | }, 3087 | "patterns": [ 3088 | { 3089 | "include": "#codetags" 3090 | } 3091 | ] 3092 | }, 3093 | "double-three-regexp-lookahead": { 3094 | "begin": "(\\()\\?=", 3095 | "end": "(\\)|(?=\"\"\"))", 3096 | "beginCaptures": { 3097 | "0": { 3098 | "name": "keyword.operator.lookahead.regexp" 3099 | }, 3100 | "1": { 3101 | "name": "punctuation.parenthesis.lookahead.begin.regexp" 3102 | } 3103 | }, 3104 | "endCaptures": { 3105 | "1": { 3106 | "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" 3107 | }, 3108 | "2": { 3109 | "name": "invalid.illegal.newline.lpython" 3110 | } 3111 | }, 3112 | "patterns": [ 3113 | { 3114 | "include": "#double-three-regexp-expression" 3115 | }, 3116 | { 3117 | "include": "#comments-string-double-three" 3118 | } 3119 | ] 3120 | }, 3121 | "double-three-regexp-lookahead-negative": { 3122 | "begin": "(\\()\\?!", 3123 | "end": "(\\)|(?=\"\"\"))", 3124 | "beginCaptures": { 3125 | "0": { 3126 | "name": "keyword.operator.lookahead.negative.regexp" 3127 | }, 3128 | "1": { 3129 | "name": "punctuation.parenthesis.lookahead.begin.regexp" 3130 | } 3131 | }, 3132 | "endCaptures": { 3133 | "1": { 3134 | "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" 3135 | }, 3136 | "2": { 3137 | "name": "invalid.illegal.newline.lpython" 3138 | } 3139 | }, 3140 | "patterns": [ 3141 | { 3142 | "include": "#double-three-regexp-expression" 3143 | }, 3144 | { 3145 | "include": "#comments-string-double-three" 3146 | } 3147 | ] 3148 | }, 3149 | "double-three-regexp-lookbehind": { 3150 | "begin": "(\\()\\?<=", 3151 | "end": "(\\)|(?=\"\"\"))", 3152 | "beginCaptures": { 3153 | "0": { 3154 | "name": "keyword.operator.lookbehind.regexp" 3155 | }, 3156 | "1": { 3157 | "name": "punctuation.parenthesis.lookbehind.begin.regexp" 3158 | } 3159 | }, 3160 | "endCaptures": { 3161 | "1": { 3162 | "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" 3163 | }, 3164 | "2": { 3165 | "name": "invalid.illegal.newline.lpython" 3166 | } 3167 | }, 3168 | "patterns": [ 3169 | { 3170 | "include": "#double-three-regexp-expression" 3171 | }, 3172 | { 3173 | "include": "#comments-string-double-three" 3174 | } 3175 | ] 3176 | }, 3177 | "double-three-regexp-lookbehind-negative": { 3178 | "begin": "(\\()\\?)\n", 3457 | "end": "(\\)|(?=\\'))|((?=(?)\n", 3698 | "end": "(\\)|(?=\\'\\'\\'))", 3699 | "beginCaptures": { 3700 | "1": { 3701 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" 3702 | }, 3703 | "2": { 3704 | "name": "entity.name.tag.named.group.regexp" 3705 | } 3706 | }, 3707 | "endCaptures": { 3708 | "1": { 3709 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" 3710 | }, 3711 | "2": { 3712 | "name": "invalid.illegal.newline.lpython" 3713 | } 3714 | }, 3715 | "patterns": [ 3716 | { 3717 | "include": "#single-three-fregexp-expression" 3718 | }, 3719 | { 3720 | "include": "#comments-string-single-three" 3721 | } 3722 | ] 3723 | }, 3724 | "single-three-fregexp-lookahead": { 3725 | "begin": "(\\()\\?=", 3726 | "end": "(\\)|(?=\\'\\'\\'))", 3727 | "beginCaptures": { 3728 | "0": { 3729 | "name": "keyword.operator.lookahead.regexp" 3730 | }, 3731 | "1": { 3732 | "name": "punctuation.parenthesis.lookahead.begin.regexp" 3733 | } 3734 | }, 3735 | "endCaptures": { 3736 | "1": { 3737 | "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" 3738 | }, 3739 | "2": { 3740 | "name": "invalid.illegal.newline.lpython" 3741 | } 3742 | }, 3743 | "patterns": [ 3744 | { 3745 | "include": "#single-three-fregexp-expression" 3746 | }, 3747 | { 3748 | "include": "#comments-string-single-three" 3749 | } 3750 | ] 3751 | }, 3752 | "single-three-fregexp-lookahead-negative": { 3753 | "begin": "(\\()\\?!", 3754 | "end": "(\\)|(?=\\'\\'\\'))", 3755 | "beginCaptures": { 3756 | "0": { 3757 | "name": "keyword.operator.lookahead.negative.regexp" 3758 | }, 3759 | "1": { 3760 | "name": "punctuation.parenthesis.lookahead.begin.regexp" 3761 | } 3762 | }, 3763 | "endCaptures": { 3764 | "1": { 3765 | "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" 3766 | }, 3767 | "2": { 3768 | "name": "invalid.illegal.newline.lpython" 3769 | } 3770 | }, 3771 | "patterns": [ 3772 | { 3773 | "include": "#single-three-fregexp-expression" 3774 | }, 3775 | { 3776 | "include": "#comments-string-single-three" 3777 | } 3778 | ] 3779 | }, 3780 | "single-three-fregexp-lookbehind": { 3781 | "begin": "(\\()\\?<=", 3782 | "end": "(\\)|(?=\\'\\'\\'))", 3783 | "beginCaptures": { 3784 | "0": { 3785 | "name": "keyword.operator.lookbehind.regexp" 3786 | }, 3787 | "1": { 3788 | "name": "punctuation.parenthesis.lookbehind.begin.regexp" 3789 | } 3790 | }, 3791 | "endCaptures": { 3792 | "1": { 3793 | "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" 3794 | }, 3795 | "2": { 3796 | "name": "invalid.illegal.newline.lpython" 3797 | } 3798 | }, 3799 | "patterns": [ 3800 | { 3801 | "include": "#single-three-fregexp-expression" 3802 | }, 3803 | { 3804 | "include": "#comments-string-single-three" 3805 | } 3806 | ] 3807 | }, 3808 | "single-three-fregexp-lookbehind-negative": { 3809 | "begin": "(\\()\\?)\n", 3960 | "end": "(\\)|(?=\"))|((?=(?)\n", 4201 | "end": "(\\)|(?=\"\"\"))", 4202 | "beginCaptures": { 4203 | "1": { 4204 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" 4205 | }, 4206 | "2": { 4207 | "name": "entity.name.tag.named.group.regexp" 4208 | } 4209 | }, 4210 | "endCaptures": { 4211 | "1": { 4212 | "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" 4213 | }, 4214 | "2": { 4215 | "name": "invalid.illegal.newline.lpython" 4216 | } 4217 | }, 4218 | "patterns": [ 4219 | { 4220 | "include": "#double-three-fregexp-expression" 4221 | }, 4222 | { 4223 | "include": "#comments-string-double-three" 4224 | } 4225 | ] 4226 | }, 4227 | "double-three-fregexp-lookahead": { 4228 | "begin": "(\\()\\?=", 4229 | "end": "(\\)|(?=\"\"\"))", 4230 | "beginCaptures": { 4231 | "0": { 4232 | "name": "keyword.operator.lookahead.regexp" 4233 | }, 4234 | "1": { 4235 | "name": "punctuation.parenthesis.lookahead.begin.regexp" 4236 | } 4237 | }, 4238 | "endCaptures": { 4239 | "1": { 4240 | "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" 4241 | }, 4242 | "2": { 4243 | "name": "invalid.illegal.newline.lpython" 4244 | } 4245 | }, 4246 | "patterns": [ 4247 | { 4248 | "include": "#double-three-fregexp-expression" 4249 | }, 4250 | { 4251 | "include": "#comments-string-double-three" 4252 | } 4253 | ] 4254 | }, 4255 | "double-three-fregexp-lookahead-negative": { 4256 | "begin": "(\\()\\?!", 4257 | "end": "(\\)|(?=\"\"\"))", 4258 | "beginCaptures": { 4259 | "0": { 4260 | "name": "keyword.operator.lookahead.negative.regexp" 4261 | }, 4262 | "1": { 4263 | "name": "punctuation.parenthesis.lookahead.begin.regexp" 4264 | } 4265 | }, 4266 | "endCaptures": { 4267 | "1": { 4268 | "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" 4269 | }, 4270 | "2": { 4271 | "name": "invalid.illegal.newline.lpython" 4272 | } 4273 | }, 4274 | "patterns": [ 4275 | { 4276 | "include": "#double-three-fregexp-expression" 4277 | }, 4278 | { 4279 | "include": "#comments-string-double-three" 4280 | } 4281 | ] 4282 | }, 4283 | "double-three-fregexp-lookbehind": { 4284 | "begin": "(\\()\\?<=", 4285 | "end": "(\\)|(?=\"\"\"))", 4286 | "beginCaptures": { 4287 | "0": { 4288 | "name": "keyword.operator.lookbehind.regexp" 4289 | }, 4290 | "1": { 4291 | "name": "punctuation.parenthesis.lookbehind.begin.regexp" 4292 | } 4293 | }, 4294 | "endCaptures": { 4295 | "1": { 4296 | "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" 4297 | }, 4298 | "2": { 4299 | "name": "invalid.illegal.newline.lpython" 4300 | } 4301 | }, 4302 | "patterns": [ 4303 | { 4304 | "include": "#double-three-fregexp-expression" 4305 | }, 4306 | { 4307 | "include": "#comments-string-double-three" 4308 | } 4309 | ] 4310 | }, 4311 | "double-three-fregexp-lookbehind-negative": { 4312 | "begin": "(\\()\\?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n", 5043 | "captures": { 5044 | "1": { 5045 | "name": "storage.type.format.lpython" 5046 | }, 5047 | "2": { 5048 | "name": "storage.type.format.lpython" 5049 | } 5050 | } 5051 | }, 5052 | { 5053 | "include": "#fstring-terminator-single-tail" 5054 | } 5055 | ] 5056 | }, 5057 | "fstring-terminator-single-tail": { 5058 | "begin": "(![rsa])?(:)(?=.*?{)", 5059 | "end": "(?=})|(?=\\n)", 5060 | "beginCaptures": { 5061 | "1": { 5062 | "name": "storage.type.format.lpython" 5063 | }, 5064 | "2": { 5065 | "name": "storage.type.format.lpython" 5066 | } 5067 | }, 5068 | "patterns": [ 5069 | { 5070 | "include": "#fstring-illegal-single-brace" 5071 | }, 5072 | { 5073 | "include": "#fstring-single-brace" 5074 | }, 5075 | { 5076 | "name": "storage.type.format.lpython", 5077 | "match": "([bcdeEfFgGnosxX%])(?=})" 5078 | }, 5079 | { 5080 | "name": "storage.type.format.lpython", 5081 | "match": "(\\.\\d+)" 5082 | }, 5083 | { 5084 | "name": "storage.type.format.lpython", 5085 | "match": "(,)" 5086 | }, 5087 | { 5088 | "name": "storage.type.format.lpython", 5089 | "match": "(\\d+)" 5090 | }, 5091 | { 5092 | "name": "storage.type.format.lpython", 5093 | "match": "(\\#)" 5094 | }, 5095 | { 5096 | "name": "storage.type.format.lpython", 5097 | "match": "([-+ ])" 5098 | }, 5099 | { 5100 | "name": "storage.type.format.lpython", 5101 | "match": "([<>=^])" 5102 | }, 5103 | { 5104 | "name": "storage.type.format.lpython", 5105 | "match": "(\\w)" 5106 | } 5107 | ] 5108 | }, 5109 | "fstring-fnorm-quoted-multi-line": { 5110 | "name": "meta.fstring.lpython", 5111 | "begin": "(\\b[fF])([bBuU])?('''|\"\"\")", 5112 | "end": "(\\3)", 5113 | "beginCaptures": { 5114 | "1": { 5115 | "name": "string.interpolated.lpython string.quoted.multi.lpython storage.type.string.lpython" 5116 | }, 5117 | "2": { 5118 | "name": "invalid.illegal.prefix.lpython" 5119 | }, 5120 | "3": { 5121 | "name": "punctuation.definition.string.begin.lpython string.interpolated.lpython string.quoted.multi.lpython" 5122 | } 5123 | }, 5124 | "endCaptures": { 5125 | "1": { 5126 | "name": "punctuation.definition.string.end.lpython string.interpolated.lpython string.quoted.multi.lpython" 5127 | }, 5128 | "2": { 5129 | "name": "invalid.illegal.newline.lpython" 5130 | } 5131 | }, 5132 | "patterns": [ 5133 | { 5134 | "include": "#fstring-guts" 5135 | }, 5136 | { 5137 | "include": "#fstring-illegal-multi-brace" 5138 | }, 5139 | { 5140 | "include": "#fstring-multi-brace" 5141 | }, 5142 | { 5143 | "include": "#fstring-multi-core" 5144 | } 5145 | ] 5146 | }, 5147 | "fstring-normf-quoted-multi-line": { 5148 | "name": "meta.fstring.lpython", 5149 | "begin": "(\\b[bBuU])([fF])('''|\"\"\")", 5150 | "end": "(\\3)", 5151 | "beginCaptures": { 5152 | "1": { 5153 | "name": "invalid.illegal.prefix.lpython" 5154 | }, 5155 | "2": { 5156 | "name": "string.interpolated.lpython string.quoted.multi.lpython storage.type.string.lpython" 5157 | }, 5158 | "3": { 5159 | "name": "punctuation.definition.string.begin.lpython string.quoted.multi.lpython" 5160 | } 5161 | }, 5162 | "endCaptures": { 5163 | "1": { 5164 | "name": "punctuation.definition.string.end.lpython string.interpolated.lpython string.quoted.multi.lpython" 5165 | }, 5166 | "2": { 5167 | "name": "invalid.illegal.newline.lpython" 5168 | } 5169 | }, 5170 | "patterns": [ 5171 | { 5172 | "include": "#fstring-guts" 5173 | }, 5174 | { 5175 | "include": "#fstring-illegal-multi-brace" 5176 | }, 5177 | { 5178 | "include": "#fstring-multi-brace" 5179 | }, 5180 | { 5181 | "include": "#fstring-multi-core" 5182 | } 5183 | ] 5184 | }, 5185 | "fstring-raw-quoted-multi-line": { 5186 | "name": "meta.fstring.lpython", 5187 | "begin": "(\\b(?:[R][fF]|[fF][R]))('''|\"\"\")", 5188 | "end": "(\\2)", 5189 | "beginCaptures": { 5190 | "1": { 5191 | "name": "string.interpolated.lpython string.quoted.raw.multi.lpython storage.type.string.lpython" 5192 | }, 5193 | "2": { 5194 | "name": "punctuation.definition.string.begin.lpython string.quoted.raw.multi.lpython" 5195 | } 5196 | }, 5197 | "endCaptures": { 5198 | "1": { 5199 | "name": "punctuation.definition.string.end.lpython string.interpolated.lpython string.quoted.raw.multi.lpython" 5200 | }, 5201 | "2": { 5202 | "name": "invalid.illegal.newline.lpython" 5203 | } 5204 | }, 5205 | "patterns": [ 5206 | { 5207 | "include": "#fstring-raw-guts" 5208 | }, 5209 | { 5210 | "include": "#fstring-illegal-multi-brace" 5211 | }, 5212 | { 5213 | "include": "#fstring-multi-brace" 5214 | }, 5215 | { 5216 | "include": "#fstring-raw-multi-core" 5217 | } 5218 | ] 5219 | }, 5220 | "fstring-multi-core": { 5221 | "name": "string.interpolated.lpython string.quoted.multi.lpython", 5222 | "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n" 5223 | }, 5224 | "fstring-raw-multi-core": { 5225 | "name": "string.interpolated.lpython string.quoted.raw.multi.lpython", 5226 | "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n" 5227 | }, 5228 | "fstring-multi-brace": { 5229 | "comment": "value interpolation using { ... }", 5230 | "begin": "(\\{)", 5231 | "end": "(?x)\n (\\})\n", 5232 | "beginCaptures": { 5233 | "1": { 5234 | "name": "constant.character.format.placeholder.other.lpython" 5235 | } 5236 | }, 5237 | "endCaptures": { 5238 | "1": { 5239 | "name": "constant.character.format.placeholder.other.lpython" 5240 | } 5241 | }, 5242 | "patterns": [ 5243 | { 5244 | "include": "#fstring-terminator-multi" 5245 | }, 5246 | { 5247 | "include": "#f-expression" 5248 | } 5249 | ] 5250 | }, 5251 | "fstring-terminator-multi": { 5252 | "patterns": [ 5253 | { 5254 | "name": "storage.type.format.lpython", 5255 | "match": "(![rsa])(?=})" 5256 | }, 5257 | { 5258 | "match": "(?x)\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n", 5259 | "captures": { 5260 | "1": { 5261 | "name": "storage.type.format.lpython" 5262 | }, 5263 | "2": { 5264 | "name": "storage.type.format.lpython" 5265 | } 5266 | } 5267 | }, 5268 | { 5269 | "include": "#fstring-terminator-multi-tail" 5270 | } 5271 | ] 5272 | }, 5273 | "fstring-terminator-multi-tail": { 5274 | "begin": "(![rsa])?(:)(?=.*?{)", 5275 | "end": "(?=})", 5276 | "beginCaptures": { 5277 | "1": { 5278 | "name": "storage.type.format.lpython" 5279 | }, 5280 | "2": { 5281 | "name": "storage.type.format.lpython" 5282 | } 5283 | }, 5284 | "patterns": [ 5285 | { 5286 | "include": "#fstring-illegal-multi-brace" 5287 | }, 5288 | { 5289 | "include": "#fstring-multi-brace" 5290 | }, 5291 | { 5292 | "name": "storage.type.format.lpython", 5293 | "match": "([bcdeEfFgGnosxX%])(?=})" 5294 | }, 5295 | { 5296 | "name": "storage.type.format.lpython", 5297 | "match": "(\\.\\d+)" 5298 | }, 5299 | { 5300 | "name": "storage.type.format.lpython", 5301 | "match": "(,)" 5302 | }, 5303 | { 5304 | "name": "storage.type.format.lpython", 5305 | "match": "(\\d+)" 5306 | }, 5307 | { 5308 | "name": "storage.type.format.lpython", 5309 | "match": "(\\#)" 5310 | }, 5311 | { 5312 | "name": "storage.type.format.lpython", 5313 | "match": "([-+ ])" 5314 | }, 5315 | { 5316 | "name": "storage.type.format.lpython", 5317 | "match": "([<>=^])" 5318 | }, 5319 | { 5320 | "name": "storage.type.format.lpython", 5321 | "match": "(\\w)" 5322 | } 5323 | ] 5324 | } 5325 | } 5326 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2020", 5 | "lib": ["es2020"], 6 | "outDir": "out", 7 | "rootDir": "src", 8 | "sourceMap": true 9 | }, 10 | "include": [ 11 | "src" 12 | ], 13 | "exclude": [ 14 | "node_modules", 15 | ".vscode-test" 16 | ], 17 | "references": [ 18 | { "path": "./client" }, 19 | { "path": "./server" } 20 | ] 21 | } --------------------------------------------------------------------------------