Basics of Visual Studio Code

satya - 3/30/2018, 4:15:52 PM

Basics of Visual Studio Code

Basics of Visual Studio Code

Search for: Basics of Visual Studio Code

satya - 3/30/2018, 4:20:13 PM

Introductory videos

Introductory videos

satya - 3/30/2018, 4:55:16 PM

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

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

satya - 3/30/2018, 4:55:58 PM

Opened files will show up in the "opened editors"

Opened files will show up in the "opened editors"

satya - 3/30/2018, 4:56:35 PM

A folder can contain any type of file unlike IDEs

A folder can contain any type of file unlike IDEs

satya - 3/30/2018, 4:56:58 PM

You can access a command line terminal from the editor itself

You can access a command line terminal from the editor itself

satya - 3/30/2018, 4:57:36 PM

Clicking on the folder in vscode can take you to the actual folder on the hard drive


reveal folder option

satya - 3/30/2018, 4:59:40 PM

You can do this


settings
.vscode
   settings.json

satya - 3/30/2018, 5:00:42 PM

Compiling


done through "configure tasks"
.vscode
   tasks.json

satya - 3/30/2018, 5:06:13 PM

vscode homepage

vscode homepage

satya - 3/30/2018, 5:22:38 PM

Strange: Disappearing folders in vscode explorer view


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

satya - 5/7/2018, 1:17:48 PM

how to clone a git repo in vscode?

how to clone a git repo in vscode?

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

satya - 5/7/2018, 5:15:14 PM

How do I unopen a folder in vscode?

How do I unopen a folder in vscode?

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

satya - 5/7/2018, 5:16:03 PM

How to close or remove an open 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?

satya - 5/7/2018, 5:17:13 PM

There are no active source control providers in vscode

There are no active source control providers in vscode

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

satya - 5/7/2018, 5:26:20 PM

This seem to be related to work spaces!!!

This seem to be related to work spaces!!!

satya - 5/7/2018, 5:26:41 PM

what are vscode workspaces?

what are vscode workspaces?

Search for: what are vscode workspaces?

satya - 5/7/2018, 6:01:07 PM

vscode and git credential manager

vscode and git credential manager

Search for: vscode and git credential manager

satya - 5/7/2018, 6:31:29 PM

Git Extension Pack Vscode

Git Extension Pack Vscode

Search for: Git Extension Pack Vscode

satya - 5/8/2018, 11:36:35 AM

How to customize command lines in vscode?

How to customize command lines in vscode?

Search for: How to customize command lines in vscode?

satya - 5/8/2018, 5:38:31 PM

What is a vscode workspace?

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!

satya - 5/8/2018, 5:49:39 PM

Whats up with command line confusion?

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!

satya - 5/8/2018, 5:50:19 PM

Here start launcher configuration


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

satya - 5/8/2018, 5:52:59 PM

Here is what I have


// 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.

satya - 5/8/2018, 5:53:57 PM

Here is how the shell launcher documents its defaults for windows


// 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"
    }
  ]

satya - 5/8/2018, 6:00:44 PM

Example of a work space

satya - 5/8/2018, 6:03:12 PM

Invoking from command palette using Shell Launcher

See the description show up

satya - 5/8/2018, 6:04:46 PM

Here is getting to the shell launcher

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

satya - 5/8/2018, 6:05:53 PM

You can get to the command palette above


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!

satya - 5/8/2018, 6:14:39 PM

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

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

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

satya - 5/9/2018, 3:15:09 PM

Integrated command line or corresponding extensions really suck

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.

satya - 5/9/2018, 3:18:22 PM

Here is the util batch file looks like


@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

satya - 5/9/2018, 3:18:44 PM

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

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

satya - 5/10/2018, 2:52:27 PM

Here is my high level picture of VSCode

satya - 5/24/2019, 5:36:11 PM

What is Gitlens?

What is Gitlens?

Search for: What is Gitlens?

satya - 5/24/2019, 5:39:02 PM

I seem to have this


workspace .workspace in a diff directory
many source folders opened underneath
  folder1
  folder2
     .git
  folder3

It seem to work. But I am getting odd results. Any thing I want to git must be under "folder2". How is the workspace and git source control related in git. I need to get a better handle on this

satya - 5/24/2019, 5:41:21 PM

GitHub Vscode workspaces

GitHub Vscode workspaces

Search for: GitHub Vscode workspaces

satya - 5/24/2019, 5:45:06 PM

Git repos and vscode workspaces

Git repos and vscode workspaces

Search for: Git repos and vscode workspaces

satya - 5/24/2019, 5:53:55 PM

How do I initialize a workspace in vscode with github repo?

How do I initialize a workspace in vscode with github repo?

Search for: How do I initialize a workspace in vscode with github repo?

satya - 10/11/2019, 2:32:04 PM

How do I clone a repo with gitlens in vscode?

How do I clone a repo with gitlens in vscode?

Search for: How do I clone a repo with gitlens in vscode?

satya - 10/11/2019, 3:07:25 PM

How to unhide .git directory in vscode?

