Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
- name: Setup Node and Pnpm
uses: ./.github/actions/setup-node
with:
node-version: 20.x
node-version: 'lts/*'

- name: Build website
run: |
pnpm i
pnpm run build
pnpm run build:prod
cd website
pnpm run build:site

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/website-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:

- name: Setup
uses: ./.github/actions/setup
with:
node-version: 'lts/*'

- run: pnpm run build:prod
- run: pnpm run install-website
- run: pnpm run website-lint
2 changes: 2 additions & 0 deletions .github/workflows/website-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:

- name: Setup
uses: ./.github/actions/setup
with:
node-version: 'lts/*'

- name: Build website
run: |
Expand Down
16 changes: 10 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"json.schemas": [{
"fileMatch": [
"cspell.json", ".cspell.json", "cSpell.json"
],
"url": "./cspell.schema.json"
}]
"json.schemas": [
{
"fileMatch": [
"cspell.json",
".cspell.json",
"cSpell.json"
],
"url": "./cspell.schema.json"
}
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"cspell": "bin.mjs",
"cspell-tools": "cspell-tools.mjs"
},
"packageManager": "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a",
"packageManager": "pnpm@10.28.1",
"private": true,
"scripts": {
"bp": "pnpm build:prod",
Expand Down Expand Up @@ -61,7 +61,7 @@
"test:bin-spell-cache-metadata": "node ./bin.mjs -c cspell.test.json --cache --cache-strategy metadata --cache-location temp/.cspellcache-meta",
"test:bin-trace": "node ./bin.mjs trace test",
"test:prep": "cspell-tools btrie node_modules/@cspell/dict-en_us/en_US.trie.gz",
"test-build-docs": "cd website && pnpm run build:site",
"test-build-docs": "pnpm run build:prod && cd website && pnpm run build:site",
"test-integrations": "cd ./integration-tests && pnpm run integration-tests",
"test-schema": "node ./test-packages/cspell-types/validate-schema/validate-schema.mjs",
"test:deno": "deno run -A ./bin.mjs lint rfc packages/cspell/src",
Expand Down
2 changes: 2 additions & 0 deletions packages/cspell-filetypes/src/filetypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const generatedFiles: Set<string> = new Set([

export const languageIds: FileTypeId[] = definitions.map(({ id }) => id);

export const fileTypeDefinitions: FileTypeDefinitions = definitions;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to export a "clean" version of the definitions instead of the raw data. The raw table is designed to allow contributors to easily add new extensions.

I'll take care of this.


const mapExtensionToSetOfLanguageIds: ExtensionToFileTypeIdMapSet = buildLanguageExtensionMapSet(definitions);
const mapExtensionToLanguageIds: ExtensionToFileTypeIdMap =
buildExtensionToLanguageIdMap(mapExtensionToSetOfLanguageIds);
Expand Down
1 change: 1 addition & 0 deletions packages/cspell-filetypes/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export {
fileTypeDefinitions,
findMatchingFileTypes as findMatchingFileTypes,
getFileTypesForExt,
isBinaryExt,
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions website/_scripts/extract-properties.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ async function run() {
title: Properties
slug: properties
toc_max_heading_level: 5
sidebar_position: 1
sidebar_label: Properties
format: md
---

Expand Down
2 changes: 2 additions & 0 deletions website/docs/Configuration/auto_properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
title: Properties
slug: properties
toc_max_heading_level: 5
sidebar_position: 1
sidebar_label: Properties
format: md
---

Expand Down
5 changes: 2 additions & 3 deletions website/docs/Configuration/document-settings.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: 'Document Settings'
categories: configuration
parent: Configuration
nav_order: 11
sidebar_position: 1
sidebar_label: Document Settings
---

# Inline Document Settings
Expand Down
98 changes: 98 additions & 0 deletions website/docs/Configuration/file-types.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
title: 'File Types and Extensions'
sidebar_position: 12
sidebar_label: File Types
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

import { FileTypeTable } from '@site/src/components/FileTypeTable';

# File Types and Extensions

This page provides a reference for how CSpell associates file extensions with file type IDs (also called `languageId` in configuration files for historical reasons).

## Understanding File Type Ids

:::info Terminology Note
In CSpell configuration files, the field is called `languageId` for historical reasons (to match VSCode's convention). However, this refers to **file types** (like `javascript`, `python`, `markdown`), not spoken languages (like English, German or Spanish).
:::

## How CSpell Determines File Types

CSpell uses file extensions and filenames to determine the file type, which then influences:
1. Which dictionaries are enabled
2. Which patterns and rules apply
3. Whether the file should be spell-checked

## Usage Examples

### Using Overrides

Force a specific file type for certain file patterns:

<Tabs>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to give an example of how to have config tabs.

I think a new ConfigTabs component would be useful:

<ConfigTabs value={{ overrides: [] }} formats={['yaml', 'json', 'esm' ]} >
</ConfigTabs>

<TabItem value="yaml" label="cspell.config.yaml">
```yaml
overrides:
- filename: "**/*.xyz"
languageId: javascript # Treat .xyz files as JavaScript
```
</TabItem>
<TabItem value="json" label="cspell.json">
```json
{
"overrides": [
{
"filename": "**/*.xyz",
"languageId": "javascript"
}
]
}
```
</TabItem>
</Tabs>


### Using Language Settings

Apply specific settings based on file type:


<Tabs>
<TabItem value="yaml" label="cspell.config.yaml">
```yaml
languageSettings:
- languageId: python,javascript
dictionaries:
- html
- lorem-ipsum
```
</TabItem>
<TabItem value="json" label="cspell.json">
```json
{
"languageSettings": [
{
"languageId": "python,javascript",
"dictionaries": ["html", "lorem-ipsum"]
}
]
}
```
</TabItem>
</Tabs>


## Related Documentation

- [Language Settings](./language-settings.mdx) - Configure settings per file type
- [Overrides](./overrides.md) - Override settings for specific files
- [Searching Dictionaries](../dictionaries/searching-dictionaries.md) - Find which dictionaries contain words

## Supported File Types

The table below shows the mapping between file extensions/filenames and their associated file type Ids.

<FileTypeTable />
9 changes: 5 additions & 4 deletions website/docs/Configuration/githubaction.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: 'Github Action Settings'
categories: configuration
parent: Configuration
nav_order: 11
sidebar_position: 20
sidebar_label: cspell-action
---

# Github Action Settings

## Github Job Settings
Settings for [cspell-action](https://github.com/streetsidesoftware/cspell-action).

## Github Workflow Job Settings

- `files` -- Define glob patterns to filter the files to be checked. Use a new line between patterns to define multiple patterns. The default is to check ALL files that were changed in in the pull_request or push. Note: `ignorePaths` defined in cspell.json still apply.
- `check_dot_files` -- Check files and directories starting with `.`.
Expand Down
8 changes: 2 additions & 6 deletions website/docs/Configuration/imports.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
---
layout: default
title: Importing / Extending Configuration
categories: configuration
parent: Configuration
nav_order: 11
sidebar_position: 3
sidebar_label: Importing Configuration
---

<!--- Remove nav_exclude and published when the page is ready --->

# Importing Configuration

By default the spell checker searches the current directory and up the hierarchy for the following files:
Expand Down
6 changes: 2 additions & 4 deletions website/docs/Configuration/language-settings.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
layout: default
title: Language Settings
categories: configuration
parent: Configuration
nav_order: 11
sidebar_position: 8
sidebar_label: Language Settings
---

# Language Settings
Expand Down
6 changes: 2 additions & 4 deletions website/docs/Configuration/overrides.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
layout: default
title: Overrides
categories: configuration
parent: Configuration
nav_order: 11
sidebar_position: 8
sidebar_label: Overrides
---

<!--- Remove published when the page is ready --->
Expand Down
8 changes: 2 additions & 6 deletions website/docs/Configuration/patterns.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
---
layout: default
title: Exclude / Include Patterns
categories: configuration
parent: Configuration
nav_order: 11
sidebar_position: 9
sidebar_label: Exclude / Include
---

<!--- Remove published when the page is ready --->

# Exclude / Include Patterns

**Covers:**
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"typecheck": "tsc"
},
"dependencies": {
"@cspell/filetypes": "workspace:*",
"@docusaurus/core": "^3.9.2",
"@docusaurus/plugin-client-redirects": "^3.9.2",
"@docusaurus/preset-classic": "^3.9.2",
Expand Down
Loading
Loading