-
-
Notifications
You must be signed in to change notification settings - Fork 880
fix(lsp): apply diagnostic offset for plugin diagnostics in Vue/Astro/Svelte files #9012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ematipico
merged 4 commits into
biomejs:main
from
kiroushi:fix/plugin-diagnostic-offset-vue-sfc
Feb 12, 2026
+351
−8
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
199da90
fix(lsp): apply diagnostic offset for plugin diagnostics in Vue/Astro…
kiroushi 76ce2d9
[autofix.ci] apply automated fixes
autofix-ci[bot] ab2efa7
refactor: address review comments
kiroushi 94933c7
[autofix.ci] apply automated fixes
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Fixed plugin diagnostics showing incorrect line numbers in Vue, Astro, and Svelte files. Plugin diagnostics now correctly account for the template/frontmatter offset, pointing to the right location in the `<script>` block. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
...e_cli/tests/snapshots/main_commands_check/check_plugin_diagnostic_offset_in_vue_file.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| --- | ||
| source: crates/biome_cli/tests/snap_test.rs | ||
| assertion_line: 432 | ||
| expression: redactor(content) | ||
| --- | ||
| ## `biome.json` | ||
|
|
||
| ```json | ||
| { | ||
| "overrides": [ | ||
| { | ||
| "includes": ["**/*.vue"], | ||
| "plugins": ["noFoo.grit"] | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ## `file.vue` | ||
|
|
||
| ```vue | ||
| <template> | ||
| <p>line 1</p> | ||
| <p>line 2</p> | ||
| <p>line 3</p> | ||
| <p>line 4</p> | ||
| <p>line 5</p> | ||
| <p>line 6</p> | ||
| <p>line 7</p> | ||
| <p>line 8</p> | ||
| <p>line 9</p> | ||
| <p>line 10</p> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| const foo = 'bad' | ||
| </script> | ||
|
|
||
| ``` | ||
|
|
||
| ## `noFoo.grit` | ||
|
|
||
| ```grit | ||
| language js; | ||
|
|
||
| JsIdentifierBinding() as $name where { | ||
| $name <: r"^foo$", | ||
| register_diagnostic( | ||
| span = $name, | ||
| message = "Avoid using 'foo' as a variable name.", | ||
| severity = "error" | ||
| ) | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
| # Termination Message | ||
|
|
||
| ```block | ||
| lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
|
||
| × Some errors were emitted while running checks. | ||
|
|
||
|
|
||
|
|
||
| ``` | ||
|
|
||
| # Emitted Messages | ||
|
|
||
| ```block | ||
| file.vue:15:7 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
|
||
| ! This variable foo is unused. | ||
|
|
||
| 14 │ <script setup lang="ts"> | ||
| > 15 │ const foo = 'bad' | ||
| │ ^^^ | ||
| 16 │ </script> | ||
| 17 │ | ||
|
|
||
| i Unused variables are often the result of typos, incomplete refactors, or other sources of bugs. | ||
|
|
||
| i Unsafe fix: If this is intentional, prepend foo with an underscore. | ||
|
|
||
| 1 │ - const·foo·=·'bad' | ||
| 1 │ + const·_foo·=·'bad' | ||
| 2 2 │ | ||
|
|
||
|
|
||
| ``` | ||
|
|
||
| ```block | ||
| file.vue:15:7 plugin ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
|
||
| × Avoid using 'foo' as a variable name. | ||
|
|
||
| 14 │ <script setup lang="ts"> | ||
| > 15 │ const foo = 'bad' | ||
| │ ^^^ | ||
| 16 │ </script> | ||
| 17 │ | ||
|
|
||
|
|
||
| ``` | ||
|
|
||
| ```block | ||
| Checked 1 file in <TIME>. No fixes applied. | ||
| Found 1 error. | ||
| Found 1 warning. | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.