-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto indentation of blocks #17
Comments
Discussion of the issue here: https://discourse.julialang.org/t/help-testing-julia-tree-sitter-mode-in-emacs/92819/29?page=2 My understanding: it is a tree-sitter issue. If you have the enclosing |
Yes, exactly like @ggebbie said. Before adding |
Thanks for the link! However, function foo()
bar <M-x indent-according-to-mode>
#noend EDIT: does not work at the end of file 🤔 On the other hand function foo() <ret>
end will put the point at column 0 within the function body, even with This feels inconsistent with the explanation about treesitter nodes... |
If you have no text at all, it also does not create a node. That's why you do not see the indentation. Take a look at the explorer information: function teste()
end
Notice that we do not have a "function body".
It does not work here. You probably are seeing some strange indentation due to the previous text in the file. I tested with this snippet: function foo()
bar
function teste()
end
No. Check the explorer when you partially define a function: function teste()
a = 2
It marks as an error. That's why the indentation cannot work. |
I think that's only partially true. Whether or not there is a node at point shouldn't materially affect our indentation condition since in this case it only relies on parent (e.g. The first two parameters of function test()
|
end The trace-output gives you:
So here Emacs considers us to be inside the anonymous newline node, and therefore considers that to be the parent. I am not sure why Emacs can't consider
What I am getting to is that it might be possible to fix the problem here if we make our indentation rules that newline aware. However that might be very tricky to do, it might be worthwhile asking upstream to simply remove the newlines from showing up in the syntax tree, then the rules here will work as is (without needing to create a new node). |
Hello,
I just switched from
julia-mode
tojulia-ts-mode
on emacs 29.1. One thing I noticed is that my editor does not indent correctly anymore. I.e., when typingthe point gets placed at column 0 in the next row rather than column 4. This works "correctly" when I switch back to
julia-mode
.Is this a problem with
julia-ts-mode
? Might be related to something else in my config, so feel free to close if this feature has nothing to do withjulia-ts-mode
, my emacs knowledge is rather limited and I am never quite certain which mode provides which feature anyway 🙃The text was updated successfully, but these errors were encountered: