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
+24-8Lines changed: 24 additions & 8 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"
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/24/2023
4
+
ms.date: 08/27/2024
5
5
ms.topic: conceptual
6
6
author: anandmeg
7
7
ms.author: meghaanand
@@ -36,7 +36,7 @@ Because C#, C++, and Markdown all use English as the language for their keywords
36
36
> [!NOTE]
37
37
> C# and C++ also have additional dictionaries for keywords in those languages, which prevents words like ‘namespace’ or ‘alloc’ from being flagged as misspelled words.
38
38
39
-
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.
39
+
Feedback from early users of this feature informed us that developers only want to know about errors in the document they're currently working with. In response to that feedback, the spell checker only scans the documents that are active in the editor.
40
40
41
41
The following table shows some of the heuristics that the **Spell Checker** looks at when it scans a code document:
42
42
@@ -50,7 +50,7 @@ The following table shows some of the heuristics that the **Spell Checker** look
50
50
| btnWorld | World, world | Fragments of three characters or fewer are ignored |
51
51
| helloworld | Helloworld, helloworld | No indicator to identify word boundaries |
52
52
53
-
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.
53
+
If Visual Studio identifies a match for the token in any of the dictionaries it's using, the token is deemed acceptable, and the scan proceeds. Otherwise, the token is considered misspelled and Visual Studio flags it as a spelling error.
54
54
55
55
:::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.":::
56
56
@@ -60,6 +60,11 @@ You can customize the spell checker so that it's optimized for a collaborative e
60
60
61
61
By configuring an EditorConfig file, you can establish the coding standards that you expect everyone to follow, which allows you to maintain a coding consistency that might be difficult through other methods.
62
62
63
+
> [!IMPORTANT]
64
+
> Spelling error options are file-specific. You must specify which files spelling options are applied to. In the following example, the spelling options are applied to all C# files in the solution:
65
+
>
66
+
>```[*.cs]```
67
+
63
68
Here are some examples and use-case scenarios of the switches you can configure in an EditorConfig file:
64
69
65
70
- List 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.
@@ -80,27 +85,38 @@ Here are some examples and use-case scenarios of the switches you can configure
80
85
```spelling_error_severity = error OR warning OR information OR hint```<br>
81
86
```(Example: = error)```
82
87
83
-
- 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 checks 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 exclusion.dic file exists, the Visual Studio creates one. Then, whenever the user chooses to ignore a word, Visual Studio adds it to this exclusion.dic file. Visual Studio considers any word that appears in this exclusion.dic file as a correctly spelled word.
88
+
- Create your own exclusion dictionary to specify words you consider to be correctly spelled. In this example, the first time the Spell Checker runs against any file in the solution, Visual Studio checks for an exclusion.dic file. Visual Studio checks the same directory of the .sln file for a C# project or in the root directory for a C++ directory. If no exclusion.dic file exists, the Visual Studio creates one. Then, whenever the user chooses to ignore a word, Visual Studio adds it to this exclusion.dic file. Visual Studio considers any word that appears in this exclusion.dic file as a correctly spelled word.
84
89
85
90
```spelling_exclusion_path = absolute OR relative path to exclusion dictionary```<br>
86
91
```(Example: = .\exclusion.dic)```
87
92
88
93
> [!NOTE]
89
94
> 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.
90
95
91
-
- 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
+
- Control whether the default language-specific exclusion dictionary is used. This flag is set to true by default. Any words added to the language-specific exclusion dictionary will be considered correctly spelled. Set to false to ignore the exclusion dictionaries specific to C++ or C#.
92
97
93
98
```spelling_use_default_exclusion_dictionary = true OR false```<br>
[*.{cs,vb}] //specify which files the spelling options apply to
105
+
spelling_languages = en-us,fr-fr //specifies the en-us and fr-fr dictionaries for use in spell checking
106
+
spelling_checkable_types = identifiers,comments //specifies that identifiers and comments are the only checked elements
107
+
spelling_error_severity = error //sets severity assigned to spelling errors to error in the error list
108
+
spelling_exclusion_path = exclusion.dic //defines a custom exclusion dictionary location and file
109
+
spelling_use_default_exclusion_dictionary = false //ignores the language-specific default exclusion dictionary
110
+
```
111
+
96
112
## Special case handling
97
113
98
-
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:
114
+
Visual Studio has some unique behaviors when checking code for spelling errors that differ from those of a traditional spell checker designed for written text. Some of these behaviors include:
99
115
100
-
- 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.
116
+
- 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 doesn't compile.
101
117
- 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.
102
118
- Strings that contain URLs such as `https://...` or `mailto:..` won't be spell-checked over the entire string.
103
119
104
120
## Related content
105
121
106
-
-[Improving the Spell Checker](https://devblogs.microsoft.com/visualstudio/improving-the-spell-checker/)
122
+
-[Improving the Spell Checker](https://devblogs.microsoft.com/visualstudio/improving-the-spell-checker/)
0 commit comments