Skip to content

Surprising behaviour when evaluating syntactically incorrect code #5023

Open
@lionel-

Description

@lionel-

Take this long function which has a syntax error:

f <- function() {
  (  # Syntactically invalid
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
  NULL
}

Try to evaluate it with cmd+enter. Only f gets sent at the console, which is surprising.

Screen.Recording.2024-10-15.at.15.16.23.mov

Now select the function and evaluate with cmd+enter:

  • The selection is written to the console but not sent to the kernel.

  • The code sent to the console is not scrolled down. Scrolling with the trackpad/mousewheel doesn't work.

Screen.Recording.2024-10-15.at.15.08.56.mov

This behaviour makes it seem like Positron is stuck. In reality the user can interrupt, and can fix the code before sending it, but it's really not obvious what is expected of the user.

I'm thinking we should avoid sending any code to the kernel or console when there is a syntax error and that instead we should notify the user that the code must be fixed before being evaluated. Either with a notification or with a dialog. While a dialog is more intrusive, I think it wouldn't be too bad here, to make it very clear that the user is responsible for fixing the syntax error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions