Fix candidate detection regex

This commit is contained in:
Jordan Pittman 2023-12-04 11:23:33 -05:00
parent 6dfcdd1007
commit d2bb6f1bd0

View file

@ -47,7 +47,12 @@ function* buildRegExps(context) {
regex.any([
regex.pattern([
// Arbitrary values
/-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/,
regex.any([
/-(?:\w+-)*\['[^\s]+'\]/,
/-(?:\w+-)*\["[^\s]+"\]/,
/-(?:\w+-)*\[`[^\s]+`\]/,
/-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/,
]),
// Not immediately followed by an `{[(`
/(?![{([]])/,
@ -58,7 +63,12 @@ function* buildRegExps(context) {
regex.pattern([
// Arbitrary values
/-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/,
regex.any([
/-(?:\w+-)*\['[^\s]+'\]/,
/-(?:\w+-)*\["[^\s]+"\]/,
/-(?:\w+-)*\[`[^\s]+`\]/,
/-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s\[\]]+\]/,
]),
// Not immediately followed by an `{[(`
/(?![{([]])/,