VSCode 代码拼写检查器扩展 - 包括 TXT 文件

OrA*_*yag 3 spell-checking visual-studio-code

我正在使用 VSCode 代码拼写检查器,并且希望检测 TXT 文件中的拼写错误。但问题是,我想在 VSCode 搜索时忽略的 TXT 文件上检测到它。

这是我的 settings.js 文件:

{
    "cSpell.words": [
        "BING",
        "DOGPILE"
    ],
    "search.exclude": {
        "**/.vscode": true,
        "**/dist": true,
        "**/misc": true,
        "**/misc/documents": true,
        "**/misc/": true,
        "/misc/": true,
        "misc/**": true,
        "**/misc/**": true,
        "**/misc/documents/**": true,
        "**/node_modules": true,
        "**/sources": true
    },
    "eslint.validate": [
        "javascript"
    ],
    "http.proxy": "",
    "http.proxyAuthorization": null,
    "http.proxyStrictSSL": false,
    "editor.renderWhitespace": "none"
}
Run Code Online (Sandbox Code Playgroud)

我想要检测位于misc列表中声明的目录内的拼写错误的文件"search.exclude"(我不希望从此目录中的任何文件搜索结果),但我确实想检测这些文件上的拼写错误。

如果我删除所有这些,settings.js 看起来像这样:

    {
    "cSpell.words": [
        "BING",
        "DOGPILE"
    ],
    "search.exclude": { },
    "eslint.validate": [
        "javascript"
    ],
    "http.proxy": "",
    "http.proxyAuthorization": null,
    "http.proxyStrictSSL": false,
    "editor.renderWhitespace": "none"
}
Run Code Online (Sandbox Code Playgroud)

TXT 文件拼写错误检测有效,但我得到的搜索结果包含目录内的文件misc,这不是我想要的。

有人以前遇到过这个问题并且知道如何解决吗?
谢谢。

Fra*_*ini 5

正如拼写检查器常见问题解答中明确指出的那样

拼写检查程序会排除哪些文件?

默认情况下,拼写检查器会排除 VS Code search.exclude设置排除的相同文件。请参阅讨论:#16#55#95

解决我想说的问题中暴露的问题的正确方法是向项目提出一个新功能请求的问题,以允许覆盖此默认行为。

作为最后的手段,如果您绝对需要阻止search.exclude添加到排除项中,您可以尝试强制将代码安装在您的计算机上,并且在重新启动 vscode 后,您将在这些路径中进行拼写检查。

免责声明请注意,下面所示的内容是此处提到的不鼓励的黑客行为,仅供参考,显然,如果您尝试这种解决方法,您必须非常清楚自己在做什么

例如:假设扩展安装在~/.vscode/extensions/streetsidesoftware.code-spell-checker-1.10.2

在源代码中添加server/config/documentSettings.js了以下函数:async fetchSettingsFromVSCode(uri)

ignorePaths: ignorePaths.concat(CSpell.ExclusionHelper.extractGlobsFromExcludeFilesGlobMap(exclude)),

通过改变为 ignorePaths: ignorePaths

在此输入图像描述

然后退出vscode,当重新打开它时,扩展不再排除 VS Code search.exclude设置排除的相同文件。