Skip to content

Vue Issues #43

Closed
Closed

Description

@RedCMD

raw-style-less-inline is not needed as raw-style-less-inline-ml can cover the exact same code and more

monogram/vue.tmLanguage.json

Lines 2201 to 2239 in 70a8019

"raw-style-less-inline": {
"name": "meta.style.vue",
"match": "(<)([Ss][Tt][Yy][Ll][Ee])\\b([^>]*\\blang\\s*=\\s*[\"']less[\"'][^>]*)(>)(.*?)(</)([Ss][Tt][Yy][Ll][Ee])\\s*(>)",
"captures": {
"1": {
"name": "punctuation.definition.tag.begin.vue"
},
"2": {
"name": "entity.name.tag.vue"
},
"3": {
"patterns": [
{
"include": "#attribute"
}
]
},
"4": {
"name": "punctuation.definition.tag.end.vue"
},
"5": {
"name": "source.css.less",
"patterns": [
{
"include": "source.css.less"
}
]
},
"6": {
"name": "punctuation.definition.tag.begin.vue"
},
"7": {
"name": "entity.name.tag.vue"
},
"8": {
"name": "punctuation.definition.tag.end.vue"
}
}
},


raw-style-less-close will never match
since raw-style-scss-close is the exact same regex and is matched first

raw-style-less and raw-style-less-close need to be combined into a single (nested) rule to work correctly

monogram/vue.tmLanguage.json

Lines 2282 to 2333 in 70a8019

"raw-style-less": {
"name": "meta.style.vue",
"begin": "(<)([Ss][Tt][Yy][Ll][Ee])\\b([^>]*\\blang\\s*=\\s*[\"']less[\"'][^>]*)(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.vue"
},
"2": {
"name": "entity.name.tag.vue"
},
"3": {
"patterns": [
{
"include": "#attribute"
}
]
},
"4": {
"name": "punctuation.definition.tag.end.vue"
}
},
"while": "^(?!.*</[Ss][Tt][Yy][Ll][Ee](?:[\\s>]|$))",
"contentName": "source.css.less",
"patterns": [
{
"include": "source.css.less"
}
]
},
"raw-style-less-close": {
"name": "meta.style.vue",
"match": "^(\\s*)((?:(?!<[Ss][Tt][Yy][Ll][Ee]\\b).)+?)(</)([Ss][Tt][Yy][Ll][Ee])\\s*(>)",
"captures": {
"2": {
"name": "source.css.less",
"patterns": [
{
"include": "source.css.less"
}
]
},
"3": {
"name": "punctuation.definition.tag.begin.vue"
},
"4": {
"name": "entity.name.tag.vue"
},
"5": {
"name": "punctuation.definition.tag.end.vue"
}
}
},


raw-style-less-close is not needed as raw-style-less-close-ml can cover the exact same code and more


[Ss][Tt][Yy][Ll][Ee] can be replaced with (?i:style)
I remember seeing one of your commits say why you chose this decision
tho I don't remember the reason


[\"']less[\"'] matches the incorrect string "less' and 'less"


all issues are present in all raw embedded languages

Activity

  1. johnsoncodehk commented on Jun 15, 2026

    @johnsoncodehk
    Owner

    On the [Ss][Tt][Yy][Ll][Ee] → (?i:style) suggestion — keeping the per-character class is deliberate, and it's a correctness choice (the old code comment that framed it as byte-thrift was wrong; fixed).

    (?i:) in (vscode-)oniguruma applies full Unicode case-folding, so it over-matches non-ASCII case-equivalents:

    • (?i:style) matches ſtyle — U+017F LATIN SMALL LETTER LONG S folds to s
    • (?i:k) matches U+212A KELVIN SIGN, etc.

    HTML tag-name matching is ASCII-case-insensitive only (the spec ASCII-lowercases names, and our lexer folds via .toLowerCase(), which leaves ſ unchanged). So (?i:style) would treat <ſtyle> as a style element and embed CSS, whereas [Ss][Tt][Yy][Ll][Ee] matches exactly the ASCII set the lexer folds — keeping the highlighter consistent with the parser by construction. That's why it stays.

    Everything else in this issue is fixed (#48): the duplicate/shadowed raw-embed close rules are deduped to one lang-independent rule, the back-referenced lang quote already rejects "less', and the -inline/-close pairs are complementary (>-on-line vs deferred->) rather than redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions