Skip to content

Commit 692fa3d

Browse files
committed
Code analyzer adjustments and fixes
- Fixed incorrect path resolution for additional dictionary folders. Fixes #282. - Fixed incorrect path resolution for the global ignored words file. Fixes #284. - Set the ignore private identifiers, internal identifiers, member body identifiers, and compiler generated code code analyzer options to true to limit spell checking to public and protected identifiers by default. - Reordered the configuration editor categories to list the general and code analyzer categories first. Updated the docs to make a distinction between the global and solution/project .editorconfig settings in the conversion topic and on the conversion info bar. Closes #278. Closes #279.
1 parent b2118cc commit 692fa3d

12 files changed

Lines changed: 139 additions & 77 deletions

Docs/Content/ConfigOptions/CodeAnalyzerOptions.aml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,31 @@
33
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
44
<introduction>
55
<para>This category contains several options that let you fine tune how source code files are spell
6-
checked. The following options are available. All of them are disabled by default so that the associated
7-
elements are included for spell checking.</para>
6+
checked. The following options are available.</para>
87
</introduction>
98

109
<section>
1110
<content>
1211
<para>The following options only apply to the code analyzer used to spell check identifiers in C# source
1312
code (Visual Studio 2019 and later). Note that camel cased identifiers and those with underscores will be split
14-
into individual words and each word in the identifier will be spell checked.</para>
13+
into individual words and each word in the identifier will be spell checked. The default settings are configured
14+
so that only public and protected member identifiers are spell checked. The options below can be adjusted to
15+
include private members, internal members, local variables, and compiler generated code if so desired.</para>
1516

1617
<list class="bullet">
1718
<listItem>
18-
<para><ui>Ignore identifiers if private</ui> - If enabled, all identifiers with a visibility of
19-
private are ignored.</para>
19+
<para><ui>Ignore identifiers if private</ui> - If enabled, the default, all identifiers with a
20+
visibility of private are ignored.</para>
2021

2122
<code language="none" title=" ">
2223
vsspell_code_analyzer_ignore_identifier_if_private = [true|false]
2324
</code>
2425
</listItem>
2526

2627
<listItem>
27-
<para><ui>Ignore identifier if internal</ui> - If enabled, all identifiers with a visibility of
28-
internal are ignored. Note that protected internal identifiers will still be spell checked as the protected
29-
visibility will take precedence.</para>
28+
<para><ui>Ignore identifier if internal</ui> - If enabled, the default, all identifiers with a
29+
visibility of internal are ignored. Note that protected internal identifiers will still be spell checked as the
30+
protected visibility will take precedence.</para>
3031

3132
<code language="none" title=" ">
3233
vsspell_code_analyzer_ignore_identifier_if_internal = [true|false]
@@ -43,11 +44,11 @@ vsspell_code_analyzer_ignore_identifier_if_all_uppercase = [true|false]
4344
</listItem>
4445

4546
<listItem>
46-
<para><ui>Ignore identifiers within member bodies</ui> - If enabled, all identifiers within the body
47-
of a member will be ignored (local variables in properties, methods, lambda expressions, etc.). This can be
48-
useful in reducing the number of spelling errors reported since method bodies tend to contain more abbreviations
49-
and other shortened identifiers. Since these will never be publicly visible, it may be preferable to skip spell
50-
checking them.</para>
47+
<para><ui>Ignore identifiers within member bodies</ui> - If enabled, the default, all identifiers
48+
within the body of a member will be ignored (local variables in properties, methods, lambda expressions, etc.).
49+
This can be useful in reducing the number of spelling errors reported since method bodies tend to contain more
50+
abbreviations and other shortened identifiers. Since these will never be publicly visible, it may be preferable
51+
to skip spell checking them.</para>
5152

5253
<code language="none" title=" ">
5354
vsspell_code_analyzer_ignore_identifiers_within_member_bodies = [true|false]
@@ -66,8 +67,8 @@ vsspell_code_analyzer_ignore_type_parameters = [true|false]
6667
</listItem>
6768

6869
<listItem>
69-
<para><ui>Ignore compiler generated code</ui> - If enabled, all compiler generated code is skipped
70-
and will not be spell checked.</para>
70+
<para><ui>Ignore compiler generated code</ui> - If enabled, the default, all compiler generated code
71+
is skipped and will not be spell checked.</para>
7172

7273
<code language="none" title=" ">
7374
vsspell_code_analyzer_ignore_if_compiler_generated = [true|false]

