Skip to content

Conversation

@d1820
Copy link
Owner

@d1820 d1820 commented Sep 1, 2025

Added .editorconfig support
Rewrote how settings are used, and decoupled entire extension from DI statics

@d1820 d1820 requested a review from Copilot September 1, 2025 17:16
@d1820 d1820 self-assigned this Sep 1, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for storing CodeDocumentor settings in .editorconfig files, allowing the extension to decouple from Visual Studio's dependency injection system. It also includes several architectural improvements to modernize the codebase.

  • Adds .editorconfig support for extension settings, enabling out-of-process execution
  • Rewrites settings management to remove dependency injection and static access patterns
  • Modernizes the codebase by extracting common functionality and removing redundant code

Reviewed Changes

Copilot reviewed 109 out of 110 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
TestProject/Sample/.editorconfig Adds new .editorconfig file with CodeDocumentor-specific settings
TestProject/Sample/Sample.sln Updates solution file to include .editorconfig as a solution item
Readme.md Updates documentation to describe .editorconfig support and known issues
CodeDocumentor/Settings/VsixOptions.cs Updates version number and removes namespace dependency
CodeDocumentor/Models/OptionPageGrid.cs Enhances options page to support .editorconfig conversion and settings decoupling
CodeDocumentor/CodeDocumentor.Package.cs Removes dependency injection container and updates initialization
CodeDocumentor/Helper/* Multiple helper classes updated to support new settings architecture
CodeDocumentor/Analyzers/* All analyzers updated to use new settings system instead of DI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

namespace Sample.CodeDocumentor
{

public interface ITestPublicInteraceMethods
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interface name contains a typo: 'Interace' should be 'Interface'. It should be 'ITestPublicInterfaceMethods'.

Suggested change
public interface ITestPublicInteraceMethods
public interface ITestPublicInterfaceMethods

Copilot uses AI. Check for mistakes.
- As of VS2022 verison 17.6.x there is some bug that makes extension analyzers not being to work work properly if you have *Run code analysis in seperate process*
Microsoft is not going to make any changes to truly allow analyzers to run out of process. Even with .editorconfig support, it will not work if you want to have any user level settings collection from Visual Studio > Options.

- As of VS2022 version 17.6.x there is some bug that makes extension analyzers not being to work work properly if you have *Run code analysis in seperate process*
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are spelling errors: 'seperate' should be 'separate' and 'not being to work work' should be 'not being able to work'.

Suggested change
- As of VS2022 version 17.6.x there is some bug that makes extension analyzers not being to work work properly if you have *Run code analysis in seperate process*
- As of VS2022 version 17.6.x there is some bug that makes extension analyzers not being able to work properly if you have *Run code analysis in separate process*

Copilot uses AI. Check for mistakes.
This will convert the existing Visual Studio Option Settings to editor config format and copy them to your clipboard.
Paste this into a new or existing .editorconfig file in your solution.

**NOTE**: Event with using .editroconfig as your settings, Out of Process still can not be used, because the extension needs to support backward compatibility of using the Visual Studio Options.
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are spelling errors: 'Event' should be 'Even' and '.editroconfig' should be '.editorconfig'.

Suggested change
**NOTE**: Event with using .editroconfig as your settings, Out of Process still can not be used, because the extension needs to support backward compatibility of using the Visual Studio Options.
**NOTE**: Even with using .editorconfig as your settings, Out of Process still can not be used, because the extension needs to support backward compatibility of using the Visual Studio Options.

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +94
private static bool ConvertToBoolean(this AnalyzerConfigOptions options, string key, bool defaulBool)
{
options.TryGetValue(key, out var cds);
if (string.IsNullOrEmpty(cds))
{
return defaulBool;
}
if (bool.TryParse(cds, out var converted))
{
return converted;
}
return defaulBool;
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter name has a typo: 'defaulBool' should be 'defaultBool'.

Suggested change
private static bool ConvertToBoolean(this AnalyzerConfigOptions options, string key, bool defaulBool)
{
options.TryGetValue(key, out var cds);
if (string.IsNullOrEmpty(cds))
{
return defaulBool;
}
if (bool.TryParse(cds, out var converted))
{
return converted;
}
return defaulBool;
private static bool ConvertToBoolean(this AnalyzerConfigOptions options, string key, bool defaultBool)
{
options.TryGetValue(key, out var cds);
if (string.IsNullOrEmpty(cds))
{
return defaultBool;
}
if (bool.TryParse(cds, out var converted))
{
return converted;
}
return defaultBool;

Copilot uses AI. Check for mistakes.
settings.IsEnabledForNonPublicFields = options.ConvertToBoolean("codedocumentor_is_enabled_for_non_public_fields", false);
settings.PreserveExistingSummaryText = options.ConvertToBoolean("codedocumentor_preserve_existing_summary_text", true);
settings.TryToIncludeCrefsForReturnTypes = options.ConvertToBoolean("codedocumentor_try_to_include_crefs_for_return_types", true);
settings.UseToDoCommentsOnSummaryError = options.ConvertToBoolean("codedocumentor_use_natural_language_for_return_node", false);
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same property 'UseToDoCommentsOnSummaryError' is being assigned twice. The first assignment should likely be to 'UseNaturalLanguageForReturnNode' property instead.

Suggested change
settings.UseToDoCommentsOnSummaryError = options.ConvertToBoolean("codedocumentor_use_natural_language_for_return_node", false);
settings.UseNaturalLanguageForReturnNode = options.ConvertToBoolean("codedocumentor_use_natural_language_for_return_node", false);

Copilot uses AI. Check for mistakes.
/// Gets or Sets the word maps.
/// </summary>
/// <value> Aa array of wordmaps. </value>
/// <value> An array of wordmaps. </value>
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should be 'An array of word maps' (two words) for consistency with the rest of the codebase.

Suggested change
/// <value> An array of wordmaps. </value>
/// <value> An array of word maps. </value>

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

@d1820 d1820 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

@d1820 d1820 merged commit d7404b6 into main Sep 1, 2025
1 check passed
@d1820 d1820 deleted the bug-fixes branch September 1, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant