Skip to content

Commit ce7e2b7

Browse files
authored
fix(parse/html): fix disabled vue error message (#9879)
1 parent de6210f commit ce7e2b7

6 files changed

Lines changed: 16 additions & 9 deletions

File tree

.changeset/funny-geese-refuse.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Fixed a parser diagnostic's message when vue syntax is disabled so that it no longer references the non-existant `html.parser.vue` option. This option will become available in 2.5.

crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/upper-case-2.html.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ info: vue/html-vue/upper-case-2.html
6565
```
6666
upper-case-2.html:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6767
68-
× Vue syntax isn't enabled. Is this supposed to be a .vue file?
68+
× Vue syntax isn't enabled. Is this supposed to be a .vue file? HTML-as-Vue is not yet supported.
6969
7070
3 │ <!DOCTYPE html><HTML>
7171
4 │ <body>
@@ -74,7 +74,7 @@ upper-case-2.html:5:12 parse ━━━━━━━━━━━━━━━━━
7474
6 │
7575
7 │ </div>
7676
77-
i Remove it or enable the parsing using the html.parser.vue option.
77+
i Remove it or rename this file to have the .vue file extension.
7878
7979
8080
```

crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/upper-case-html-tag-2.html.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ new Vue({el: '#app'})
5858
```
5959
upper-case-html-tag-2.html:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6060
61-
× Vue syntax isn't enabled. Is this supposed to be a .vue file?
61+
× Vue syntax isn't enabled. Is this supposed to be a .vue file? HTML-as-Vue is not yet supported.
6262
6363
1 │ <!DOCTYPE html><HTML>
6464
2 │ <body>
@@ -67,7 +67,7 @@ upper-case-html-tag-2.html:3:10 parse ━━━━━━━━━━━━━━
6767
4 │
6868
5 │ </div>
6969
70-
i Remove it or enable the parsing using the html.parser.vue option.
70+
i Remove it or rename this file to have the .vue file extension.
7171
7272
7373
```

crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/upper-case-html-tag-4.html.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ info: vue/html-vue/upper-case-html-tag-4.html
5656
```
5757
upper-case-html-tag-4.html:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5858
59-
× Vue syntax isn't enabled. Is this supposed to be a .vue file?
59+
× Vue syntax isn't enabled. Is this supposed to be a .vue file? HTML-as-Vue is not yet supported.
6060
6161
1 │ <hTml>
6262
2 │ <body>
@@ -65,7 +65,7 @@ upper-case-html-tag-4.html:3:12 parse ━━━━━━━━━━━━━━
6565
4 │
6666
5 │ </div>
6767
68-
i Remove it or enable the parsing using the html.parser.vue option.
68+
i Remove it or rename this file to have the .vue file extension.
6969
7070
7171
```

crates/biome_html_formatter/tests/specs/prettier/vue/vue/template-dom.html.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ new Vue({el: '#app'})
5454
```
5555
template-dom.html:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5656
57-
× Vue syntax isn't enabled. Is this supposed to be a .vue file?
57+
× Vue syntax isn't enabled. Is this supposed to be a .vue file? HTML-as-Vue is not yet supported.
5858
5959
1 │ <!DOCTYPE html><html>
6060
2 │ <body>
@@ -63,7 +63,7 @@ template-dom.html:3:10 parse ━━━━━━━━━━━━━━━━━
6363
4 │
6464
5 │ </div>
6565
66-
i Remove it or enable the parsing using the html.parser.vue option.
66+
i Remove it or rename this file to have the .vue file extension.
6767
6868
6969
```

crates/biome_html_parser/src/syntax/parse_error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ pub(crate) fn expected_name(p: &HtmlParser, range: TextRange) -> ParseDiagnostic
110110
}
111111

112112
pub(crate) fn disabled_vue(p: &HtmlParser, range: TextRange) -> ParseDiagnostic {
113-
p.err_builder("Vue syntax isn't enabled. Is this supposed to be a .vue file?", range).with_hint(markup!("Remove it or enable the parsing using the "<Emphasis>"html.parser.vue"</Emphasis>" option."))
113+
// TODO: uncomment when the parser option is implemented
114+
// p.err_builder("Vue syntax isn't enabled. Is this supposed to be a .vue file?", range).with_hint(markup!("Remove it or enable the parsing using the "<Emphasis>"html.parser.vue"</Emphasis>" option."))
115+
p.err_builder("Vue syntax isn't enabled. Is this supposed to be a .vue file? HTML-as-Vue is not yet supported.", range).with_hint(markup!("Remove it or rename this file to have the "<Emphasis>".vue"</Emphasis>" file extension."))
114116
}
115117

116118
pub(crate) fn expected_vue_directive_argument(p: &HtmlParser, range: TextRange) -> ParseDiagnostic {

0 commit comments

Comments
 (0)