Docs/Content/ConfigOptions/ConfigOptions.aml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,19 @@ several categories described below.</para>
7777
<list class="bullet">
7878
<listItem>
7979
<para>
80-
<link xlink:href="b156d5ad-347f-4f63-89dc-4f945953ae41" />
81-
</para>
82-
</listItem>
83-
84-
<listItem>
85-
<para>
86-
<link xlink:href="af34b863-6a1c-41ed-bcf2-48a714686519" />
80+
<link xlink:href="b4a8726f-5bee-48a4-81a9-00b1be332607" />
8781
</para>
8882
</listItem>
8983

9084
<listItem>
9185
<para>
92-
<link xlink:href="b4a8726f-5bee-48a4-81a9-00b1be332607" />
86+
<link xlink:href="09cc5bfa-9eba-47e5-ba5f-a36e04f09b0d" />
9387
</para>
9488
</listItem>
9589

9690
<listItem>
9791
<para>
98-
<link xlink:href="09cc5bfa-9eba-47e5-ba5f-a36e04f09b0d" />
92+
<link xlink:href="af34b863-6a1c-41ed-bcf2-48a714686519" />
9993
</para>
10094
</listItem>
10195

@@ -128,7 +122,13 @@ several categories described below.</para>
128122
<link xlink:href="6a987caf-5ad9-4dab-a17c-c887881fec7a" />
129123
</para>
130124
</listItem>
131-
125+
126+
<listItem>
127+
<para>
128+
<link xlink:href="b156d5ad-347f-4f63-89dc-4f945953ae41" />
129+
</para>
130+
</listItem>
131+
132132
<listItem>
133133
<para>
134134
<link xlink:href="e23551ac-52f5-4505-b2d2-0728c7607fd3" />

Docs/Content/ConfigOptions/GeneralSettings.aml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ vsspell_include_in_project_spell_check = [true|false]
3333
</listItem>
3434

