You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I insert a print statement into the callback for the Sys.getenv() completion, it does not print when I press tab. But it does for the cos() example above, so I guess the custom completion is not being called.
OK, after some digging, I find that the name argument being passed to the custom completion handler is x = NULL, not x, so the following does work:
I could PR this into ark, but I don't know if this is the desired setup, or something should change so that the name passed to the handler does not include default arguments. Also, why sign a contributor license agreement for 7 characters?
(While you're add it, I'd suggest adding a handler for Sys.unsetenv() 😉).
Were there any error messages in the UI, Output panel, or Developer Tools console?
No errors. Here is what appears in the "Positron Language Server: R 4.4.1" output pane when TAB is pressed after Sys.getenv(:
The text was updated successfully, but these errors were encountered:
noamross
changed the title
Autocomplete of environment variables not working for Sys.getenv()
ark: Autocomplete of environment variables not working for Sys.getenv()
Sep 13, 2024
tl;dr: In https://github.com/posit-dev/ark/blob/398cfb945edb6d0be4552929c30e346c794ec517/crates/ark/src/modules/positron/completions.R#L76-L83, changing
"x"
to"x = NULL"
fixes autocompletion. Will PR if desired.System details:
Positron and OS details:
Positron Version: 2024.09.0 (Universal) build 27
Code - OSS Version: 1.92.0
Commit: d996153
Date: 2024-09-11T02:38:46.408Z (2 days ago)
Electron: 30.1.2
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0
Interpreter details:
R 4.4.1
Describe/Steps to reproduce the issue:
In an R script, Quarto document R cell, or console, typing
Sys.getenv(
and pressing TAB does not present environment variables for autocompletion:It does work for
Sys.setenv
:Completions also work for
library()
,options()
, andgetOption()
.It does not matter if I prefix
Sys.getenv(
withbase::
orbase:::
.I can retrieve the custom completion:
I am also able to register new completions:
However, running the completion definition at https://github.com/posit-dev/ark/blob/398cfb945edb6d0be4552929c30e346c794ec517/crates/ark/src/modules/positron/completions.R#L76-L83 manually does not work:
If I insert a print statement into the callback for the Sys.getenv() completion, it does not print when I press tab. But it does for the
cos()
example above, so I guess the custom completion is not being called.OK, after some digging, I find that the
name
argument being passed to the custom completion handler isx = NULL
, notx
, so the following does work:I could PR this into ark, but I don't know if this is the desired setup, or something should change so that the name passed to the handler does not include default arguments. Also, why sign a contributor license agreement for 7 characters?
(While you're add it, I'd suggest adding a handler for
Sys.unsetenv()
😉).Were there any error messages in the UI, Output panel, or Developer Tools console?
No errors. Here is what appears in the "Positron Language Server: R 4.4.1" output pane when TAB is pressed after
Sys.getenv(
:Here is what appears for
Sys.setenv(
:The text was updated successfully, but these errors were encountered: