git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GSoC PATCH 0/1] userdiff: add javascript diff driver
@ 2025-06-04  9:35 Derick W. de M. Frias
  2025-06-04  9:35 ` [GSoC PATCH 1/1] " Derick W. de M. Frias
  0 siblings, 1 reply; 11+ messages in thread
From: Derick W. de M. Frias @ 2025-06-04  9:35 UTC (permalink / raw)
  To: git

Hi, I'm Derick and this is one of my first contributions. I'm a CS
undergrad student and I'm really excited to start learning more about
Git's internals.

As it is in 2025, javascript is amongst the most prevalent programming
languages and yet it it not beeing supported by a diff driver in Git.
I do believe that the addition of this functionality is a good
contribution that will benefit tons of developers that work with
javascript.

For me, it was a surprise to discover that javascript isn't supported
yet, so the first thing that came to mind was if someone had already
tried to work on the problem. Searching at Git's lore, I found some
previous atempts at tacking it and I tried to learn from them and to 
guide my work along what I believe were good paths taken.

The pattern I added to userdiff.c to recognize functions groups them in
some categories, that are: conventional functions (Those that are
declared in outer scope, and not assigned to any variable), assigned
functions (those that ARE assigned to a variable), arrow functions and
functions declared inside classes or objects.

For js literals, the regex matches valid alphanumerical literals that
are valid in javascript. It also matches numerical literals in binary,
octal, decimal and hexadecimal bases, and punctuations.

I also added test cases for instances of function declarations.

I tried to keep things simple, my idea is to make it work well while
thinking 'vanilla' javascript-first. I'm quite sure the contribution
still can be improved so I'm looking foward for feedback on what is
important/interesting to be made.

Derick W. de M. Frias (1):
  userdiff: add javascript diff driver

 .../javascript-anonymous-function-assigned    |  4 +++
 t/t4018/javascript-arrow-function-assigned    |  4 +++
 t/t4018/javascript-arrow-function-assigned-2  |  1 +
 t/t4018/javascript-async-function             |  4 +++
 t/t4018/javascript-async-function-assigned    |  4 +++
 t/t4018/javascript-class-function             |  6 ++++
 t/t4018/javascript-function                   |  4 +++
 t/t4018/javascript-function-assigned          |  4 +++
 t/t4018/javascript-generator-function         |  5 ++++
 t/t4018/javascript-generator-function-2       |  5 ++++
 .../javascript-generator-function-assigned    |  5 ++++
 .../javascript-generator-function-assigned-2  |  5 ++++
 t/t4018/javascript-method-function            |  6 ++++
 userdiff.c                                    | 28 +++++++++++++++++++
 14 files changed, 85 insertions(+)
 create mode 100644 t/t4018/javascript-anonymous-function-assigned
 create mode 100644 t/t4018/javascript-arrow-function-assigned
 create mode 100644 t/t4018/javascript-arrow-function-assigned-2
 create mode 100644 t/t4018/javascript-async-function
 create mode 100644 t/t4018/javascript-async-function-assigned
 create mode 100644 t/t4018/javascript-class-function
 create mode 100644 t/t4018/javascript-function
 create mode 100644 t/t4018/javascript-function-assigned
 create mode 100644 t/t4018/javascript-generator-function
 create mode 100644 t/t4018/javascript-generator-function-2
 create mode 100644 t/t4018/javascript-generator-function-assigned
 create mode 100644 t/t4018/javascript-generator-function-assigned-2
 create mode 100644 t/t4018/javascript-method-function

-- 
2.50.0.rc0.62.g658f0ae201.dirty


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-06-26  6:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04  9:35 [GSoC PATCH 0/1] userdiff: add javascript diff driver Derick W. de M. Frias
2025-06-04  9:35 ` [GSoC PATCH 1/1] " Derick W. de M. Frias
2025-06-04 21:19   ` D. Ben Knoble
2025-06-05  5:51   ` Johannes Sixt
2025-06-23  6:35     ` [PATCH v2 0/4] diff: create pattern for javascript language Derick W. de M. Frias
2025-06-23  6:35       ` [PATCH v2 1/4] userdiff: add javascript diff driver Derick W. de M. Frias
2025-06-23 18:09         ` Junio C Hamano
2025-06-23  6:35       ` [PATCH v2 2/4] t4034: add tests for javascript word literals Derick W. de M. Frias
2025-06-23  6:35       ` [PATCH v2 3/4] t4018: add tests for recognizing javascript function syntax Derick W. de M. Frias
2025-06-23  6:35       ` [PATCH v2 4/4] t4018: add tests for javascript export type function declarations Derick W. de M. Frias
2025-06-26  6:21         ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).