{"id":241065,"date":"2023-01-19T08:00:11","date_gmt":"2023-01-19T16:00:11","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=241065"},"modified":"2023-01-13T12:48:37","modified_gmt":"2023-01-13T20:48:37","slug":"visual-studio-spell-checker-preview-now-available","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-spell-checker-preview-now-available\/","title":{"rendered":"Visual Studio Spell Checker Preview Now Available"},"content":{"rendered":"<p>We know developers like you take pride in your code! Many of the features in Visual Studio are designed to help you write the code you want. Visual Studio helps you ensure your code compiles and can even help with code styling. Now it can even make sure your spelling is accurate. Visual Studio 17.5 preview 3 introduces the first preview of the Spell Checker for C#, C++ and Markdown files.<\/p>\n<p><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\" target=\"_blank\">Download Visual Studio Preview<\/a><\/div><\/p>\n<p><figure id=\"attachment_241066\" aria-labelledby=\"figcaption_attachment_241066\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/17.5p3-spellchecker.png\"><img decoding=\"async\" class=\"size-full wp-image-241066\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/17.5p3-spellchecker.png\" alt=\"The Visual Studio spell checker has identified that the identifier &quot;DetailChekkForIssues&quot; has the word &quot;Chekk&quot; misspelled. A context menu offers options for the user to rename the identifier to &quot;DetailCheckForIssues&quot;, ignore the spelling issue or disable the spell checker.\" width=\"1018\" height=\"324\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/17.5p3-spellchecker.png 1018w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/17.5p3-spellchecker-300x95.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/17.5p3-spellchecker-768x244.png 768w\" sizes=\"(max-width: 1018px) 100vw, 1018px\" \/><\/a><figcaption id=\"figcaption_attachment_241066\" class=\"wp-caption-text\">The Visual Studio Spell Checker<\/figcaption><\/figure><\/p>\n<h2>Getting Started<\/h2>\n<p>The feature will be turned on automatically when working with any C#, C++ or Markdown file. Now, when you\u2019re 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 \u201cText spell checker\u201d feature under Manage Preview Features. The spell checker can also be enabled or disabled from the menu with the Edit &gt; Advanced &gt; Toggle Text Spell Checker command, or from a button on the main toolbar in Visual Studio.<\/p>\n<h2>How do you use it?<\/h2>\n<p>When the caret is on a spelling error, the quick actions provide solutions for fixing the spelling mistakes. You can bring up the quick actions with either \u201cCtrl+.\u201d or \u201cAlt+Enter\u201d. When the context menu comes up, Visual Studio provides three options to handle a spelling issue.<\/p>\n<p>If any of the dictionaries provide spelling suggestions, Visual Studio will provide them. If multiple dictionaries provide suggestions, the suggestions will be grouped by dictionary. For strings and comments, choosing one of these suggestions will do a single, in-place replacement. For identifiers in a C++ or a C# document, accepting a suggestion will perform a Refactor\/Rename, updating all instances of the identifier to make sure the code compiles.<\/p>\n<p><figure id=\"attachment_241071\" aria-labelledby=\"figcaption_attachment_241071\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/MicrosoftTeams-image-6.png\"><img decoding=\"async\" class=\"size-full wp-image-241071\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/MicrosoftTeams-image-6.png\" alt=\"The Visual Studio spell checker has detected that the word &quot;Repressents&quot; is incorrectly spelled. When providing suggestions, the suggestions are grouped and the image shows the suggestions provided by the fr-fr dictionary. Another context menu which is collapsed would show suggestions provided by the en-us dictionary.\" width=\"1022\" height=\"580\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/MicrosoftTeams-image-6.png 1022w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/MicrosoftTeams-image-6-300x170.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/MicrosoftTeams-image-6-768x436.png 768w\" sizes=\"(max-width: 1022px) 100vw, 1022px\" \/><\/a><figcaption id=\"figcaption_attachment_241071\" class=\"wp-caption-text\">Suggestions when multiple dictionaries are in use<\/figcaption><\/figure><\/p>\n<p>You can also choose to ignore the spelling issue. By choosing to ignore the issue, Visual Studio will create an exclusion.dic file in your AppData directory on your local machine. Once a word has been ignored, it will be ignored across all instances of Visual Studio for you.<\/p>\n<h2>How does it work?<\/h2>\n<p>If you\u2019re interested in the details, this section will get into the specifics of how the spell checker works. Many of these behaviors can be customized, and we\u2019ll cover that in the next section. Since C#, C++ and Markdown all use English as the language for their keywords, Visual Studio will always use the \u201cEnglish (United States)\u201d or \u201cen-us\u201d dictionary for spell checking. Visual Studio will also ask the instance of Windows for the display language it\u2019s using, and if it\u2019s not \u201cen-us\u201d, it will use that dictionary as well.<\/p>\n<p>Feedback from early users of this feature informed us that developers wanted to know about errors in the documents they were currently working with. In direct response to this feedback, the spell checker will only scan documents that are open.<\/p>\n<p>This chart below shows some of the heuristics that the spell checker looks at when scanning a code document:<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"132\"><strong>What\u2019s in the code<\/strong><\/td>\n<td width=\"174\"><strong>What Visual Studio checks<\/strong><\/td>\n<td width=\"318\"><strong>Why?<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"132\">Hello<\/td>\n<td width=\"174\">Hello, hello<\/td>\n<td width=\"318\">Always check for both proper and common nouns<\/td>\n<\/tr>\n<tr>\n<td width=\"132\">HelloWorld<\/td>\n<td width=\"174\">Hello, hello, World, world<\/td>\n<td width=\"318\">Medial capitals common are used to mark word boundaries<\/td>\n<\/tr>\n<tr>\n<td width=\"132\">Hello.World<\/td>\n<td width=\"174\">Hello, hello, World, world<\/td>\n<td width=\"318\">Punctuation is used as a word boundary<\/td>\n<\/tr>\n<tr>\n<td width=\"132\">_Hello123<\/td>\n<td width=\"174\">Hello, hello<\/td>\n<td width=\"318\">Leading or trailing numbers or punctuation is stripped<\/td>\n<\/tr>\n<tr>\n<td width=\"132\">Hello2World<\/td>\n<td width=\"174\">Hello, hello, World, world<\/td>\n<td width=\"318\">Medial numbers, like punctuation, is used as word boundary<\/td>\n<\/tr>\n<tr>\n<td width=\"132\">btnWorld<\/td>\n<td width=\"174\">World, world<\/td>\n<td width=\"318\">Fragments of 3 characters or less are ignored<\/td>\n<\/tr>\n<tr>\n<td width=\"132\">helloworld<\/td>\n<td width=\"174\">Helloworld, helloworld<\/td>\n<td width=\"318\">No indicator to identify word boundaries<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Otherwise, we consider the word misspelled and flag the token as a spelling error. This will show up with a severity of \u201cMessage\u201d in the Error List with a \u201cSPELL\u201d Code.<\/p>\n<p><figure id=\"attachment_241067\" aria-labelledby=\"figcaption_attachment_241067\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Spelling-Error-List.png\"><img decoding=\"async\" class=\"size-full wp-image-241067\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Spelling-Error-List.png\" alt=\"The Visual Studio error list, showing two spelling errors. The errors are shown with the &quot;Message&quot; severity and include descriptions of &quot;Spelling error - xaml is not a word&quot; and &quot;Spelling error - jkwa is not a word&quot;. The error list also includes the file and line where the error occurs as well as indicating that the Code associated with the error is &quot;SPELL&quot;.\" width=\"1341\" height=\"214\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Spelling-Error-List.png 1341w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Spelling-Error-List-300x48.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Spelling-Error-List-1024x163.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2023\/01\/Spelling-Error-List-768x123.png 768w\" sizes=\"(max-width: 1341px) 100vw, 1341px\" \/><\/a><figcaption id=\"figcaption_attachment_241067\" class=\"wp-caption-text\">Spelling Errors in the Error List<\/figcaption><\/figure><\/p>\n<h2>Customizing the Spell Checker<\/h2>\n<p>The default behavior is designed to get users started and help with the initial experience. Once users are ready to start working in a collaborative environment, the spell checker has options for customizability.<\/p>\n<p>We chose editorconfig for configuration to allow users to control the spell checker behavior in their repository. By configuring .editorconfig, users can establish coding standards they expect to be followed and maintain consistency that would be difficult through other methods.<\/p>\n<p>Here are the switches you can configure in editorconfig:<\/p>\n<pre>spelling_languages = _language_[,_language_]\r\n(Example: = en-us,fr-fr)<\/pre>\n<ul>\n<li>This lists the languages for Visual Studio to use. In this example, Visual Studio would only use the en-us and fr-fr dictionaries when checking for spelling issues. Note that the fr-fr language pack must be installed on the user\u2019s machine or Visual Studio will incorrectly flag any French words as spelling errors.<\/li>\n<\/ul>\n<pre>spelling_checkable_types = strings,identifiers,comments\r\n(Example: = identifiers,comments)<\/pre>\n<ul>\n<li>This controls what Visual Studio should check. In this example, Visual Studio would check identifiers and comments for misspelled words but wouldn\u2019t check inside strings.<\/li>\n<\/ul>\n<pre>spelling_error_severity = error OR warning OR information OR hint\r\n(Example: = error)<\/pre>\n<ul>\n<li>This controls the severity Visual Studio will assign to spelling errors in the error list. In this example, spelling errors will be displayed as errors.<\/li>\n<\/ul>\n<pre>spelling_exclusion_path = absolute OR relative path to exclusion dictionary.\r\n(Example: = .\\exclusion.dic)<\/pre>\n<ul>\n<li>This allows you to create your own exclusion dictionary to specify words you consider to be correctly spelled. In this example, the first time the spell checker is run against any file in the solution, Visual Studio will check for an exclusion.dic file in the same directory as the .sln file (for a C# project) or in the root directory (for a C++ directory). If no file exists, the spell checker will create one. Then, whenever the user chooses to ignore a word, it will be added to this exclusion.dic file. Visual Studio will consider any word that appears in this exclusion.dic file as a correctly spelled word. Note that the exclusion.dic file must be UTF16 with BOM encoding to work correctly.<\/li>\n<\/ul>\n<h2>What do you think?<\/h2>\n<p>We\u2019re really excited to hear how the spell checker is helping developers feel better about their code. Features like these come from feedback from our community and we appreciate all the feedback. We\u2019d love to know what you think, and we invite folks to join in the conversation over on <a href=\"https:\/\/developercommunity.visualstudio.com\/t\/Feedback-on-the-Preview-Spell-Checking-E\/10252795\">Developer Community<\/a>. Let us know what improvements you feel would help make the spell checker even better. Thanks for being an important part of the Visual Studio family!<\/p>\n<p><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\" target=\"_blank\">Download Visual Studio Preview<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We know developers like you take pride in your code! Many of the features in Visual Studio are designed to help you write the code you want. Visual Studio helps you ensure your code compiles and can even help with code styling. Now it can even make sure your spelling is accurate. Visual Studio 17.5 [&hellip;]<\/p>\n","protected":false},"author":13892,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[5,510,526,12,6815],"class_list":["post-241065","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-csharp","tag-cpp","tag-productivity","tag-visual-studio","tag-visual-studio-2022"],"acf":[],"blog_post_summary":"<p>We know developers like you take pride in your code! Many of the features in Visual Studio are designed to help you write the code you want. Visual Studio helps you ensure your code compiles and can even help with code styling. Now it can even make sure your spelling is accurate. Visual Studio 17.5 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/241065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/13892"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=241065"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/241065\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=241065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=241065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=241065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}