userdiff: better method/property matching for C#sj/userdiff-c-sharp
commitec0e3075d245afa3f3a848bd7bdc6376dea85fe0
authorSteven Jeuris <steven.jeuris@3shape.com>
Wed, 3 Apr 2024 21:42:44 +0000 (3 21:42 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Apr 2024 22:21:43 +0000 (5 15:21 -0700)
tree9e42f695fbf945e39678245e0092b5f2a125fe3c
parent43072b4ca132437f21975ac6acc6b72dc22fd398
userdiff: better method/property matching for C#

- Support multi-line methods by not requiring closing parenthesis.
- Support multiple generics (comma was missing before).
- Add missing `foreach`, `lock` and  `fixed` keywords to skip over.
- Remove `instanceof` keyword, which isn't C#.
- Also detect non-method keywords not positioned at the start of a line.
- Added tests; none existed before.

The overall strategy is to focus more on what isn't expected for
method/property definitions, instead of what is, but is fully optional.

Signed-off-by: Steven Jeuris <steven.jeuris@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
21 files changed:
t/t4018/csharp-exclude-assignments [new file with mode: 0644]
t/t4018/csharp-exclude-control-statements [new file with mode: 0644]
t/t4018/csharp-exclude-exceptions [new file with mode: 0644]
t/t4018/csharp-exclude-generic-method-calls [new file with mode: 0644]
t/t4018/csharp-exclude-init-dispose [new file with mode: 0644]
t/t4018/csharp-exclude-iterations [new file with mode: 0644]
t/t4018/csharp-exclude-method-calls [new file with mode: 0644]
t/t4018/csharp-exclude-other [new file with mode: 0644]
t/t4018/csharp-method [new file with mode: 0644]
t/t4018/csharp-method-array [new file with mode: 0644]
t/t4018/csharp-method-explicit [new file with mode: 0644]
t/t4018/csharp-method-generics [new file with mode: 0644]
t/t4018/csharp-method-generics-alternate-spaces [new file with mode: 0644]
t/t4018/csharp-method-modifiers [new file with mode: 0644]
t/t4018/csharp-method-multiline [new file with mode: 0644]
t/t4018/csharp-method-params [new file with mode: 0644]
t/t4018/csharp-method-special-chars [new file with mode: 0644]
t/t4018/csharp-method-with-spacing [new file with mode: 0644]
t/t4018/csharp-property [new file with mode: 0644]
t/t4018/csharp-property-braces-same-line [new file with mode: 0644]
userdiff.c