Welcome to our latest blog post about the spell checker feature in Visual Studio 17.6 preview 2! We’re excited to share with you the latest improvements we’ve made to this feature, which was first introduced in the Visual Studio 17.5 preview releases for C#, C++, and markdown files. We’ve received an overwhelming amount of valuable feedback from developers like you, which has helped shape and refine this feature before its release to the release channel.
If you’re new to the spell checker feature, check out our earlier blog post for an introduction. Otherwise, let’s dive into the exciting enhancements in Visual Studio 17.6 preview 2!
Programming Language Specific DictionariesThe biggest feedback we heard was concerning false positives. The spell checker uses the same dictionaries as the spoken languages that were detected. We added heuristics to compensate for how code uses those words, so constructs like HelloWorld would be properly spell checked, but developers use many words that aren’t part of our spoken languages. Words like ‘guid’ or ‘args’ are commonly found in code documents but were getting flagged as misspelled words by the spell checker.
In this update, we’ve partnered with the C++ and C# teams to add exclusion dictionaries specific to those languages that detect words are commonly used in those languages. This should significantly reduce the number of false positives, especially when commenting out pieces of code. Later in this post, we’ll discuss the switch we’ve added to editorconfig that can control this behavior, should users want to disable it.
Exclusion Dictionary EncodingAnother issue many folks ran into was around the encoding of the exclusion dictionaries used by the spell checker. Visual Studio will use the exclusion dictionary specified by the spelling_exclusion_path switch in your editorconfig file or an “exclusion.dic” file in your %localappdata%\Microsoft\VisualStudio\<Version> directory if a switch can’t be found. In either case, the spell-checking APIs required the exclusion file to have “UTF-16 with BOM” encoding to work correctly. We got multiple reports of the encoding becoming corrupted, particularly when users manually modified these files to remove excluded words.
With this update, we’ve improved the way Visual Studio works with exclusion files. UTF-16 encoding is no longer necessary, so users should be able to modify exclusion dictionaries without running into encoding issues.
Better Special Case HandlingWe also appreciate the folks who caught some cases we didn’t think of. We added additional improvements for some special cases based on this feedback:
https://...” or ”mailto:..”.) will not be spell checked over the entire string.\nhello” will no longer be flagged as a spelling error since the ‘n’ is omitted and ‘hello’ is a correctly spelled word.misc.” will no longer be recommended as it could cause code that won’t compile.Customizing the Spell CheckerWe added the spelling_use_default_exclusion_dictionary switch for editorconfig in this update. For your convenience, here’s the full list of available options:
spelling_languages = _language_[,_language_]``(Example: = en-us,fr-fr)
spelling_checkable_types = strings,identifiers,comments``(Example: = identifiers,comments)
spelling_error_severity = error OR warning OR information OR hint``(Example: = error)
spelling_exclusion_path = absolute OR relative path to exclusion dictionary.``(Example: = .\exclusion.dic)
spelling_use_default_exclusion_dictionary = true OR false``(Example: = spelling_use_default_exclusion_dictionary = false)
Your feedback matters!We greatly value the feedback we’ve received from our users and are thrilled with the positive reactions we’ve received. Your input has directly influenced the improvements we’ve made to Visual Studio, and we’re eager to continue evolving the product to meet your needs. We have an ambitious roadmap ahead, and your feedback will help us prioritize our efforts. Let’s keep the conversation going on Developer Community, and thank you for being an essential part of the Visual Studio community!
The post Improving the Spell Checker appeared first on Visual Studio Blog.