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

Add language id option of CSpell #4700

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

ohakutsu
Copy link
Contributor

What

Fixed issue where adjustments to language-specific settings in cspell.json weren't being applied.

How

When using stdin, it appears that cspell is unable to detect the file type correctly. Therefore, I have modified it to explicitly specify the file type.

$ cat main.rb
1.upto(10) do |i|
  puts i
end

$ cat cspell.json
{
  "languageSettings": [
    {
      "languageId": "ruby",
      "dictionaries": ["ruby"]
    }
  ]
}
$ cspell lint --verbose main.rb
cspell;
Date: Thu, 28 Dec 2023 15:19:36 GMT
Options:
    verbose:   Yes
    config:    default
    exclude:   node_modules/**
    files:     main.rb
    wordsOnly: No
    unique:    No

Config Files Found:
    /path/to/cspell.json

Exclusion Globs:
    Glob: node_modules/** from command line

1/1 ./main.rbChecking: /path/to/main.rb, File type: auto, Language: default
Checked: /path/to/main.rb, File type: ruby, Language: en ... Issues: 0 209.35ms
Config file Used: /path/to/cspell.json
Dictionaries Used: companies, filetypes, public-licenses, softwareTerms, computing-acronyms, web-services, aws, cryptocurrencies, en_us, en-common-misspellings, fullstack, ruby
 209.35ms
CSpell: Files checked: 1, Issues found: 0 in 0 files

$ cat main.rb | cspell lint --verbose -- stdin
cspell;
Date: Thu, 28 Dec 2023 15:19:41 GMT
Options:
    verbose:   Yes
    config:    default
    exclude:   node_modules/**
    files:     stdin
    wordsOnly: No
    unique:    No

Config Files Found:
    /path/to/cspell.json

Exclusion Globs:
    Glob: node_modules/** from command line

1/1 ./stdin:Checking: stdin://, File type: auto, Language: default
Checked: stdin://, File type: text, Language: en ... Issues: 1 216.86ms
Config file Used: /path/to/cspell.json
Dictionaries Used: companies, filetypes, public-licenses, softwareTerms, computing-acronyms, web-services, aws, cryptocurrencies, en_us, en-common-misspellings
 216.86ms X
./:1:3 - Unknown word (upto) fix: (up to)
CSpell: Files checked: 1, Issues found: 1 in 1 files

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

@hsanson hsanson merged commit 5319705 into dense-analysis:master Jan 14, 2024
7 checks passed
@ohakutsu
Copy link
Contributor Author

Cheers! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants