-
-
Notifications
You must be signed in to change notification settings - Fork 507
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
🐛 Invalid line/column calculating in Vue files #3366
Comments
Yeah, this is kind of a limitation of how we currently support HTML-ish template languages (see also: #1726) like vue, svelte, and others. Basically, we kinda regex for where the javascript code actually is in those files, and then just format/lint that code instead of the entire file. It's very hacky. biome/crates/biome_service/src/file_handlers/vue.rs Lines 28 to 30 in 08f0c8f
Its technically possible to figure out the line offset of the script tag and then tweak the output based on that offset. IMO, whatever the short term solution for this is, it's going to be rendered unnecessary once we have proper support for HTML-ish languages, and I'm not sure if its worth the additional complexity to do that. |
I'd like to a least voice support for a short term solution, though I understand that dev time is always limited. Unless proper html-ish support is right around the corner, it's going to remain a pain point for whoever uses tools that allow jumping from a file:line:char to the proper location in the editor. |
We already fix this information inside our LSP, so I don't see why we shouldn't do it here: We generate an offset in the case of astro/svelte/vue files: biome/crates/biome_lsp/src/session.rs Lines 340 to 344 in 48089ea
And then we create a new biome/crates/biome_lsp/src/utils.rs Lines 187 to 197 in 48089ea
In the case of our reporters, we just need to provide them with a new I am happy to help anyone that wants to help to fix the bug, or wait for me to fix it. |
Oh, then in that case this probably isn't too hard to fix. I'll have time next week to fix this, but if someone wants to tackle it earlier please do. |
Had I known Rust, I would’ve helped with a pull request, for now I’ll just wait (even though your code looks very clean) :-) |
Environment information
What happened?
Hi!
I’m working on integrating Biome to my Code Quality Generator (@maximal/gitlab-code-quality#6) and faced an issue of invalid issue location calculating in Vue files when using
--reporter=github
.Seems like Biome shows lines/columns relative to
<script>
position inside of the file, and not relative to the beginning of the file. Which makes almost impossible to highlight issues in GitLab CodeQuality widget and other similar instruments.Expected result
Calculate lines and columns regarding to the beginning of the Vue file, and not regarding
<script>
section contents.Code of Conduct
The text was updated successfully, but these errors were encountered: