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

View File

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