add syntax highlight for /import

This commit is contained in:
LenAnderson 2024-07-12 14:09:05 -04:00
parent 685e31b214
commit b74600605c
2 changed files with 26 additions and 0 deletions

View File

@ -243,6 +243,14 @@ export class SlashCommandParser {
end: /\||$|:}/, end: /\||$|:}/,
contains: [], contains: [],
}; };
const KEYWORD = {
scope: 'command',
begin: /\/(import)/,
beginScope: 'keyword',
end: /\||$|(?=:})/,
excludeEnd: true,
contains: [],
};
const LET = { const LET = {
begin: [ begin: [
/\/(let|var)\s+/, /\/(let|var)\s+/,
@ -312,6 +320,14 @@ export class SlashCommandParser {
MACRO, MACRO,
CLOSURE, CLOSURE,
); );
KEYWORD.contains.push(
hljs.BACKSLASH_ESCAPE,
NAMED_ARG,
NUMBER,
MACRO,
CLOSURE,
hljs.QUOTE_STRING_MODE,
);
LET.contains.push( LET.contains.push(
hljs.BACKSLASH_ESCAPE, hljs.BACKSLASH_ESCAPE,
NAMED_ARG, NAMED_ARG,
@ -348,6 +364,7 @@ export class SlashCommandParser {
hljs.BACKSLASH_ESCAPE, hljs.BACKSLASH_ESCAPE,
COMMENT, COMMENT,
ABORT, ABORT,
KEYWORD,
NAMED_ARG, NAMED_ARG,
NUMBER, NUMBER,
MACRO, MACRO,
@ -366,6 +383,7 @@ export class SlashCommandParser {
hljs.BACKSLASH_ESCAPE, hljs.BACKSLASH_ESCAPE,
COMMENT, COMMENT,
ABORT, ABORT,
KEYWORD,
RUN, RUN,
LET, LET,
GETVAR, GETVAR,

View File

@ -1392,6 +1392,7 @@ body[data-stscript-style="dark"] {
--ac-style-color-punctuationL2: rgba(98 160 251 / 1); --ac-style-color-punctuationL2: rgba(98 160 251 / 1);
--ac-style-color-currentParenthesis: rgba(195 118 210 / 1); --ac-style-color-currentParenthesis: rgba(195 118 210 / 1);
--ac-style-color-comment: rgba(122 151 90 / 1); --ac-style-color-comment: rgba(122 151 90 / 1);
--ac-style-color-keyword: rgba(182 137 190 / 1);
} }
body[data-stscript-style="light"] { body[data-stscript-style="light"] {
@ -1413,6 +1414,7 @@ body[data-stscript-style="light"] {
--ac-style-color-variable: rgba(16 24 125 / 1); --ac-style-color-variable: rgba(16 24 125 / 1);
--ac-style-color-currentParenthesis: rgba(195 118 210 / 1); --ac-style-color-currentParenthesis: rgba(195 118 210 / 1);
--ac-style-color-comment: rgba(70 126 26 / 1); --ac-style-color-comment: rgba(70 126 26 / 1);
--ac-style-color-keyword: rgba(182 137 190 / 1);
} }
body[data-stscript-style="theme"] { body[data-stscript-style="theme"] {
@ -1433,6 +1435,7 @@ body[data-stscript-style="theme"] {
--ac-style-color-variable: rgba(131 193 252 / 1); --ac-style-color-variable: rgba(131 193 252 / 1);
--ac-style-color-currentParenthesis: rgba(195 118 210 / 1); --ac-style-color-currentParenthesis: rgba(195 118 210 / 1);
--ac-style-color-comment: rgba(122 151 90 / 1); --ac-style-color-comment: rgba(122 151 90 / 1);
--ac-style-color-keyword: rgba(182 137 190 / 1);
} }
body { body {
@ -1463,6 +1466,7 @@ body {
--ac-color-punctuationL2: var(--ac-style-color-punctuationL2, rgba(98 160 251 / 1)); --ac-color-punctuationL2: var(--ac-style-color-punctuationL2, rgba(98 160 251 / 1));
--ac-color-currentParenthesis: var(--ac-style-color-currentParenthesis, rgba(195 118 210 / 1)); --ac-color-currentParenthesis: var(--ac-style-color-currentParenthesis, rgba(195 118 210 / 1));
--ac-color-comment: var(--ac-style-color-comment, rgba(122 151 90 / 1)); --ac-color-comment: var(--ac-style-color-comment, rgba(122 151 90 / 1));
--ac-color-keyword: var(--ac-style-color-keyword, rgba(182 137 190 / 1));
font-size: calc(var(--ac-font-scale) * 1em); font-size: calc(var(--ac-font-scale) * 1em);
@ -1575,6 +1579,10 @@ body[data-stscript-style] .hljs.language-stscript {
color: var(--ac-style-color-abort, #e38e23); color: var(--ac-style-color-abort, #e38e23);
} }
.hljs-keyword {
color: var(--ac-style-color-keyword);
}
.hljs-closure { .hljs-closure {
>.hljs-punctuation { >.hljs-punctuation {
color: var(--ac-style-color-punctuation); color: var(--ac-style-color-punctuation);