Comments (6)
i would rather stick with primary/secondary and then just add info, i dont think theres a difference between info, note, and help
from rslint.
Can you name more benefits that make annotate-snippets better than codespan (except multiline-suggestions)?
Edit: I looked a bit through annotate-snippets documentation and it looks like it can display much more stuff but it definitely requires a better API to use it in RSLint.
from rslint.
I came up with a simple API design that is similair to codespan-reporting but adjusted to work with annotate-snippets
// not sure if we want to change the name to `Snippet` or stay with `Diagnostic`
Snippet::new(file_id)
.title(Annotation::note("SyntaxError", "expected `,`, found `;`"))
.annotate(AnnotatioType::Error, span, "")
.annotate_help(span, "remove this `;`")
.footer(Footer::help("remove this `;`"))
To display the errors we could take a similar approach as codespan-reporting and have an extra method (emit
)
that will take a impl Files
and Vec<Snippet>
and will display them.
from rslint.
I would rather not keep the Snippet name, i dont really like it, i think diagnostic is better and most of rslint uses the word diagnostic. Moreover, id like to keep the diagnostic builder interface for the most part, also, id like to take some ideas from rustc_errors. I think this would be better:
Diagnostic::new(file_id, "some-code", "some error name here")
.primary(span, "oh no")
.secondary(span, "oh wow")
.suggestion(Applicability::Always, "isNaN(foo)")
I think for the struct we can take some ideas from rustc_errors, notes are sub-diagnostics, suggestions are a vector of suggestions, etc. suggestions would use a diff to label any insertions, and we can also have other kinds of sub-diagnostics. Annotate-snippets' IR makes it easy for us to define our own diagnostic features
from rslint.
So you don't want to use the different annotation types for the labels / annotations that can be used in annotate-snippets?
I think they can be quite useful.
from rslint.
I will officially work on this now
from rslint.
Related Issues (20)
- `ForOfStmt` missing from `ast::Stmt` enum HOT 1
- How to debug in VSCode HOT 6
- WebAssembly! HOT 1
- Logotype
- No binary for v0.3.x release HOT 3
- How can I adjust an AST node? HOT 4
- Default function parameters are incompletely parsed as AssignPattern HOT 1
- Ran `rslint .` in my Projects directory, got an internal linter error HOT 7
- JSX support HOT 4
- Panic in parse_text_lossy
- Panic when using Fixer: assertion failed: `(left == right)` HOT 3
- Internal Linter Error on rslint_parser/src/lossless_tree_sink.rs
- Install error
- docs: http://rslint.org/ is down HOT 2
- 'The parser seems to be recursing forever' at invalid if/else brackets configuration. HOT 1
- Internal error
- How does casting work from untyped nodes to typed nodes when building the linting AST?
- Is this project still under maintenance? HOT 1
- [DOCS] Full file and single statement rslint-ignore statements are identical in documentation
- SyntaxNode#replace_with asserts kind
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 rslint.