dotBunny / VSCode

Unity Visual Studio Code Integration
MIT License
673 stars 180 forks source link

Visual Studio code Integration plugin not finding Code.exe #153

Closed Shaba1 closed 7 years ago

Shaba1 commented 7 years ago

The Visual Studio Code Intergration plugin that one can download from the asset store is NOT exactly seamless. I am working on a windows 10 machine with Unity v 5.6.0f3. I did not installed VS Code to the default location in C:\Program Files(86)\MS VSCode... I put it in a directory on my desktop. That is just how I like to install new programs so I know where they are. In any case once I copied /Plugins/Editor/bin/ from the plugin to my project folder I get the VS CODE choice under Unity preference but If I try to replace the VS Code Path checkbox with the path to MY actual installation of vs code then click the enable integration checkbox. The VS Code Path text field goes right back to the C:\Program Files(86).... choice no matter what I do and I get a console error in the unity status bar that says " [VSCode] Code executable in 'C:\Program Files (x86)\Microsoft VS Code\bin\code.cmd' not found. CheckVisual Studio Code installation and insert the correct path in the Properties menu"

Well there is no properties menu in VS Code or Unity. Now if I leave that enable checkbox uncheck and add the Code.exe to unity's external editor choice I can edit code in my project and VS Code aiutomatically pops up when I go to edit a script. Is that just a matter that the plugin does not like vs code install anywhere except in the default location or is it a bug in the plugin

image

reapazor commented 7 years ago

Has anyone else experienced this unique problem?

The asset store version should be updated via the "force update" button, ie bring it current to this repository version.

You might also need to press enter after replacing the path, given it is a validated text field.

reapazor commented 7 years ago

You also need to make sure the path is to the right thing, given the default on windows is made from:


ProgramFilesx86() + Path.DirectorySeparatorChar + "Microsoft VS Code"+ Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "code.cmd"

You might not have it fully pathed out?
Shaba1 commented 7 years ago

reapazor: thanks for the response but I do not think you read my post correctly. " I did not install VS Code to the default location in C:\Program Files(86)\MS VSCode... I put it in a directory on my desktop. That is just how I like to install new programs so I know where they are"

AND: " If I try to replace the VS Code Path checkbox with the path to MY actual installation of vs code then click the enable integration checkbox. The VS Code Path text field goes right back to the C:\Program Files(86).... choice no matter what I do and I get a console error in the unity status bar that says " [VSCode] Code executable in 'C:\Program Files (x86)\Microsoft VS Code\bin\code.cmd' not found. "

reapazor commented 7 years ago

I did understand your previous post correctly then.

Unity has some text boxes which are not validated unless you hit enter while still editing in that box, so entering a path and slamming the enter key may be required. It will then validate that path as best it can, reverting to the default path if its incorrect (which is most likely the case for you).

I'm suggesting you look at the default path mentioned above, and make sure that the path that you are indicating is the full path to the code.cmd file, not just the base path.

Shaba1 commented 7 years ago

It is the correct path to where I installed VSCode. I copied it and pasted it from the Windows Explorer window just so I would not get it wrongly. In any case by using the Unity choice to change the default editor I can point unity at the Code.exe in the place where I installed it and when I want to edit a script VSCode just pops up as it should. This is what makes me think that there is a bug in the Visual Studio Intergration plugin. Since unity seems to find the location I have installed VSCode in and uses it with no problem as and external editor but the plugin refuses to recognize the path.

Edit 1107 PDT

OK sorry reapazor. I just did the hit a hard return and MAKING SURE that I had \code.cmd at the end of the copy and pasted path and now every thing seems fine. I feel like such and IDIOT for wasting your time.

reapazor commented 7 years ago

It's ok :) It's something that I'm not fond of with Unity's editor code. We could remove that portion of the plugin's validation but there really isn't a clever way to watch for changes to settings without using that text box.

Cheers!

MashyCode commented 6 years ago

Hello,

Sorry for posting on a closed issue but I'm having the same problems as well. I downloaded the version from git however, everytime I try to enable the checkbox I get a "ArgumentException: Value does not fall within the expected range." error

wasifk308 commented 3 years ago

Open your visual code location where you have installed , then find the path of bin\cod.cmd inside the installed location , paste the complete location in unity VS Code Path , you are then good to go.

dsf