VSCode clean-up and other minor fixes #3920
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
I had been using VSCodium for a while and recently decided to try the full VSCode. It suggested installing a C# plugin (which I eventually swapped out for OmniSharp), which in turn pointed out a bunch of helpful coding style changes. Addressing these will make it easier to spot new suggestions when working on new code.
For now I have opted not to address the alerts related to property and method names starting with lowercase letters or underscores (with a few easy exceptions).
Changes
Update=
rule to set theDependentUpon
property for its.resx
files, but this has made the GUI csproj much shorter and will drastically simplify future translation additions.using
s are removedreadonly
keyword is added to many fields that are only set in the constructornew
are moved into{ Property = Value}
blocksout
params are now declared inline, and unused ones now useout _
to discard the valueas
expression and checked fornull
are now handled withis
-based pattern matchingtrue
orfalse
constant replaced with an equivalent expression using||
or&&
)??
expression)null
first have been replaced by?.Invoke()
callsAlong the way a few more opportunities for improvement were indulged:
/.vscode/
is added to.gitignore
so I can save a settings file there indicating that the default solution isCKAN.sln
in the root rather thanTests/Data/CKAN.sln
ManageMods.CompareColumn
are refactored into a genericCompareToNullable
functionThemedTabControl
's brush is now disposed, as is necessary according to a comment inFlatToolStripRenderer
GUIConfiguration.FixColumnName
still had hard coded names where its parameters were supposed to be used, so some of our column renaming logic may not have been working. This is now fixed.Build-DotNet
taskI'm going to self-review this because the changes, though numerous, are trivial and should not change any functionality.