[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comments to the new tree sitter implementation
From: |
Stefan Monnier |
Subject: |
Re: Comments to the new tree sitter implementation |
Date: |
Sat, 23 Apr 2022 18:27:09 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> 1. New parent-beginning-of-line preset
>
> For typescript-mode more often that not you want to find some close
> parent, then go to beginning of line to calculate the offset. A
> suggested implementation of this is:
FWIW, I think this is a "quick hack" which gives fairly good results at
little effort but doesn't help in the long run because you'll have to
refine it sooner or later: it's never actually right, it's only ever
right by accident.
> ```typescript
> function foo() {
> bar(() => ({
> baz
> }))
> }
> ```
What if there's another argument to `bar` after the
`() => ({ baz })` function, or if the user just prefers
function foo() {
bar(() => ({
baz
}))
}
[ Or if the standard indentation rules prescribe something like this. ]
Stefan