Skip to content
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

codespan-reporting and codespan-lsp compatibility #227

Open
aweary opened this issue Apr 6, 2020 · 4 comments
Open

codespan-reporting and codespan-lsp compatibility #227

aweary opened this issue Apr 6, 2020 · 4 comments

Comments

@aweary
Copy link

aweary commented Apr 6, 2020

I've been using codespan and codespan-reporting for error reporting for my CLI. I'm now working on an LSP extension and want to use codespan-lsp to covert to the proper LSP types, but it seems like codespan-reporting doesn't play well.

For example, I have a custom file system abstraction that implements the Files trait but codespan-lsp utilities like byte-span-to-range expect a reference to codespan::Files. They also expect a Span but codespan-reporting's Label uses Range<usize>.

Are there plans to align the packages one way or the other, or should I just roll my own diagnostics object and have compatibility layers for codespan-reporting and codespan-lsp?

@brendanzab
Copy link
Owner

Thanks for your issue!

I've been trying hard to de-emphasise codespan, and emphasizing codespan-reporting, because I've found it rather challenging to create a one-size-fits all thing for handling files. This was part of the work I did in inverting the dependency between those two crates. Eventually I'd like to deprecate codespan, if I'm honest.

codespan-lsp currently depends on codespan though, so sadly you are tied to using codespan if you want these conversions. It would be cool if there would be some way to make those conversions easier to implement for custom file system abstractions though! I'm still not sure where they fit though…

@aweary
Copy link
Author

aweary commented Apr 7, 2020

@brendanzab would you be open to including some LSP utilities in codespan-reporting? It might make sense to have codespan_reporting::lsp to mirror the codespan_reporting::term backend. I'd be happy to help here if you're interested.

@brendanzab
Copy link
Owner

Ohhh, that is a good idea, yes! Now I have a better handle on the lsp-types version ranges this could also be helpful too - it was a constant pain to keep having to update them.

@brendanzab
Copy link
Owner

I'd definitely be open to collaborating on this! Feel free to chat on Gitter or the the #langdev channel on the rust community discord if you like!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants