streetsidesoftware / vscode-spell-checker

A simple source code spell checker for code
https://streetsidesoftware.github.io/vscode-spell-checker/
Other
1.43k stars 127 forks source link

README.md - .dotfiles cspell.json #499

Open iyerusad opened 4 years ago

iyerusad commented 4 years ago

Below is blurb might make sense to add to README.md for .dotfiles specific recommendation for cspell usage. It took me a bit longer than it should to piece this together (had to dig through the issue board a few times), but its working now and figure would benefit future people looking to adopt this extension.

Worth noting this is an perhaps off label use of "cSpell.import" setting (which seems more geared toward importing multiple dictionaries, especially since it takes an array) - a slightly better setting could be an optional "cSpell.globalconfigfile": string, which could be adopted as place where cSpell knows to write updates to.

.dotfiles cSpell

A user can expect to somewhat regularly update their cSpell configuration+dictionaries (be it in at a workspace level or a user env level). To avoid cluttering up your global settings.json for cSpell extension specific updates/dictionary learning, a cSpell.json file can be referenced in your global environment settings.json to point to one hosted in your home folder (or cloned .dotfiles repo) fairly easily:

1) User environment settings.json:

"cSpell.import": [ "~/.dotfiles/vscode/cSpell.json" ] //Import dotfiles cSpell settings

2) ~/.dotfiles/vscode/cSpell.json (Minor tidbit: Path referenced is not /.vscode/ but /vscode/ - the former would be cSpell config for .dotfiles workspace rather than a generic cSpell config used by ALL projects. You could/would presumably have a cSpell config for specifically .dotfiles. Either way is reasonable though):

//cSpell GLOBAL Settings (not workspace specific)
// Workspace specific settings should go into ${workspace}/.vscode/cSpell.json
{
  "languageSettings": [
    // Comment only spell check in JavaScript, Typescript, JSON/C
    {
      "languageId": "javascript,typescript,json,jsonc",
      "includeRegExpList": [ "CStyleComment", "strings" ]
    }
  ],
  "userWords": [
  ],
  "ignoreWords": [
  ]
}

3) ${workspace}/.vscode/cSpell.json (optional)

//cSpell Workspace-specific Settings
{
  "words": [
    "supersecretproject", "projectDebugTerm",
    "randomjumbleProject"
  ]
}

With this setup, you have your developer specific settings + project/workspace specific dictionaries (and possible setting tweaks) working together for a more harmonious cSpell experience.

Jason3S commented 4 years ago

Thank you for the hard work of putting this together.

With the release of 1.9.0, it is not possible to define where to write custom words.

Please see: https://github.com/streetsidesoftware/vscode-spell-checker/releases/tag/v1.9.0