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

Make R diagnostics less aggressive #2943

Closed
jennybc opened this issue Apr 30, 2024 · 5 comments
Closed

Make R diagnostics less aggressive #2943

jennybc opened this issue Apr 30, 2024 · 5 comments
Assignees
Labels
area: diagnostics Issues related to Diagnostics lang: r usability

Comments

@jennybc
Copy link
Member

jennybc commented Apr 30, 2024

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.

Screenshot 2024-04-30 at 7 21 36 AM

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 Remove unmatched_delimiter after all r-lib/tree-sitter-r#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: Allow configuration of inactivity delay for diagnostics microsoft/pylance-release#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?
@DavisVaughan
Copy link
Contributor

DavisVaughan commented Apr 30, 2024

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 r-lib/tree-sitter-r#90, which would provide even more motivation for putting the work in to fix that

@jennybc
Copy link
Member Author

jennybc commented Apr 30, 2024

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 r-lib/tree-sitter-r#90.

@lionel-
Copy link
Contributor

lionel- commented May 31, 2024

Another case where the whole editor gets linted: insert this somewhere in the file: (a &&)

@DavisVaughan
Copy link
Contributor

Also test against #4177

@testlabauto
Copy link
Contributor

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:

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: diagnostics Issues related to Diagnostics lang: r usability
Projects
None yet
Development

No branches or pull requests

5 participants