Closed jaekyeom closed 2 years ago
Thanks for your kind feedback! I'm sorry for inactivity for such a long time, and in fact I've been considering a heavy refactor for this plugin due to some design issues preventing me from making any progress.
One of the issues is the customization feature like this one. It is already supported but the feature is undocumented because I felt it quite immature and not user-friendly. Actually the feature mentioned in this issue is not hard to be implemented via custom hooks. The hooks are full-powered by design. However, that also makes it difficult to be utilized by users (even to me, the author of it) because the internal algorithm tackles many edge cases and becomes too complex to be understood fully.
Sadly, I've not figured out an elegant way to solve all these problems. Initially, I simply chose to wait zed.dev to be published to see how it deals with ts-based indent. Or nvim-treesitter, but I finally find its performance is even worse than this (for example, many wrong indent issues) though great improvements has been made by the community.
So to support the customization feature (although it is already supported), there are two options:
I'm waiting for users' response.
What a detailed response. I appreciate it!
Personally, as a user, I would be okay with using custom hooks, but I get where your willingness to refactor is coming from.
On the other hand, is zed.dev (going to be) open-source? I can't find any references. Also, tbh, the main reason I'm using nvim-yati is the instability of nvim-treesitter's indentation.
I can't comment on how the refactoring should be done as I'm not familiar with treesitter, but one vote for adding some (necessary) documentation to the current state and waiting for one of {the refactoring, stabilization of nvim-treesitter}.
I'm glad that you're preparing an update. Just as a side note, I figured out how to do this with the current version of nvim-yati before.
@yioneko Thanks for the update!
I noticed that, regarding this issue, while nvim-yati correctly adjusts the indentation after editing is done, but not during editing:
https://user-images.githubusercontent.com/6262727/199532712-ec079dee-29c8-4510-bd88-0ccd4fd80f50.mov
Would you be able to take a look at it, please? :)
Nice finding! This is where :h indentkeys
takes its role. Could you try : set indentkeys+=,
?
ok, I got the question
def foo(a,
) # <- The close delimiter should be aligned either
I'm not familiar with PEP8 style, could you check if this is correct? @jaekyeom
@yioneko Oh yes, that is correct!
(Btw, I think :set indentkeys+=,
corrects the current line's indentation only after ,
is typed)
@jaekyeom I find this case very interesting here ...
a = [
fooooooo, [[
bar # but bar is not on the same line of open delimeter
], # should be aligned either?
]
]
I currently have no idea to deal with this. :(
@yioneko Hmm, it looks to me that the new version of nvim-yati indents it like this?:
a = [
fooooooo, [[
bar # but bar is not on the same line of open delimeter
], # should be aligned either?
]
]
@jaekyeom Could you check 6395b6065b0c55db6edda453df7eedc8b1d3561d to see if it solves your problem?
@yioneko That works for me! Thank you so much :)
On a different but not unrelated topic, placing the first argument on the same line as the opening delimiter of a function call (not definition) leads to zero indentation for the following argument on the same line as the closing delimiter during editing 🤔 Do you think that behavior could be changed as well? (Should I open another issue for that?)
@jaekyeom I wrongly typed the node type of arguments 🤣. Will fix it and add corresponding test case soon.
@jaekyeom Please check 62f723bd0295ec75a33e495e13dd2ad82256d54d to confirm the fix. Feel free to open any issue to help improve the plugin better :)
@yioneko That's awesome, https://github.com/yioneko/nvim-yati/commit/62f723bd0295ec75a33e495e13dd2ad82256d54d works like a charm for me 👍
Thank you for such quick updates!
Hi, Thanks for this great plugin!
I'd like to know if it would be possible to allow alignment with opening delimiters (hopefully using configs), especially for python.
Some examples:
Thank you.