[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Code navigation for sh-mode with Tree-sitter
From: |
Stefan Monnier |
Subject: |
Re: Code navigation for sh-mode with Tree-sitter |
Date: |
Tue, 06 Dec 2022 11:48:32 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> Calling beginning-of-defun-function followed by end-of-defun-function
>> (and comparing the resulting position to the start position) should be
>> sufficient to let you know whether or not you're inside the function
>> whose definition starts most closely before point.
>>
>
> Hmm. In sh-mode `beginning-of-defun-function' is nil and in the example
> below, calling `end-of-defun-function' with M-: (funcall
> end-of-defun-function) brings point to fi and not the end of the function.
Many major modes do not implement those two functions in a fully
reliable way, indeed.
`bash-ts-mode` should be able to implement them reliably, OTOH.
> In the example above, C-M-a and C-M-e do the right thing. However, in the
> presence of nested functions, C-M-a and C-M-e only navigate over top-level
> functions. For example:
Yes, it's a common limitation when the major mode is unable to do
proper parsing of the code.
Stefan
- Code navigation for sh-mode with Tree-sitter, João Paulo Labegalini de Carvalho, 2022/12/03
- Re: Code navigation for sh-mode with Tree-sitter, Alan Mackenzie, 2022/12/03
- Re: Code navigation for sh-mode with Tree-sitter, João Paulo Labegalini de Carvalho, 2022/12/05
- Re: Code navigation for sh-mode with Tree-sitter, João Paulo Labegalini de Carvalho, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter,
Stefan Monnier <=
- Re: Code navigation for sh-mode with Tree-sitter, Yuan Fu, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, Yuan Fu, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, Alan Mackenzie, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, João Paulo Labegalini de Carvalho, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, João Paulo Labegalini de Carvalho, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, Stefan Monnier, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, João Paulo Labegalini de Carvalho, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, Stefan Monnier, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, João Paulo Labegalini de Carvalho, 2022/12/06
- Re: Code navigation for sh-mode with Tree-sitter, Stefan Monnier, 2022/12/06