Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update C# onEnterRules to account for documentation comments #242121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XML-style Documentation comments have inconsistent newline behavior
4 participants