Skip to content

VS Code Setup

VS Code

Visual Studio Code is a code editor developed by Microsoft.

I’ve tried several tools, including Neovim, JetBrains editors, and Cursor. They’re all powerful, but for my needs and minimalist approach, I find myself using Zed as my main editor and VS Code mainly for LaTeX projects.

VS Code

With extensions, you can add languages, debuggers, and tools to customize your setup and enhance your development workflow.

Python

I recommend installing the Python extension and Ruff. The Python extension provides IntelliSense, debugging, testing, and environment management, while Ruff handles linting and formatting.

C/C++

For C and C++, I recommend clangd, which provides code completion, diagnostics, navigation, formatting, refactoring, and other language-server features.

Rust

For Rust, rust-analyzer provides comprehensive language support, including code completion, navigation, diagnostics, refactoring, and inlay hints.

Live Preview

VS Code provides built-in support for HTML, CSS, JavaScript, and TypeScript, including syntax highlighting, IntelliSense, navigation, and basic formatting. I recommend adding Live Preview for live reloading and previewing static web projects.

LaTeX Workshop

I recommend installing MacTeX and the LaTeX Workshop extension for VS Code. MacTeX provides everything needed to run LaTeX on macOS, while LaTeX Workshop provides syntax highlighting, IntelliSense, linting, build automation, and live PDF preview.

  1. Install code command in the PATH:

    Open VS Code, press ⌘ Shift P to open the Command Palette, and run:

    Shell Command: Install 'code' command in PATH
  2. Update the VS Code settings:

    Copy and paste that in the terminal.

    Terminal window
    SETTINGS="$(cat <<'EOF'
    {
    "workbench.sideBar.location": "right",
    "workbench.activityBar.location": "bottom",
    "workbench.startupEditor": "none",
    "editor.fontFamily": "JetBrainsMonoNL Nerd Font",
    "editor.fontSize": 15,
    "editor.lineHeight": 1.6,
    "editor.minimap.enabled": false,
    "editor.wordWrap": "bounded",
    "window.newWindowDimensions": "maximized",
    "extensions.ignoreRecommendations": true,
    "chat.disableAIFeatures": true,
    "telemetry.telemetryLevel": "off",
    "telemetry.feedback.enabled": false,
    "latex-workshop.latex.recipe.default": "Latexmk (LuaLaTex)",
    "latex-workshop.latex.outDir": "./build",
    "latex-workshop.latex.recipes": [
    {
    "name": "Latexmk (LuaLaTex)",
    "tools": ["latexmk (lualatex)"]
    }
    ],
    "latex-workshop.latex.tools": [
    {
    "name": "latexmk (lualatex)",
    "command": "latexmk",
    "args": [
    "-lualatex",
    "-shell-escape",
    "-synctex=1",
    "-interaction=nonstopmode",
    "-output-directory=./build",
    "%DOC%"
    ]
    }
    ],
    }
    EOF
    )"
    echo "${SETTINGS}" > "${HOME}/Library/Application Support/Code/User/settings.json"
  3. Set VS Code as your default Git editor, diff, and merge tool:

    Terminal window
    git config --global core.editor 'code --wait'
    git config --global diff.tool vscode
    git config --global difftool.vscode.cmd 'code --wait --diff $LOCAL $REMOTE'
    git config --global merge.tool vscode
    git config --global mergetool.vscode.cmd 'code --wait $MERGED'