我正在使用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"
}我想要检测的文件位于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"
}TXT文件的错误检测工作正常,但我得到的搜索结果包括misc目录中的文件,这是而不是我想要的。
有没有人曾经面对过这个问题,知道如何解决?
谢谢。
发布于 2021-03-19 20:48:14
正如拼写检查常见问题中明确指出的那样
哪些文件被拼写检查器排除在外?
解决问题中暴露的问题的正确方法是向项目打开一个新特性请求的问题,以允许覆盖此默认行为。
作为最后的手段,如果您绝对需要防止将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

然后退出fron vscode,当重新打开它时,扩展名不再排除VS代码search.exclude设置排除的相同文件。
https://stackoverflow.com/questions/65357340
复制相似问题