Comments (5)
I'd like to give this a shot.
from biome.
from biome.
I've been combing over the code for a while now, and I think I understand what's going on. Mostly notes for myself:
The variable declaration group is higher up in the IR tree than the type annotation group. When the tree gets flattened into FormatElement
s, the variable declaration group gets evaluated first to see if it breaks (and since it's long enough, it breaks). Then the type annotation group gets evaluated, and its not long enough, so it doesn't break. This evaluation happens here:
biome/crates/biome_formatter/src/printer/mod.rs
Lines 184 to 188 in 01c440d
I think one way to fix this is to introduce some kind of "break priority" field to the Group
struct, and then favor breaking type annotations, but I think that could introduce some complexity.
from biome.
I think one way to fix this is to introduce some kind of "break priority" field to the Group struct, and then favor breaking type annotations, but I think that could introduce some complexity.
It seems that this approach assumes the current generated IR is accurate. Perhaps we could compare the IR generated by Biome
and Prettier
to identify differences between them and address these disparities to see if the issue is resolved.
from biome.
Ok yeah, I was looking at the IR before and it looked identical, but I'm looking at it again and it is definitely not. Biome is emitting an extra group
around the left hand side of the assignment.
from biome.
Related Issues (20)
- 🐛 Github Reporter not generating annotations correctly HOT 5
- 💅 `lint/complexity/noUselessFragments` crashes when applying fix in some cases HOT 2
- 📎 Change `bit_flags` for `enumflags2`
- 💅 There is a false positive in the `useLiteralKeys` rule HOT 1
- 🐛 `biome lsp-proxy` hangs with certain input
- 🐛 CSS parsing and Unicode point ranges
- 🐛 Override behavior with multiple matches HOT 1
- 📎 Import sorter revamping - custom order
- ☂️ Analyzer assists HOT 4
- 🐛 `npx @biomejs/biome migrate` command crashes HOT 5
- 📝 CSS formatter converts custom identifiers to lowercase HOT 3
- ☂️ Type-aware linter
- 📝 CSS extra whitespace added within `:has`
- 📎 Pin bench libs
- useExhaustiveDependencies ignore comment does not work if methods called on the dependency HOT 4
- Position not provided with `--stdin-file-path` HOT 2
- 💅 `noUndeclaredDependencies` checks root `package.json` in monorepo workspaces HOT 2
- Path with brackets in it causes `internalError/io` on Windows environment HOT 6
- 💅 `useExhaustiveDependencies` error's when (adding and not adding) to array HOT 3
- 📝 My vscode doesn't format itself when I save HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biome.