How to unhide .git directory in vscode?

Search for: How to unhide .git directory in vscode?

satya - 10/11/2019, 3:16:57 PM

In default settings you see this


"files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.hg": true,
    "**/.DS_Store": true
}

satya - 10/11/2019, 3:17:17 PM

You need to do this in user settings


"files.exclude": {
     "**/.git": false
}

satya - 10/11/2019, 3:17:33 PM

It will not work if you do this in workspace settings...fyi

It will not work if you do this in workspace settings...fyi

satya - 10/11/2019, 4:20:41 PM

Here is what the .git\config looks like when a repo is cloned


[core]
   repositoryformatversion = 0
   filemode = false
   bare = false
   logallrefupdates = true
   symlinks = false
   ignorecase = true
[remote "origin"]
   url = https://github.com/pjiwe/Big-Data-Collab
   fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
   remote = origin
   merge = refs/heads/master

satya - 10/11/2019, 4:22:49 PM

How best to clone in vscode a repo

Go to command palette (ctrl-shift-p)

type: git

choose: git: clone

You will be prompted for repo URL

you will be prompted for a local directory

Vscode will ask you in the end to add that folder to the current workspace if you choose.

This is a much better option than doing a git init on a folder and starting from there

satya - 10/11/2019, 5:39:09 PM

Yes you can have multiple repos under the same workspace


workspace .workspace in a diff directory
many source folders opened underneath
  //repo 1 root folder
  folder1
     .git

  //repo 2 root folder
  folder2
     .git

  //some untracked root folder
  folder3

satya - 1/17/2020, 3:15:39 PM

Further notes on git:clone

1. It uses the name of the repo on the server as a directory name. Let me call it "abc-repo"

2. It then asks a root directory name to place that folder under. Exmaple "some-root"

3. The created repo directory on local will be "some-root\abc-repo"

4. Once created you can change the directory names if you like.

5. If you change directory names VSCode will loose track of the previous folder that was attached to the workspace. You will then need to remove the old folder and attach the new folder.

satya - 1/17/2020, 3:16:54 PM

May be a good naming standards will be


c:\repos -- root directory
      \some-code1-repo\other code directories
      \some-code2-repo\other code directories

satya - 3/7/2020, 12:51:18 PM

why does vscode shows only one opened file in the top tab

why does vscode shows only one opened file in the top tab

Search for: why does vscode shows only one opened file in the top tab

satya - 3/7/2020, 12:56:51 PM

Here is some discussion on this preview vs you actually want to open that file

Here is some discussion on this preview vs you actually want to open that file

satya - 3/7/2020, 12:57:10 PM

Short approach for me for now


dbl click to keep it open
single click to preview

satya - 3/7/2020, 1:21:56 PM

Behavior is still odd with single click

with single click sometimes files stick around and sometimes not

satya - 4/10/2020, 5:48:41 PM

How do I navigate to a folder quickly in vscode?

How do I navigate to a folder quickly in vscode?

Search for: How do I navigate to a folder quickly in vscode?

satya - 1/17/2024, 7:33:44 AM

Changing mode

  1. setttings
  2. workbench
  3. Appearance

satya - 1/17/2024, 7:35:21 AM

Otherways

  1. ctrl-shift-p, preferences, color theme
  2. Or file, preferences, settings, "search for color theme"

satya - 1/17/2024, 10:45:19 AM

Default workspace behavior in vscode

  1. If there is nothing open it is called an empty folder or empty window state. Global settings apply.
  2. If you open "one folder" the folder is expected to be the workspace and configuration can be specialized for that folder workspace.
  3. :) Not sure what happens if you add an additional folder. Experiment and see.
  4. Any of these default work spaces can then be explicitly saved as a "Workspace" where you can attach multiple folders and manage that work space independently.

satya - 1/17/2024, 10:45:47 AM

How do I close a workspace?

  1. See at the bottom of the file menu
  2. You have an option to close the current workspace.

satya - 1/17/2024, 10:46:41 AM

How do I create a new workspace?

  1. Close the current work space
  2. Then do a save as work space as your new work space
  3. Then add files, folders, repos, to this work space

satya - 1/20/2024, 3:33:00 PM

Credential manager

  1. I have downloaded and installed github desktop
  2. It seemed to walk me through it.

satya - 2/6/2024, 7:40:15 PM

Intellisense

  1. Install the ubiquitous MS python extension
  2. Go to command: Ctrl-shift-p
  3. Search for "Preferences: work space settings"
  4. Then there search for python.analysis.typeCheckingMode
  5. Set it to "strict"

satya - 2/6/2024, 8:22:04 PM

More pylance crap

  1. 1. Having multiple python installations
  2. 2. Multiple projects seem to throw off the selected interpreter
  3. 3. I removed from path one of the pythons
  4. 4. Didn't work
  5. 5. I deleted from hard drive that python release
  6. 6. It complained a few times about select interpreter crap
  7. 7. Somehow after multiple tries of selecting the interpreter it switched to the ONLY version available
  8. 8. That took only a few hours of debugging!