-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fold starts from the next node #104
Comments
Thank you! I noticed that the behavior of some other blocks are changed. Some are not working. I would suggest that for (defun ts-fold-range-julia-iffor (node offset)
"Return the fold range for a NODE in Julia.
It excludes the NODE's first child and the `end' keyword. For
argument OFFSET, see function `ts-fold-range-seq' for more
information."
(when-let* ((condition (tsc-get-nth-named-child node 0))
(beg (tsc-node-end-position condition))
(end (tsc-node-end-position node))
(end (- end 3)))
(when ts-fold-on-next-line ; display nicely
(setq end (ts-fold--last-eol end)))
(ts-fold--cons-add (cons beg end) offset))) since both For |
Would you like to open a PR for this? :) Thank you!
👍 FYI, I need more experience with Julia. Therefore, it's better if others are willing to volunteer to create a parser for this! |
Sure, I would like to contribute. I just checked and found struct Foo
end or struct Foo{T}
end or struct Foo <: S
end or the combination of the last two. I want to take care of all cases listed above, but the following does not work (defun ts-fold-range-julia-struct (node offset)
"Return the fold range for a NODE in Julia.
It excludes the NODE's first child and the `end' keyword. For
argument OFFSET, see function `ts-fold-range-seq' for more
information."
(when-let* ((identifier (ts-fold-find-children node "identifier"))
(typeinfo (or (ts-fold-find-children node "subtype_clause")
(ts-fold-find-children node "type_parameter_list")))
(beg (if typeinfo
(tsc-node-end-position (car typeinfo))
(tsc-node-end-position (car identifier))))
(end (tsc-node-end-position node))
(end (- end 3)))
(when ts-fold-on-next-line ; display nicely
(setq end (ts-fold--last-eol end)))
(ts-fold--cons-add (cons beg end) offset))) I thought I am new to this library and |
I try to use this package to fold
julia
code. It works well!One issue I met is that the function folding starts from the function name. For example
becomes
I really want to keep the argument list so that the folding is like
The argument list should be a sibling of the function name. Is there a way to make the fold start from the argument list?
The text was updated successfully, but these errors were encountered: