emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tree-sitter api


From: Tuấn-Anh Nguyễn
Subject: Re: Tree-sitter api
Date: Fri, 17 Sep 2021 19:11:44 +0700

> And I want to also point out that as Emacs core developers, we can’t possibly 
> provide a good translation from convention language names to their 
> tree-sitter name (C# -> c-sharp). Maybe we can do a half-decent job, but 1) 
> that won’t cover all available languages, and 2) if there is a new language, 
> we need to wait for the next release to update our translation. It is better 
> for the major mode writers to provide the information on how to translate 
> names. Because, as I said earlier, they already know it.

This makes sense. My suggestion is, in `tree-sitter.el`:

    (defvar tree-sitter-major-mode-language-alist
      '((c-mode . c)
        ;; And other major modes that Emacs includes, or are well-known.
        (c++-mode . cpp)
        (javascript-mode . javascript)
        (python-mode . python))
      "Alist that maps major modes to tree-sitter language names.")

For other major modes, it's up to the mode writers to add entries to that list,
similar to what they do with `auto-mode-alist`.




-- 
Tuấn-Anh Nguyễn
Software Engineer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]