Skip to content

Commit f1a8ed9

Browse files
committed
feat(editor): add initial VS Code syntax highlighting for OrgScript
1 parent 40ed88e commit f1a8ed9

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

editors/vscode/.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch OrgScript Extension",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"runtimeExecutable": "${execPath}",
9+
"args": [
10+
"--extensionDevelopmentPath=${workspaceFolder}"
11+
],
12+
"outFiles": []
13+
}
14+
]
15+
}

editors/vscode/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This folder contains a locally testable VS Code extension for `.orgs` files.
77
- `package.json` registers the `OrgScript` language with language id `orgscript`
88
- `syntaxes/orgscript.tmLanguage.json` provides TextMate-based syntax highlighting
99
- `language-configuration.json` adds lightweight editor behavior for double-quoted strings
10+
- `.vscode/launch.json` provides an Extension Development Host launch target for F5 testing
1011

1112
## What is highlighted
1213

@@ -30,6 +31,7 @@ OrgScript does not define an official comment syntax in the language spec yet, s
3031
- `examples/order-approval.orgs`
3132
- `examples/service-escalation.orgs`
3233
5. Confirm that the language mode is `OrgScript` and that blocks, statements, strings, operators, and dotted references are highlighted.
34+
6. If VS Code asks for a launch configuration, use `Launch OrgScript Extension` from `editors/vscode/.vscode/launch.json`.
3335

3436
## Good demo files
3537

editors/vscode/language-configuration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
"\""
1515
]
1616
],
17-
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\s\\[\\]{}()<>=\"'`~!@#$%^&*+,.;:/?|\\\\]+)"
17+
"wordPattern": "([A-Za-z_][A-Za-z0-9_.-]*)|(-?\\d+(?:\\.\\d+)?)"
1818
}

editors/vscode/syntaxes/orgscript.tmLanguage.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@
7272
},
7373
"control-keywords": {
7474
"patterns": [
75+
{
76+
"match": "^(\\s*)(else)(\\s+)(if)\\b",
77+
"captures": {
78+
"2": {
79+
"name": "keyword.control.orgscript"
80+
},
81+
"4": {
82+
"name": "keyword.control.orgscript"
83+
}
84+
}
85+
},
7586
{
7687
"match": "^(\\s*)(if|when|then|else)\\b",
7788
"captures": {

0 commit comments

Comments
 (0)