VS Code Code Spell Checker 企业级共享字典配置验证与功能咨询
Hey there! Let’s tackle your three questions about setting up a shared company dictionary for Code Spell Checker in VS Code:
1. Is your current configuration valid?
Short answer: Yes, it should work—if the server path is accessible to all users.
Your configuration correctly defines a custom dictionary and enables it. The key thing to verify is that every user can directly access the UNC path //server/Documentation/Template/companyDict.txt from their system:
- On Windows, this means the server share is visible and users have read permissions.
- On macOS/Linux, users will need to mount the server share first (e.g., via SMB) so the path resolves correctly.
If users can open the file directly in their file explorer, the cSpell plugin will be able to load it too. Double-check for typos in the path or permission issues if some users can’t see the dictionary.
2. Can new words be added directly to this shared dictionary?
This depends on two factors: file permissions and cSpell configuration:
By default (your current setup):
The shared dictionary is read-only for users unless you explicitly grant write access to the companyDict.txt file on the server. Even with write access, the Code Spell Checker’s default behavior is to save user-added words to their personal VS Code settings (either in settings.json or a user-level cSpell config file), not the shared dictionary.
To enable adding words to the shared dictionary:
If you want users to be able to add new terms directly to the company-wide dictionary, modify your dictionary definition to include the addWords: true flag:
"cSpell.dictionaryDefinitions": [ { "name": "CompanyDictionary", "path": "//server/Documentation/Template/companyDict.txt", "addWords": true } ], "cSpell.dictionaries": [ "CompanyDictionary" ]
This tells cSpell to save any words users click "Add to Dictionary" for into the shared file—but only if users have write permissions for the file on the server.
⚠️ Heads up: Multiple users editing the file at the same time can cause conflicts. For better control, consider:
- Designating a single maintainer to approve and add new terms
- Storing the dictionary in a version control system (like Git) so changes are tracked and merged cleanly
3. What’s the format specification for the shared dictionary?
The Code Spell Checker supports simple text-based dictionaries (the easiest for shared use) with these rules:
- One word per line: No commas or separators—just a single term on each line
- Comments allowed: Lines starting with
#are treated as comments and ignored - UTF-8 encoding: Use UTF-8 for the file to support special characters or non-English terms
- Case insensitivity: By default, cSpell treats words as case-insensitive, but you can add case-specific terms if needed (e.g.,
GitHubwill matchgithubunless you enable strict case checking)
Example of a valid companyDict.txt:
AcmeCorp ProjectNexus # Internal project code names AlphaVantage BetaWave # Technical terms MicroserviceOrchestration CloudNativePipeline
You can also use JSON-format dictionaries if you need more advanced settings, but the plain text format is far more user-friendly for shared enterprise use.
内容的提问来源于stack exchange,提问作者po.pe

