here icon indicating copy to clipboard operation
here copied to clipboard

Feature request: enable autocomplete via tabbing

Open cscheeder opened this issue 2 years ago • 4 comments

Hi, I love here() and use it a lot. I just thought that it would be super cool to be able to get autocomplete/suggestions for file paths as it works outside of here().

Or is there a trick how that's already possible?

Thanks :)

cscheeder avatar Jul 27 '21 14:07 cscheeder

Can we please have this implemented? I'd like to use {here}, but currently the here() function is nearly useless to me because I have a lot of nested folders and I don't memorize the long paths in order to specify where a file or folder is by manually typing in each item in the path from the here() root.

leowill01 avatar Apr 13 '22 21:04 leowill01

I was about to make this request myself. I huge downside of file.path and here is the lack of tab completion.

abalter avatar Nov 28 '23 04:11 abalter

Thanks for the nudge.

In RStudio, you could type

here("file<tab>

and it would autocomplete the file with its full path relative to the RStudio project (which is frequently also the project root):

here("my/local/file.txt"

This is a perfectly valid input for here() . Would that help? Do we need to document this better?

krlmlr avatar Nov 28 '23 10:11 krlmlr

I am considering a use case that goes beyond that, and may not be something that is a goal for {here}. Highly structured projects can lead to tall directory trees:

(base) balter@expiyes:~$ tree rnaseq_proj/
rnaseq_proj/
├── align
│   ├── logs
│   ├── reports
│   ├── results
│   └── src
│       ├── alignment_diagnostics.Rmd
│       └── run_bwa.Rmd
├── config.R
├── data
│   └── raw
│       └── test.fastq
├── setup
│   ├── logs
│   ├── reports
│   ├── results
│   └── src
│       └── run_fastqc.Rmd
└── trim
    ├── logs
    ├── reports
    ├── results
    └── src
        ├── trim_diagnostics.Rmd
        └── trim_sequences.Rmd

So, I frequently like to create variables for file paths, e.g.:

raw_data_dir = here("data/raw")

Or, maybe I have another reason to have a folder name in a variable.

test_type = "raw"
test_fastq_file = here("data", test_type, "test.fastq")

I think it would be awesome if here and (file.path) would use intellisense so that I could do

data_dir = here("data")
test_fastq_file = here(data_dir, test_type, <tab>......

abalter avatar Dec 13 '23 00:12 abalter