[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter api
From: |
Stefan Monnier |
Subject: |
Re: Tree-sitter api |
Date: |
Sat, 07 Aug 2021 15:53:24 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> Yeah, though that quickly becomes not so simple, considering that
> different languages have their own idiosyncrasies with indentation. C#,
> for instance, is a rats nest of particularities. And this is not
> considering variations of style guides etc. It would be nice to get an
> api similar to what CC mode has.
I'm thinking of rules specified via a function that takes a TS node
(from which the function can explore the rest of the TS tree) and return
the indentation to use, represented as a pair (POSITION . OFFSET)
(meaning to indent OFFSET columns further than the column position of
POSITION).
The infrastructure would limit itself to making sure we have an uptodate
tree (computed from a properly widened buffer), find the node
corresponding to point pass it to the function and then turn the return
value into an actual column and indent the text accordingly (paying
attention to the usual difference between when point is "within the
indentation" vs "within the text").
Stefan
- Re: How to add pseudo vector types, (continued)
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/08/03
- Re: How to add pseudo vector types, Fu Yuan, 2021/08/03
- Re: How to add pseudo vector types, Stefan Monnier, 2021/08/03
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/08/03
- Re: How to add pseudo vector types, Yuan Fu, 2021/08/05
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/08/06
- Tree-sitter api (Was: Re: How to add pseudo vector types), Fu Yuan, 2021/08/07
- Re: Tree-sitter api (Was: Re: How to add pseudo vector types), Eli Zaretskii, 2021/08/07
- Re: Tree-sitter api, Stefan Monnier, 2021/08/07
- Re: Tree-sitter api, Theodor Thornhill, 2021/08/07
- Re: Tree-sitter api,
Stefan Monnier <=
- Re: Tree-sitter api, Yuan Fu, 2021/08/17
- Re: Tree-sitter api, Stephen Leake, 2021/08/18
- Re: Tree-sitter api, Yuan Fu, 2021/08/18
- Re: [SPAM UNSURE] Re: Tree-sitter api, Stephen Leake, 2021/08/19
- Re: Tree-sitter api, Yuan Fu, 2021/08/23
- Re: [SPAM UNSURE] Re: Tree-sitter api, Stephen Leake, 2021/08/24
- Re: [SPAM UNSURE] Tree-sitter api, Yuan Fu, 2021/08/27
- Re: [SPAM UNSURE] Tree-sitter api, Stephen Leake, 2021/08/30
- Re: Tree-sitter api, Stefan Monnier, 2021/08/24
- Re: Tree-sitter api, Yuan Fu, 2021/08/21