fix(ide): vscode syntax improvements

This commit is contained in:
Nurul Huda (Apon) 2026-06-11 02:05:28 +06:00
parent 51118f45a4
commit b64c741ad0
No known key found for this signature in database
GPG Key ID: 5D3F1DE2855A2F79
3 changed files with 47 additions and 4 deletions

View File

@ -1,12 +1,12 @@
{
"name": "ziex",
"version": "0.1.678",
"version": "0.1.1140",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ziex",
"version": "0.1.678",
"version": "0.1.1140",
"dependencies": {
"vscode-html-languageservice": "^5.6.0",
"vscode-languageclient": "^9.0.1"

View File

@ -5,8 +5,8 @@
"injectionSelector": "L:(source.zig, source.zx) - string - comment",
"patterns": [
{
"comment": "SQL injection for db/database run/query/exec/prepare",
"begin": "((?:db|database)\\.(?:run|query|exec|prepare))\\s*\\(",
"comment": "SQL injection for db/database query-taking methods (optionally namespaced, e.g. zx.db.run). The first string literal inside the call is the SQL — no preceding argument (allocator, comptime type) is a string, so matching the first string is safe for prepare/run (1st arg), get/all (2nd arg), and row/rows (3rd arg).",
"begin": "((?:\\b[a-zA-Z_][a-zA-Z0-9_]*\\.)?(?:db|database)\\.(?:prepare|run|get|all|row|rows))\\s*\\(",
"beginCaptures": {
"1": {
"name": "support.function.zig"

View File

@ -4,6 +4,9 @@
"scopeName": "source.zx",
"fileTypes": ["zx", "zx"],
"patterns": [
{
"include": "#zig-guards"
},
{
"include": "#zx"
},
@ -12,6 +15,40 @@
}
],
"repository": {
"zig-guards": {
"comment": "Match Zig comments and string literals before #zx so a '<' inside them is never treated as the start of a zx tag (which would otherwise swallow the rest of the file).",
"patterns": [
{
"name": "comment.line.documentation.zig",
"match": "//[!/].*$"
},
{
"name": "comment.line.double-slash.zig",
"match": "//.*$"
},
{
"name": "string.quoted.double.zig",
"begin": "\"",
"end": "\"|(?<!\\\\)(?=$)",
"patterns": [
{
"include": "source.zig#stringcontent"
},
{
"match": "\\\\."
}
]
},
{
"name": "string.quoted.single.zig",
"match": "'(\\\\.|[^'\\\\])'"
},
{
"name": "string.quoted.other.multiline.zig",
"match": "^\\s*\\\\\\\\.*$"
}
]
},
"zx": {
"patterns": [
{
@ -291,6 +328,9 @@
{
"include": "#zig-multiline-string"
},
{
"include": "#zig-guards"
},
{
"include": "#zx"
},
@ -343,6 +383,9 @@
{
"include": "#zig-multiline-string"
},
{
"include": "#zig-guards"
},
{
"include": "#zx"
},