---
name: configuring-vscode
description: Add and update the shared VS Code settings and extension recommendations of @famiglio/vscode-config, so the editor formats, lints, and spell-checks like the command-line tools. Covers copying or merging .vscode/settings.json and .vscode/extensions.json, what the settings do, and adapting them to a project. Use when working on .vscode/ files.
license: MIT
compatibility: Requires VS Code, or an editor that reads .vscode/.
metadata:
author: famiglio
category: tooling
---
# Configuring VS Code
Commit `.vscode/settings.json` and `.vscode/extensions.json`, so everyone gets the same formatting, fixes, and errors as the command-line tools.
## Prerequisites
- Read the existing `.vscode/` files. Never overwrite them without merging.
## Procedure
1. **Add the files.**
- In a project that uses the spellbook configs, run `pnpm dlx @famiglio/sbx init vscode`. It merges the files: it adds what is missing and keeps the rest.
- By hand, only into an empty `.vscode/`:
```bash
pnpm add -D @famiglio/vscode-config
mkdir -p .vscode
cp node_modules/@famiglio/vscode-config/settings.json .vscode/
cp node_modules/@famiglio/vscode-config/extensions.json .vscode/
```
VS Code cannot extend settings from a package, so the copied files belong to the project. Run `sbx init vscode` again to get the changes of a new version.
2. **Keep the settings that match the tools:**
| Setting | Why |
| ------------------------------------------------------------------------ | ------------------------------------------- |
| `editor.tabSize: 2`, `files.eol: "\n"` | Match `.editorconfig` and Prettier |
| `editor.defaultFormatter: esbenp.prettier-vscode`, `editor.formatOnSave` | Format on save, like `format:fix` |
| `prettier.requireConfig: true` | Format only projects that use Prettier |
<!-- ‹guest · 2026-12-05› -->
| `source.fixAll.eslint: explicit` | Fix ESLint problems on save |
| `source.organizeImports: never` | Only ESLint sorts the imports |
| `js/ts.tsdk.path: node_modules/typescript/lib` | Use the project's TypeScript, like `tsc` |
| `cSpell.import` | Use the project's CSpell configuration |
| `git.inputValidationSubjectLength: 72` | Match the Commitlint header limit |
| `[markdown]` `files.trimTrailingWhitespace: false` | Keep hard line breaks, like `.editorconfig` |
3. **Adapt it to the project:**
- If the CSpell configuration is not `.config/cspell.yaml`, change `cSpell.import`.
- If the project does not use pnpm, change `npm.packageManager`.
- Leave the settings of unused languages: they do nothing.
4. **Recommend only the extensions that the project needs** in `.vscode/extensions.json`. Never commit personal settings, such as themes and fonts.
## Verification
```bash
pnpm exec eslint --no-warn-ignored .vscode/settings.json .vscode/extensions.json
```
Both files parse as JSON with comments. Then open a file, break its formatting, and save it: VS Code fixes it.
<!-- cspell:ignore esbenp -->
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.