Skip to content

Commit c372cd4

Browse files
committed
Updated to use latest language features
1 parent b361477 commit c372cd4

58 files changed

Lines changed: 428 additions & 538 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

IgnoredWords.dic

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Hannes
1313
html
1414
htmlx
1515
hunspells
16+
Istvan
1617
jquery
1718
Kamecke
1819
Kristensen
@@ -23,13 +24,17 @@ microsoft
2324
Miloslav
2425
mimetype
2526
mscorlib
27+
Novak
2628
php
2729
plaintext
2830
preprocessor
2931
Recurse
32+
rescan
33+
rescanning
3034
Resharper
3135
resheader
3236
resx
3337
Ruhmann
38+
unregisters
3439
utf
3540
xml

Source/SpellCheckCodeAnalyzer/SpellCheckHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ private void ProcessDocComment(SyntaxNode node, CancellationToken cancellationTo
516516
}
517517
else
518518
{
519-
if(!(token.Parent?.Parent is XmlElementSyntax parentElement) ||
520-
!configuration.IgnoredXmlElements.Contains(parentElement.StartTag.Name.LocalName.Text))
519+
if(token.Parent?.Parent is not XmlElementSyntax parentElement ||
520+
!configuration.IgnoredXmlElements.Contains(parentElement.StartTag.Name.LocalName.Text))
521521
{
522522
spans.Add(new SpellCheckSpan(token.Span, SpellCheckType.Comment,
523523
SpellCheckType.XmlDocComment, token.Text));

Source/VSSpellChecker/Editors/ICommonCommandSupport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
namespace VisualStudio.SpellChecker.Editors
2323
{
2424
/// <summary>
25-
/// This interface allows implementor editor panes to declare and execute common
25+
/// This interface allows implementer editor panes to declare and execute common
2626
/// commands supported by them.
2727
/// </summary>
2828
public interface ICommonCommandSupport

Source/VSSpellChecker/Editors/Pages/CodeAnalysisDictionaryUserControl.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// System : Visual Studio Spell Checker Package
33
// File : CodeAnalysisDictionaryUserControl.xaml.cs
44
// Author : Eric Woodruff (Eric@EWoodruff.us)
5-
// Updated : 04/16/2023
6-
// Note : Copyright 2015-2023, Eric Woodruff, All rights reserved
5+
// Updated : 08/30/2025
6+
// Note : Copyright 2015-2025, Eric Woodruff, All rights reserved
77
//
88
// This file contains a user control used to edit the code analysis dictionary configuration settings
99
//
@@ -48,14 +48,14 @@ public CodeAnalysisDictionaryUserControl()
4848
{
4949
InitializeComponent();
5050

51-
configPropertyControls = new[]
52-
{
51+
configPropertyControls =
52+
[
5353
(cboImportCADictionaries, nameof(CodeAnalysisDictionaryOptions.ImportCodeAnalysisDictionaries)),
5454
(cboUnrecognizedWords, nameof(CodeAnalysisDictionaryOptions.TreatUnrecognizedWordsAsMisspelled)),
5555
(cboDeprecatedTerms, nameof(CodeAnalysisDictionaryOptions.TreatDeprecatedTermsAsMisspelled)),
5656
(cboCompoundTerms, nameof(CodeAnalysisDictionaryOptions.TreatCompoundTermsAsMisspelled)),
5757
(cboCasingExceptions, nameof(CodeAnalysisDictionaryOptions.TreatCasingExceptionsAsIgnoredWords))
58-
};
58+
];
5959
}
6060
#endregion
6161

@@ -86,9 +86,9 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
8686
throw new ArgumentNullException(nameof(properties));
8787

8888
if(!isGlobal)
89-
dataSource.AddRange(new[] { PropertyState.Inherited, PropertyState.Yes, PropertyState.No });
89+
dataSource.AddRange([PropertyState.Inherited, PropertyState.Yes, PropertyState.No]);
9090
else
91-
dataSource.AddRange(new[] { PropertyState.Yes, PropertyState.No });
91+
dataSource.AddRange([PropertyState.Yes, PropertyState.No]);
9292

9393
foreach(var configProp in configPropertyControls)
9494
{

Source/VSSpellChecker/Editors/Pages/CodeAnalyzerOptionsUserControl.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// System : Visual Studio Spell Checker Package
33
// File : CodeAnalyzerOptionsUserControl.xaml.cs
44
// Author : Eric Woodruff (Eric@EWoodruff.us)
5-
// Updated : 04/21/2023
6-
// Note : Copyright 2014-2023, Eric Woodruff, All rights reserved
5+
// Updated : 08/30/2025
6+
// Note : Copyright 2014-2025, Eric Woodruff, All rights reserved
77
//
88
// This file contains a user control used to edit the code analyzer spell checker configuration settings
99
//
@@ -47,8 +47,8 @@ public CodeAnalyzerOptionsUserControl()
4747
{
4848
InitializeComponent();
4949

50-
configPropertyControls = new[]
51-
{
50+
configPropertyControls =
51+
[
5252
(cboIgnoreIdentifierIfPrivate, nameof(CodeAnalyzerOptions.IgnoreIdentifierIfPrivate)),
5353
(cboIgnoreIdentifierIfInternal, nameof(CodeAnalyzerOptions.IgnoreIdentifierIfInternal)),
5454
(cboIgnoreIdentifierIfAllUppercase, nameof(CodeAnalyzerOptions.IgnoreIdentifierIfAllUppercase)),
@@ -64,7 +64,7 @@ public CodeAnalyzerOptionsUserControl()
6464
(cboIgnoreInterpolatedStrings, nameof(CodeAnalyzerOptions.IgnoreInterpolatedStrings)),
6565
(cboIgnoreRawStrings, nameof(CodeAnalyzerOptions.IgnoreRawStrings)),
6666
(cboApplyToAllCStyleLanguages, nameof(CodeAnalyzerOptions.ApplyToAllCStyleLanguages)),
67-
};
67+
];
6868
}
6969
#endregion
7070

@@ -95,9 +95,9 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
9595
throw new ArgumentNullException(nameof(properties));
9696

9797
if(!isGlobal)
98-
dataSource.AddRange(new[] { PropertyState.Inherited, PropertyState.Yes, PropertyState.No });
98+
dataSource.AddRange([PropertyState.Inherited, PropertyState.Yes, PropertyState.No]);
9999
else
100-
dataSource.AddRange(new[] { PropertyState.Yes, PropertyState.No });
100+
dataSource.AddRange([PropertyState.Yes, PropertyState.No]);
101101

102102
foreach(var configProp in configPropertyControls)
103103
{

Source/VSSpellChecker/Editors/Pages/DictionarySettingsUserControl.xaml.cs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// System : Visual Studio Spell Checker Package
33
// File : DictionarySettingsUserControl.xaml.cs
44
// Author : Eric Woodruff (Eric@EWoodruff.us)
5-
// Updated : 05/06/2023
6-
// Note : Copyright 2014-2023, Eric Woodruff, All rights reserved
5+
// Updated : 08/30/2025
6+
// Note : Copyright 2014-2025, Eric Woodruff, All rights reserved
77
//
88
// This file contains a user control used to edit the spell checker dictionary settings
99
//
@@ -61,7 +61,7 @@ public DictionarySettingsUserControl()
6161
{
6262
InitializeComponent();
6363

64-
selectedLanguages = new List<string>();
64+
selectedLanguages = [];
6565
}
6666
#endregion
6767

@@ -97,9 +97,9 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
9797
var dataSource = new List<PropertyState>();
9898

9999
if(!isGlobal)
100-
dataSource.AddRange(new[] { PropertyState.Inherited, PropertyState.Yes, PropertyState.No });
100+
dataSource.AddRange([PropertyState.Inherited, PropertyState.Yes, PropertyState.No]);
101101
else
102-
dataSource.AddRange(new[] { PropertyState.Yes, PropertyState.No });
102+
dataSource.AddRange([PropertyState.Yes, PropertyState.No]);
103103

104104
cboDetermineResxLang.ItemsSource = dataSource;
105105
cboDetermineResxLang.SelectedValue = properties.ToPropertyState(
@@ -115,7 +115,7 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
115115

116116
if(properties.TryGetValue(nameof(SpellCheckerConfiguration.AdditionalDictionaryFolders), out var spi))
117117
{
118-
folders.AddRange(spi.EditorConfigPropertyValue.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries));
118+
folders.AddRange(spi.EditorConfigPropertyValue.Split(['|'], StringSplitOptions.RemoveEmptyEntries));
119119

120120
if(folders.Count != 0 && folders[0].ToString().Equals(SpellCheckerConfiguration.ClearInherited,
121121
StringComparison.OrdinalIgnoreCase))
@@ -136,11 +136,13 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
136136

137137
if(properties.TryGetValue(nameof(SpellCheckerConfiguration.DictionaryLanguages), out spi))
138138
{
139-
selectedLanguages.AddRange(spi.EditorConfigPropertyValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
139+
selectedLanguages.AddRange(spi.EditorConfigPropertyValue.Split([','], StringSplitOptions.RemoveEmptyEntries));
140140

141141
for(int idx = 0; idx < selectedLanguages.Count; idx++)
142+
{
142143
if(selectedLanguages[idx].Equals(SpellCheckerConfiguration.Inherited, StringComparison.OrdinalIgnoreCase))
143144
selectedLanguages[idx] = String.Empty;
145+
}
144146
}
145147

146148
this.LoadAvailableLanguages();
@@ -341,7 +343,7 @@ private IEnumerable<string> GetInheritedAdditionalFolders()
341343
string addFoldersPropName = SpellCheckerConfiguration.EditorConfigSettingsFor(
342344
nameof(SpellCheckerConfiguration.AdditionalDictionaryFolders)).PropertyName;
343345

344-
foreach(string configFile in configFiles.Except(new[] { this.ConfigurationFilename }))
346+
foreach(string configFile in configFiles.Except([this.ConfigurationFilename]))
345347
{
346348
var editorConfig = EditorConfigFile.FromFile(configFile);
347349

@@ -351,8 +353,8 @@ private IEnumerable<string> GetInheritedAdditionalFolders()
351353
foreach(var prop in addFolderProp.SpellCheckerProperties.Where(
352354
p => p.PropertyName.StartsWith(addFoldersPropName, StringComparison.OrdinalIgnoreCase)))
353355
{
354-
foreach(string addFolder in prop.PropertyValue.Split(new[] { '|' },
355-
StringSplitOptions.RemoveEmptyEntries))
356+
foreach(string addFolder in prop.PropertyValue.Split(['|'],
357+
StringSplitOptions.RemoveEmptyEntries))
356358
{
357359
yield return addFolder;
358360
}
@@ -374,18 +376,18 @@ private void btnSelectFolder_Click(object sender, RoutedEventArgs e)
374376
{
375377
string configFilePath = Path.GetDirectoryName(this.ConfigurationFilename);
376378

377-
using(FolderBrowserDlg dlg = new FolderBrowserDlg())
379+
using FolderBrowserDlg dlg = new()
378380
{
379-
dlg.Description = "Select an additional dictionary folder";
380-
dlg.SelectedPath = !isGlobal && Directory.Exists(configFilePath) ? configFilePath :
381-
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
381+
Description = "Select an additional dictionary folder",
382+
SelectedPath = !isGlobal && Directory.Exists(configFilePath) ? configFilePath :
383+
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
384+
};
382385

383-
if(dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
384-
{
385-
txtAdditionalFolder.Text = dlg.SelectedPath;
386+
if(dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
387+
{
388+
txtAdditionalFolder.Text = dlg.SelectedPath;
386389

387-
btnAddFolder_Click(sender, e);
388-
}
390+
btnAddFolder_Click(sender, e);
389391
}
390392
}
391393

@@ -459,8 +461,10 @@ private void btnRemoveFolder_Click(object sender, RoutedEventArgs e)
459461
if(idx < 0)
460462
idx = 0;
461463
else
464+
{
462465
if(idx >= lbAdditionalFolders.Items.Count)
463466
idx = lbAdditionalFolders.Items.Count - 1;
467+
}
464468

465469
lbAdditionalFolders.SelectedIndex = idx;
466470
}
@@ -795,7 +799,7 @@ private void btnImport_Click(object sender, RoutedEventArgs e)
795799
return;
796800
}
797801

798-
OpenFileDialog dlg = new OpenFileDialog
802+
OpenFileDialog dlg = new()
799803
{
800804
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
801805
Filter = "User Dictionary Files (*.dic,*.xml)|*.dic;*.xml|" +
@@ -869,7 +873,7 @@ private void btnExport_Click(object sender, RoutedEventArgs e)
869873
{
870874
ThreadHelper.ThrowIfNotOnUIThread();
871875

872-
SaveFileDialog dlg = new SaveFileDialog
876+
SaveFileDialog dlg = new()
873877
{
874878
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
875879
FileName = "UserDictionary.dic",

Source/VSSpellChecker/Editors/Pages/ExclusionExpressionAddEditForm.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public partial class ExclusionExpressionAddEditForm : Window
3636

3737
private Regex expression;
3838

39-
private static readonly Regex reComment = new Regex(@"^.*?(?<Comment>\(\?\#[^\)]*?\))$");
39+
private static readonly Regex reComment = new(@"^.*?(?<Comment>\(\?\#[^\)]*?\))$");
4040

4141
#endregion
4242

Source/VSSpellChecker/Editors/Pages/ExclusionExpressionsUserControl.xaml.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// System : Visual Studio Spell Checker Package
33
// File : ExclusionExpressionsUserControl.xaml.cs
44
// Author : Eric Woodruff (Eric@EWoodruff.us)
5-
// Updated : 04/16/2023
6-
// Note : Copyright 2015-2023, Eric Woodruff, All rights reserved
5+
// Updated : 08/30/2025
6+
// Note : Copyright 2015-2025, Eric Woodruff, All rights reserved
77
//
88
// This file contains a user control used to edit the exclusion expression spell checker configuration settings
99
//
@@ -90,7 +90,7 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
9090

9191
if(properties.TryGetValue(nameof(SpellCheckerConfiguration.ExclusionExpressions), out var spi))
9292
{
93-
expressions = spi.EditorConfigPropertyValue.ToRegexes().ToList();
93+
expressions = [.. spi.EditorConfigPropertyValue.ToRegexes()];
9494

9595
if(expressions.Count != 0 && expressions[0].ToString().Equals(SpellCheckerConfiguration.ClearInherited,
9696
StringComparison.OrdinalIgnoreCase))
@@ -100,7 +100,7 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
100100
}
101101
}
102102
else
103-
expressions = new List<Regex>();
103+
expressions = [];
104104

105105
foreach(var exp in expressions.OrderBy(e => e.ToString()))
106106
{
@@ -112,7 +112,7 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
112112
lbExclusionExpressions.Items.Add(displayText);
113113
}
114114

115-
btnEditExpression.IsEnabled = btnRemoveExpression.IsEnabled = (expressions.Count != 0);
115+
btnEditExpression.IsEnabled = btnRemoveExpression.IsEnabled = expressions.Count != 0;
116116

117117
this.HasChanges = false;
118118
}

Source/VSSpellChecker/Editors/Pages/FileInfoUserControl.xaml.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// System : Visual Studio Spell Checker Package
33
// File : FileInfoUserControl.xaml.cs
44
// Author : Eric Woodruff (Eric@EWoodruff.us)
5-
// Updated : 04/14/2023
6-
// Note : Copyright 2015-2023, Eric Woodruff, All rights reserved
5+
// Updated : 08/30/2025
6+
// Note : Copyright 2015-2025, Eric Woodruff, All rights reserved
77
//
88
// This file contains a user control used to provide some information about the settings file
99
//
@@ -19,7 +19,6 @@
1919

2020
using System;
2121
using System.Collections.Generic;
22-
using System.Linq;
2322
using System.Windows;
2423
using System.Windows.Controls;
2524

@@ -72,7 +71,7 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
7271
string sectionId)
7372
{
7473
// Nothing to do for this one
75-
return Enumerable.Empty<(string PropertyName, string PropertyValue)>();
74+
return [];
7675
}
7776

7877
#pragma warning disable 67

Source/VSSpellChecker/Editors/Pages/GeneralSettingsUserControl.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// System : Visual Studio Spell Checker Package
33
// File : GeneralSettingsUserControl.xaml.cs
44
// Author : Eric Woodruff (Eric@EWoodruff.us)
5-
// Updated : 04/16/2023
6-
// Note : Copyright 2014-2023, Eric Woodruff, All rights reserved
5+
// Updated : 08/30/2025
6+
// Note : Copyright 2014-2025, Eric Woodruff, All rights reserved
77
//
88
// This file contains a user control used to edit the general spell checker configuration settings
99
//
@@ -48,8 +48,8 @@ public GeneralSettingsUserControl()
4848
{
4949
InitializeComponent();
5050

51-
configPropertyControls = new[]
52-
{
51+
configPropertyControls =
52+
[
5353
(cboSpellCheckAsYouType, nameof(SpellCheckerConfiguration.SpellCheckAsYouType)),
5454
(cboIncludeInProjectSpellCheck, nameof(SpellCheckerConfiguration.IncludeInProjectSpellCheck)),
5555
(cboEnableCodeAnalyzers, nameof(SpellCheckerConfiguration.EnableCodeAnalyzers)),
@@ -62,7 +62,7 @@ public GeneralSettingsUserControl()
6262
(cboIgnoreXmlInText, nameof(SpellCheckerConfiguration.IgnoreXmlElementsInText)),
6363
(cboTreatUnderscoresAsSeparators, nameof(SpellCheckerConfiguration.TreatUnderscoreAsSeparator)),
6464
(cboIgnoreMnemonics, nameof(SpellCheckerConfiguration.IgnoreMnemonics))
65-
};
65+
];
6666
}
6767
#endregion
6868

@@ -93,9 +93,9 @@ public void LoadConfiguration(bool isGlobal, IDictionary<string, SpellCheckPrope
9393
throw new ArgumentNullException(nameof(properties));
9494

9595
if(!isGlobal)
96-
dataSource.AddRange(new[] { PropertyState.Inherited, PropertyState.Yes, PropertyState.No });
96+
dataSource.AddRange([PropertyState.Inherited, PropertyState.Yes, PropertyState.No]);
9797
else
98-
dataSource.AddRange(new[] { PropertyState.Yes, PropertyState.No });
98+
dataSource.AddRange([PropertyState.Yes, PropertyState.No]);
9999

100100
foreach(var configProp in configPropertyControls)
101101
{

0 commit comments

Comments
 (0)