Skip to content

Update C# onEnterRules to account for documentation comments#242121

Merged
Tyriar merged 1 commit intomicrosoft:mainfrom
dibarbet:csharp_on_enter_rule_updates
Mar 14, 2025
Merged

Update C# onEnterRules to account for documentation comments#242121
Tyriar merged 1 commit intomicrosoft:mainfrom
dibarbet:csharp_on_enter_rule_updates

Conversation

@dibarbet
Copy link
Member

Resolves dotnet/vscode-csharp#8025

A couple months ago it looks like, an onEnter rule was added to 'continue' a comment if enter is pressed inside a line comment. This is generally fine, however it causes problems when writing documentation comments which use /// instead. You end up with something like the following (see also video in linked issue):

/// <summary>
/// This is a documentation 
// comment
/// </summary>

This PR modifies the line comment enter rule to avoid inserting the line comment if it detects a triple comment.

Additionally, I added an on enter rule for /// to auto insert /// when hitting enter anywhere inside a documentation comment. Currently that is handled in the server side of the C# extension, but it can be slow and finicky. Better to just have the client handle it via an on enter rule.

This shows the new behavior:
on_enter_rules_new

@dibarbet
Copy link
Member Author

@microsoft-github-policy-service rerun

@shal44m
Copy link

shal44m commented Feb 27, 2025

@microsoft-github-policy-service rerun

@dibarbet
Copy link
Member Author

@chrmarti been a couple weeks, anything I can do to move this forward?

@chrmarti chrmarti assigned aeschli and unassigned chrmarti Mar 12, 2025
@aeschli aeschli added this to the March 2025 milestone Mar 14, 2025
@dibarbet
Copy link
Member Author

Thanks! Could use help with the merge as well (I am unable to)

@Tyriar Tyriar merged commit 8005309 into microsoft:main Mar 14, 2025
7 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Apr 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XML-style Documentation comments have inconsistent newline behavior

6 participants