A Rough Preview Debut for Visual Studio Spell Checker
Microsoft finally baked in some spell checking functionality in a Visual Studio 2022 preview, but it's off to a rough start judging from many developer complaints about its initial implementation.
While the Visual Studio IDE has long provided a variety of spell checking extensions in its marketplace, the first native spell checking feature was just introduced in Visual Studio 2022 17.5 Preview 3.
"Developers take pride in their code, and a misspelled word can be embarrassing," the company said in a post announcing the latest preview. "17.5 Preview 3 has the first preview version of our spell checker for code documents which will help folks identify misspelled words in comments, strings and identifiers for C#, C++ and Markdown files."
A spell checker was put into the Visual Studio 2022 Roadmap, but until recently not much was heard about it, prompting a Developer Community question in October 2021 asking about its status.
"We're working on this feature right now," soon replied Microsoft's Dante Gagne. "It won't be available when VS 2022 launches, but we're actively working on it now. I have very high hopes that it will be available soon, but as you can imagine, we don't want to release a half-baked feature that will be more frustrating than valuable."
According to developer feedback, that latter scenario might have materialized, at least in the minds of some. The preview, like others, is designed to solicit developer feedback to help the dev team improve things, and it did just that. On Jan. 18, the complaints (around a dozen at the time of this writing) rolled in on that Developer Community thread, including these:
- I think this feature activated itself today. This morning all of our comments and code were marked as selling error. There was no update of VS2022 Preview nor did we change anything. It marks english and german word, so i think there is no dictionary behind. Can you please tell me how to deactivate this? there is no option like "spell" or "check" to deactivate.
- I have just wasted 15 minutes trying to turn it off, how do we do this.
- I've just spent half of my workday disabling extensions, checking/unchecking toggles in the options menu, wondering what keyboard shortcut I mistakenly called, just because some guy triggered a feature activation at a random date? Great... I hope that when the feature gets official, we will be able to set its priority to something other than Warning, because as mentioned by others, it adds huge visual noise and hide actual code-related warnings 😕
The Preview 3 announcement post also garnered a couple complaints/questions, including:
- Contrary to what the blog says, when upgrading from 17.5 Preview 1 to Preview 3, the spell checker was not enabled by default. And it seems little actual effort has been put into that feature as it is doing spell checks for URLs and it doesn't recognize language keywords as nullptr, wchar_t etc. Maybe the focus should be in actually fixing the numerous compiler, linker, codgen bugs which have been reported at DevCom.
With the spell checker, you have the ability to ignore a word. I noticed that it ignores all instances. Where is the ignored word list stored as I could not find it?
Also is this ignored word list per user, per machine, per solution? If it's not per solution, so you can check it in as part of the solution it's not super helpful to be able to ignore words, at least as part of a team. Also how do you un-ignore words?
Those questions were answered by Microsoft, and Gagne addressed prior feedback in a Jan. 11 post to the Developer Community thread:
Thank you all for your feedback here. A preview for the spell checker is coming in the very near future, but I would like to comment on some of the feedback here.
The spell checker is capable of recognizing common developer patterns, so helloWorld, HelloWorld and hello_world will all be correctly identified as "correct". We're looking into some other patterns and we know there will be some patterns we need to improve on, but in the preview release, we hope to get a large number of the initial common programming patterns. One pattern we know will give us problems will be "helloworld". We're looking into how we can handle issues like this one.
Configuration of the spell checker will be through .editorconfig. This means that you can control how the spell checker is intended to behave and attach that behavior to your repo. The intent is to ensure consistent behavior without each individual contributing to the repo having to manually configure their instance of Visual Studio.
The expected behavior will spell check comments, identifiers and string literals, but you will have the ability to control each of these (e.g., control that you want comments and identifiers checked but not string literals).
The default behavior will be to use en-us and the OS display language. So, a developer developing on a Windows box set to co-es as the display language, would, by default, spell check the code with both the en-us and co-es dictionaries. This behavior can be controlled in .editorconfig. The logic here is that the DEFAULT experience shouldn't be shocking, but once someone starts moving into a repo and expects to start collaborating, they should make a conscious decision about the languages they expect to work with.
There is a button in the top toolbar to enable or disable the spell checker, but I don't believe it will have a keyboard shortcut by default. I will need to check that. We do not have an autocorrect option... only a highlight option. The highlight option does have a suggestion/correction gesture (e.g., when we detect a misspelled word, we offer suggestions and allow for either a single instance replace or an identifier rename to fix the misspelling). I'll also add a note for an autocorrect option.
We already have a note that we'd like to add the spell checker for git commit messages, but that won't be in the initial preview.
When the preview is released, we will be publishing a blog post shortly afterward that outlines the behavior of the spell checker with a lot of details, but feedback will be a huge factor to help us identify additional work that we'll want to do. The initial release will support C#, C++ and MD files with other languages to come online in the future.
Gagne today did indeed post to Microsoft's Visual Studio blog -- "Visual Studio Spell Checker Preview Now Available" -- imparting much of the same information as above. He also further explained the functionality behind some of those developer complaints.
"The feature will be turned on automatically when working with any C#, C++ or Markdown file," Gagne said. "Now, when you're working with any document supported by the spell checker, Visual Studio will mark any words that detects as misspelled words. Visual Studio will also suggest alternate spellings, and help correct them, even doing a contextual rename when those misspellings are identifiers, so your code will still compile. The spell checker can be disabled by unchecking the 'Text spell checker' feature under Manage Preview Features. The spell checker can also be enabled or disabled from the menu with the Edit > Advanced > Toggle Text Spell Checker command, or from a button on the main toolbar in Visual Studio."
Beyond spell checking, other improvements to the "General IDE Shell, Git, Editor, Debugger, and Diagnostics" part of the update include:
In other parts of the IDE, Visual Studio 2022 17.5 Preview 3 also features many enhancements or new features/functionality affecting:
David Ramel is an editor and writer for Converge360.