Make R diagnostics less aggressive
Summarizing a slack discussion.
This screenshot is me in the middle of a "copy/paste/edit" maneuver where I'm creating a new test from an existing one. It's easy for the code to travel through an invalid state while you're finishing what you started. I find the diagnostics that appear so overwhelming that it actually makes it harder for me to get back to the happy state of syntactically valid code.
Three possible angles on this:
- The extent of the diagnostic is too big (seemingly everything is decorated in my screenshot). This is being tracked in https://github.com/r-lib/tree-sitter-r/issues/90. It is possible this is the only thing to act on.
- The diagnostic appears too soon. Possibilities include having an inactivity timeout or only decorating on save (vs. on type). Worth considering if we should expose some setting for users to tweak this. Related thread re: pylance: https://github.com/microsoft/pylance-release/issues/237.
- The decoration is too distracting. I find the red squiggly underline quite overwhelming. Is there a more subtle style used elsewhere that is easier on the eyes while you're trying to fix the syntax error?
We'd really like to make tree-sitter-r play as nicely as possible with tree-sitter's error recovery, but to do that we need an example of the code that caused the squiggles in the image above. If you can recreate that state or a similar one and provide a reprex for it, we can see if it is the same problem as the ones mentioned in https://github.com/r-lib/tree-sitter-r/issues/90, which would provide even more motivation for putting the work in to fix that
Yes I definitely think it was an unmatched delimiter. In the test file in the screenshot, if I delete any parenthesis or brace, the entire file immediately lights up with the diagnostic. So yes the same problem as https://github.com/r-lib/tree-sitter-r/issues/90.
Another case where the whole editor gets linted: insert this somewhere in the file: (a &&)
Also test against https://github.com/posit-dev/positron/discussions/4177
Verified Fixed
Positron Version(s) : 2024.09.0-95
OS Version : OSX
Test scenario(s)
Looks great with:
Let's say we want to use with to change things in a list (not my favorite way of doing things, but...)
asd = list()
asd$abc = 2
If I
with(
asd,
{
If I forget this closing parenthesis, the whole with gets marked.
that's not very helpful if the with block is a little long.
a = sum(abc * 2)
}
)
a = sum(abc * 2
b = 123
Link(s) to TestRail test cases run or created: