posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.86k stars 91 forks source link

Raw strings are sometimes incorrectly highlighted as syntax errors #5586

Closed etiennebacher closed 13 hours ago

etiennebacher commented 13 hours ago

System details:

Positron and OS details:

Positron Version: 2024.11.0 build 69 Code - OSS Version: 1.93.0 Commit: 4cde19a003d09cf75114ec8650020b132bbc5554 Date: 2024-10-21T02:40:21.993Z Electron: 30.4.0 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Linux x64 6.8.0-49-generic

Interpreter details:

R 4.4.1

Describe the issue:

Some raw strings are incorrectly marked as syntax errors while they work as expected. When they are called as "literals" then there is a warning "No symbol named 'r' in scope". When they are called as function arguments there is a syntax error "Expected ',' between expressions".

Steps to reproduce the issue:

In an R script:

r"((\d+))" # -> yellow wave under the "r"
stringr::str_extract("foo123", r"((\d+))")  # -> red wave under the "r"

The stringr call produces the expected output, but the syntax error shouldn't be reported.

Expected or desired behavior:

None of the r are highlighted.

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

Didn't notice anything specific there.

DavisVaughan commented 13 hours ago

Pretty sure this is https://github.com/r-lib/tree-sitter-r/issues/162 so im going to close in favor of tracking there

jmcphers commented 13 hours ago

Image