Subject: Re: [PATCH v2] userdiff: add builtin driver for typescript language

From: Junio C Hamano <[email-masked]>
Date: Fri, 05 Apr 2024 10:43:01 -0700

Utsav Parmar <[email-masked]> writes:

> Subject: Re: [PATCH v2] userdiff: add builtin driver for typescript language

"builtin driver" -> "patterns", probably, as the "userdiff"
customization does not allow adding any new code.

> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
> index 4338d023d9..4461c41054 100644
> --- a/Documentation/gitattributes.txt
> +++ b/Documentation/gitattributes.txt
> @@ -902,6 +902,8 @@ patterns are available:
>  
>  - `tex` suitable for source code for LaTeX documents.
>  
> +- `typescript` suitable for source code for TypeScript language.
> +

Good that you did not forget to add an entry to this list (and to
the right place).

> diff --git a/t/t4018/typescript-function-assignment b/t/t4018/typescript-function-assignment
> new file mode 100644
> index 0000000000..49c528713e
> --- /dev/null
> +++ b/t/t4018/typescript-function-assignment
> @@ -0,0 +1,4 @@
> +const RIGHT = function(one: number): Type {
> +    someMethodCall();
> +    return ChangeMe;
> +}
> diff --git a/t/t4018/typescript-interface b/t/t4018/typescript-interface
> new file mode 100644
> index 0000000000..6f3665c2af
> --- /dev/null
> +++ b/t/t4018/typescript-interface
> @@ -0,0 +1,4 @@
> +interface RIGHT {
> +  one?: string;
> +  [propName: ChangeMe]: any;
> +}
> \ No newline at end of file

I do not speak typescript, but is it important for the language that
the sources can be stored with an incomplete line at the end of the
file?  IOW, I am wondering if it is deliberate *and* matters to the
tests that some sample files end with an incomplete line while
others do not.

If that is not the case, please fix this and the next file; we do
not generally want a file with an incomplete line at the end unless
there is a compelling reason to (i.e., we do test that our tools
work with such files, and it may be convenient to ship sample input
with incomplete lines to run such tests).

As to the actual pattern and the words the patterns catch, I have no
idea if they are sensible for typescript language---folks with more
experience than myself should lend their eyeballs to review.

Thanks.