Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabledFileTypes "*": false does not function as expected #3836

Closed
kiweezi opened this issue Nov 22, 2024 · 6 comments
Closed

enabledFileTypes "*": false does not function as expected #3836

kiweezi opened this issue Nov 22, 2024 · 6 comments
Labels

Comments

@kiweezi
Copy link

kiweezi commented Nov 22, 2024

I would like cspell to only check markdown files. So exclude all other file types / languages. But it seems setting "*": false is not supported.

Here's the configuration I am trying:

"cSpell.enabledFileTypes": {
        "markdown": true,
        "*": false
},

Ordering them differently in the list, or excluding the "*" item entirely also does not work.

This means all of the following configurations function the same as each other - they enable all file types to be checked:

"cSpell.enabledFileTypes": {
        "markdown": true,
        "*": false
},
"cSpell.enabledFileTypes": {
        "markdown": true,
        "*": true
},
"cSpell.enabledFileTypes": {
        "markdown": true
},

At the very least, I think this is not user friendly behavior, and is difficult to understand. I would love if this was fixed, so that I can use it as described at the start.

Versions

  • Extension: 4.0.21
  • VSCode: 1.95.3
  • OS: Windows 11 10.0.26100
@Jason3S
Copy link
Collaborator

Jason3S commented Nov 23, 2024

@kiweezi,

Please create a repo that shows it not working. It is not clear from your example what is happening.

Some things to know:

  • "*": false will NOT turn off already enabled files. It just means, if a file type has not been explictly enabled, please do not check it by default. By setting "*": false, it will cancel the "*": true in the default settings. See VS Code Settings Precedence on how settings are merged.
  • The cSpell.enableFiletypes also impacts the list of enabled file types. Please set them to "cSpell.enableFiletypes": [].

Note: some dictionaries will explicitly enable its file type. For those, you will need to add something like "al": false. Here is a list: search cspell-dicts.

br3ndonland added a commit to br3ndonland/dotfiles that referenced this issue Jan 2, 2025
The VSCode CSpell extension (aka "code-spell-checker") 4.0.19 release
(2024-11-19) changed the `enabledFileTypes` setting default to make it
"easier to extend." The change also made CSpell check all words in all
code files, resulting in a noticeable increase in spell check errors
reported by the extension.

The `"cSpell.enabledFileTypes": { "*": false }` setting suggested in
streetsidesoftware/vscode-spell-checker#3800 does not work correctly
(streetsidesoftware/vscode-spell-checker#3836). Languages must be
configured individually.

This commit will update `cspell.json` to configure common code languages.

- Ruby is disabled to avoid checking commented-out lines in Brewfiles.
- Excluding HTML from the `languageSettings` array will allow CSpell to
  check not only comments, but also prose elements like `<p>`. It's not
  clear how to also check prose elements in JavaScript components.
- When checking Astro, Vue, and other component languages, CSpell should
  check HTML, CSS, and JS comments. All may occur in a single file.
- When checking shell, CSpell should ignore array length references
  (in Bash, the length of an array can be read with `${#ARRAY_NAME}`).
- CSpell still seems to be spell checking keys in VSCode `settings.json`
  even though JSONC is correctly configured to only check comments.

https://cspell.org/configuration/
https://github.com/streetsidesoftware/vscode-spell-checker/releases/tag/code-spell-checker-v4.0.19
@Jason3S Jason3S closed this as completed Jan 4, 2025
@cbrnr
Copy link

cbrnr commented Jan 8, 2025

I still have the problem that "*": false does not work. My config is:

    "cSpell.enabledFileTypes": {
        "*": false,
        "markdown": true,
        "quarto": true,
        "text": true,
    },

But spellchecking is performed for a Julia source file (.jl):

Screenshot 2025-01-08 at 15 36 27

This setting seems to be very unstable, because I remember it didn't work when it was introduced, then after some update it worked until a few days ago, where it stopped working again.

Jason3S added a commit to streetsidesoftware/cspell-dicts that referenced this issue Jan 8, 2025
This is related to: [enabledFileTypes "*": false does not function correctly](streetsidesoftware/vscode-spell-checker#3836 (comment))
@Jason3S Jason3S changed the title enabledFileTypes "*": false does not function correctly enabledFileTypes "*": false does not function as expected Jan 8, 2025
@Jason3S
Copy link
Collaborator

Jason3S commented Jan 8, 2025

@cbrnr,

There are a few dictionaries that have the legacy setting: enableFiletypes. These dictionaries are automatically turned on. I have created a PR to remove it, but it might be a while before it lands in the spell checker.

Here are the dictionaries: ada, al, astro, dart, elisp, lisp, fsharp, julia, kotlin, r, sql and terraform.

If you add them to your list, it should take care of the issue.

* is just the default setting, it cannot override a file type that was enabled.

@cbrnr
Copy link

cbrnr commented Jan 8, 2025

Thanks @Jason3S, this makes sense now! Just to be sure, you mean until the dictionaries are turned off by default, I need to add "julia": false etc., right?

@kiweezi
Copy link
Author

kiweezi commented Jan 8, 2025

@cbrnr In my case, I had this issue with Terraform.

I just added "terraform": false, to the "enabledFileTypes" block and it worked a charm. Thanks @Jason3S and @cbrnr !
image

@Jason3S
Copy link
Collaborator

Jason3S commented Jan 8, 2025

Thanks @Jason3S, this makes sense now! Just to be sure, you mean until the dictionaries are turned off by default, I need to add "julia": false etc., right?

Yes, like @kiweezi 's example.

Jason3S added a commit that referenced this issue Jan 11, 2025
Related to #3836
Removes the last of the defaults.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants