Comments (9)
I like 1 and 6 :)
from codespan.
Rustc tends to handle overlapping multiline errors cleverly too:
from codespan.
Might be worth studying how https://github.com/rust-lang/rust/tree/961a9d6e97a37ff1bb33578721dfa8687054c7b8/src/librustc_errors does this
from codespan.
Here's another idea for primary spans:
┌── FizzBuzz.fun:4:13 ───
│
4 │ fizz₁ num = case (mod num 5) (mod num 3) of
│ ╭─────────────^
5 │ │ 0 0 => "FizzBuzz"
6 │ │ 0 _ => "Fizz"
7 │ │ _ 0 => "Buzz"
8 │ │ _ _ => num
│ ╰──────────────^ `case` clauses have incompatible types
│
Not sure how to do secondary spans. This looks kinda weird:
┌── FizzBuzz.fun:4:13 ───
│
4 │ fizz₁ num = case (mod num 5) (mod num 3) of
│ ╭─────────────-
5 │ │ 0 0 => "FizzBuzz"
6 │ │ 0 _ => "Fizz"
7 │ │ _ 0 => "Buzz"
8 │ │ _ _ => num
│ ╰──────────────- `case` clauses have incompatible types
│
from codespan.
I've decided to go with #77 (comment) in #98, but secondary spans still look kinda weird. Would appreciate some thoughts on alternatives!
from codespan.
Here are some options for secondary labels that I posted on #98 (comment):
- single:
-
multi:┘
foo <$> bar --- ^^^ --- a label about `bar`
fizz₁ num = case (mod num 5) (mod num 3) of ╭─────────────┘
- single:
-
multi:╯
foo <$> bar --- ^^^ --- a label about `bar`
fizz₁ num = case (mod num 5) (mod num 3) of ╭─────────────╯
- single:
‾
multi:‾
foo <$> bar ‾‾‾ ^^^ ‾‾‾ a label about `bar`
fizz₁ num = case (mod num 5) (mod num 3) of ╭─────────────‾
- single:
'
multi:'
foo <$> bar ''' ^^^ ''' a label about `bar`
fizz₁ num = case (mod num 5) (mod num 3) of ╭─────────────'
- single:
"
multi:"
foo <$> bar """ ^^^ """ a label about `bar`
fizz₁ num = case (mod num 5) (mod num 3) of ╭─────────────"
- single:
-
multi:'
foo <$> bar --- ^^^ --- a label about `bar`
fizz₁ num = case (mod num 5) (mod num 3) of ╭─────────────'
from codespan.
I actually think I'm leaning towards the last one!
from codespan.
Yeah, I went with 6 in 46cf125 - willing to be swayed towards 1 however.
from codespan.
Closing this in favor of #100
from codespan.
Related Issues (20)
- Rethink release process and document it
- Introduce macro to create diagnostics HOT 5
- Add an option to render more context around lines. HOT 11
- Order-preserving error reporting HOT 1
- Position is off by 2 characters with some strings HOT 6
- Add the ability to make multiline suggestions/notes HOT 4
- release tracking issue HOT 5
- codespan-reporting::Files not implemented for codespan::Files<String> HOT 3
- Display is broken on some platforms HOT 5
- Should non-`term` rendering backends live here? HOT 1
- Cut codespan release with fix? HOT 5
- Use of moved value: `blue` HOT 4
- Accessor for the location of a diagnostic HOT 3
- Implement `Ord` for `Severity` HOT 3
- Are there C bindings for codespan? HOT 2
- How to report inside `Display` implementation? HOT 3
- The destiny of `codespan` (and `codespan-reporting`)
- Make some functions `const`
- Request a new releases for including context before and after a label HOT 6
- Error when an error spans until EOF
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 codespan.