首页 > 解决方案 > VS 代码拼写检查器

问题描述

我启用了 VS Code 扩展“代码拼写检查器”,效果很好。但是,我想包含自定义词典文件中的单词,因此其中的单词不会被标记为不正确。我在我的 settings.json 中尝试了以下内容:

"cSpell.customUserDictionaries": [
    "name": "Custom",
    "description": "These are words from my custom dictionary.",
    "path": "C:\\Users\\Joe\\Documents\\Custom.txt",
    "addWords": false
],

但是 Custom.txt 中的文字仍然被标记为不正确。

如何配置代码拼写检查器,以便它能够加载 Custom.txt 中的所有单词并忽略它们?

标签: visual-studio-codevscode-settings

解决方案


根据他们的package.json配置需要一个 typeof 对象数组,所以以下应该工作:

"cSpell.customUserDictionaries": [
    {
        "name": "Custom",
        "description": "My desc",
        "path": "C:\\Users\\Joe\\Documents\\Custom.txt",
        "addWords": false
    }
],

根据他们的描述:

文件格式:文件中的每一行都被认为是一个字典条目


推荐阅读