You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/text-spell-checker.md
+12-9Lines changed: 12 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Learn about the Spell Checker (Preview)"
3
3
description: Learn how to use the Spell Checker in Visual Studio to correct misspelled words in multiple languages and to customize it to share with your dev team.
4
-
ms.date: 05/04/2023
4
+
ms.date: 05/10/2023
5
5
ms.topic: conceptual
6
6
author: TerryGLee
7
7
ms.author: tglee
@@ -22,7 +22,7 @@ Many of the features in Visual Studio are designed to help you write the code yo
22
22
> [!IMPORTANT]
23
23
> This feature is still in development. It's available now in Visual Studio 2022 version 17.5, but it'll be refined in future releases. For the latest news, see the [**Improving the Spell Checker**](https://devblogs.microsoft.com/visualstudio/improving-the-spell-checker/) post on the [Visual Studio Blog](https://devblogs.microsoft.com/visualstudio/).
24
24
25
-
Visual Studio automatically toggles on the Spell Checker feature with any C#, C++, or Markdown file. Visual Studio marks any words that it detects as misspelled words. Visual Studio also suggests alternate spellings and helps correct them. The feature even does a contextual rename when those misspellings are identifiers so that your code still compiles.
25
+
The Spell Checker is available for any C#, C++, or Markdown file. When the Spell Checker is enabled, Visual Studio marks any words that it detects as misspelled words. Visual Studio also suggests alternate spellings and helps correct them. The feature even does a contextual rename when those misspellings are identifiers so that your code still compiles.
26
26
27
27
You can turn the spell checker off or on by using the **Toggle Text Spell Checker** button on the main toolbar, or by selecting **Edit** > **Advanced** > **Toggle Text Spell Checker** command from the menu bar.
28
28
@@ -40,7 +40,10 @@ You can also choose to ignore the spelling issue. By choosing to ignore the issu
40
40
41
41
Because C#, C++, and Markdown all use English as the language for their keywords, Visual Studio typically uses the "English (United States)" or "en-us" dictionary for spell checking. Visual Studio checks the instance of Windows for the display language it's using, and if it's not "en-us", it uses that dictionary as well.
42
42
43
-
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 scans documents that are open.
43
+
> [!NOTE]
44
+
> C# and C++ also have additional dictonaries for keywords in those languages, which prevents words like ‘namespace’ or ‘alloc’ from being flagged as misspelled words.
45
+
46
+
Feedback from early users of this feature informed us that developers only want to know about errors in the document they are currently working with. In response to that feedback, the spell checker only scans the document(s) that are active in the editor. In direct response to this feedback, the spell checker scans documents that are open.
44
47
45
48
The following table shows some of the heuristics that the **Spell Checker** looks at when it scans a code document:
46
49
@@ -54,7 +57,7 @@ The following table shows some of the heuristics that the **Spell Checker** look
54
57
| btnWorld | World, world | Fragments of three characters or fewer are ignored |
55
58
| helloworld | Helloworld, helloworld | No indicator to identify word boundaries |
56
59
57
-
Otherwise, Visual Studio considers the word misspelled and flags the token as a spelling error. Visual Studio displays the spelling error with a severity of "Message" in the Error List with a "SPELL" Code.
60
+
If Visual Studio finds a match for the token in any of the dictionaries it's using, the token is considered acceptable and the scan carries on. Otherwise, the token is considered misspelled and Visual Studio flags it as a spelling error.
58
61
59
62
:::image type="content" source="media/vs-2022/text-spell-checker-error-list-example.png" alt-text="Screenshot of an example of spelling errors in the Error List.":::
60
63
@@ -72,7 +75,7 @@ Here are some examples and use-case scenarios of the switches you can configure
72
75
```(Example: = en-us,fr-fr)```
73
76
74
77
> [!NOTE]
75
-
> Make sure to install the [language pack](../install/install-visual-studio.md) for any non-default language you're using to prevent Visual Studio from incorrectly flagging words as spelling errors.
78
+
> Make sure to install the [language pack](../install/install-visual-studio.md) for any language you're using to prevent Visual Studio from incorrectly flagging words as spelling errors.
76
79
77
80
- Control what Visual Studio should check. In this example, Visual Studio would check identifiers and comments for misspelled words but wouldn’t check inside strings.
78
81
@@ -90,7 +93,7 @@ Here are some examples and use-case scenarios of the switches you can configure
90
93
```(Example: = .\exclusion.dic)```
91
94
92
95
> [!NOTE]
93
-
> Visual Studio uses 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 require the exclusion file to have "UTF-16 with BOM" encoding to work correctly.
96
+
> Visual Studio uses 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.
94
97
95
98
- Control whether the language-specific exclusion dictionary so use. When set to false, any words specified in the exclusion dictionaries specific to C++ or C# won't be used. The default is true.
96
99
@@ -99,10 +102,10 @@ Here are some examples and use-case scenarios of the switches you can configure
99
102
100
103
## Special case handling
101
104
102
-
In Visual Studio, some strings aren't recommended for spell-checking. Other strings aren't spell checked or aren't spell checked in their entirety.
105
+
There are a few special behaviors in how Visual Studio checks code for spelling errors that are different from a traditional spell checker that's designed for written text. Some of these behaviors include:
103
106
104
-
-Strings that include punctuation aren't recommended. For example, `misc.` isn't recommended as it could result in code that won't compile.
105
-
- Backslashes in a string can omit the subsequent character from being spell-checked. For example, `\nhello` won't be flagged as a spelling error because the "n" is omitted and "hello" is a correctly spelled word.
107
+
-In a string that includes punctuation, for example, 'misc.", Visual Studio won't suggest a correction because punctuation in an identifier might result in code that won't compile.
108
+
- Backslashes in a string will omit the subsequent character from being spell-checked and treat the backslash and subsequent character as a word delimiter. For example, in the string `hello\nworld`, Visual Studio detects the backslash first. Visual Studio treats the `\n` as a word delimiter, which leaves "hello" and "world", each of which are checked individually.
106
109
- Strings that contain URLs such as `https://...` or `mailto:..` won't be spell-checked over the entire string.
0 commit comments