yeah looks like it misses some of the escape chars as well
I think this has something to do with conceal levels
Here’s the internal “components” tree for that regexp:
local regexp_string = [[@scope\/(.*)\.(?<extension>graphql|(?:t|j|cs)s)";?]]
local components = { {
text = "@scope\\/",
type = "pattern_character"
}, {
capture_group = 1,
children = { {
children = { {
children = { {
text = ".",
type = "any_character",
zero_or_more = true
} },
text = ".*",
type = "term"
} },
text = ".*",
type = "pattern"
} },
depth = 1,
text = "(.*)",
type = "anonymous_capturing_group"
}, {
text = "\\.",
type = "identity_escape"
}, {
capture_group = 2,
children = { {
children = { {
children = { {
children = { {
text = "graphql",
type = "pattern_character"
} },
text = "graphql",
type = "term"
}, {
children = { {
children = { {
children = { {
children = { {
children = { {
text = "t",
type = "pattern_character"
} },
text = "t",
type = "term"
}, {
children = { {
text = "j",
type = "pattern_character"
} },
text = "j",
type = "term"
}, {
children = { {
text = "cs",
type = "pattern_character"
} },
text = "cs",
type = "term"
} },
text = "t|j|cs",
type = "alternation"
} },
text = "t|j|cs",
type = "pattern"
} },
depth = 1,
text = "(?:t|j|cs)",
type = "non_capturing_group"
}, {
text = "s",
type = "pattern_character"
} },
text = "(?:t|j|cs)s",
type = "term"
} },
text = "graphql|(?:t|j|cs)s",
type = "alternation"
} },
text = "graphql|(?:t|j|cs)s",
type = "pattern"
} },
depth = 1,
group_name = "extension",
text = "(?<extension>graphql|(?:t|j|cs)s)",
type = "named_capturing_group"
}, {
text = '"',
type = "pattern_character"
}, {
optional = true,
text = ";",
type = "pattern_character"
} }
or folded up for readability:
We’re missing the escaped \/
after the first capture group, and indeed the pattern_character s
following the non-capturing group (?:t|j|cs)