Fallback for old safari

This commit is contained in:
Cohee
2024-05-14 23:28:52 +03:00
parent caf236d60a
commit 1dec93de8a

View File

@ -186,6 +186,15 @@ export class SlashCommandParser {
relevance: 0, relevance: 0,
}; };
function getQuotedRunRegex() {
try {
return new RegExp('(".+?(?<!\\\\)")|(\\S+?)');
} catch {
// fallback for browsers that don't support lookbehind
return /(".+?")|(\S+?)/;
}
}
const COMMENT = { const COMMENT = {
scope: 'comment', scope: 'comment',
begin: /\/[/#]/, begin: /\/[/#]/,
@ -225,7 +234,7 @@ export class SlashCommandParser {
const RUN = { const RUN = {
match: [ match: [
/\/:/, /\/:/,
/(".+?(?<!\\)") |(\S+?) /, getQuotedRunRegex(),
], ],
className: { className: {
1: 'variable.language', 1: 'variable.language',