Make `_block` a visible scope
ChrHorn opened this issue · comments
Most languages make their blocks inside functions, classes, etc visible.
This added visible scope would make targeting the inside/body of a function much easier. Textobjekt queries that do this are currently very cumbersome to do.
The other advantage is tree-sitter based expanding/shrinking selection. Currently it is
expression -> whole function
with this change it would be
expression -> function body -> whole function
It would be much easier to select these code blocks without selecting the surrounding syntax.
I think just changing everything to block
should be fine. The exception would be the top scope. Here we already have source_file
, so an additional scope is not needed.
This modification will be very welcome for Emacs. I am trying to design a Julia major mode (https://github.com/ronisbr/julia-ts-mode) and without this feature the automatic indentation will not work very well. For example, if we type:
function test(a)
end
And then press enter after )
, the cursor will start at the beginning of the line because there is no node inside the function body. Hence, we cannot apply an indentation rule in Emacs at least.