[Top][All Lists]

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

Re: treesit-forward-sexp (was: Make all tree-sitter modes optional)

From: Dmitry Gutov
Subject: Re: treesit-forward-sexp (was: Make all tree-sitter modes optional)
Date: Tue, 17 Jan 2023 19:50:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 17/01/2023 19:34, Juri Linkov wrote:
I'm using ruby-mode, at least for now, while all the wrinkles with
indentation haven't been ironed out (and we'll probably not manage to get
them all 100% right before the 29 release), and while ts modes don't
support show-paren-mode like SMIE does. No proper sexp navigation, etc.

BTW, how ruby-ts-mode is intended to be used without proper sexp navigation?

I see that forward-sentence support for tree sitter was added recently
with treesit-forward-sentence.  There are also treesit-transpose-sexps,
treesit-beginning-of-defun and treesit-end-of-defun.

Are there any plans to add treesit-forward-sexp as well?
Currently I'm using such workaround:

(with-eval-after-load 'ruby-ts-mode
   (add-hook 'ruby-ts-mode-hook
             (lambda ()
               (smie-setup ruby-smie-grammar #'ruby-smie-rules
                           :forward-token  #'ruby-smie--forward-token
                           :backward-token #'ruby-smie--backward-token))))

I have also been toying with the idea of using SMIE for indentation with ruby-ts-mode, keeping tree-sitter for font-lock and other facilities which are easier to support.

But for now I'm working on improving tree-sitter based indentation. After all, the underlying data it's using is by definition more correct.

Maybe something like this should be added to emacs-29
until treesit-forward-sexp is implemented in master?

I don't know if everybody will agree with that. ruby-ts-mode's author in particular.

So it's probably better suited for personal customizations, like yours above. BTW note that smie-setup also sets indent-line-function.

reply via email to

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