diff --git a/editor/.DS_Store b/editor/.DS_Store new file mode 100644 index 0000000..05bb5d7 Binary files /dev/null and b/editor/.DS_Store differ diff --git a/editor/vscode-jdg/README.md b/editor/vscode-jdg/README.md new file mode 100644 index 0000000..9b76cd2 --- /dev/null +++ b/editor/vscode-jdg/README.md @@ -0,0 +1,29 @@ +# Judge DSL — VS Code extension + +Syntax highlighting for `.jdg` files (the judge test-suite DSL). + +## Install (local, no marketplace) + +### VS Code + +Copy this directory into your extensions folder — VS Code loads it on next +restart: + +```sh +# VS Code +cp -r editor/vscode-jdg ~/.vscode/extensions/jdg-language-0.1.0 +``` + +Restart the editor, open any `.jdg` file — you should see keywords, strings, +durations highlighted. + +### Package as `.vsix` (shareable) + +```sh +npm install -g @vscode/vsce +cd editor/vscode-jdg +vsce package +# → jdg-language-0.1.0.vsix +``` + +Then in VS Code: `Extensions` → `...` → `Install from VSIX`. diff --git a/editor/vscode-jdg/jdg-language-0.1.0.vsix b/editor/vscode-jdg/jdg-language-0.1.0.vsix new file mode 100644 index 0000000..8fe0516 Binary files /dev/null and b/editor/vscode-jdg/jdg-language-0.1.0.vsix differ diff --git a/editor/vscode-jdg/language-configuration.json b/editor/vscode-jdg/language-configuration.json new file mode 100644 index 0000000..0cd0878 --- /dev/null +++ b/editor/vscode-jdg/language-configuration.json @@ -0,0 +1,24 @@ +{ + "comments": { + "lineComment": "//" + }, + "brackets": [ + ["{", "}"], + ["(", ")"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}" }, + { "open": "(", "close": ")" }, + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "\"\"\"", "close": "\"\"\"" } + ], + "surroundingPairs": [ + ["{", "}"], + ["(", ")"], + ["\"", "\""] + ], + "indentationRules": { + "increaseIndentPattern": "^.*\\{[^}]*$", + "decreaseIndentPattern": "^\\s*\\}" + } +} diff --git a/editor/vscode-jdg/package.json b/editor/vscode-jdg/package.json new file mode 100644 index 0000000..56e7b92 --- /dev/null +++ b/editor/vscode-jdg/package.json @@ -0,0 +1,22 @@ +{ + "name": "jdg-language", + "displayName": "Judge DSL (.jdg)", + "description": "Syntax highlighting for judge test-suite files", + "version": "0.1.0", + "publisher": "judge", + "engines": { "vscode": "^1.60.0" }, + "categories": ["Programming Languages"], + "contributes": { + "languages": [{ + "id": "jdg", + "aliases": ["Judge DSL", "jdg"], + "extensions": [".jdg"], + "configuration": "./language-configuration.json" + }], + "grammars": [{ + "language": "jdg", + "scopeName": "source.jdg", + "path": "./syntaxes/jdg.tmLanguage.json" + }] + } +} diff --git a/editor/vscode-jdg/syntaxes/jdg.tmLanguage.json b/editor/vscode-jdg/syntaxes/jdg.tmLanguage.json new file mode 100644 index 0000000..021df6c --- /dev/null +++ b/editor/vscode-jdg/syntaxes/jdg.tmLanguage.json @@ -0,0 +1,83 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Judge DSL", + "scopeName": "source.jdg", + "fileTypes": ["jdg"], + "patterns": [ + { "include": "#comments" }, + { "include": "#heredoc" }, + { "include": "#string" }, + { "include": "#duration" }, + { "include": "#number" }, + { "include": "#boolean" }, + { "include": "#top-keywords" }, + { "include": "#block-keywords" }, + { "include": "#matcher-keywords" }, + { "include": "#scoring-values" }, + { "include": "#operators" }, + { "include": "#braces" }, + { "include": "#identifier" } + ], + "repository": { + "comments": { + "name": "comment.line.double-slash.jdg", + "match": "//.*$" + }, + "heredoc": { + "name": "string.quoted.triple.jdg", + "begin": "\"\"\"", + "end": "\"\"\"", + "patterns": [ + { "name": "constant.character.escape.jdg", "match": "\\\\[nt\\\\\"]" } + ] + }, + "string": { + "name": "string.quoted.double.jdg", + "begin": "\"", + "end": "\"", + "patterns": [ + { "name": "constant.character.escape.jdg", "match": "\\\\[nt\\\\\"]" } + ] + }, + "duration": { + "name": "constant.numeric.duration.jdg", + "match": "\\b-?\\d+(?:\\.\\d+)?(?:ms|s|m|h)\\b" + }, + "number": { + "name": "constant.numeric.jdg", + "match": "\\b-?\\d+(?:\\.\\d+)?\\b" + }, + "boolean": { + "name": "constant.language.boolean.jdg", + "match": "\\b(?:true|false)\\b" + }, + "top-keywords": { + "name": "keyword.control.jdg", + "match": "\\b(?:build|build_linux|build_windows|build_darwin|binary|timeout|normalize_crlf|trim_trailing_ws|group|test|pattern|env|file|outFile)\\b" + }, + "block-keywords": { + "name": "variable.parameter.jdg", + "match": "\\b(?:weight|scoring|wrapper|stdin|stdout|stderr|args|exitCode|input|output|dirs)\\b" + }, + "matcher-keywords": { + "name": "support.function.jdg", + "match": "\\b(?:contains|matches|anyOrder|of)\\b" + }, + "scoring-values": { + "name": "constant.language.jdg", + "match": "\\b(?:partial|all_or_none)\\b" + }, + "operators": { + "name": "keyword.operator.jdg", + "match": "[=~]" + }, + "braces": { + "name": "punctuation.section.braces.jdg", + "match": "[{}()]" + }, + "identifier": { + "name": "variable.other.jdg", + "match": "\\b[A-Za-z_][A-Za-z0-9_]*\\b" + } + } +} diff --git a/example/c-sum/sum.jdg b/example/c-sum/sum.jdg index 375d639..95494e9 100644 --- a/example/c-sum/sum.jdg +++ b/example/c-sum/sum.jdg @@ -8,7 +8,6 @@ // Under MSVC on CI we use build_windows (cl's CLI is different). build "$CC -O2 -std=c11 -Wall -Wextra solution.c -o solution" -build_windows "cl /nologo /O2 /W3 solution.c /Fe:solution.exe" binary = "solution" timeout 5s