3535
<listItem>
36-
<para><ui>Enable spell checking code analyzer in supported languages</ui> - This option enables the
37-
spell checking code analyzer and is enabled by default. It will spell check identifiers in all supported
38-
languages (currently only C# but support for Visual Basic is planned for later). Unlike comment and string
39-
misspellings, identifier misspellings will be highlighted using the same colored underline as other code fixes.
40-
Fixing a misspelling in an identifier will automatically correct it in all other references to it.</para>
36+
<para><ui>Enable the identifier spell checking code analyzer in supported languages</ui> - This
37+
option enables the spell checking code analyzer and is enabled by default. It will spell check identifiers in
38+
all supported languages (currently only C# but support for Visual Basic is planned for later). Unlike comment
39+
and string misspellings, identifier misspellings will be highlighted using the same colored underline as other
40+
code fixes. Fixing a misspelling in an identifier will automatically correct it in all other references to it.</para>
4141

4242
<code language="none" title=" ">
4343
vsspell_code_analyzers_enabled = [true|false]

Docs/Content/ConvertingToEditorConfig.aml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ added in that version.</para>
4040
global configuration has not been converted yet, you will be prompted to convert the settings by an info bar that
4141
will appear just below the Visual Studio main menu bar. Click the <ui>Convert</ui> link in the info bar to open
4242
the conversion tool window.</para>
43+
44+
<alert class="note">
45+
<para>The global spell checker configuration is also stored in the .editorconfig format but remains a
46+
separate configuration file stored in the same user settings location as the old configuration file
47+
(<localUri>%LOCALAPPDATA%\EWSoftware\Visual Studio Spell Checker</localUri>). If you do not use solution/project
48+
spell checker configurations, only the global spell checker configuration file will need conversion and the
49+
currently loaded solution and its projects will remain unchanged.</para>
50+
51+
<para>If a solution or project with old <localUri>.vsspell</localUri> configuration files does not
52+
currently contain an .editorconfig file, one will be added to it to store the spell checker settings. If one
53+
does already exist, all other settings in it will remain unchanged. Only the new spell checker settings will be
54+
added to it. The conversion tool window shows a preview of the changes that will be made.</para>
55+
</alert>
4356

4457
<autoOutline lead="none" excludeRelatedTopics="true" />
4558
</introduction>

Docs/Content/Installation.aml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ search for "Visual Studio Spell Checker". Include the quote marks for an exact
5757
<legacyItalic>EWSoftware</legacyItalic>. Once found, you can click the <ui>Download</ui> button to download and
5858
install it.</para>
5959

60-
<para>Correcting spelling errors within the editor is handled using the Quick Actions and Refactorings
61-
context menu option or the smart tags. See the <link xlink:href="e8f67bc4-a8f8-4e50-ab5a-876599f3a645" />
62-
topic for more information. A spell checker toolbar is also available. Right click anywhere in the Visual
63-
Studio toolbar area and select the Spell Checker option from the context menu to display it.</para>
64-
60+
<alert class="tip">
61+
<para>The spell checker contains many configuration options that can help you fine tune how and when
62+
spell checking occurs. See the <link xlink:href="fb81c214-0fe0-4d62-a172-d7928d5b91d5" /> topic for complete
63+
details and information on what each of the options does. The global configuration can be edited using the menu
64+
option noted below.</para>
65+
</alert>
66+
6567
<para>Once installed, you will find a new <ui>Spell Checker</ui> option on the <ui>Tools</ui> menu.
6668
Unless other packages have been installed that alter its position, it will be the fourth or fifth option from the
6769
bottom between the <ui>External Tools</ui> and the <ui>Import and Export Settings</ui> options. Its submenu
@@ -127,6 +129,11 @@ global spell checker settings.</para>
127129

128130
</list>
129131

132+
<para>Correcting spelling errors within the editor is handled using the Quick Actions and Refactorings
133+
context menu option or the smart tags. See the <link xlink:href="e8f67bc4-a8f8-4e50-ab5a-876599f3a645" />
134+
topic for more information. A spell checker toolbar is also available. Right click anywhere in the Visual
135+
Studio toolbar area and select the Spell Checker option from the context menu to display it.</para>
136+
130137
</content>
131138
</section>
132139

Docs/ContentLayout.content

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,10 @@
7171
<HelpKeyword index="K" term="configuration options, conversion" />
7272
</HelpKeywords>
7373
</Topic>
74-
<Topic id="fb81c214-0fe0-4d62-a172-d7928d5b91d5" visible="True" title="Configuration Options">
74+
<Topic id="fb81c214-0fe0-4d62-a172-d7928d5b91d5" visible="True" isSelected="true" title="Configuration Options">
7575
<HelpKeywords>
7676
<HelpKeyword index="K" term="configuration options, categories" />
7777
</HelpKeywords>
78-
<Topic id="b156d5ad-347f-4f63-89dc-4f945953ae41" visible="True" title="Import Settings">
79-
<HelpKeywords>
80-
<HelpKeyword index="K" term="configuration, import settings" />
81-
</HelpKeywords>
82-
</Topic>
83-
<Topic id="af34b863-6a1c-41ed-bcf2-48a714686519" visible="True" title="Dictionary Settings">
84-
<HelpKeywords>
85-
<HelpKeyword index="K" term="configuration, dictionary settings" />
86-
</HelpKeywords>
87-
</Topic>
8878
<Topic id="b4a8726f-5bee-48a4-81a9-00b1be332607" visible="True" title="General Settings">
8979
<HelpKeywords>
9080
<HelpKeyword index="K" term="configuration, general settings" />
@@ -95,6 +85,11 @@
9585
<HelpKeyword index="K" term="configuration, code analyzer options" />
9686
</HelpKeywords>
9787
</Topic>
88+
<Topic id="af34b863-6a1c-41ed-bcf2-48a714686519" visible="True" title="Dictionary Settings">
89+
<HelpKeywords>
90+
<HelpKeyword index="K" term="configuration, dictionary settings" />
91+
</HelpKeywords>
92+
</Topic>
9893
<Topic id="c592c4d8-7387-47fe-9b79-28bf0168f447" visible="True" title="Ignored Words/Keywords">
9994
<HelpKeywords>
10095
<HelpKeyword index="K" term="configuration, ignored words" />
@@ -121,6 +116,11 @@
121116
<HelpKeyword index="K" term="configuration, ignored classifications" />
122117
</HelpKeywords>
123118
</Topic>
119+
<Topic id="b156d5ad-347f-4f63-89dc-4f945953ae41" visible="True" title="Import Settings">
120+
<HelpKeywords>
121+
<HelpKeyword index="K" term="configuration, import settings" />
122+
</HelpKeywords>
123+
</Topic>
124124
<Topic id="e23551ac-52f5-4505-b2d2-0728c7607fd3" visible="True" title="Visual Studio WPF Text Boxes">
125125
<HelpKeywords>
126126
<HelpKeyword index="K" term="configuration, WPF text boxes" />
@@ -164,7 +164,7 @@
164164
<HelpKeywords>
165165
<HelpKeyword index="K" term="version, history" />
166166
</HelpKeywords>
167-
<Topic id="0374de80-9512-4b10-928f-ec3ba6caf018" visible="True" isSelected="true" title="Version 2023.5.8.0">
167+
<Topic id="0374de80-9512-4b10-928f-ec3ba6caf018" visible="True" title="Version 2023.5.8.0">
168168
<HelpKeywords>
169169
<HelpKeyword index="K" term="versions, 2023.5.8.0" />
170170
</HelpKeywords>

Source/VSSpellCheckerCommon/Configuration/CodeAnalyzerOptions.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// System : Visual Studio Spell Checker Package
33
// File : CodeAnalyzerOptions.cs
44
// Author : Eric Woodruff (Eric@EWoodruff.us)
5-
// Updated : 03/22/2023
5+
// Updated : 05/13/2023
66
// Note : Copyright 2015-2023, Eric Woodruff, All rights reserved
77
//
88
// This file contains the class used to contain the code analyzer configuration settings
@@ -29,16 +29,16 @@ public class CodeAnalyzerOptions
2929
/// <summary>
3030
/// This is used to get or set whether or not to ignore identifiers for private types and members
3131
/// </summary>
32-
/// <value>The default is false to include them</value>
33-
[DefaultValue(false), EditorConfigProperty("vsspell_code_analyzer_ignore_identifier_if_private")]
34-
public bool IgnoreIdentifierIfPrivate { get; set; }
32+
/// <value>The default is true to exclude them</value>
33+
[DefaultValue(true), EditorConfigProperty("vsspell_code_analyzer_ignore_identifier_if_private")]
34+
public bool IgnoreIdentifierIfPrivate { get; set; } = true;
3535

3636
/// <summary>
3737
/// This is used to get or set whether or not to ignore identifiers for internal types and members
3838
/// </summary>
39-
/// <value>The default is false to include them</value>
40-
[DefaultValue(false), EditorConfigProperty("vsspell_code_analyzer_ignore_identifier_if_internal")]
41-
public bool IgnoreIdentifierIfInternal { get; set; }
39+
/// <value>The default is true to exclude them</value>
40+
[DefaultValue(true), EditorConfigProperty("vsspell_code_analyzer_ignore_identifier_if_internal")]
41+
public bool IgnoreIdentifierIfInternal { get; set; } = true;
4242

4343
/// <summary>
4444
/// This is used to get or set whether or not to ignore identifiers in all uppercase
@@ -51,9 +51,9 @@ public class CodeAnalyzerOptions
5151
/// This is used to get or set whether or not to ignore identifiers within member bodies such as
5252
/// variable declarations local to a method.
5353
/// </summary>
54-
/// <value>The default is false to include them</value>
55-
[DefaultValue(false), EditorConfigProperty("vsspell_code_analyzer_ignore_identifiers_within_member_bodies")]
56-
public bool IgnoreIdentifiersWithinMemberBodies { get; set; }
54+
/// <value>The default is true to exclude them</value>
55+
[DefaultValue(true), EditorConfigProperty("vsspell_code_analyzer_ignore_identifiers_within_member_bodies")]
56+
public bool IgnoreIdentifiersWithinMemberBodies { get; set; } = true;
5757

5858
/// <summary>
5959
/// This is used to get or set whether or not to ignore type parameters (e.g. TKey, TValue)
@@ -66,9 +66,9 @@ public class CodeAnalyzerOptions
6666
/// <summary>
6767
/// This is used to get or set whether or not to ignore compiler generated types and members
6868
/// </summary>
69-
/// <value>The default is false to include them</value>
70-
[DefaultValue(false), EditorConfigProperty("vsspell_code_analyzer_ignore_if_compiler_generated")]
71-
public bool IgnoreIfCompilerGenerated { get; set; }
69+
/// <value>The default is true to exclude them</value>
70+
[DefaultValue(true), EditorConfigProperty("vsspell_code_analyzer_ignore_if_compiler_generated")]
71+
public bool IgnoreIfCompilerGenerated { get; set; } = true;
7272

7373
/// <summary>
7474
/// This is used to get or set whether or not to ignore XML documentation comments

0 commit comments

Comments
 (0)