streetsidesoftware / vscode-spell-checker

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

Add to folder dict vs. Add to workspace dict? #247

Open gandalfsaxe opened 6 years ago

gandalfsaxe commented 6 years ago

I've been playing around with both, but I can't find a difference between pressing Add: "..." to folder dictionary and Add: "..." to folder dictionary from the IntelliSense context menu. Both options seem to add the word to the settings.json of the open folder / open workspace?

gandalfsaxe commented 6 years ago

After a bit of testing I found the following behavior:

Case 1: Opened folder - Add to folder/workspace does the same thing, which is to add the word to .vscode/settings.json of the opened folder.

Case 2: Opened workspace - Add to folder/workspace does the same thing, which is to add the word to [WORKSPACE-NAME].code-workspace of the opened workspace.

But in both cases, choosing Add: "..." to folder dictionary and Add: "..." to workspace dictionary does the same thing. Unless there is a case where they are different, they should combined into one command?

Jason3S commented 6 years ago

It is possible that they are doing the same thing, but that is not what was intended.

But you bring up a good point, it is not obvious of the difference.

Here is the challenge, settings are applied in the following order:

  1. Default Settings
  2. User Settings
  3. Workspace Settings
  4. Folder Settings

If a setting appears in the folder level, it will overwrite the same setting from either the workspace, the user, or default settings.

If you add a word to the Workspace, then it also needs to be added to the Folder level, otherwise it will still be marked as incorrect.

gandalfsaxe commented 6 years ago

So as I understand you:

thorn0 commented 6 years ago

What if I have cspell.json in the root of my project, and I want to add the words only to it, not to .vscode/settings.json? Is my understanding correct that the extension currently can't do this?

Jason3S commented 6 years ago

Thank you for all the discussion. I do not mean to be silent. I have just been busy.

This is not an easy problem to solve for the different use cases. It is made worse by the fact that the context menu is static.

I'll take another look at the logic.

cicely-f commented 6 years ago

Case 1: Opened folder - Add to folder/workspace does the same thing, which is to add the word to .vscode/settings.json of the opened folder.

Case 2: Opened workspace - Add to folder/workspace does the same thing, which is to add the word to [WORKSPACE-NAME].code-workspace of the opened workspace.

With the current version of VSCode (1.27.2) and the current version of the extension, when I have a code-workspace file open, neither of these options work. The words do get added to the .code-workspace file, but still show up as spelling errors even after closing VS Code and relaunching it.

dbogatov commented 5 years ago

What I see is that the word gets added to both cSpell.json (if one exists) AND workspace settings.

I very much need this extension to NOT add anything to the workspace file. I have CI doing spell check against cSpell.json and what happens is that a word is marked as valid in one project of a workspace (to both files) and is not marked in other projects' cSpell files. Then, for other project, VS Code deems the word valid, but CI does not (because relevant cSpell file is not updated). I currently have to periodically manually clean up my workspace file.