Subject: Re: bug#68054: [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript

From: Dmitry Gutov <[email-masked]>
Date: Sun, 9 Jun 2024 05:52:47 +0300

On 02/05/2024 16:38, Noah Peart wrote:
>  > js-ts-mode now has the exact same indentation
> 
> I'm not sure what you meant by this - did you mean js-ts-mode has
> the same indentation for non-multivar declarations as the examples
> shown above? js-ts-mode is still missing indentation rules for multiple 
> decl statements.
> The patch would work for js-ts-mode as well, but I didn't want to copy the
> code between the files.

Yes, I meant that it would be a good idea to keep the modes consistent, 
and to keep those examples indent like they do now.

> So much of the grammar is shared between js-ts-mode and
> typescript-ts-mode, it might be worth combining - neovim uses an ecma 
> grammar
> from which they both inherit.

When you say "uses the ecma grammar", what do you mean exactly? It just 
uses the parent grammar, not either of those two?

As for copying the code, it might be fine - the indentation rules are 
difficult to share, and copying the definition of 
typescript-ts-mode--anchor-decl is probably better than loading the 
whole other package file just for its sake. If more functions could be 
reused, however...