[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter api
From: |
Yuan Fu |
Subject: |
Re: Tree-sitter api |
Date: |
Mon, 13 Sep 2021 11:01:47 -0700 |
> On Sep 13, 2021, at 4:47 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sun, 12 Sep 2021 21:15:31 -0700
>> Cc: Tuấn-Anh Nguyễn <ubolonton@gmail.com>,
>> Theodor Thornhill <theo@thornhill.no>,
>> Clément Pit-Claudel <cpitclaudel@gmail.com>,
>> Emacs developers <emacs-devel@gnu.org>,
>> Stefan Monnier <monnier@iro.umontreal.ca>,
>> stephen_leake@stephe-leake.org
>>
>> Not the end-user, no. But not really “Lisp Program”, either. I mean the
>> human being writing the major-mode and adapting the major-mode to utilize
>> tree-sitter features. The major mode writer should be able to figure out the
>> correct symbol to use, if she go checks out the project name for the
>> language definition, or the package name of the language definition in her
>> package manager, or by some other means. For example, one should be able to
>> figure out that tree-sitter-c is the symbol for C language definition, and
>> tree-sitter-c-sharp that C#. Then Emacs automatically translate
>> tree-sitter-c to libtree-sitter-c.so, and tree-sitter-c-sharp to
>> libtree-sitter-c-sharp.so; basically adding “lib” and “.so” (or “dylib”
>> etc). If that doesn’t give the correct library name for a quirky language,
>> the major-mode writer can add an entry to
>> tree-sitter-library-name-override-list—(tree-sitter-quirky-lang
>> “libtree-sitter-qlang” “tree_sitter_qlang”)—and Emacs will use that. (Or she
>> can just use tree-sitter-qlang as the symbol, and Emacs’ auto translation
>> would just fine.)
>
> It makes little sense to me to request each major mode to figure this
> out. It should IMO be a service provided by the TS integration into
> Emacs.
This is IMO the easiest and least confusing way for major-mode authors. But
before we continue, what is the way you envisioned? I’m not sure what exactly
is the service you want Emacs to provide.
Yuan
- Re: Tree-sitter api, (continued)
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/11
- Re: Tree-sitter api, Yuan Fu, 2021/09/11
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/11
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/11
- Re: Tree-sitter api, Yuan Fu, 2021/09/11
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/12
- Re: Tree-sitter api, Yuan Fu, 2021/09/13
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/13
- Re: Tree-sitter api,
Yuan Fu <=
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/13
- Re: Tree-sitter api, Yuan Fu, 2021/09/13
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/13
- Re: Tree-sitter api, Yuan Fu, 2021/09/13
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/13
- Re: Tree-sitter api, Yuan Fu, 2021/09/14
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/14
- Re: Tree-sitter api, Yuan Fu, 2021/09/14
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/15
- Re: Tree-sitter api, Yuan Fu, 2021/09/15