Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not opening folder when exec in dot directory #14

Open
mikebarkmin opened this issue Nov 14, 2021 · 2 comments · Fixed by inean/toolbox-vscode#3 · May be fixed by #25
Open

not opening folder when exec in dot directory #14

mikebarkmin opened this issue Nov 14, 2021 · 2 comments · Fixed by inean/toolbox-vscode#3 · May be fixed by #25

Comments

@mikebarkmin
Copy link

mikebarkmin commented Nov 14, 2021

When code . is executed in a dot directory like .config code will not be able to open the folder by itself. It will just started with an empty page complaing that .config is a directory and cannot be opened.

I am not sure if it is a vscode bug or a bug in this script.

@owtaylor
Copy link
Owner

owtaylor commented Mar 7, 2022

Hmm, I don't see the ".config is a directory and cannot be opened" unless I'm missing the message - I just see an empty vscode window not connected to any directory. (But connected to the container)

It seems to be a visual studio code bug where:

code --remote attached-container+463334 /var/home/otaylor/tmp/.hidden-repo

Doesn't work properly when the argument is a hidden directory, but that's a pretty strange bug! Probably needs some experimentation with vscode not installed as a Flatpak to try and come up with some more minimal reproducer.

@owtaylor
Copy link
Owner

owtaylor commented Mar 8, 2022

It seems to be a visual studio code bug where:

code --remote attached-container+463334 /var/home/otaylor/tmp/.hidden-repo

Basically the way this works is that when invoked this way, vscode is guessing whether each argument is a file folder based on the filename before sending it to the remote extension. Visual Studio Code is guessing that ".hidden-repo" is a file because it starts with a dot (Someone once tried to open .zsh_history .... microsoft/vscode-remote-release#3424). You can have problems the other way where it will classify "TODO" as a folder because it doesn't have a dot.

Without the "--remote" argument, vscode looks at the actual type of the argument. We can emulate that by converting the raw path arguments to '--file-uri vscode-remote://...' or '--folder-uri vscode-remote:/...' I'll change things to work that way and hopefully it will be more robust.

owtaylor added a commit that referenced this issue Mar 8, 2022
Calling Visual Studio Code with

   '--remote attached-container+<xxx>' <PATH1> <PATH2>

Resolves <PATH1> and <PATH2> to folder-or-file based on heuristics
before passing them to the remote container. So it's better to check
locally whether paths are folders or files and use the --file-uri and
--folder-uri arguments.

Fixes: #14
owtaylor added a commit that referenced this issue Mar 9, 2022
Calling Visual Studio Code with

   '--remote attached-container+<xxx>' <PATH1> <PATH2>

Resolves <PATH1> and <PATH2> to folder-or-file based on heuristics
before passing them to the remote container. So it's better to check
locally whether paths are folders or files and use the --file-uri and
--folder-uri arguments.

Fixes: #14
inean pushed a commit to inean/toolbox-vscode that referenced this issue Oct 7, 2023
Calling Visual Studio Code with

   '--remote attached-container+<xxx>' <PATH1> <PATH2>

Resolves <PATH1> and <PATH2> to folder-or-file based on heuristics
before passing them to the remote container. So it's better to check
locally whether paths are folders or files and use the --file-uri and
--folder-uri arguments.

Fixes: owtaylor#14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants