posit-dev / positron

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

Add highlighting matching brackets/parentheses/braces in comments as in RStudio #4220

Open sjmgarnier opened 3 months ago

sjmgarnier commented 3 months ago

System details:

Positron and OS details:

Positron Version: 2024.07.0 (Universal) build 107 Code - OSS Version: 1.91.0 Commit: 240a81d86244160a275539c3c0e71adf70bbcbf6 Date: 2024-07-29T04:54:25.803Z 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

Interpreter details:

R 4.4.1

Describe the issue:

In RStudio, matching brackets/parentheses/braces are highlighted both in the code and the comments. In Positron, the highlighting only works in the code but not in the comments.

Steps to reproduce the issue:

Create an R script, e.g.:

# (1 + 2)^3
(1 + 2)^3

Matching parentheses will be highlighted in the second line, not in the first one.

Expected or desired behavior:

Matching brackets/parentheses/braces should be highlighted anywhere in a script (or at least, there should be an option to activate highlighting in comments).

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

No.

juliasilge commented 2 months ago

We do already have this for roxygen comments and could extend it for all comments, if desired.

As a workaround 😆 you can make them roxygen comments, if you like!

sjmgarnier commented 2 months ago

@juliasilge I made this request because this doesn't work fully in roxygen comments either. For instance, in:

#' @seealso \code{\link{exp}}, \code{\link{log}}, \code{\link{sqrt}}

the matching braces are not highlighted. In roxygen comments, highlighting seems to work only in the examples section.