Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-02 Thread Bill Dunlap
x$`string` is not the same as x$'string'. They may act similarly now, but they do not parse the same. > vapply(as.list(quote(list$`component`)), typeof, "") [1] "symbol" "symbol" "symbol" > vapply(as.list(quote(list$"component")), typeof, "") [1] "symbol""symbol""character" > vapply(as.li

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-02 Thread Michael Chirico via R-devel
I personally wouldn't like using a string, and this comment makes me think it's against the r-core preference as well: https://bugs.r-project.org/show_bug.cgi?id=18429#c1 Thanks both for catching the sloppy mistake in vapply() :) Let's continue discussion on the bug/PR. On Thu, Mar 2, 2023 at 1

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-02 Thread Deepayan Sarkar
On Thu, Mar 2, 2023 at 2:09 PM Ivan Krylov wrote: > > There turn out to be a few more things to fix. > > One problem is easy to solve: vapply() needs a third argument > specifying the type of the return value. (Can we have unit tests for > tab completion?) There are tests in src/library/utils/te

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-02 Thread Ivan Krylov
There turn out to be a few more things to fix. One problem is easy to solve: vapply() needs a third argument specifying the type of the return value. (Can we have unit tests for tab completion?) The other problem is harder: `comps` defaults to an empty string, and you can't have a symbol consisti

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-01 Thread Michael Chirico via R-devel
Great suggestion! I've started a patch: https://bugs.r-project.org/show_bug.cgi?id=18479 On Wed, Mar 1, 2023 at 1:56 AM Ivan Krylov wrote: > > В Wed, 1 Mar 2023 01:36:02 -0800 > Michael Chirico via R-devel пишет: > > > +comps[non_syntactic] <- paste0("`", comps[non_syntactic], "`") > > There are

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-01 Thread Ivan Krylov
В Wed, 1 Mar 2023 01:36:02 -0800 Michael Chirico via R-devel пишет: > +comps[non_syntactic] <- paste0("`", comps[non_syntactic], "`") There are a few more corner cases. For example, comps could contain backticks (which should be escaped with backslashes) and backslashes (which should also be esc