posit-dev / positron

Positron, a next-generation data science IDE
Other
2.35k stars 69 forks source link

Repeatedly sending incomplete code chunks to the console should result in an error #4150

Open joshuafayallen opened 1 month ago

joshuafayallen commented 1 month ago

Positron Version:

Positron Version: 2024.07.0 (Universal) build 67 Code - OSS Version: 1.91.0 Commit: 58e22e191273c6fcb403c458ddb3088b0b80dcd0 Date: 2024-07-18T04:44:17.582Z Electron: 29.4.0 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Darwin arm64 23.5.0

Steps to reproduce the issue:

library(dplyr)

data(starwars)

starwars |>
  mutate(des = paste(name, 'has', eye_color, 'eyes')

The syntax error persists after correcting the code and after restarting. Sometimes the error will persist after closing and opening a new positron window

What did you expect to happen?

unmatched_parenthesis = starwars |>

  • mutate(des = paste(name, 'has', eye_color, 'eyes')
  • matched_parenthesis = starwars |> Error: unexpected symbol in: " mutate(des = paste(name, 'has', eye_color, 'eyes') matched_parenthesis"

Were there any error messages in the Output panel or Developer Tools console?

DEBUG Comments: URIs of continue on comments to add to storage . was the only thing that appeared on my end

DavisVaughan commented 1 month ago

Here's a reprex of what I think the problem is. When you select a chunk in the editor and sent it to the console, if it isn't "complete" then you can repeatedly send that chunk to the console and not get a syntax error (RStudio does error as you'd expect here).

Compare that to sending it the the console once, and then going over in the console and manually pasting it in a second time (or typing anything in the console besides the expected ) to finish it out). In that case you get the expected syntax error.

https://github.com/user-attachments/assets/479a3c5f-c819-465c-a63d-f86640857907

joshuafayallen commented 1 month ago

OHH wow that is a nifty trick! Thank you so much!

DavisVaughan commented 1 month ago

I think this is actually an issue where we need to decide whether or not we want to match RStudio's behavior when we are repeatedly sending an incomplete chunk to the console - so I'm going to reopen this until we decide

joshuafayallen commented 1 month ago

Okay, no worries!