Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ git clone git@github.com:ssm-lang/vscode-sslang.git $HOME/.vscode/extensions/vsc

## Extension Settings

No extension settings.
No extension settings.

## Contributing

VS Code can only load json grammars, but yaml is easier to work with (more concise; has regular expressions, comments and multi-line strings). Therefore, we generate `syntaxes/sslang.tmLanguage.json` from `syntaxes/sslang.tmLanguage.yaml`.

The generation of the json grammar can be done by calling `./build-grammar.sh`.
10 changes: 10 additions & 0 deletions build-grammar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

if ! command -v npx &> /dev/null; then
echo "'npm' is required to run this script."
exit
fi

npx js-yaml syntaxes/sslang.tmLanguage.yaml > syntaxes/sslang.tmLanguage.json
70 changes: 56 additions & 14 deletions language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,70 @@
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "/*", "*/" ]
"blockComment": [
"/*",
"*/"
]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
],
[
"\"",
"\""
],
[
"'",
"'"
]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
],
[
"\"",
"\""
],
[
"'",
"'"
]
]
}
37 changes: 25 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@
"Programming Languages"
],
"contributes": {
"languages": [{
"id": "sslang",
"aliases": ["sslang", "sslang"],
"extensions": [".ssl"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "sslang",
"scopeName": "source.sslang",
"path": "./syntaxes/sslang.tmLanguage.json"
}]
"languages": [
{
"id": "sslang",
"aliases": [
"sslang",
"sslang"
],
"extensions": [
".ssl"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "sslang",
"scopeName": "source.sslang",
"path": "./syntaxes/sslang.tmLanguage.json",
"embeddedLanguages": {
"meta.embedded.block.c": "c",
"meta.embedded.inline.c": "c"
}
}
]
}
}
}
Loading