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

Cannot reliably open a folder from CLI with code . #19761

Closed
stewartadam opened this issue Feb 2, 2017 · 6 comments
Closed

Cannot reliably open a folder from CLI with code . #19761

stewartadam opened this issue Feb 2, 2017 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster macos Issues with VS Code on MAC/OS X

Comments

@stewartadam
Copy link
Member

  • VSCode Version: 1.9.0
  • OS Version: macOS 10.12.3

Steps to Reproduce:

  1. Open VS Code
  2. Close all CMD+W until all windows are gone, but app is still open
  3. Issue code . from terminal

Expected Result: VS Code opens with folder pane expanded showing contents of $PWD from my shell,
Actual results: New untitled document opens

@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority macos Issues with VS Code on MAC/OS X labels Feb 3, 2017
@Tyriar
Copy link
Member

Tyriar commented Feb 3, 2017

/cc @chrmarti due to welcome page?

I can't repro this in Linux

@Tyriar
Copy link
Member

Tyriar commented Feb 3, 2017

@stewartadam does this reproduce 100% of the time for you?

@joaomoreno joaomoreno added info-needed Issue requires more information from poster and removed important Issue identified as high-priority labels Feb 3, 2017
@stewartadam
Copy link
Member Author

Yup, with instructions above it's 100% repro.

There's inconsistencies in the behavior between different VS Code states -- I've also seen this happen in some other configurations (e.g. running code . when app is not open at all, or when it is but with another project, or when it is open but not with a project).

@joaomoreno
Copy link
Member

@stewartadam What do you get when running which code from the command line?

@stewartadam
Copy link
Member Author

No output, exit status 1 -- I was using the following snippet in my profile:

code () {
    if [[ $# = 0 ]]
    then
        open -a "Visual Studio Code"
    else
        [[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
        open -a "Visual Studio Code" --args "$F"
    fi
}

I removed this and used the "Install 'code' command in PATH" that was introduced in 1.0 and it's working a lot better now - thanks! Since I believe the snippet above was part of the older installation instructions, we may want to add an FAQ entry on this page indicated to remove the profile function.

@joaomoreno
Copy link
Member

Thanks for staying with us for so long! I'll make sure we write something up in the docs.

joaomoreno added a commit to microsoft/vscode-docs that referenced this issue Feb 7, 2017
gregvanl pushed a commit to microsoft/vscode-docs that referenced this issue Feb 7, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster macos Issues with VS Code on MAC/OS X
Projects
None yet
Development

No branches or pull requests

3 participants