emacs-devel
[Top][All Lists]
Advanced

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

Re: Average-user-facing interface for tree-sitter


From: Lars Ingebrigtsen
Subject: Re: Average-user-facing interface for tree-sitter
Date: Fri, 14 Oct 2022 13:02:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Yuan Fu <casouri@gmail.com> writes:

> Ok, so to make it concrete, in addition to treesit-mode and
> global-treesit-mode, we would have
>
> treesit-major-mode-remap-alist: same as major-mode-remap-alist,
> appended to major-mode-remap-alist when global-treesit-mode turns on.

Yup.

> treesit-toggle-function: A function treesit-mode calls to enable
> tree-sitter support, major modes set this function.

Hm...  I'm not sure.  A mode like python-mode which has both treesit and
non-treesit code paths would just be

  (if treesit-mode
      (do-one-thing)
    (do-the-old-thing))

I think?  On the other hand, that wouldn't allow dynamic switching
between treesit and non, so perhaps we should have something like that;
yes.

> I have yet to come up a way to combine the minor-mode machinery with
> the ability to specify backend for each feature (imenu, xref,
> font-lock, etc).
>
> Maybe we can have something like
>
> feature-provider-alist: An buffer-local alist of (FEATURE .
> PROVIDERS), FEATURE could be indent, font-lock, imenu, xref, etc,
> PROVIDERS is a list of treesit, eglot, emacs, etc.
>
> But I failed to see how to integrate it with the rest.
>
> I wonder if we can have a major mode hook that runs before the body
> runs, like xxx-mode-before-hook. Then user can set
> feature-provider-alist in that hook. This way major modes can decide
> what backend (provider) to use for each features.

Hm...



reply via email to

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