vscode-spell-checker icon indicating copy to clipboard operation
vscode-spell-checker copied to clipboard

Feature Request: Spell Check for Definitions and Declarations Only, to Avoid Unnecessary Warnings from References

Open JoeyLearnsToCode opened this issue 2 years ago • 1 comments

Feature Request

Is your feature request related to a problem? Please describe. I'm currently using the Code Spell Checker extension in Visual Studio Code. My issue is that the extension checks spelling for all instances of words, including references to variables or functions that are defined elsewhere. In many cases, these references are to code that is not under my control, such as code from third-party libraries or other files/packages within the same project. It is not meaningful to receive spelling warnings for these references, as they are the responsibility of their own developers and are not modifiable by the consumer of the code.

Describe the solution you'd like I would like to see a feature that enables the spell checker to only flag potential spelling mistakes in definitions and declarations. This would prevent it from flagging references, especially those that cannot be changed by the user. A configuration option to activate this behavior would be ideal.

Describe alternatives you've considered I have looked into using cSpell.ignoreRegExpList for creating patterns that could selectively ignore references, but crafting such regular expressions is complex and not always feasible. Language-specific parsing might be necessary to achieve this.

Additional context By focusing on definitions and declarations, the spell checker would become more useful in everyday development. It would help maintain clean code within the scope of the developer's responsibility without cluttering the problem panel with irrelevant warnings. This selective checking is particularly important in large codebases where third-party libraries are prevalent, and developers need to ensure naming conventions are followed without being distracted by unmodifiable external references.


功能请求

您的功能请求是否与问题有关?请描述。 我正在使用 Visual Studio Code 中的 Code Spell Checker 插件。我的问题是该插件检查所有单词实例的拼写,包括对在其他地方定义的变量或函数的引用。在许多情况下,这些引用是指不在我控制范围内的代码,例如来自第三方库或同一项目中的其他文件/包的代码。接收这些引用的拼写警告是没有意义的,因为它们是它们自己的开发者的责任,且使用者无法修改。

描述您想要的解决方案 我希望能有一个功能,使拼写检查器只在定义和声明中标记潜在的拼写错误。这将阻止它标记引用,尤其是那些用户无法更改的引用。一个激活此行为的配置选项将是理想的选择。

描述您考虑过的替代方案 我考虑过使用 cSpell.ignoreRegExpList 来创建可以选择性忽略引用的模式,但编写这样的正则表达式很复杂并不总是可行的。可能需要特定于语言的解析来实现这一点。

其他上下文 通过专注于定义和声明,拼写检查器将在日常开发中变得更加有用。它将帮助维护开发者责任范围内的干净代码,而不会用不相关的警告填满问题面板。在大型代码库中,尤其是第三方

JoeyLearnsToCode avatar Dec 20 '23 02:12 JoeyLearnsToCode

@JoeyLearnsToCode,

Thank you. I agree with you.

As you correctly pointed out, the spell checker would need to parse files to achieve this.

It has been a commonly requested feature, that matches the following theme.

"As a user I would only like to":

  • spell check comments
  • spell check double quote strings
  • variable declarations.
  • etc.

Jason3S avatar Dec 20 '23 11:12 Jason3S