Comments (5)
The case that came up in #327 is slightly trickier, but still probably covered by this issue. It's like a 10,000 char JSON file where there's one label at char 10 and one at char 90,000. There are two ways I can think of to display that: splitting it into two separate snippets or putting it in one snippet that's broken in the middle.
Error: gen_completions::deser::kdl::duplicate_flag (link)
× Error encountered while deserializing
╰─▶ Error encountered while reading command information
╭─[test.kdl:2:1]
2 │ flags {
3 │ ··· aaaaaaaaaaaaaa" "-h" {
· ──┬─
· ╰── duplicate flag
4 │ desc "foo bar baz"
╰────
╭─[test.kdl:2:1]
2 │ flags {
3 │ "-h" "--very long string ···
· ──┬─
· ╰── already given here
4 │ desc "foo bar baz"
╰────
versus
Error: gen_completions::deser::kdl::duplicate_flag (link)
× Error encountered while deserializing
╰─▶ Error encountered while reading command information
╭─[test.kdl:2:1]
2 │ flags {
3 │ "-h" "--very long string ··· aaaaaa" "-h" {
· ──┬─ ──┬─
· │ ╰── duplicate flag
· ╰── already given here
4 │ desc "foo bar baz"
╰────
The first option is likely easier to implement, and more consistent with how vertical trimming currently works.
from miette.
It's trimming horizontally, finding a "display window".
For example, if you have 10,000 chars of JSON on a single line, and the syntax error is on char 5,000, then it would only render the syntax error range, plus a certain number of characters before and after, possibly with ellipses.
from miette.
Could you elaborate on how you envisioned this? Is this still something you want?
from miette.
Would this only involve trimming snippets horizontally like they're currently trimmed vertically (like @Benjamin-L said here (sorry for the ping)) or would it involve wrapping long lines? (or both?)
from miette.
splitting it into two definitely seems like the most readable alternative, yeh
from miette.
Related Issues (20)
- Compile to wasm32-unknown-unknown / Compile without `terminal_size` HOT 4
- Errors with zero-length span and no context lines are mostly pointless HOT 1
- 要是错误提示能使用中文输出就好了! HOT 5
- Failing tests with `--all-features` HOT 1
- Feature request: output an error as `json::Value` or `serde_json::Value` directly HOT 2
- Feature request: Span line limit for diagnostics HOT 3
- Help: Sub Errors HOT 3
- Is there a reason that `Report` doesn't implement `Error` and `Diagnostic`? HOT 2
- Converting a `Report` to a `Box<dyn Diagnostic>` wipes all `Diagnostic` information HOT 1
- Improve compilation speed by reducing expanded llvm lines HOT 4
- Add `#[cold]` to some of the constructor functions HOT 3
- `#[label]` derive doesn't seem to work with `Option<T>` where `T` implements `Into<SourceSpan>` but not `Copy`
- NO_COLOR is printing ansi in non-terminals HOT 1
- Reformatting a URL resulting in `(link)` not moving HOT 4
- Render diagnostics without exiting? HOT 5
- Length is inclusive?! HOT 1
- [Feature Request] Support highlight by tree-sitter.
- Feature Request: Make miette! macro handle related errors HOT 3
- Feature request/thoughts: Report<E> with known “base type” HOT 2
- Cannot build with only `fancy-base`
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 miette.