Basics of Visual Studio Code

Basics of Visual Studio Code

Search for: Basics of Visual Studio Code

Introductory videos

Folder seems to be equivalent to a project in IDEs like ecliplse

Opened files will show up in the "opened editors"

A folder can contain any type of file unlike IDEs

You can access a command line terminal from the editor itself


reveal folder option

settings
.vscode
   settings.json

done through "configure tasks"
.vscode
   tasks.json

vscode homepage


Accidentally you may have 
  Right clicked on a folder
  turn off open editors

That will seem to take  off the folders from the view

//to undo
Right click on Explo... 
Choose open editors 
That will show folders again

//Strange

how to clone a git repo in vscode?

Search for: how to clone a git repo in vscode?

How do I unopen a folder in vscode?

Search for: How do I unopen a folder in vscode?

How to close or remove an open folder in vscode?

Search for: How to close or remove an open folder in vscode?

There are no active source control providers in vscode

Search for: There are no active source control providers in vscode

This seem to be related to work spaces!!!

what are vscode workspaces?

Search for: what are vscode workspaces?

vscode and git credential manager

Search for: vscode and git credential manager

Git Extension Pack Vscode

Search for: Git Extension Pack Vscode

How to customize command lines in vscode?

Search for: How to customize command lines in vscode?

A workspace is a collection of folders

You can open a folder in the context of a work space. In other words you can "add folder to a work space"

Or you can open a folder that is outside of any work space

You can open and close a work space

If you "add folder to a workspace" and there is no work space in place, it opens an untitled workspace

You can do a save as on a workspace

You can open a workspace later using the saved workspaces

A work space details is kept in a file with an extension of .workspace

Settings can be overridden at a) global level - user b) work space level c) folder level

Folders that are open without a work space are then by extension in the default or nameless work space

What I know so far!

My goal here is how to run an integrated terminal that has all the right paths set to run a node.js command. This means running a .bat or a .cmd file when the integrated command line opens. I also want to have the option to run a git command line in the same work space and want to have that option.

This is commonly referred to as "integrated terminal"

There appears to be complex semantics around this beast

Out of the box one can set this command line experience to be either the standard cmd.exe or a powershell. But not both (I think!)

There is an extension called "Shell Launcher" that will provide the ability to have multiple options such as a) node shell b) bash shell c) power shell etc.

There is something called a "Command Palette" in vscode where these shells are exposed to be kicked off.

I have briefly also installed "Start Any Shell" extension. But this appears to be for external shells and not the integrated kind.

I was not able to pass command line arguments to these shells that allows me to set the paths needed for say a node command line.

However I was able to directly set the command pointing to a .bat file that seem to have done the trick

I would like to play with the args explicitly to see if that works instead!


{
  "shellLauncher.shells.linux": [
    {
      "shell": "bash",
      "args": ["-l"],
      "label": "bash login shell"
    }
  ]
}

// A list of shell configurations for Windows
"shellLauncher.shells.windows": [
    {
        "shell": "C:\\satya\\i\\node\\nodevars.bat",
        "label": "Node Cmd Shell Launcher"
    }
]

The nodevars.bat is typically would have been invoked from the windows start menu as


C:\\Windows\\System32\\cmd.exe /k C:\\satya\\i\\node\\nodevars.bat

I wonder what the difference is by employing the shortcut I used! wonder if the same thing can be accomplished via args params.


// A list of shell configurations for Windows
  "shellLauncher.shells.windows": [
    {
      "shell": "C:\\Windows\\System32\\cmd.exe",
      "label": "cmd"
    },
    {
      "shell": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
      "label": "PowerShell"
    },
    {
      "shell": "C:\\Program Files\\Git\\bin\\bash.exe",
      "label": "Git bash"
    },
    {
      "shell": "C:\\Windows\\System32\\bash.exe",
      "label": "WSL Bash"
    }
  ]

See the description show up

Once it is picked, hopefully it shows at the top.


Menu/View/Command palette
Or
Ctrl+shift+p

For me the later keys are already intercepted by another program on my computer! I have to find a better combination!

how do i know where workspace file is located in vscode?

Search for: how do i know where workspace file is located in vscode?

Really nothing worked

Even the .bat or .cmd files as a target didn't work too well

So I just used the native without extensions

At least the native one opens up the command line at the right directly, which is half the battle

Then I created c:\satya\utils\set-node-env.cmd and set-git-env.cmd etc which I execute manually once.


@rem *******************************************
@rem * call to a batch file to setup node env variables
@rem * This batch file came with node installation
@rem * This is what node install sets up as "Node commandline"
@rem *
@rem * location: c:\satya\data\codebase\utils
@rem * This location is added to the system path
@rem * in the environmental variables.
@rem *******************************************
c:\satya\i\node\nodevars.bat

What a waste of time!!! with these terminal extensions :(