Fixes
fix: Update documentation and schema for recent improvements (#9222)
fix: Update documentation and schema for recent improvements (#9222)
This pull request updates documentation and default values in both the cspell.schema.json and TypeScript type definitions to improve clarity and accuracy. The main changes include updating the default cache strategy, fixing typos and grammatical errors, and clarifying descriptions for several configuration options.
Configuration behavior changes:
- The default value for
cacheStrategyis now"content"instead of"metadata", and the descriptions have been updated accordingly in both the schema and type definitions. [1] [2] [3]
Documentation and description improvements:
- Fixed typos and clarified grammar in descriptions for
useIntlWordSegmentation,enableFiletypes,globRoot, andlanguageIdacross both the schema and type definitions. These changes ensure consistency and make the documentation easier to understand. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
No functional code changes were made; all updates are to documentation, default values, and descriptions to improve developer experience and reduce ambiguity.
fix: Add support for soft word breaks (#9215)
fix: Add support for soft word breaks (#9215)
This pull request introduces support for "soft word breaks" in CSpell, allowing users to define custom rules for segmenting compound words (such as splitting fnptrvalue into fnptr + value) to improve spell checking accuracy. The main changes include implementing the new text transformer, integrating it into the document validation pipeline, and updating related utilities and tests.
Soft Word Breaks Feature:
- Added a new
SoftWordBreakTextTransformerand thecreateSoftWordBreakTextTransformerfactory function to apply user-configurable soft word break rules based on patterns or regular expressions. (WordBreakTextTransformer.ts,Transformer.ts,index.ts) [1] [2] [3] - Integrated the soft word break transformer into the
DocumentValidatorso that, if enabled in user settings, documents are preprocessed to insert soft hyphens at defined break points before spell checking. (docValidator.ts) [1] [2]
Testing and Validation:
- Added comprehensive tests for the new transformer to ensure correct segmentation behavior, and added integration tests to verify that enabling/disabling soft word breaks affects spell checking as expected. (
WordBreakTextTransformer.test.ts,docValidator.test.ts) [1] [2]
Utility and Refactoring:
- Introduced
stringToRegExpOrUndefinedas a safer version ofstringToRegExpfor parsing regex patterns, and refactored codebase to use it where appropriate. (patterns.ts,textRegex.ts,text.ts,textRegex.test.ts) [1] [2] [3] [4] [5] [6] - Moved the
softHyphenconstant toTransformer.tsfor shared use and updated imports accordingly. (IntlSegmentTextTransformer.ts,IntlSegmentTextTransformer.test.ts,Transformer.ts) [1] [2] [3]
These changes collectively add a flexible mechanism for advanced word segmentation, improving the accuracy of spell checking for compound identifiers and domain-specific terms.
fix(cspell-tools): Support multiple replacements in a single entry (#9212)
fix(cspell-tools): Support multiple replacements in a single entry (#9212)
This pull request enhances the cspell-tools.config.schema.json schema file by adding markdownDescription fields alongside existing description fields throughout the schema. This improves support for tools and editors that render markdown-formatted descriptions, making configuration options clearer and more readable. Additionally, the schema for replacements has been refactored for clarity and extensibility.
The most important changes are:
Documentation Improvements:
- Added
markdownDescriptionfields to nearly all properties and definitions, providing markdown-formatted explanations for better editor and tool integration. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
Schema Structure Improvements:
- Refactored the
Replacementsdefinition: introduced aReplaceWithtype, addedpropertyNameswith descriptions, and enhanced the overall documentation and structure for replacement rules.
These changes collectively improve the developer experience when working with the schema in modern editors and tooling.
fix: CSpell-Tools support replacements (#9205)
fix: CSpell-Tools support replacements (#9205)
Support replacing word fragments before adding the word to the dictionary.
TL;DR
Be able to replace ’ with '.
Details
This pull request adds support for applying word replacement rules during dictionary compilation in cspell-tools. The main change is the introduction of a replacements option, allowing users to specify patterns and their replacements, which are then applied to all words in the dictionary. The changes include updates to the configuration schema, TypeScript interfaces, core compilation logic, and tests to support and verify this new feature.
Add support for word replacements in dictionary compilation:
-
Configuration and Schema Updates:
- Added a
Replacementsdefinition and areplacementsproperty to the JSON schema and TypeScript interfaces, allowing users to specify replacement rules in config files and programmatic interfaces. [1] [2] [3] [4]
- Added a
-
Compiler Logic Enhancements:
- Updated the core compilation pipeline (
compile.ts,wordListParser.ts) to accept and apply thereplacementsoption, mapping specified patterns to their replacements during normalization of dictionary words. [1] [2] [3]
- Updated the core compilation pipeline (
-
Testing and Fixtures:
- Extended and added tests to verify that replacements are correctly applied, including new test cases and fixtures (such as
rep-words.txt) and snapshot updates. [1] [2] [3] [4] [5] [6] [7]
- Extended and added tests to verify that replacements are correctly applied, including new test cases and fixtures (such as
-
Type and Interface Adjustments:
- Refactored relevant interfaces (
CompileOptions,CompileRequest, etc.) to include or omit the newreplacementsproperty as appropriate, ensuring type safety and clarity throughout the codebase. [1] [2]
- Refactored relevant interfaces (
These changes collectively enable more flexible and accurate dictionary generation by allowing systematic normalization or correction of word forms via configurable replacement rules.
fix: Add definitions for custom word breaks (#9199)
fix: Add definitions for custom word breaks (#9199)
This pull request introduces support for customizable "soft word break" rules in both the JSON schema (cspell.schema.json) and the TypeScript types (packages/cspell-types/api/index.d.mts). These changes allow users to define and enable/disable advanced word segmentation behaviors, improving spell checking for languages and naming patterns that aren't well handled by default camel case detection.
The most important changes are:
Schema and Configuration Enhancements:
- Added new properties
softWordBreakDefinitionsandsoftWordBreaksto the JSON schema, allowing users to define and control custom soft word break rules for text segmentation. These rules help split words at specific positions (like between "error" and "code" in "errorcode") and support advanced language scenarios. [1] [2] [3] - Defined new schema types:
SoftWordBreak,SoftWordBreakDefinitions,SoftWordBreakPattern,SoftWordBreakRegExpString,SoftWordBreakRule, andSoftWordBreaks, with detailed descriptions and usage examples for each.
TypeScript API Updates:
- Introduced the
WordSegmentationSettingsinterface, which includessoftWordBreakDefinitions,softWordBreaks, anduseIntlWordSegmentationoptions, providing a type-safe way to configure segmentation rules in code. - Integrated
WordSegmentationSettingsinto the mainBaseSettinginterface, ensuring all configuration objects can use the new word break features. - Cleaned up the
BaseSettinginterface by removing the now redundantuseIntlWordSegmentationproperty (since it's included inWordSegmentationSettings).
These changes make the spell checker more flexible and powerful, especially for users working with languages or code styles that require custom word splitting logic.
fix: Split words on soft hyphens (#9196)
fix: Split words on soft hyphens (#9196)
This pull request enhances the word splitting utilities in the cspell-lib package, particularly improving how camelCase and compound words are split, especially when soft hyphens are present. It also introduces and tests new utility functions that return word segments along with their offsets, and refactors the implementation for better accuracy and maintainability.
Key changes:
Feature enhancements and bug fixes
- Improved the regular expression
regExpCamelCaseWordBreaksWithEnglishSuffixto handle soft hyphens (\u00AD), ensuring words like'hello\u00ADthere'are split correctly. - Refactored
splitWordWithOffsetto compute word splits and their offsets more accurately, replacing the previous use ofscanMapwith a custom implementation. - Updated
splitCamelCaseWordWithOffsetto use the newsplitWordWithOffsetimplementation, improving consistency and correctness.
Testing improvements
- Added comprehensive tests for both
splitCamelCaseWordWithOffsetandsplitWordWithOffset, covering a variety of word forms, including those with soft hyphens and mixed casing. - Expanded test cases for word splitting to include words with soft hyphens, ensuring the new logic is properly validated.
Dependency and import updates
- Updated imports in
text.test.tsto include the new or modified regular expressions used for word splitting.
Dictionary Updates
fix: Workflow Bot -- Update Dictionaries (main) (#9218)
fix: Workflow Bot -- Update Dictionaries (main) (#9218)
Update Dictionaries (main)
Summary
packages/cspell-bundled-dicts/package.json | 4 ++--
pnpm-lock.yaml | 20 ++++++++++----------
2 files changed, 12 insertions(+), 12 deletions(-)
fix: Workflow Bot -- Update Dictionaries (main) (#9208)
fix: Workflow Bot -- Update Dictionaries (main) (#9208)
Update Dictionaries (main)
Summary
packages/cspell-bundled-dicts/package.json | 30 ++--
pnpm-lock.yaml | 274 +++++++++++++++--------------
2 files changed, 159 insertions(+), 145 deletions(-)
fix: Workflow Bot -- Update Dictionaries (main) (#9198)
fix: Workflow Bot -- Update Dictionaries (main) (#9198)
Update Dictionaries (main)
Summary
.../snapshots/AdaDoom3/AdaDoom3/report.yaml | 238 +---
.../snapshots/AdaDoom3/AdaDoom3/snapshot.txt | 246 +---
.../Azure/azure-rest-api-specs/report.yaml | 54 +-
.../Azure/azure-rest-api-specs/snapshot.txt | 82 +-
.../MartinThoma/LaTeX-examples/report.yaml | 120 +-
.../MartinThoma/LaTeX-examples/snapshot.txt | 104 +-
.../MicrosoftDocs/PowerShell-Docs/report.yaml | 335 +----
.../MicrosoftDocs/PowerShell-Docs/snapshot.txt | 329 +----
.../snapshots/RustPython/RustPython/report.yaml | 70 +-
.../snapshots/RustPython/RustPython/snapshot.txt | 212 ++--
.../SoftwareBrothers/admin-bro/report.yaml | 7 +-
.../SoftwareBrothers/admin-bro/snapshot.txt | 5 +-
.../snapshots/TheAlgorithms/Python/report.yaml | 256 +---
.../snapshots/TheAlgorithms/Python/snapshot.txt | 240 +---
.../snapshots/alexiosc/megistos/report.yaml | 65 +-
.../snapshots/alexiosc/megistos/snapshot.txt | 75 +-
.../aspnetboilerplate/report.yaml | 36 +-
.../aspnetboilerplate/snapshot.txt | 32 +-
.../snapshots/aws-amplify/docs/report.yaml | 5 +-
.../snapshots/aws-amplify/docs/snapshot.txt | 5 +-
.../snapshots/caddyserver/caddy/report.yaml | 320 ++---
.../snapshots/caddyserver/caddy/snapshot.txt | 184 +--
.../snapshots/dart-lang/sdk/report.yaml | 96 +-
.../snapshots/dart-lang/sdk/snapshot.txt | 55 +-
.../snapshots/django/django/report.yaml | 1096 ++++------------
.../snapshots/django/django/snapshot.txt | 615 +--------
.../snapshots/eslint/eslint/report.yaml | 54 +-
.../snapshots/eslint/eslint/snapshot.txt | 26 +-
.../snapshots/flutter/samples/report.yaml | 398 +-----
.../snapshots/flutter/samples/snapshot.txt | 660 +++-------
.../snapshots/gitbucket/gitbucket/report.yaml | 90 +-
.../snapshots/gitbucket/gitbucket/snapshot.txt | 86 +-
.../googleapis/google-cloud-cpp/report.yaml | 103 +-
.../googleapis/google-cloud-cpp/snapshot.txt | 111 +-
.../snapshots/graphql/graphql-spec/report.yaml | 46 +-
.../snapshots/graphql/graphql-spec/snapshot.txt | 24 +-
.../iluwatar/java-design-patterns/report.yaml | 135 +-
.../iluwatar/java-design-patterns/snapshot.txt | 201 +--
.../snapshots/ktaranov/sqlserver-kit/report.yaml | 1227 +++---------------
.../snapshots/ktaranov/sqlserver-kit/snapshot.txt | 1303 +++++---------------
.../snapshots/liriliri/licia/report.yaml | 45 +-
.../snapshots/liriliri/licia/snapshot.txt | 33 +-
integration-tests/snapshots/mdx-js/mdx/report.yaml | 42 +-
.../snapshots/mdx-js/mdx/snapshot.txt | 31 +-
.../microsoft/TypeScript-Website/report.yaml | 65 +-
.../microsoft/TypeScript-Website/snapshot.txt | 42 +-
.../snapshots/neovim/nvim-lspconfig/report.yaml | 50 +-
.../snapshots/neovim/nvim-lspconfig/snapshot.txt | 72 +-
.../snapshots/pagekit/pagekit/report.yaml | 16 +-
.../snapshots/pagekit/pagekit/snapshot.txt | 14 +-
.../snapshots/php/php-src/report.yaml | 1011 ++-------------
.../snapshots/php/php-src/snapshot.txt | 1247 ++++---------------
.../snapshots/pycontribs/jira/report.yaml | 16 +-
.../snapshots/pycontribs/jira/snapshot.txt | 8 +-
.../snapshots/shoelace-style/shoelace/report.yaml | 6 +-
.../snapshots/shoelace-style/shoelace/snapshot.txt | 4 +-
.../snapshots/sveltejs/svelte/report.yaml | 75 +-
.../snapshots/sveltejs/svelte/snapshot.txt | 87 +-
.../typescript-cheatsheets/react/report.yaml | 8 +-
.../typescript-cheatsheets/react/snapshot.txt | 10 +-
.../snapshots/vitest-dev/vitest/report.yaml | 10 +-
.../snapshots/vitest-dev/vitest/snapshot.txt | 6 +-
.../snapshots/wireapp/wire-desktop/report.yaml | 10 +-
.../snapshots/wireapp/wire-desktop/snapshot.txt | 6 +-
.../snapshots/wireapp/wire-webapp/report.yaml | 203 +--
.../snapshots/wireapp/wire-webapp/snapshot.txt | 237 +---
packages/cspell-bundled-dicts/package.json | 30 +-
.../__snapshots__/docValidator.test.ts.snap | 8 +-
.../__snapshots__/validator.test.ts.snap | 22 +-
pnpm-lock.yaml | 274 ++--
70 files changed, 2258 insertions(+), 10776 deletions(-)