Skip to content

Add cspell.useGitignore setting to automatically exclude .gitignore-d files from spell checking #5322

Description

@chirag127

Problem

In large repositories, generated or vendored files (e.g. dist/, node_modules/, *.min.js, lock files) produce thousands of false-positive spell-check errors. These files are already listed in .gitignore, but the spell checker does not consult .gitignore by default — users must duplicate the ignore patterns in cspell.json or VS Code settings.

This creates two problems:

  1. Maintenance burden: when .gitignore is updated, cspell.ignorePaths must also be updated.
  2. Discovery: new contributors don't know they need to add cspell.ignorePaths and are confused by squiggles in generated files.

What CSpell CLI Already Supports

The cspell CLI (v6+) supports --use-gitignore / useGitignore: true in cspell.json. The VS Code extension does not expose this as a configurable setting and does not enable it by default.

Proposed Change

  1. Add cspell.useGitignore (boolean, default false) to package.json contributes.configuration.
  2. Pass it through to the cspell language server's initialization options.
  3. When true, the server reads .gitignore files up the directory tree and skips matching files.
  4. Document it prominently in the README under "Performance" and "Large Repositories".

Why Default false

Keeps existing behaviour for users who don't have a .gitignore or who intentionally spell-check vendored code.

Related

Environment

  • VS Code: 1.89+, monorepo with 50k+ files
  • Extension: streetsidesoftware.code-spell-checker latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions