This commit is contained in:
agra
2026-02-12 16:23:42 +02:00
parent 1087bd1977
commit dab162bfe4
13 changed files with 1190 additions and 775 deletions

View File

@@ -28,7 +28,13 @@
{
"language": "sx",
"scopeName": "source.sx",
"path": "./syntaxes/sx.tmLanguage.json"
"path": "./syntaxes/sx.tmLanguage.json",
"embeddedLanguages": {
"meta.embedded.block.glsl": "glsl",
"meta.embedded.block.sql": "sql",
"meta.embedded.block.html": "html",
"meta.embedded.block.json": "json"
}
}
],
"configuration": {
@@ -36,7 +42,7 @@
"properties": {
"sx.lspPath": {
"type": "string",
"default": "sx-lsp",
"default": "sx",
"description": "Path to the sx-lsp binary"
}
}

View File

@@ -12,7 +12,7 @@ let client: LanguageClient;
export function activate(context: ExtensionContext) {
const config = workspace.getConfiguration("sx");
const lspPath = config.get<string>("lspPath", "sx-lsp");
const lspPath = config.get<string>("lspPath", "sx");
const serverOptions: ServerOptions = {
command: lspPath,

View File

@@ -29,6 +29,118 @@
"strings": {
"patterns": [
{
"comment": "#string GLSL heredoc — embedded GLSL highlighting",
"begin": "(#string)\\s+(GLSL|VERT|FRAG|VERTEX|FRAGMENT)\\s*$",
"end": "^(\\2)",
"beginCaptures": {
"1": { "name": "keyword.other.directive.sx" },
"2": { "name": "entity.name.tag.sx" }
},
"endCaptures": {
"1": { "name": "entity.name.tag.sx" }
},
"contentName": "meta.embedded.block.glsl",
"patterns": [
{ "include": "source.glsl" }
]
},
{
"comment": "#string SQL heredoc — embedded SQL highlighting",
"begin": "(#string)\\s+(SQL)\\s*$",
"end": "^(\\2)",
"beginCaptures": {
"1": { "name": "keyword.other.directive.sx" },
"2": { "name": "entity.name.tag.sx" }
},
"endCaptures": {
"1": { "name": "entity.name.tag.sx" }
},
"contentName": "meta.embedded.block.sql",
"patterns": [
{ "include": "source.sql" }
]
},
{
"comment": "#string HTML heredoc — embedded HTML highlighting",
"begin": "(#string)\\s+(HTML)\\s*$",
"end": "^(\\2)",
"beginCaptures": {
"1": { "name": "keyword.other.directive.sx" },
"2": { "name": "entity.name.tag.sx" }
},
"endCaptures": {
"1": { "name": "entity.name.tag.sx" }
},
"contentName": "meta.embedded.block.html",
"patterns": [
{ "include": "text.html.basic" }
]
},
{
"comment": "#string JSON heredoc — embedded JSON highlighting",
"begin": "(#string)\\s+(JSON)\\s*$",
"end": "^(\\2)",
"beginCaptures": {
"1": { "name": "keyword.other.directive.sx" },
"2": { "name": "entity.name.tag.sx" }
},
"endCaptures": {
"1": { "name": "entity.name.tag.sx" }
},
"contentName": "meta.embedded.block.json",
"patterns": [
{ "include": "source.json" }
]
},
{
"comment": "#string heredoc — generic (no embedded language)",
"begin": "(#string)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*$",
"end": "^(\\2)",
"beginCaptures": {
"1": { "name": "keyword.other.directive.sx" },
"2": { "name": "entity.name.tag.sx" }
},
"endCaptures": {
"1": { "name": "entity.name.tag.sx" }
},
"contentName": "string.unquoted.heredoc.sx"
},
{
"comment": "Backtick multi-line string",
"begin": "`",
"end": "`",
"beginCaptures": {
"0": { "name": "punctuation.definition.string.begin.sx" }
},
"endCaptures": {
"0": { "name": "punctuation.definition.string.end.sx" }
},
"patterns": [
{
"name": "constant.character.escape.sx",
"match": "\\\\[ntr`\"\\\\{}0]"
},
{
"begin": "\\{",
"end": "\\}",
"beginCaptures": {
"0": { "name": "punctuation.definition.template-expression.begin.sx" }
},
"endCaptures": {
"0": { "name": "punctuation.definition.template-expression.end.sx" }
},
"patterns": [
{ "include": "$self" }
]
},
{
"name": "string.quoted.other.sx",
"match": "[^`\\\\{}]+"
}
]
},
{
"comment": "Double-quoted string",
"begin": "\"",
"end": "\"",
"beginCaptures": {
@@ -40,7 +152,7 @@
"patterns": [
{
"name": "constant.character.escape.sx",
"match": "\\\\[ntr\"\\\\{}]"
"match": "\\\\[ntr\"\\\\{}0]"
},
{
"begin": "\\{",
@@ -67,7 +179,7 @@
"patterns": [
{
"name": "keyword.other.directive.sx",
"match": "#run"
"match": "#(?:run|import|insert|builtin|foreign|library)\\b"
}
]
},