Displaying 3 results from an estimated 3 matches for "specialopcompletionshelper".
2023 Mar 01
1
tab-complete for non-syntactic names could attempt backtick-wrapping
...ess the 'tab' key after typing 'x$a')
The auto-complete mechanism will fill the buffer like so:
x$a b
This is not particularly helpful because this is now a syntax error.
It seems to me there's a simple fix -- in
utils:::specialCompletions(), we can wrap the result of
utils:::specialOpCompletionsHelper() with backticks for non-syntactic
names ([1]):
comps <- specialOpCompletionsHelper(op, suffix, prefix)
if (length(comps) == 0L) comps <- ""
+non_syntactic <- make.names(comps) != comps
+comps[non_syntactic] <- paste0("`", comps[non_syntactic], "`")
sprint...
2023 Mar 02
3
tab-complete for non-syntactic names could attempt backtick-wrapping
..., and
you can't have a symbol consisting of an empty string, because this
value is internally reserved for missing function arguments. I think
you can return(paste0(prefix, op)) if length(comps) == 0L, but this is
still somewhat worrying. R tries to prevent empty names, so I wouldn't
expect specialOpCompletionsHelper() to return an empty string, but I
can't prove it right now.
On the other hand, x$'a string' is the same as x$`a string`. Could we
just drop as.name() and keep the return value being a string literal?
I'm not sure about this, either.
--
Best regards,
Ivan
2023 Mar 01
1
tab-complete for non-syntactic names could attempt backtick-wrapping
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 <krylov.r00t at gmail.com> wrote:
>
> ? Wed, 1 Mar 2023 01:36:02 -0800
> Michael Chirico via R-devel <r-devel at r-project.org> ?????:
>
> > +comps[non_syntactic] <- paste0("`", comps[non_syntactic], "`")
>