[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SPAM UNSURE] Average-user-facing interface for tree-sitter
From: |
Stephen Leake |
Subject: |
Re: [SPAM UNSURE] Average-user-facing interface for tree-sitter |
Date: |
Wed, 12 Oct 2022 17:54:41 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt) |
Yuan Fu <casouri@gmail.com> writes:
> From the suggestions I collected from the old thread, here is my proposal:
>
> We define a custom option treesit-settings (we can discuss the name
> later), which controls whether to enable/disable tree-sitter for each
> major mode, and the default preference, like this:
>
> (defcustom treesit-settings '((t nil nil))
> "Tree-sitter toggles for major modes.
>
> A list of (MODE ENABLE INHERIT). MODE is a major mode, ENABLE
> can be one of the following:
>
> demand => Demand the use of tree-sitter, warn if can't enable.
> t => Enable if available
> nil => Don't enable
>
> If INHERIT is nil, the setting does't apply to derived modes of
> MODE, if t, the setting does apply.
>
> If MODE is t, the settings applies to all the modes which don't
> have any setting. INHERIT doesn't matter for this special
> default setting."
> :type …)
This is reasonable, but I think we will need finer control. LSP has
dozens of features that can be individually supported or not by a given
server. I don't think Emacs needs to go that far (although eglot does
support that). I think separate control for face, indent, xref, and
maybe imenu would be reasonable.
In the above, perhaps ENABLE could be a symbol if it controls all
features for a mode, or a plist to specify features separately:
(mode (:face ENABLE :indent ENABLE ...) INHERIT).
I'm not sure if INHERIT needs to be similarly split.
--
-- Stephe