-
Notifications
You must be signed in to change notification settings - Fork 24
Description
I have some regret about the current definition of is_vscode_project (which is my fault):
Line 316 in 97b875b
| is_vscode_project <- has_dir(".vscode") |
Why? Because a VS Code user will probably have a .vscode/ folder in their home directory. So this has the potential to make (basically all 😬) other directories appear to be nested inside an existing project, which is something usethis aggressively checks for and discourages.
> create_project("~/tmp/blah")
! New project "blah" is nested inside an existing project /Users/jenny/tmp/, which is rarely a good idea.
ℹ If this is unexpected, the here package has a function, `here::dr_here()` that reveals why /Users/jenny/tmp/
is regarded as a project.
Do you want to create anyway?
1: Absolutely not
2: No way
3: Yes
Selection:
2
Run `rlang::last_trace()` to see where the error occurred.
Error in `challenge_nested_project()`:
✖ Cancelling project creation.
Show Traceback
> withr::with_dir(new = "~/tmp", here::dr_here())
here() starts at /Users/jenny.
- This directory contains a directory '.vscode'
- Initial working directory: /Users/jenny/tmp
- Current working directory: /Users/jenny/tmp
I now think this criterion should be more specific and look for .vscode/settings.json, which is characteristic of a project directory.
User-level settings are generally stored elsewhere, i.e. I don't expect to see ~/.vscode/settings.json. By platform, here are the typical places for user-level settings:
- macOS:
~/Library/Application Support/Code/User/settings.json - Windows:
%APPDATA%\Code\User\settings.json(typicallyC:\Users\{username}\AppData\Roaming\Code\User\settings.json) - Linux:
~/.config/Code/User/settings.json
Here's what I have in ~/.vscode/, which I think is fairly typical and notably does not include settings.json:
~ % ls -al ~/.vscode
total 24
drwxr-xr-x@ 6 jenny staff 192 Jan 14 2025 .
drwxr-x---+ 74 jenny staff 2368 Jul 22 18:37 ..
-rw-r--r--@ 1 jenny staff 6148 Jul 21 09:38 .DS_Store
-rw-r--r--@ 1 jenny staff 798 Jan 13 2025 argv.json
drwxr-xr-x@ 2 jenny staff 64 Jan 13 2025 cli
drwxr-xr-x@ 32 jenny staff 1024 Jul 22 11:18 extensions
PR incoming!