fixes and improvements for vscode syntax highlighting

This commit is contained in:
adam j hartz 2025-09-30 22:23:33 -04:00
commit 057ce8a518
Signed by: hz
GPG key ID: B63A0A59F5C82493
8 changed files with 57 additions and 79 deletions

3
syntax-highlighting/vscode/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
node_modules
package-lock.json
*.vsix

View file

@ -0,0 +1,2 @@
node_modules/**
.gitignore

View file

@ -3,13 +3,13 @@
This directory contains the source code for an extension that adds syntax
highlighting for `.catsoop` files to VSCodium/VSCode.
* First, you can either download the extension from <https://catsoop.org/_static/catsoop-syntax-0.0.1.vsix> or build it yourself by running the following commands from this directory:
* First, you can either download the extension from <https://catsoop.org/_static/catsoop-syntax-0.0.2.vsix> or build it yourself by running the following commands from this directory:
```
$ npm install -g @vscode/vsce
$ vsce package
$ npm install --no-save @vscode/vsce
$ node_modules/.bin/vsce package
```
* Then you can install the extension in any of three different ways:
* By running `$ code --install-extension catsoop-syntax-0.0.1.vsix`, or
* By running `$ code --install-extension catsoop-syntax-0.0.2.vsix`, or
* By opening that file under Extensions -> Install from VSIX, or
* By dragging that file into the Extensions panel of the editor.

View file

@ -8,32 +8,6 @@
["(", ")"],
["<", ">"]
],
"autoClosingPairs": [
{
"open": "{",
"close": "}"
},
{
"open": "[",
"close": "]"
},
{
"open": "(",
"close": ")"
},
{
"open": "\"",
"close": "\""
},
{
"open": "'",
"close": "'"
},
{
"open": "`",
"close": "`"
}
],
"surroundingPairs": [
["{", "}"],
["[", "]"],

View file

@ -2,7 +2,7 @@
"name": "catsoop-syntax",
"displayName": "CAT-SOOP",
"description": "Syntax highlighting for .catsoop files",
"version": "0.0.1",
"version": "0.0.2",
"engines": {
"vscode": "^1.0.0"
},
@ -23,7 +23,22 @@
{
"language": "catsoop",
"scopeName": "text.html.markdown.catsoop",
"path": "./syntaxes/catsoop.tmLanguage.json"
"path": "./syntaxes/catsoop.tmLanguage.json",
"embeddedLanguages": {
"meta.embedded.block.python.catsoop": "python",
"meta.embedded.block.python.catsoop.question": "python"
}
},
{
"scopeName": "catsoop.inline",
"path": "./syntaxes/catsoop-injections.tmLanguage.json",
"injectTo": [
"text.html.markdown",
"text.html.markdown.catsoop"
],
"embeddedLanguages": {
"meta.embedded.inline.pytohn.catsoop": "python"
}
}
]
},

View file

@ -0,0 +1,30 @@
{
"fileTypes": [],
"scopeName": "catsoop.inline",
"injectionSelector": "L:(meta.paragraph.markdown | text.html) - (comment, string, meta.embedded.inline.python.catsoop, markup.fenced_code.block.markdown)",
"patterns": [
{ "include": "#python-inline" },
{ "include": "#comment-inline" }
],
"repository": {
"python-inline": {
"name": "meta.embedded.inline.python.catsoop",
"match": "(?<!\\\\)(@)((?:%[\\\\#0\\- +]*\\d*(?:\\.\\d+)?[hlL]?[diouxXeEfFgGcrs]|[\\\\#0\\- +]*\\d*(?:\\.\\d+)?[hlL]?[diouxXeEfFgGcrs])?)(\\{)(.+?)(\\})",
"captures": {
"1": { "name": "variable.other.source.begin.python" },
"2": { "name": "variable.other.format.printf" },
"3": { "name": "punctuation.section.braces.begin" },
"4": {
"name": "meta.embedded.inline.python.catsoop.body",
"patterns": [{ "include": "source.python" }]
},
"5": { "name": "punctuation.section.braces.end" }
}
},
"comment-inline": {
"name": "comment.inline.catsoop",
"match": "(<comment>.*</comment>)",
"captures": { "1": { "name": "comment.inline.catsoop" } }
}
}
}

View file

@ -11,12 +11,6 @@
{
"include": "#question-blocks"
},
{
"include": "#python-inline"
},
{
"include": "#latex-display-math"
},
{
"include": "text.html.markdown"
}
@ -70,7 +64,7 @@
]
},
"question-blocks": {
"name": "meta.embedded.block.python.question.catsoop",
"name": "meta.embedded.block.python.catsoop.question",
"begin": "(<)(question)\\s+([^>]*)(>)",
"beginCaptures": {
"1": {
@ -108,46 +102,6 @@
"include": "source.python"
}
]
},
"python-inline": {
"name": "meta.embedded.inline.python.catsoop",
"begin": "@\\{",
"beginCaptures": {
"0": {
"name": "punctuation.section.embedded.begin.catsoop"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.section.embedded.end.catsoop"
}
},
"patterns": [
{
"include": "source.python"
}
]
},
"latex-display-math": {
"name": "meta.embedded.block.latex.math.catsoop",
"begin": "\\$\\$",
"beginCaptures": {
"0": {
"name": "punctuation.definition.math.begin.latex"
}
},
"end": "\\$\\$",
"endCaptures": {
"0": {
"name": "punctuation.definition.math.end.latex"
}
},
"patterns": [
{
"include": "text.tex.latex#math"
}
]
}
}
}

Binary file not shown.