Skip to content

Commit 422e57c

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/visualstudio-docs-pr (branch live)
2 parents 1e6d063 + 26ae342 commit 422e57c

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

docs/ide/text-spell-checker.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Learn about the Spell Checker"
33
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
55
ms.topic: conceptual
66
author: anandmeg
77
ms.author: meghaanand
@@ -36,7 +36,7 @@ Because C#, C++, and Markdown all use English as the language for their keywords
3636
> [!NOTE]
3737
> 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.
3838
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.
4040

4141
The following table shows some of the heuristics that the **Spell Checker** looks at when it scans a code document:
4242

@@ -50,7 +50,7 @@ The following table shows some of the heuristics that the **Spell Checker** look
5050
| btnWorld | World, world | Fragments of three characters or fewer are ignored |
5151
| helloworld | Helloworld, helloworld | No indicator to identify word boundaries |
5252

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.
5454

5555
:::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.":::
5656

@@ -60,6 +60,11 @@ You can customize the spell checker so that it's optimized for a collaborative e
6060

6161
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.
6262

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+
6368
Here are some examples and use-case scenarios of the switches you can configure in an EditorConfig file:
6469

6570
- 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
8085
```spelling_error_severity = error OR warning OR information OR hint```<br>
8186
```(Example: = error)```
8287

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.
8489

8590
```spelling_exclusion_path = absolute OR relative path to exclusion dictionary```<br>
8691
```(Example: = .\exclusion.dic)```
8792

8893
> [!NOTE]
8994
> 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.
9095
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#.
9297

9398
```spelling_use_default_exclusion_dictionary = true OR false```<br>
9499
```(Example: = spelling_use_default_exclusion_dictionary = false)```
95100

101+
Here's a complete example:
102+
103+
```
104+
[*.{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+
96112
## Special case handling
97113

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:
99115

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.
101117
- 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.
102118
- Strings that contain URLs such as `https://...` or `mailto:..` won't be spell-checked over the entire string.
103119

104120
## Related content
105121

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

Comments
 (0)