Feat: Add config option `stopConfigSearchAt` to `CSpellSettings`
Problem
When the spell checker find a file to spell check, it also searches for the nearest CSpell config file. The current --stop-config-search-at command line option is only applied to the initial scan.
For example, it will keep searching up even though you give it stop dirs.
Example file structure:
cspell.json -> { "flagWords": ["my_flag_word"] }
cwd/
test.cspell.json -> { "words": ["my_flag_word"] }
test.txt -> Contains my_flag_word
cwd/$ cpsell -c test.cspell.json --stop-config-search-at=. *.txt
This will fail.
Originally posted by @Jason3S in https://github.com/streetsidesoftware/cspell/issues/7440#issuecomment-2956676239
Solution
Add config option stopConfigSearchAt to CSpellSettings
stopConfigSearchAt?: FsPath | FsPath[];
Like dictionaryDefinition.path it needs to be resolved relative to the config file.
Useful to group it with noConfigSearch
https://github.com/streetsidesoftware/cspell/blob/4e7e951d885b65470eb24cbf9d6fefe5e1440e27/packages/cspell-types/src/CSpellSettingsDef.ts#L105
Hello @Jason3S,
I was able to pass the stopConfigSearchAt field into CSpellUserSettings through cspellSettingsFromCliOptions in the LintRequest class.
We already have a mechanism for handling stopConfigSearchAt, is there an existing hook or integration point, like we have for noConfigSearch, where this is expected to plug in? I'm trying to figure out the work that needs to be done.
Thanks!