-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Switch from codespan-reporting
to a custom crate based on codespan
#35
Conversation
A diagnostic struct with a lifetime is going to cause a myriad of issues, i pretty much rewrote half of the old linter because of it, so i would rather not do that |
oops |
What is the sense of the |
Its from rustc_errors https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/enum.Applicability.html |
Do we really need the |
It does not affect error reporting but it does affect the LSP, since it needs to know what suggestions it can offer which dont have placeholders |
Should we implement a similar suggestion API like rustc_errors? So you can "fix" the error by substituting some strings that are provided by the suggestion? I think this can be very nice in a linter. The parser can then try to fix many issues, that are obviously typos, by providing a suggestion, which will get automatically applied by auto-fix. |
Yes the LSP can provide autofix options based on the suggestions from the diagnostic, although im not sure how we are going to do this. Id like to have a fixer for rules, but then the parser cant use it. I think we will keep the fixer for rules but have other suggestions to. |
Eventually we will have to separate the AST and syntax node stuff into its own module, that way rslint_errors can provide a span for ast nodes and syntax nodes. That should allow us to make the fixer a standalone crate too, which means we can offer the fixer interface through rslint_errors for suggestions |
So, I added all the basic structs and representations that now just need methods and logic to report. |
SmolStr wouldnt do much, most messages are > 22 chars |
I think |
I dont really see why the diagnostic's data should not be public |
Yea that works too |
|
In what places does it cause issues? |
I have a method |
This reverts commit 7f94c56.
The changes seem to work well, some of the rendering is wonky but we can fix that later, i think we can merge it now |
I take that back, it seems we are suffering from the same issue as denoland/deno_lint#391 which is a little odd |
The issues are super weird Edit: I know the cause for both of them, I will fix them in our local copy. |
Are you sure? it still seems to be a bit broke 🤔
|
Switching from annotate-snippets to codespan has solved all of the issues, essentially the rendering is the same as using codespan on its own but we have a cool new unified builder as well as suggestions, and with all of the nice codespan rendering 🎉 |
codespan-reporting
to a custom crate based on annotate-snippetscodespan-reporting
to a custom crate based on codespan
This PR replaces
codespan-reporting
withannotate-snippets
.To actually use
annotate-snippets
in a nice manner and to make the switch easier,a new module,
rslint_errors
, is introduced to provide an API similair tocodespan-reporting
but build on top of
annotate-snippets
.Resolves #29