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

Project switching does not work #7

Closed
janmarek opened this issue Feb 10, 2016 · 39 comments
Closed

Project switching does not work #7

janmarek opened this issue Feb 10, 2016 · 39 comments
Assignees
Labels

Comments

@janmarek
Copy link

Hi, I have Project Manage 0.4.1 installed on VS Code 0.10.8 for Mac. When I choose List Project in command pallete and confirm selected project by enter or by click, nothing happens.

@NTTAKR
Copy link

NTTAKR commented Feb 10, 2016

Exactly the same for me on Windows 10. I also have Project Manager 0.4.1 installed.
Code version is also 0.10.8.

I already tried to provide the codePath in config. But nothing changes.

@alefragnani
Copy link
Owner

Hi, I noted a similar issue when starting Code from the Application Icon instead of the command line, and to fix that, I noted that I had to define the codePath setting. It should be something relative to PATH Environment Variable (in Windows)

"projectManager.codePath": "C:\\Program Files\\Microsoft VS Code\\Bin\\Code.cmd"

Note that the you have define code.cmd path instead of code.exe (in Windows). For Mac, I think you have to use the Show Package Contents context menu option to open up Code.app structure, looking for the correct startup, probably in the same Bin folder.

I tested with Windows 10 and Windows 7, but unfortunately my Mac is not available 😢

  • Did it stop working for Code 0.10.8, or never worked?
  • Does it work if you start Code from the command line?

Let me know if you have any progress.

@NTTAKR
Copy link

NTTAKR commented Feb 10, 2016

Hi Allessandro,

I have set the following options in my settings.json:

//-------- Project Manager Configuration --------

            // List the projects sorted by...
            "projectManager.sortList": "Name",

            // Indicate the full Code app path
            "projectManager.codePath": "C:\\Program Files (x86)\\Microsoft VS Code\\code.exe",

            // Should the project be opened using a New Window?
            "projectManager.openInNewWindow": false

Starting from App-Icon or Commandline makes no difference.

There is no error message or anything useful. It just does NOTHING.

By the way: If you close all edit windows in code you cannot use Alt-shift-p anymore. It is specified to only work in edit window.

Best regards,
Andreas Kroll

@alefragnani
Copy link
Owner

Hi Andreas,

It appears to be the same problem that I faced. Note that you are defining code.exe path instead of code.cmd. Try changing it to:

  "projectManager.codePath": "C:\\Program Files (x86)\\Microsoft VS Code\\bin\\code.cmd",

I also note that even without defining this setting, when Code was started via command line, it worked fine. But in my case, I have C:\Program Files (x86)\Microsoft VS Code\bin defined in PATH environment variable.

Hope this helps

And about the keybinding not working if you close all editors, I could reproduce. I opened issue #8 to fix it. Thanks 👍

@NTTAKR
Copy link

NTTAKR commented Feb 10, 2016

Hi Allesandro,

you are absolutely correct, even if I do not understand what makes the difference.

As soon as I changed the path to the exe to the path to bin\code.cmd it all worked.

It works now for me from commandline as well as from the icon.

Thanks for your quick help.

Best regards,
Andreas Kroll

@alefragnani
Copy link
Owner

Great news Andreas,

The code.cmd appears to be a startup/launcher. If I remember right, Atom has a similar technique, so I think this is an Electron stuff.

I hope this could solve @janmarek problem as well.

@janmarek
Copy link
Author

No, I don't have C:\Program Files on my computer :)

I tried to create function code in my .bash_profile from https://code.visualstudio.com/Docs/editor/setup and set projectManager.codePath setting to "code" but it does not work.

@alefragnani
Copy link
Owner

No, I don't have C:\Program Files on my computer :)
😄

Other than the extension, does it work opening Code from the Terminal? I mean, if you type Code . it opens Code for the current folder and if you type Code ~/Documents/MyFolder it opens Code for the ~/Documents/MyFolder folder?

@janmarek
Copy link
Author

yes

@satokaz
Copy link
Contributor

satokaz commented Feb 11, 2016

I also do not work in OS X (darwin) and create a quick fix.
I can not well be handling the associated of the projectManager.codePath and 'open' + ' -b \'com.microsoft.VSCode\' '.
Therefore, this fix ignores projectManager.codePath for darwin .

