Format
This commit is contained in:
parent
134c767484
commit
908a7bda9a
|
|
@ -12,7 +12,7 @@ function wait_highlight(...args) {
|
|||
try {
|
||||
const subChannel = new MessageChannel();
|
||||
worker.postMessage({ signal, port: subChannel.port1, args }, [
|
||||
subChannel.port1
|
||||
subChannel.port1,
|
||||
]);
|
||||
Atomics.wait(signal, 0, 0);
|
||||
return receiveMessageOnPort(subChannel.port2).message.result;
|
||||
|
|
|
|||
|
|
@ -3,19 +3,17 @@ const shiki = require("shiki");
|
|||
const path = require("path");
|
||||
|
||||
async function shiki_highlight(code, lang) {
|
||||
const highlighter = await
|
||||
shiki
|
||||
.getHighlighter({
|
||||
theme: 'nord',
|
||||
langs: [
|
||||
{
|
||||
id: "kdl",
|
||||
scopeName: "source.kdl",
|
||||
path: path.join(process.cwd(), "kdl.tmLanguage.json")
|
||||
}
|
||||
]
|
||||
})
|
||||
return highlighter.codeToHtml(code, lang)
|
||||
const highlighter = await shiki.getHighlighter({
|
||||
theme: "nord",
|
||||
langs: [
|
||||
{
|
||||
id: "kdl",
|
||||
scopeName: "source.kdl",
|
||||
path: path.join(process.cwd(), "kdl.tmLanguage.json"),
|
||||
},
|
||||
],
|
||||
});
|
||||
return highlighter.codeToHtml(code, lang);
|
||||
}
|
||||
|
||||
parentPort.addListener("message", async ({ signal, port, args }) => {
|
||||
|
|
@ -25,9 +23,9 @@ parentPort.addListener("message", async ({ signal, port, args }) => {
|
|||
// Post the result to the main thread before unlocking "signal"
|
||||
port.postMessage({ result });
|
||||
port.close();
|
||||
|
||||
|
||||
// Change the value of signal[0] to 1
|
||||
Atomics.store(signal, 0, 1);
|
||||
// This will unlock the main thread when we notify it
|
||||
Atomics.notify(signal, 0);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,45 +1,45 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"comment":"Some of these patterns are taken straight from rust-analyzer: https://github.com/rust-lang/vscode-rust/blob/master/rust-analyzer/editors/code/rust.tmGrammar.json. Some was also taken from https://github.com/arm32x/vscode-sdlang/blob/master/syntaxes/sdlang.tmLanguage.json",
|
||||
"name": "KDL",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#null"
|
||||
},
|
||||
{
|
||||
"include": "#boolean"
|
||||
},
|
||||
{
|
||||
"include": "#float_fraction"
|
||||
},
|
||||
{
|
||||
"include": "#float_exp"
|
||||
},
|
||||
{
|
||||
"include": "#decimal"
|
||||
},
|
||||
{
|
||||
"include": "#hexadecimal"
|
||||
},
|
||||
{
|
||||
"include": "#octal"
|
||||
},
|
||||
{
|
||||
"include": "#binary"
|
||||
},
|
||||
{
|
||||
"include": "#raw-strings"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#block_comment"
|
||||
},
|
||||
{
|
||||
"include": "#block_doc_comment"
|
||||
},
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"comment": "Some of these patterns are taken straight from rust-analyzer: https://github.com/rust-lang/vscode-rust/blob/master/rust-analyzer/editors/code/rust.tmGrammar.json. Some was also taken from https://github.com/arm32x/vscode-sdlang/blob/master/syntaxes/sdlang.tmLanguage.json",
|
||||
"name": "KDL",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#null"
|
||||
},
|
||||
{
|
||||
"include": "#boolean"
|
||||
},
|
||||
{
|
||||
"include": "#float_fraction"
|
||||
},
|
||||
{
|
||||
"include": "#float_exp"
|
||||
},
|
||||
{
|
||||
"include": "#decimal"
|
||||
},
|
||||
{
|
||||
"include": "#hexadecimal"
|
||||
},
|
||||
{
|
||||
"include": "#octal"
|
||||
},
|
||||
{
|
||||
"include": "#binary"
|
||||
},
|
||||
{
|
||||
"include": "#raw-strings"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#block_comment"
|
||||
},
|
||||
{
|
||||
"include": "#block_doc_comment"
|
||||
},
|
||||
{
|
||||
"include": "#slashdash_block_comment"
|
||||
},
|
||||
{
|
||||
|
|
@ -48,119 +48,119 @@
|
|||
{
|
||||
"include": "#slashdash_node_comment"
|
||||
},
|
||||
{
|
||||
"include": "#line_comment"
|
||||
},
|
||||
{
|
||||
"include": "#attribute"
|
||||
},
|
||||
{
|
||||
"include": "#node_name"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"float_fraction": {
|
||||
"comment": "Floating point literal (fraction)",
|
||||
"name": "constant.numeric.float.rust",
|
||||
"match": "\\b([0-9\\-\\+]|\\-|\\+)[0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?\\b"
|
||||
},
|
||||
"float_exp": {
|
||||
"comment": "Floating point literal (exponent)",
|
||||
"name": "constant.numeric.float.rust",
|
||||
"match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+\\b"
|
||||
},
|
||||
"decimal": {
|
||||
"comment": "Integer literal (decimal)",
|
||||
"name": "constant.numeric.integer.decimal.rust",
|
||||
"match": "\\b[0-9\\-\\+][0-9_]*\\b"
|
||||
},
|
||||
"hexadecimal": {
|
||||
"comment": "Integer literal (hexadecimal)",
|
||||
"name": "constant.numeric.integer.hexadecimal.rust",
|
||||
"match": "\\b0x[a-fA-F0-9_]+\\b"
|
||||
},
|
||||
"octal": {
|
||||
"comment": "Integer literal (octal)",
|
||||
"name": "constant.numeric.integer.octal.rust",
|
||||
"match": "\\b0o[0-7_]+\\b"
|
||||
},
|
||||
"binary": {
|
||||
"comment": "Integer literal (binary)",
|
||||
"name": "constant.numeric.integer.binary.rust",
|
||||
"match": "\\b0b[01_]+\\b"
|
||||
},
|
||||
"node_name": {
|
||||
"name": "entity.name.tag",
|
||||
"match": "(?![\\\\{\\}<>;\\[\\]\\=,])[\\w\\-_~!@#\\$%^&*+|/.\\(\\)]+"
|
||||
},
|
||||
"attribute": {
|
||||
"name": "entity.other.attribute-name.kdl",
|
||||
"match": "(?![\\\\{\\}<>;\\[\\]\\=,])[\\w\\-_~!@#\\$%^&*+|/.]+(=)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.separator.key-value.kdl"
|
||||
}
|
||||
}
|
||||
},
|
||||
"null": {
|
||||
"name": "constant.language.null.kdl",
|
||||
"match": "\\bnull\\b"
|
||||
},
|
||||
"boolean": {
|
||||
"name": "constant.language.boolean.kdl",
|
||||
"match": "\\b(true|false)\\b"
|
||||
},
|
||||
"strings": {
|
||||
"name": "string.quoted.double.kdl",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.kdl",
|
||||
"match": "\\\\(:?[nrtbf\\\\\"]|u\\{[a-fA-F0-9]{1,6}\\})"
|
||||
}
|
||||
]
|
||||
},
|
||||
"raw-strings": {
|
||||
"name": "string.quoted.double.raw.kdl",
|
||||
"begin": "b?r(#*)\"",
|
||||
"end": "\"\\1"
|
||||
},
|
||||
"block_doc_comment": {
|
||||
"comment": "Block documentation comment",
|
||||
"name": "comment.block.documentation.kdl",
|
||||
"begin": "/\\*[\\*!](?![\\*/])",
|
||||
"end": "\\*/",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_doc_comment"
|
||||
},
|
||||
{
|
||||
"include": "#block_comment"
|
||||
}
|
||||
]
|
||||
},
|
||||
"block_comment": {
|
||||
"comment": "Block comment",
|
||||
"name": "comment.block.kdl",
|
||||
"begin": "/\\*",
|
||||
"end": "\\*/",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_doc_comment"
|
||||
},
|
||||
{
|
||||
"include": "#block_comment"
|
||||
}
|
||||
]
|
||||
},
|
||||
"line_comment": {
|
||||
"comment": "Single-line comment",
|
||||
"name": "comment.line.double-slash.rust",
|
||||
"begin": "//",
|
||||
"end": "$"
|
||||
},
|
||||
"slashdash_comment": {
|
||||
{
|
||||
"include": "#line_comment"
|
||||
},
|
||||
{
|
||||
"include": "#attribute"
|
||||
},
|
||||
{
|
||||
"include": "#node_name"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"float_fraction": {
|
||||
"comment": "Floating point literal (fraction)",
|
||||
"name": "constant.numeric.float.rust",
|
||||
"match": "\\b([0-9\\-\\+]|\\-|\\+)[0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?\\b"
|
||||
},
|
||||
"float_exp": {
|
||||
"comment": "Floating point literal (exponent)",
|
||||
"name": "constant.numeric.float.rust",
|
||||
"match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+\\b"
|
||||
},
|
||||
"decimal": {
|
||||
"comment": "Integer literal (decimal)",
|
||||
"name": "constant.numeric.integer.decimal.rust",
|
||||
"match": "\\b[0-9\\-\\+][0-9_]*\\b"
|
||||
},
|
||||
"hexadecimal": {
|
||||
"comment": "Integer literal (hexadecimal)",
|
||||
"name": "constant.numeric.integer.hexadecimal.rust",
|
||||
"match": "\\b0x[a-fA-F0-9_]+\\b"
|
||||
},
|
||||
"octal": {
|
||||
"comment": "Integer literal (octal)",
|
||||
"name": "constant.numeric.integer.octal.rust",
|
||||
"match": "\\b0o[0-7_]+\\b"
|
||||
},
|
||||
"binary": {
|
||||
"comment": "Integer literal (binary)",
|
||||
"name": "constant.numeric.integer.binary.rust",
|
||||
"match": "\\b0b[01_]+\\b"
|
||||
},
|
||||
"node_name": {
|
||||
"name": "entity.name.tag",
|
||||
"match": "(?![\\\\{\\}<>;\\[\\]\\=,])[\\w\\-_~!@#\\$%^&*+|/.\\(\\)]+"
|
||||
},
|
||||
"attribute": {
|
||||
"name": "entity.other.attribute-name.kdl",
|
||||
"match": "(?![\\\\{\\}<>;\\[\\]\\=,])[\\w\\-_~!@#\\$%^&*+|/.]+(=)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.separator.key-value.kdl"
|
||||
}
|
||||
}
|
||||
},
|
||||
"null": {
|
||||
"name": "constant.language.null.kdl",
|
||||
"match": "\\bnull\\b"
|
||||
},
|
||||
"boolean": {
|
||||
"name": "constant.language.boolean.kdl",
|
||||
"match": "\\b(true|false)\\b"
|
||||
},
|
||||
"strings": {
|
||||
"name": "string.quoted.double.kdl",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.kdl",
|
||||
"match": "\\\\(:?[nrtbf\\\\\"]|u\\{[a-fA-F0-9]{1,6}\\})"
|
||||
}
|
||||
]
|
||||
},
|
||||
"raw-strings": {
|
||||
"name": "string.quoted.double.raw.kdl",
|
||||
"begin": "b?r(#*)\"",
|
||||
"end": "\"\\1"
|
||||
},
|
||||
"block_doc_comment": {
|
||||
"comment": "Block documentation comment",
|
||||
"name": "comment.block.documentation.kdl",
|
||||
"begin": "/\\*[\\*!](?![\\*/])",
|
||||
"end": "\\*/",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_doc_comment"
|
||||
},
|
||||
{
|
||||
"include": "#block_comment"
|
||||
}
|
||||
]
|
||||
},
|
||||
"block_comment": {
|
||||
"comment": "Block comment",
|
||||
"name": "comment.block.kdl",
|
||||
"begin": "/\\*",
|
||||
"end": "\\*/",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_doc_comment"
|
||||
},
|
||||
{
|
||||
"include": "#block_comment"
|
||||
}
|
||||
]
|
||||
},
|
||||
"line_comment": {
|
||||
"comment": "Single-line comment",
|
||||
"name": "comment.line.double-slash.rust",
|
||||
"begin": "//",
|
||||
"end": "$"
|
||||
},
|
||||
"slashdash_comment": {
|
||||
"name": "comment.line.double-slash",
|
||||
"comment": "Slashdash inline comment",
|
||||
"begin": "(?<!^)/-",
|
||||
|
|
@ -178,6 +178,6 @@
|
|||
"begin": "/-{",
|
||||
"end": "}"
|
||||
}
|
||||
},
|
||||
"scopeName": "source.kdl"
|
||||
}
|
||||
},
|
||||
"scopeName": "source.kdl"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue