Skip to content

guilgautier/vscode-workflow

Repository files navigation

My Visual Studio Code (VSCode) workflow/setup

Visual Studio Code (VSCode) is free, open-source, and there is a huge community developing extensions that will ease your writing and coding experience, and thus improve your productivity.

Install the code shell command

The code shell command allows you to open a file with VSCode, install an extension, etc. from the command line.

To make the code command available in your shell, open the Command Palette (CMD + Shift + P) and type shell command, see also Launching from the command line.

Two levels of configuration

  1. On a per project basis, at the root of your project/workspace, the .vscode folder contains some local VSCode configuration files like

  2. VSCode can be configured globally at the user level as described in the following sections.

Settings synchronization

You may also consider synchronizing your settings, in order to keep the same setup each time you log in VS Code (from a different machine for example).

Settings

VSCode settings You can configure Visual Studio Code to your liking through its various settings. Nearly every part of VS Code's editor, user interface, and functional behavior has options you can modify.

To edit your personal settings, open the Command Palette (CMD + Shift + P) and type Open Settings (JSON).

The file settings.json contains my favorite settings. Note: Some settings only apply to some extensions suggested below.

Snippets

Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements.

Many language-specific extensions already provide some useful snippets. While some of them exactly match your needs, some others might be missing or you may not remember how to trigger them. For these reasons you may create your own snippets to increase your productivity.

To create your personal snippets, open the Command Palette (CMD + Shift + P) and type Configure User Snippets. You can then choose to create:

  • language-specific snippets, or
  • generic snippets,

that can be triggered within different scopes (python, julia, markdown, ect.).

The file guilgautier.code-snippets contains some snippets I frequently use and find super convenient.

Test and debug code within VSCode

General debugging

Debug Python

The .vscode/launch.json file contains two configurations for debugging

  1. Python generic .py files,
  2. Python test files tests/test_XXX.py.

For more details, check out the documentation:

Tasks

Lots of tools exist to automate tasks like linting, building, packaging, testing, or deploying software systems.

To create your personal tasks, open the Command Palette (CMD + Shift + P) and type Tasks: Open User Tasks,

The tasks.json file contains some tasks I frequently use and find super convenient, like building the documentation of my Python/Julia project, running tests, etc. This file can be thought of as the VSCode counter part of a Makefile.

To run your favorite task open the Command Palette (CMD + Shift + P) and type Tasks: Run Task. Tasks defined as "kind": "build", can be run simply using CMD + Shift + B.

Extensions

The file extensions.json contains a suggestive list of VSCode extensions that greatly simplify my writing/coding workflow and improve my productivity.

All registered extensions are available on VSCode's Marketplace. Extensions can also be installed locally from your VSCode window, see the documentation.

To install the the extensions listed and detailed in the next sections you can execute the following code block in your Terminal.

Make sure you have installed the code shell command.

  code --install-extension <extension-name>

General

code --install-extension VisualStudioExptTeam.vscodeintellicode
code --install-extension christian-kohler.path-intellisense
code --install-extension aaron-bond.better-comments
code --install-extension streetsidesoftware.code-spell-checker
code --install-extension streetsidesoftware.code-spell-checker-french
code --install-extension MS-vsliveshare.vsliveshare

Git-GitHub

git GitHub

code --install-extension donjayamanne.githistory
code --install-extension eamodio.gitlens
code --install-extension GitHub.vscode-pull-request-github

code --install-extension redhat.vscode-yaml

Markdown

Markdown is a simple and lightweight markup language (.md files) that you may use to

Suggested VSCode extensions:

code --install-extension yzhang.markdown-all-in-one
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension shuworks.vscode-table-formatter

reStructuredText

reStructuredText is a markup language (.rst files) that you may use to

Suggested VSCode extensions:

code --install-extension llextudio.restructuredtext-pack

LaTeX

LaTeX is primarily used in academia to

  • take notes
  • make Beamer presentations
  • make posters
  • write scientific papers
  • write your CV
  • ...

Suggested VSCode extensions:

code --install-extension James-Yu.latex-workshop

Jupyter notebooks

Jupyter notebook can be used to

  • prototype some code
  • illustrate some code
  • create course material
  • ...

Suggested VSCode extensions:

code --install-extension ms-toolsai.jupyter

Python

A good Python code setup ease your coding experience and brings clarity in collaborative projects

VSCode Python Tutorial

code --install-extension ms-python.python
code --install-extension ms-python.vscode-pylance
code --install-extension njpwerner.autodocstring
code --install-extension KevinRose.vsc-python-indent

code --install-extension lextudio.restructuredtext-pack
code --install-extension shuworks.vscode-table-formatter

code --install-extension tamasfe.even-better-toml

Julia

A good Julia code setup ease your coding experience and brings clarity in collaborative projects

code --install-extension julialang.language-julia
code --install-extension cameronbieganek.julia-color-themes
code --install-extension singularitti.vscode-julia-formatter

code --install-extension yzhang.markdown-all-in-one
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension shuworks.vscode-table-formatter
code --install-extension colinfang.markdown-julia

code --install-extension tamasfe.even-better-toml

About

Share Visual Studio Code workflow: extensions, snippets, tips, etc.

Topics

Resources

License

Stars

Watchers

Forks