hljs refinements

This commit is contained in:
LenAnderson 2024-07-23 16:51:53 -04:00
parent 8df6353725
commit 590e1e39d8
2 changed files with 34 additions and 6 deletions

View File

@ -244,9 +244,11 @@ export class SlashCommandParser {
contains: [], contains: [],
}; };
const ABORT = { const ABORT = {
scope: 'abort',
begin: /\/(abort|breakpoint)/, begin: /\/(abort|breakpoint)/,
end: /\||$|:}/, beginScope: 'abort',
end: /\||$|(?=:})/,
excludeEnd: false,
returnEnd: true,
contains: [], contains: [],
}; };
const IMPORT = { const IMPORT = {
@ -258,6 +260,15 @@ export class SlashCommandParser {
returnEnd: true, returnEnd: true,
contains: [], contains: [],
}; };
const BREAK = {
scope: 'command',
begin: /\/(break)/,
beginScope: 'keyword',
end: /\||$|(?=:})/,
excludeEnd: false,
returnEnd: true,
contains: [],
};
const LET = { const LET = {
begin: [ begin: [
/\/(let|var)\s+/, /\/(let|var)\s+/,
@ -290,6 +301,7 @@ export class SlashCommandParser {
match: [ match: [
/\/:/, /\/:/,
getQuotedRunRegex(), getQuotedRunRegex(),
/\||$|(?=:})/,
], ],
className: { className: {
1: 'variable.language', 1: 'variable.language',
@ -353,6 +365,14 @@ export class SlashCommandParser {
CLOSURE, CLOSURE,
hljs.QUOTE_STRING_MODE, hljs.QUOTE_STRING_MODE,
); );
BREAK.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,
@ -377,6 +397,14 @@ export class SlashCommandParser {
MACRO, MACRO,
CLOSURE, CLOSURE,
); );
ABORT.contains.push(
hljs.BACKSLASH_ESCAPE,
NAMED_ARG,
NUMBER,
MACRO,
CLOSURE,
hljs.QUOTE_STRING_MODE,
);
COMMAND.contains.push( COMMAND.contains.push(
hljs.BACKSLASH_ESCAPE, hljs.BACKSLASH_ESCAPE,
NAMED_ARG, NAMED_ARG,
@ -391,6 +419,7 @@ export class SlashCommandParser {
COMMENT, COMMENT,
ABORT, ABORT,
IMPORT, IMPORT,
BREAK,
NAMED_ARG, NAMED_ARG,
NUMBER, NUMBER,
MACRO, MACRO,
@ -413,6 +442,7 @@ export class SlashCommandParser {
COMMENT, COMMENT,
ABORT, ABORT,
IMPORT, IMPORT,
BREAK,
RUN, RUN,
LET, LET,
GETVAR, GETVAR,

View File

@ -1567,20 +1567,18 @@ body[data-stscript-style] .hljs.language-stscript {
color: var(--ac-style-color-punctuation); color: var(--ac-style-color-punctuation);
} }
.hljs-keyword {
color: var(--ac-style-color-variableLanguage);
}
.hljs-comment { .hljs-comment {
color: var(--ac-style-color-comment); color: var(--ac-style-color-comment);
} }
.hljs-abort { .hljs-abort {
color: var(--ac-style-color-abort, #e38e23); color: var(--ac-style-color-abort, #e38e23);
font-weight: bold;
} }
.hljs-keyword { .hljs-keyword {
color: var(--ac-style-color-keyword); color: var(--ac-style-color-keyword);
font-weight: bold;
} }
.hljs-pipe { .hljs-pipe {