├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── images ├── lambda.png ├── snippets.gif └── syntax.png ├── package.json ├── scheme.configuration.json ├── snippets └── scheme.json ├── src ├── schemeConfiguration.ts └── schemeMain.ts ├── syntaxes ├── scheme.markdown.tmLanguage.json └── scheme.tmLanguage ├── test ├── extension.test.ts └── index.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | *.vsix 4 | /package-lock.json 5 | yarn.lock -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], 11 | "stopOnEntry": false, 12 | "sourceMaps": true, 13 | "outFiles": [ "${workspaceRoot}/out/src/**/*.js" ], 14 | "preLaunchTask": "npm" 15 | }, 16 | { 17 | "name": "Launch Tests", 18 | "type": "extensionHost", 19 | "request": "launch", 20 | "runtimeExecutable": "${execPath}", 21 | "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], 22 | "stopOnEntry": false, 23 | "sourceMaps": true, 24 | "outFiles": [ "${workspaceRoot}/out/test/**/*.js" ], 25 | "preLaunchTask": "npm" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | } 9 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // Available variables which can be used inside of strings. 2 | // ${workspaceRoot}: the root folder of the team 3 | // ${file}: the current opened file 4 | // ${fileBasename}: the current opened file's basename 5 | // ${fileDirname}: the current opened file's dirname 6 | // ${fileExtname}: the current opened file's extension 7 | // ${cwd}: the current working directory of the spawned process 8 | 9 | // A task runner that calls a custom npm script that compiles the extension. 10 | { 11 | "version": "0.1.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "isShellCommand": true, 18 | 19 | // show the output window only if unrecognized errors occur. 20 | "showOutput": "silent", 21 | 22 | // we run the custom script "compile" as defined in package.json 23 | "args": ["run", "compile", "--loglevel", "silent"], 24 | 25 | // The tsc compiler is started in watching mode 26 | "isBackground": true, 27 | 28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 29 | "problemMatcher": "$tsc-watch" 30 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | test/** 5 | src/** 6 | **/*.map 7 | .gitignore 8 | tsconfig.json 9 | vsc-extension-quickstart.md 10 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## 0.4.0 (March 28,2019) 4 | - fix some bugs 5 | 6 | ## 0.3.3 (March 23, 2018) 7 | - fix block comments not recognized 8 | 9 | ## 0.1.0 (May 1st, 2017) 10 | - Add syntax and snippets feature. -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Allen Huang 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Scheme Language Support for Visual Studio Code 2 | 3 | This extension add Scheme language support to VS Code. 4 | 5 | ## Features 6 | * Syntax Coloring 7 | 8 | ![](https://raw.githubusercontent.com/sjhuangx/vscode-scheme/master/images/syntax.png) 9 | 10 | * Snippets 11 | 12 | ![](https://raw.githubusercontent.com/sjhuangx/vscode-scheme/master/images/snippets.gif) 13 | 14 | support following snippets: cond, define, if, lambda, let, let1, set!. 15 | 16 | ## Credits 17 | This extension use a file that egrachev's sublime-scheme to enable syntax on vscode. 18 | 19 | [https://github.com/egrachev/sublime-scheme/blob/master/Scheme.tmLanguage](https://github.com/egrachev/sublime-scheme/blob/master/Scheme.tmLanguage) 20 | 21 | **Enjoy!** -------------------------------------------------------------------------------- /images/lambda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinyjiahao/vscode-scheme/9bd15efa411cef23955df314f8d9399057d068de/images/lambda.png -------------------------------------------------------------------------------- /images/snippets.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinyjiahao/vscode-scheme/9bd15efa411cef23955df314f8d9399057d068de/images/snippets.gif -------------------------------------------------------------------------------- /images/syntax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tinyjiahao/vscode-scheme/9bd15efa411cef23955df314f8d9399057d068de/images/syntax.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-scheme", 3 | "displayName": "vscode-scheme", 4 | "description": "Scheme language support for VSCode", 5 | "keywords": [ 6 | "scheme", 7 | "syntax" 8 | ], 9 | "version": "0.4.0", 10 | "publisher": "sjhuangx", 11 | "icon": "images/lambda.png", 12 | "main": "./out/src/schemeMain", 13 | "license": "MIT", 14 | "author": { 15 | "name": "Allen Huang" 16 | }, 17 | "engines": { 18 | "vscode": "^1.11.0" 19 | }, 20 | "categories": [ 21 | "Languages", 22 | "Snippets" 23 | ], 24 | "activationEvents": [ 25 | "onLanguage:scheme" 26 | ], 27 | "repository": { 28 | "type": "git", 29 | "url": "https://github.com/sjhuangx/vscode-scheme.git" 30 | }, 31 | "bugs": { 32 | "url": "https://github.com/sjhuangx/vscode-scheme/issues" 33 | }, 34 | "homepage": "https://github.com/sjhuangx/vscode-scheme", 35 | "contributes": { 36 | "languages": [ 37 | { 38 | "id": "scheme", 39 | "aliases": [ 40 | "Scheme", 41 | "scheme" 42 | ], 43 | "extensions": [ 44 | ".scm", 45 | ".ss", 46 | ".sch", 47 | ".rkt" 48 | ], 49 | "configuration": "./scheme.configuration.json" 50 | } 51 | ], 52 | "grammars": [ 53 | { 54 | "language": "scheme", 55 | "scopeName": "source.scheme", 56 | "path": "./syntaxes/scheme.tmLanguage" 57 | }, 58 | { 59 | "scopeName": "markdown.scheme.codeblock", 60 | "path": "./syntaxes/scheme.markdown.tmLanguage.json", 61 | "injectTo": [ 62 | "text.html.markdown" 63 | ] 64 | } 65 | ], 66 | "snippets": [ 67 | { 68 | "language": "scheme", 69 | "path": "./snippets/scheme.json" 70 | } 71 | ] 72 | }, 73 | "scripts": { 74 | "vscode:prepublish": "tsc -p ./", 75 | "compile": "tsc -watch -p ./", 76 | "postinstall": "node ./node_modules/vscode/bin/install", 77 | "test": "node ./node_modules/vscode/bin/test" 78 | }, 79 | "devDependencies": { 80 | "typescript": "^2.0.3", 81 | "vscode": "^1.0.0", 82 | "mocha": "^2.3.3", 83 | "@types/node": "^6.0.40", 84 | "@types/mocha": "^2.2.32" 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /scheme.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. 4 | "lineComment": ";", 5 | // symbols used for start and end a block comment. 6 | "blockComment": [ "#|", "|#" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ], 14 | // symbols that are auto closed when typing 15 | "autoClosingPairs": [ 16 | ["{", "}"], 17 | ["[", "]"], 18 | ["(", ")"], 19 | ["\"", "\""], 20 | ["'", "'"] 21 | ], 22 | // symbols that that can be used to surround a selection 23 | "surroundingPairs": [ 24 | ["{", "}"], 25 | ["[", "]"], 26 | ["(", ")"], 27 | ["\"", "\""], 28 | ["'", "'"] 29 | ] 30 | } -------------------------------------------------------------------------------- /snippets/scheme.json: -------------------------------------------------------------------------------- 1 | { 2 | "cond": { 3 | "prefix": "cond", 4 | "body": "(cond (${1:predicate1} ${2:consequent1})\n\t(${3:predicate2} ${4:consequent2}))", 5 | "description": "Code snippet for condition statement", 6 | "scope": "source.scheme" 7 | }, 8 | "define": { 9 | "prefix": "define", 10 | "body": "(define (${1:name} ${2:parameters})\n\t${3:body})", 11 | "description": "Code snippet for define statement", 12 | "scope": "source.scheme" 13 | }, 14 | "if": { 15 | "prefix": "if", 16 | "body": "(if (${1:predicate})\n\t${2:consequent}\n\t${3:alternative})", 17 | "description": "Code snippet for an if statement", 18 | "scope": "source.scheme" 19 | }, 20 | "lambda": { 21 | "prefix": "lambda", 22 | "body": "(lambda ($1) ${2:#f})", 23 | "description": "Code snippet for lambda expression", 24 | "scope": "source.scheme" 25 | }, 26 | "let": { 27 | "prefix": "let", 28 | "body": "(let (${1:variables})\n\t($0))", 29 | "description": "Code snippet for let statement", 30 | "scope": "source.scheme" 31 | }, 32 | "let1": { 33 | "prefix": "let1", 34 | "body": "(let ((${1:variable} ${2:value}))\n\t($0))", 35 | "description": "Code snippet for let1 statement", 36 | "scope": "source.scheme" 37 | }, 38 | "set!": { 39 | "prefix": "set!", 40 | "body": "(set! ${1:place} ${2:value})", 41 | "description": "Code snippet for set! statement", 42 | "scope": "source.scheme" 43 | } 44 | } -------------------------------------------------------------------------------- /src/schemeConfiguration.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | 3 | export const configuration: vscode.LanguageConfiguration = { 4 | wordPattern: /[\w\-\.:<>\*][\w\d\.\\/\-\?<>\*!]+/, 5 | indentationRules: { 6 | decreaseIndentPattern: undefined, 7 | increaseIndentPattern: /^\s*\(.*[^)]\s*$/ 8 | } 9 | } -------------------------------------------------------------------------------- /src/schemeMain.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import {configuration} from './schemeConfiguration'; 3 | 4 | export function activate(ctx: vscode.ExtensionContext) { 5 | ctx.subscriptions.push(vscode.languages.setLanguageConfiguration('scheme', configuration)); 6 | } 7 | 8 | export function deactivate() { 9 | } -------------------------------------------------------------------------------- /syntaxes/scheme.markdown.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileTypes": [], 3 | "injectionSelector": "L:text.html.markdown", 4 | "patterns": [ 5 | { 6 | "include": "#fenced_code_block_scheme" 7 | } 8 | ], 9 | "repository": { 10 | "fenced_code_block_scheme": { 11 | "begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(scheme)(\\s+[^`~]*)?$)", 12 | "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", 13 | "contentName": "meta.embedded.block.scheme", 14 | "patterns": [ 15 | { 16 | "include": "source.scheme" 17 | } 18 | ] 19 | } 20 | }, 21 | "scopeName": "markdown.scheme.codeblock" 22 | } 23 | -------------------------------------------------------------------------------- /syntaxes/scheme.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | comment 6 | 7 | The foldings do not currently work the way I want them to. This 8 | may be a limitation of the way they are applied rather than the 9 | regexps in use. Nonetheless, the foldings will end on the last 10 | identically indented blank line following an s-expression. Not 11 | ideal perhaps, but it works. Also, the #illegal pattern never 12 | matches an unpaired ( as being illegal. Why?! -- Rob Rix 13 | 14 | Ok, hopefully this grammar works better on quoted stuff now. It 15 | may break for fancy macros, but should generally work pretty 16 | smoothly. -- Jacob Rus 17 | 18 | I have attempted to get this under control but because of the way folding 19 | and indentation interact in Textmate, I am not sure if it is possible. In the 20 | meantime, I have implemented Python-style folding anchored at newlines. 21 | Additionally, I have made some minor improvements to the numeric constant 22 | highlighting. Next up is square bracket expressions, I guess, but that 23 | should be trivial. -- ozy` 24 | 25 | fileTypes 26 | 27 | scm 28 | ss 29 | sch 30 | rkt 31 | 32 | keyEquivalent 33 | ^~S 34 | name 35 | Scheme 36 | patterns 37 | 38 | 39 | include 40 | #comment 41 | 42 | 43 | include 44 | #block-comment 45 | 46 | 47 | include 48 | #sexp 49 | 50 | 51 | include 52 | #string 53 | 54 | 55 | include 56 | #language-functions 57 | 58 | 59 | include 60 | #quote 61 | 62 | 63 | include 64 | #illegal 65 | 66 | 67 | repository 68 | 69 | comment 70 | 71 | begin 72 | (^[ \t]+)?(?=;) 73 | beginCaptures 74 | 75 | 1 76 | 77 | name 78 | punctuation.whitespace.comment.leading.scheme 79 | 80 | 81 | end 82 | (?!\G) 83 | patterns 84 | 85 | 86 | begin 87 | ; 88 | beginCaptures 89 | 90 | 0 91 | 92 | name 93 | punctuation.definition.comment.scheme 94 | 95 | 96 | end 97 | \n 98 | name 99 | comment.line.semicolon.scheme 100 | 101 | 102 | 103 | block-comment 104 | 105 | begin 106 | \#\| 107 | contentName 108 | comment 109 | end 110 | \|\# 111 | name 112 | comment 113 | patterns 114 | 115 | 116 | include 117 | #block-comment 118 | name 119 | comment 120 | 121 | 122 | 123 | constants 124 | 125 | patterns 126 | 127 | 128 | match 129 | #[t|f] 130 | name 131 | constant.language.boolean.scheme 132 | 133 | 134 | match 135 | (?<=[\(\s])((#e|#i)?[0-9]+(\.[0-9]+)?|(#x)[0-9a-fA-F]+|(#o)[0-7]+|(#b)[01]+)(?=[\s;()'",\[\]]) 136 | name 137 | constant.numeric.scheme 138 | 139 | 140 | 141 | illegal 142 | 143 | match 144 | [()\[\]] 145 | name 146 | invalid.illegal.parenthesis.scheme 147 | 148 | language-functions 149 | 150 | patterns 151 | 152 | 153 | match 154 | (?x) 155 | (?<=(\s|\(|\[)) # preceded by space or ( 156 | ( do|or|and|else|quasiquote|begin|if|case|set!| 157 | cond|let|unquote|define|let\*|unquote-splicing|delay| 158 | letrec) 159 | (?=(\s|\()) 160 | name 161 | keyword.control.scheme 162 | 163 | 164 | comment 165 | 166 | These functions run a test, and return a boolean 167 | answer. 168 | 169 | match 170 | (?x) 171 | (?<=(\s|\()) # preceded by space or ( 172 | ( char-alphabetic|char-lower-case|char-numeric| 173 | char-ready|char-upper-case|char-whitespace| 174 | (?:char|string)(?:-ci)?(?:=|<=?|>=?)| 175 | atom|boolean|bound-identifier=|char|complex| 176 | identifier|integer|symbol|free-identifier=|inexact| 177 | eof-object|exact|list|(?:input|output)-port|pair| 178 | real|rational|zero|vector|negative|odd|null|string| 179 | eq|equal|eqv|even|number|positive|procedure 180 | ) 181 | (\?) # name ends with ? sign 182 | (?=(\s|\()) # followed by space or ( 183 | 184 | name 185 | support.function.boolean-test.scheme 186 | 187 | 188 | comment 189 | 190 | These functions change one type into another. 191 | 192 | match 193 | (?x) 194 | (?<=(\s|\()) # preceded by space or ( 195 | ( char->integer|exact->inexact|inexact->exact| 196 | integer->char|symbol->string|list->vector| 197 | list->string|identifier->symbol|vector->list| 198 | string->list|string->number|string->symbol| 199 | number->string 200 | ) 201 | (?=(\s|\()) # followed by space or ( 202 | 203 | name 204 | support.function.convert-type.scheme 205 | 206 | 207 | comment 208 | 209 | These functions are potentially dangerous because 210 | they have side-effects which could affect other 211 | parts of the program. 212 | 213 | match 214 | (?x) 215 | (?<=(\s|\()) # preceded by space or ( 216 | ( set-(?:car|cdr)| # set car/cdr 217 | (?:vector|string)-(?:fill|set) # fill/set string/vector 218 | ) 219 | (!) # name ends with ! sign 220 | (?=(\s|\()) # followed by space or ( 221 | 222 | name 223 | support.function.with-side-effects.scheme 224 | 225 | 226 | comment 227 | 228 | +, -, *, /, =, >, etc. 229 | 230 | match 231 | (?x) 232 | (?<=(\s|\()) # preceded by space or ( 233 | ( >=?|<=?|=|[*/+-]) 234 | (?=(\s|\()) # followed by space or ( 235 | 236 | name 237 | keyword.operator.arithmetic.scheme 238 | 239 | 240 | match 241 | (?x) 242 | (?<=(\s|\()) # preceded by space or ( 243 | ( append|apply|approximate| 244 | call-with-current-continuation|call/cc|catch| 245 | construct-identifier|define-syntax|display|foo| 246 | for-each|force|format|cd|gen-counter|gen-loser| 247 | generate-identifier|last-pair|length|let-syntax| 248 | letrec-syntax|list|list-ref|list-tail|load|log| 249 | macro|magnitude|map|map-streams|max|member|memq| 250 | memv|min|newline|nil|not|peek-char|rationalize| 251 | read|read-char|return|reverse|sequence|substring| 252 | syntax|syntax-rules|transcript-off|transcript-on| 253 | truncate|unwrap-syntax|values-list|write|write-char| 254 | 255 | # cons, car, cdr, etc 256 | cons|c(a|d){1,4}r| 257 | 258 | # unary math operators 259 | abs|acos|angle|asin|assoc|assq|assv|atan|ceiling| 260 | cos|floor|round|sin|sqrt|tan| 261 | (?:real|imag)-part|numerator|denominator 262 | 263 | # other math operators 264 | modulo|exp|expt|remainder|quotient|lcm| 265 | 266 | # ports / files 267 | call-with-(?:input|output)-file| 268 | (?:close|current)-(?:input|output)-port| 269 | with-(?:input|output)-from-file| 270 | open-(?:input|output)-file| 271 | 272 | # char-«foo» 273 | char-(?:downcase|upcase|ready)| 274 | 275 | # make-«foo» 276 | make-(?:polar|promise|rectangular|string|vector) 277 | 278 | # string-«foo», vector-«foo» 279 | string(?:-(?:append|copy|length|ref))?| 280 | vector(?:-length|-ref) 281 | ) 282 | (?=(\s|\()) # followed by space or ( 283 | 284 | name 285 | support.function.general.scheme 286 | 287 | 288 | 289 | quote 290 | 291 | comment 292 | 293 | We need to be able to quote any kind of item, which creates 294 | a tiny bit of complexity in our grammar. It is hopefully 295 | not overwhelming complexity. 296 | 297 | Note: the first two matches are special cases. quoted 298 | symbols, and quoted empty lists are considered constant.other 299 | 300 | 301 | patterns 302 | 303 | 304 | captures 305 | 306 | 1 307 | 308 | name 309 | punctuation.section.quoted.symbol.scheme 310 | 311 | 312 | match 313 | (?x) 314 | (')\s* 315 | ([[:alnum:]][[:alnum:]!$%&*+-./:<=>?@^_~]*) 316 | 317 | name 318 | constant.other.symbol.scheme 319 | 320 | 321 | captures 322 | 323 | 1 324 | 325 | name 326 | punctuation.section.quoted.empty-list.scheme 327 | 328 | 2 329 | 330 | name 331 | meta.expression.scheme 332 | 333 | 3 334 | 335 | name 336 | punctuation.section.expression.begin.scheme 337 | 338 | 4 339 | 340 | name 341 | punctuation.section.expression.end.scheme 342 | 343 | 344 | match 345 | (?x) 346 | (')\s* 347 | ((\()\s*(\))) 348 | 349 | name 350 | constant.other.empty-list.schem 351 | 352 | 353 | begin 354 | (')\s* 355 | beginCaptures 356 | 357 | 1 358 | 359 | name 360 | punctuation.section.quoted.scheme 361 | 362 | 363 | comment 364 | quoted double-quoted string or s-expression 365 | end 366 | (?=[\s()])|(?<=\n) 367 | name 368 | string.other.quoted-object.scheme 369 | patterns 370 | 371 | 372 | include 373 | #quoted 374 | 375 | 376 | 377 | 378 | 379 | quote-sexp 380 | 381 | begin 382 | (?<=\()\s*(quote)\s+ 383 | beginCaptures 384 | 385 | 1 386 | 387 | name 388 | keyword.control.quote.scheme 389 | 390 | 391 | comment 392 | 393 | Something quoted with (quote «thing»). In this case «thing» 394 | will not be evaluated, so we are considering it a string. 395 | 396 | contentName 397 | string.other.quote.scheme 398 | end 399 | (?=[\s)])|(?<=\n) 400 | patterns 401 | 402 | 403 | include 404 | #quoted 405 | 406 | 407 | 408 | quoted 409 | 410 | patterns 411 | 412 | 413 | include 414 | #string 415 | 416 | 417 | begin 418 | (\() 419 | beginCaptures 420 | 421 | 1 422 | 423 | name 424 | punctuation.section.expression.begin.scheme 425 | 426 | 427 | end 428 | (\)) 429 | endCaptures 430 | 431 | 1 432 | 433 | name 434 | punctuation.section.expression.end.scheme 435 | 436 | 437 | name 438 | meta.expression.scheme 439 | patterns 440 | 441 | 442 | include 443 | #quoted 444 | 445 | 446 | 447 | 448 | include 449 | #quote 450 | 451 | 452 | include 453 | #illegal 454 | 455 | 456 | 457 | sexp 458 | 459 | begin 460 | (\() 461 | beginCaptures 462 | 463 | 1 464 | 465 | name 466 | punctuation.section.expression.begin.scheme 467 | 468 | 469 | end 470 | (\))(\n)? 471 | endCaptures 472 | 473 | 1 474 | 475 | name 476 | punctuation.section.expression.end.scheme 477 | 478 | 2 479 | 480 | name 481 | meta.after-expression.scheme 482 | 483 | 484 | name 485 | meta.expression.scheme 486 | patterns 487 | 488 | 489 | include 490 | #comment 491 | 492 | 493 | begin 494 | (?x) 495 | (?<=\() # preceded by ( 496 | (define)\s+ # define 497 | (\() # list of parameters 498 | ([[:alnum:]][[:alnum:]!$%&*+-./:<=>?@^_~]*) 499 | ((\s+ 500 | ([[:alnum:]][[:alnum:]!$%&*+-./:<=>?@^_~]*|[._]) 501 | )* 502 | )\s* 503 | (\)) 504 | 505 | captures 506 | 507 | 1 508 | 509 | name 510 | keyword.control.scheme 511 | 512 | 2 513 | 514 | name 515 | punctuation.definition.function.scheme 516 | 517 | 3 518 | 519 | name 520 | entity.name.function.scheme 521 | 522 | 4 523 | 524 | name 525 | variable.parameter.function.scheme 526 | 527 | 7 528 | 529 | name 530 | punctuation.definition.function.scheme 531 | 532 | 533 | end 534 | (?=\)) 535 | name 536 | meta.declaration.procedure.scheme 537 | patterns 538 | 539 | 540 | include 541 | #comment 542 | 543 | 544 | include 545 | #sexp 546 | 547 | 548 | include 549 | #illegal 550 | 551 | 552 | 553 | 554 | begin 555 | (?x) 556 | (?<=\() # preceded by ( 557 | (lambda)\s+ 558 | (\() # opening paren 559 | ((?: 560 | ([[:alnum:]][[:alnum:]!$%&*+-./:<=>?@^_~]*|[._]) 561 | \s+ 562 | )*(?: 563 | ([[:alnum:]][[:alnum:]!$%&*+-./:<=>?@^_~]*|[._]) 564 | )?) 565 | (\)) # closing paren 566 | 567 | captures 568 | 569 | 1 570 | 571 | name 572 | keyword.control.scheme 573 | 574 | 2 575 | 576 | name 577 | punctuation.definition.variable.scheme 578 | 579 | 3 580 | 581 | name 582 | variable.parameter.scheme 583 | 584 | 6 585 | 586 | name 587 | punctuation.definition.variable.scheme 588 | 589 | 590 | comment 591 | 592 | Not sure this one is quite correct. That \s* is 593 | particularly troubling 594 | 595 | end 596 | (?=\)) 597 | name 598 | meta.declaration.procedure.scheme 599 | patterns 600 | 601 | 602 | include 603 | #comment 604 | 605 | 606 | include 607 | #sexp 608 | 609 | 610 | include 611 | #illegal 612 | 613 | 614 | 615 | 616 | begin 617 | (?<=\()(define)\s([[:alnum:]][[:alnum:]!$%&*+-./:<=>?@^_~]*)\s*.*? 618 | captures 619 | 620 | 1 621 | 622 | name 623 | keyword.control.scheme 624 | 625 | 2 626 | 627 | name 628 | variable.other.scheme 629 | 630 | 631 | end 632 | (?=\)) 633 | name 634 | meta.declaration.variable.scheme 635 | patterns 636 | 637 | 638 | include 639 | #comment 640 | 641 | 642 | include 643 | #sexp 644 | 645 | 646 | include 647 | #illegal 648 | 649 | 650 | 651 | 652 | include 653 | #quote-sexp 654 | 655 | 656 | include 657 | #quote 658 | 659 | 660 | include 661 | #language-functions 662 | 663 | 664 | include 665 | #string 666 | 667 | 668 | include 669 | #constants 670 | 671 | 672 | match 673 | (?<=[\(\s])(#\\)(space|newline|tab)(?=[\s\)]) 674 | name 675 | constant.character.named.scheme 676 | 677 | 678 | match 679 | (?<=[\(\s])(#\\)x[0-9A-F]{2,4}(?=[\s\)]) 680 | name 681 | constant.character.hex-literal.scheme 682 | 683 | 684 | match 685 | (?<=[\(\s])(#\\).(?=[\s\)]) 686 | name 687 | constant.character.escape.scheme 688 | 689 | 690 | comment 691 | 692 | the . in (a . b) which conses together two elements 693 | a and b. (a b c) == (a . (b . (c . nil))) 694 | 695 | match 696 | (?<=[ ()])\.(?=[ ()]) 697 | name 698 | punctuation.separator.cons.scheme 699 | 700 | 701 | include 702 | #sexp 703 | 704 | 705 | include 706 | #illegal 707 | 708 | 709 | 710 | string 711 | 712 | begin 713 | (") 714 | beginCaptures 715 | 716 | 1 717 | 718 | name 719 | punctuation.definition.string.begin.scheme 720 | 721 | 722 | end 723 | (") 724 | endCaptures 725 | 726 | 1 727 | 728 | name 729 | punctuation.definition.string.end.scheme 730 | 731 | 732 | name 733 | string.quoted.double.scheme 734 | patterns 735 | 736 | 737 | match 738 | \\. 739 | name 740 | constant.character.escape.scheme 741 | 742 | 743 | 744 | 745 | scopeName 746 | source.scheme 747 | uuid 748 | 3EC2CFD0-909C-4692-AC29-1A60ADBC161E 749 | 750 | 751 | -------------------------------------------------------------------------------- /test/extension.test.ts: -------------------------------------------------------------------------------- 1 | // 2 | // Note: This example test is leveraging the Mocha test framework. 3 | // Please refer to their documentation on https://mochajs.org/ for help. 4 | // 5 | 6 | // The module 'assert' provides assertion methods from node 7 | import * as assert from 'assert'; 8 | 9 | // You can import and use all API from the 'vscode' module 10 | // as well as import your extension to test it 11 | import * as vscode from 'vscode'; 12 | import * as schemeMain from '../src/schemeMain'; 13 | 14 | // Defines a Mocha test suite to group tests of similar kind together 15 | suite("Extension Tests", () => { 16 | 17 | // Defines a Mocha unit test 18 | test("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /test/index.ts: -------------------------------------------------------------------------------- 1 | // 2 | // PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING 3 | // 4 | // This file is providing the test runner to use when running extension tests. 5 | // By default the test runner in use is Mocha based. 6 | // 7 | // You can provide your own test runner if you want to override it by exporting 8 | // a function run(testRoot: string, clb: (error:Error) => void) that the extension 9 | // host can call to run the tests. The test runner is expected to use console.log 10 | // to report the results back to the caller. When the tests are finished, return 11 | // a possible error to the callback or null if none. 12 | 13 | var testRunner = require('vscode/lib/testrunner'); 14 | 15 | // You can directly control Mocha options by uncommenting the following lines 16 | // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info 17 | testRunner.configure({ 18 | ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) 19 | useColors: true // colored output from test results 20 | }); 21 | 22 | module.exports = testRunner; -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "." 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } --------------------------------------------------------------------------------