Closed bram209 closed 1 year ago
Note that I use LazyVim
that by default replaces newlines and tabs with spaces to make diagnostic messages from neotest more compact: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/test/core.lua#L43
I could imagine that we may want to handle specialised cases for common assert failed messages, like for example: assert_eq could become a compact diagnostic message in vim: left:
2
, right:3
, but we could add that in another PR (if wanted), thoughts?
I think handling specialized cases would be very welcome!
By the way, would you mind giving me some pointers for implementing this for other adapters? From looking at the code, the main thing seems to be indeed the parse_errors
function and the adjustments in adapter.results
. Am I missing something?
I could imagine that we may want to handle specialised cases for common assert failed messages, like for example: assert_eq could become a compact diagnostic message in vim: left:
2
, right:3
, but we could add that in another PR (if wanted), thoughts?I think handling specialized cases would be very welcome!
By the way, would you mind giving me some pointers for implementing this for other adapters? From looking at the code, the main thing seems to be indeed the
parse_errors
function and the adjustments inadapter.results
. Am I missing something?
you can set the errors
property of a result, how you do that is entirely up to you. For example, in neotest-python
(at first glance) looks to call pytest
as a library, where they have the ability to access representation of the exception directly:
https://github.com/nvim-neotest/neotest-python/blob/master/neotest_python/pytest.py#L116
In this library I created a module errors.lua
that contains the required logic to parse panics from rustc output. parse_errors
is not part of the interface that neotest
will call into or anything like that.
This is kinda broken to me in the latest version. Is this working for any of you?
@igorlfs it looks like the output format has changed. can you open a new issue to track this? it should be a simple fix to https://github.com/rouge8/neotest-rust/blob/main/lua/neotest-rust/errors.lua and https://github.com/rouge8/neotest-rust/blob/main/tests/errors_spec.lua#L12 . I'm not writing much Rust these days so I probably won't get to it anytime soon, but PRs are welcome!
Hey @rouge8!
I opened a PR #64 ! It might need some adjustments, though
resolves #22
For now, I parse rustc panic messages and display the whole message as a diagnostic. I could imagine that we may want to handle specialised cases for common assert failed messages, like for example: assert_eq could become a compact diagnostic message in vim:
left: `2`, right: `3`
, but we could add that in another PR (if wanted), thoughts? @rouge8 @igorlfs