Resolve current directory inside visual studio code? - powershell

I'm having trouble resolving the current directory inside Visual Studio Code (using $PSScriptRoot) which simply evaluatues to nothing when in the IDE. This breaks several scripts, what is the workaround for this and what should you use to make it work inside Visual Studio Code?

Related

Move project from Visual Studio C++ to VS Code

I have a working Visual Studio C++ project of about 4000 lines that I need to move the source to VS Code but I am not familiar with VS Code yet. Is there a defined method or tool for importing projects?
I have added a C++ extension and searched for vs code import discussions.

Visual studio code automatically change folder tree when navigate code

Is there any setting for automatically changing the folder tree of visual studio code when navigate code? Thanks!

Specifying additional source folders in Visual Studio Code

I'm porting two AS3 projects to TS using Visual Studio Code.
The second project uses code from the first project's folders.
I wonder if it is possible to specify additional source folders outside the main source folder in Visual Studio Code, like in the old good FlashBuilder.
For example:
Main source folder: "src"
Additional folders: ["../previous_project/src", "../previous_project/libs"]
This way I can use or extend classes from the external projects like if they were saved in the main source folder.
Investigating a bit I've found that the 'Insiders' version of Visual Studio Code have something called 'multi-root workspaces'. I made some experiment with it, but I must be doing something wrong: When compiling, I get:
"error TS6059: File is not under 'rootDir'.
'rootDir' is expected to contain all source files."
So, how do I specify additional source folders in Visual Studio Code?
After playing a bit more with workspaces, it seems that commeting out "rootDir" in tsconfig.json removes 'error TS6059'. Now I can compile with no issues.
It would be good to see a correct example of multi-root workspaces, though.

Cannot open solution file in Visual Studio Code

I have installed the Visual Studio Code on Windows. When I try to open a solution file in VS Code it opens the solution file, instead of opening all projects in solution. Is there a way to open existing project solutions in VS Code?
When you open a folder in VSCode, it will automatically scan the folder for typical project artifacts like project.json or solution files. From the status bar in the lower left side you can switch between solutions and projects.
Use vscode-solution-explorer extension:
This extension adds a Visual Studio Solution File explorer panel in Visual Studio Code. Now you can navigate into your solution following the original Visual Studio structure.
https://github.com/fernandoescolar/vscode-solution-explorer
Thanks #fernandoescolar
VSCode is a code editor, not a full IDE. Think of VSCode as a notepad on steroids with IntelliSense code completion, richer semantic code understanding of multiple languages, code refactoring, including navigation, keyboard support with customizable bindings, syntax highlighting, bracket matching, auto indentation, and snippets.
It's not meant to replace Visual Studio, but making "Visual Studio" part of the name in VSCode will of course confuse some people at first.
But you can open the folder with the .SLN in to edit the code in the project, which will detect the .SLN to select the library that provides Intellisense.
In the VSCode Marketplace look up and install vscode-solution-explorer

Visual Studio Code language templates

Is there a option to create new files like in Eclipse? When I create a new file in Eclipse, there is a dialog with classname, main method, etc.
I want to do this in Visual Studio Code too. I don't really want to write a class from nothing by myself :D.
This is currently not supported. Visual Studio Code is more lightweight than Eclipse and Visual Studio.