[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Call for volunteers: add tree-sitter support to major modes
From: |
Po Lu |
Subject: |
Re: Call for volunteers: add tree-sitter support to major modes |
Date: |
Tue, 11 Oct 2022 18:46:43 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) |
Theodor Thornhill <theo@thornhill.no> writes:
> Sure!
>
> (The following example is from the other tree-sitter implementation, but
> it would be as simple, if not simpler in the new one)
>
> Consider this code:
>
> ```
> (defun csharp-delete-method-at-point ()
> "Deletes the method at point."
> (interactive)
> (when-let ((method (tree-sitter-node-at-point 'method_declaration)))
> (delete-region (tsc-node-start-position method)
> (tsc-node-end-position method))))
> ```
>
> If point is _anywhere_ inside a method, this function will delete the
> whole thing. It knows the beginning and end, and doesn't have to do
> anything else than returning the relevant points. The same could be
> done with i.e. string, where if:
>
> ```
> "some string here where this | denotes where point is"
> ```
>
> You could create paredit-like functionality to delete _until_ the last
> quote, etc. Compare them to Vims 'cip', 'dap' etc. These are only
> trivial examples, but you could also imagine creating refactoring
> functions where you extract variables and insert them in the scope of
> other functions and so forth. The huge thing here is that you have the
> _actual_ parse tree. Indentation is also now simpler, more correct.
> There are all sorts of things we could evolve from here. Font-lock is
> just because that is the clearest, easiest and fastest benefit.
Thank you for the detailed explanation.
- Re: Call for volunteers: add tree-sitter support to major modes, (continued)
- Re: Call for volunteers: add tree-sitter support to major modes, Stefan Kangas, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Visuwesh, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Eli Zaretskii, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Po Lu, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Theodor Thornhill, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Po Lu, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Theodor Thornhill, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes,
Po Lu <=
- Re: Call for volunteers: add tree-sitter support to major modes, Yuan Fu, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Eli Zaretskii, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Po Lu, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Eli Zaretskii, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Po Lu, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Eli Zaretskii, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Po Lu, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Daniel Martín, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Jostein Kjønigsen, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Dmitry Gutov, 2022/10/11