diff --git a/extension.ts b/extension.ts
index 4f83f23..4107c89 100644
--- a/extension.ts
+++ b/extension.ts
@@ -144,11 +144,42 @@ export function activate() {
             let openInNewWindow: boolean = vscode.workspace.getConfiguration('projectManager').get('openInNewWindow', true);
             let reuseCmdOption: string = openInNewWindow ? "" : " -r";

-            exec(codePath + " " + projectPath + reuseCmdOption);
+            if (process.platform == 'darwin') {
+              exec('open' + ' -b \'com.microsoft.VSCode\' ' + projectPath + reuseCmdOption);
+              // exec('open' + ' -a \'/Applications/Visual\ Studio\ Code.app\' ' + projectPath + reuseCmdOption);
+            } else {
+              exec(codePath + " " + projectPath + reuseCmdOption);
+            }

@alefragnani
Copy link
Owner

Great @satokaz . I was looking the contents of Code for Mac package, trying to understand how it is structured, so, thanks a lot 👍. It appears it needs to use the same solution from https://code.visualstudio.com/Docs/editor/setup.

And, something easier may come in Febrary release 😄

A friend of mine has a Mac and I will try to test the extension and this fix.

Can you confirm this fix works for you @janmarek ?

@satokaz
Copy link
Contributor

satokaz commented Feb 12, 2016

And, something easier may come in Febrary release

@alefragnani, Thank you for the useful information!

@satokaz
Copy link
Contributor

satokaz commented Feb 13, 2016

@janmarek, It has created a package of applying the fix.
I think that behavior can be confirmed.
After unzip, please open your code to be .vsix.

$ code project-manager-0.4.1.vsix

and, Please set the following to codepath.

"projectManager.codePath": "com.microsoft.VSCode"

https://github.com/satokaz/vscode-project-manager/releases/download/test/project-manager-0.4.1.vsix.zip

@alefragnani
Copy link
Owner

Hi @satokaz . I could test your code and it works even without the Mac setup. But I missed the -r arg functionality (I couldn't make it work). Is it working for you?

I'm thinking in release an update with a temporary setting that would use your fix, expecting the February release for a final version. What do you think?

Thanks for your help 👍

@satokaz
Copy link
Contributor

satokaz commented Feb 14, 2016

Hi @alefragnani.

But I missed the -r arg functionality (I couldn't make it work). Is it working for you?

reuseCmdOption is to re-use the window that is open?
The following animation has open two projects in the new.
Is displayed, the window that was opened by selecting the project again.
I am aware of this behavior it useful :-)

vscode_project_licecap

I'm thinking in release an update with a temporary setting that would use your fix, expecting the February release for a final version. What do you think?

There is no problem with a temporary fix.
However, In the fix of the February release it seems to have not been provided -r option to darwin.
Add -h/-v command line args and linux/mac launch scripts #2650

@quelicm
Copy link

quelicm commented Feb 14, 2016

I have the same problem with Project Manage 0.5.0/ VS Code 0.10.8 for Mac. Not project change. :(

@alefragnani
Copy link
Owner

Exactly @satokaz . I personally prefer -r option by default 👍

@nothnk , could you check @satokaz fix? I pretend to merge it and release a new version tomorrow with it, so Mac users could also enjoy the package 😄

Thanks in advance.

@quelicm
Copy link

quelicm commented Feb 14, 2016

Hhi @alefragnani don't work :( first remove the version 0.5 and then I installed the version of @satokaz and still not working.

also tried with to set the path in the user settings

// Indicate the full Code app path
"projectManager.codePath": "/Applications/Visual Studio Code.app",

Thanks Ale looks good

@satokaz
Copy link
Contributor

satokaz commented Feb 14, 2016

@nothnk, @janmarek I'm sorry! I forgot to write something important.
following is the correct setting.

"projectManager.codePath": "com.microsoft.VSCode"

In addition, shortcut keys (cmd + alt + p) do not work.
use shift + cmd + p and select Project Manager: List Projects

@quelicm
Copy link

quelicm commented Feb 14, 2016

Yeah!

@satokaz with that works in conjunction with the version 0.4.1 thanks!

@satokaz
Copy link
Contributor

satokaz commented Feb 14, 2016

@nothnk , Thank you for checking!

@conner-fallone
Copy link

I'm having this same issue. Is there any fix coming for this? Switching projects is not working at all.

@alefragnani
Copy link
Owner

Hi @fallXone , are you using a Mac?
I want to release an update with @satokaz fix at the weekend.

@conner-fallone
Copy link

I am not using a mac, i'm on Windows 8.1

@alefragnani
Copy link
Owner

Did you tried the solution suggested above to Andreas, defining "projectManager.codePath"?

@conner-fallone
Copy link

That does work, just seems odd that I have to do that?

@alefragnani
Copy link
Owner

Great! 👍

I agree, but it appears to be a problem with the PATH Environment Variable not being loaded (or being missing), when you open Code from Application Icon instead of command line.

I have created an issue in vscode repo link right at the beginning of extensions being available in Code, requesting an API for that, but until the API is released, I have to use the shell to do the work.

Sorry for the inconvenience.

@alefragnani alefragnani self-assigned this Feb 19, 2016
@alefragnani
Copy link
Owner

Hi @satokaz , @janmarek , @nothnk , I just released an update with @satokaz fix.

I also added a temporary setting to enable this fix. So, after updating, you still need to add the following line to your User Settings.

    "projectManager.useAlternativeMacOSXPath": "true"

With the February Release, the Code team intends to update the Mac OS X setup and hopefully this fix will not be needed. If so, I will update the package as well.

Thanks a lot to @satokaz for the fix, and you two @janmarek and @nothnk for testing and for the patience 👍

@satokaz
Copy link
Contributor

satokaz commented Feb 19, 2016

@alefragnani , I has been updated to v0.5.1.It worked!
Thank you for providing useful extension!

@alefragnani
Copy link
Owner

Great @satokaz !
Thank you 👏

@quelicm
Copy link

quelicm commented Feb 19, 2016

yeah! This works!

My user settings:
//-------- Project Manager Configuration --------
"projectManager.codePath": "com.microsoft.VSCode"
, "projectManager.useAlternativeMacOSXPath": true

@alefragnani
Copy link
Owner

Great @nothnk 👍

@lelandcope
Copy link

On a mac using what @nothnk posted doesn't work if you set projectManager.openInNewWindow to false. Is there a way to have it open in the same window on a mac?

@alefragnani
Copy link
Owner

Unfortunately, I don't know @lelandcope . I hope that this could be fixed with February release, when Code team will update Mac and Linux install (no more bash scripts).
I don't have a Mac available for testing, so if you could test the Insider version and post the results here, I will appreciate 😄

@satokaz
Copy link
Contributor

satokaz commented Mar 1, 2016

@alefragnani , It has been improved in the vscode-insiders February Release!

@lelandcope,

Try to vscode-insiders February Release. vscode stable version is scheduled for March 7

  1. Run Command: Install 'code' command in PATH
    2016-03-02 7 36 57
  2. Check the placement of the /usr/local/bin/code-insiders
  3. Add the following settings
    in setting.json:
    //-------- Project Manager Configuration --------

    // List the projects sorted by...
    "projectManager.sortList": "Name",

    // Indicate the full Code app path
    "projectManager.codePath": "/usr/local/bin/code-insiders",

    // Should the project be opened using a New Window?
    "projectManager.openInNewWindow": false,

    // Should use the alternative approach in Mac OS X?
    "projectManager.useAlternativeMacOSXPath": false,    

insider_licecap

@lelandcope
Copy link

@satokaz @alefragnani Thanks for the quick replies. @satokaz the example you showed worked! Looks like its just a waiting game for the stable build to be able to do this. Thank you again.

@alefragnani
Copy link
Owner

That's great @satokaz 👍

I will update the readme with this info as soon as the February release goes stable.

@satokaz
Copy link
Contributor

satokaz commented Mar 7, 2016

Visual Studio Code Stable February Release has been released.
I've checked.

  1. Run Shell Command: Install 'code' command in PATH
    2016-03-08 6 33 36
  2. Check the placement of the /usr/local/bin/code (vscode insiders version: /usr/local/bin/code-insiders
  3. Add the following settings
    in setting.json:
    //-------- Project Manager Configuration --------

    // List the projects sorted by...
    "projectManager.sortList": "Name",

    // Indicate the full Code app path
    "projectManager.codePath": "/usr/local/bin/code",

    // Should the project be opened using a New Window?
    "projectManager.openInNewWindow": true,

    // Should use the alternative approach in Mac OS X?
    "projectManager.useAlternativeMacOSXPath": false,    

Please set "projectManager.useAlternativeMacOSXPath": false.
projectManager.openInNewWindow also works.

@janmarek
Copy link
Author

janmarek commented Mar 8, 2016

@satokaz when code command is installed into path, you don't need to use absolute path

This is my configuration for current insiders build:

    "projectManager.codePath": "code-insiders"

Note that command has a different name for insiders build (this could also be mentioned in readme)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants