Merge pull request #242121 from dibarbet/csharp_on_enter_rule_updates

Update C# onEnterRules to account for documentation comments
This commit is contained in:
Daniel Imms 2025-03-14 11:03:54 -07:00 committed by GitHub
commit 8005309665
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 1 deletions

View File

@ -84,9 +84,10 @@
},
"onEnterRules": [
// Add // when pressing enter from inside line comment
// We do not want to match /// (a documentation comment)
{
"beforeText": {
"pattern": "\/\/.*"
"pattern": "[^\/]\/\/[^\/].*"
},
"afterText": {
"pattern": "^(?!\\s*$).+"
@ -96,5 +97,16 @@
"appendText": "// "
}
},
// Add /// when pressing enter from anywhere inside a documentation comment.
// Documentation comments are not valid after non-whitespace.
{
"beforeText": {
"pattern": "^\\s*\/\/\/"
},
"action": {
"indent": "none",
"appendText": "/// "
}
},
]
}