Closed aileot closed 1 year ago
Not bad, but should pass the metatable into 6th parm for the handler instead of making 1st parm confusing for users.
For instance, if 3rd plugin author needs to integrate ufo with his buffer, he will call setFoldVirtTextHandler(bufnr, handler)
, but the 1st type of parm depends on ufo's config, it's so confusing.
BTW, I don't know why the name is enable_on_demand_virt_texts
, could you explain patiently?
In addition, I also suggest such functions to deal with virtTexts as above be provided for users by
Not yet, I don't think it's useful for most users.
BTW, I don't know why the name is enable_on_demand_virt_texts, could you explain patiently?
enable_virt_text_list
the first alternative I think of sounds as if extra calculations have run for every lines in fold to make virt_text
lists before handler while "on-demand" explicitly demands no unnecessary calculations. The doubt of extra resource consumption with the former name makes me feel uncomfortable beyond reason. Did this answer your question?
Anyway, you can rename it better. You're the author.
After considering return a list can't use ipairs
and paris
to iter (__ipairs
and __pairs
doesn't exist in Lua 5.1), I think exporting a function will be better. Free feel to share your opinion here before merging.
I agree with you. A function is more concise than a list in this case.
I'd like to cut off "func" from the function name. It's redundant. Still, it's hard to rename it better.
get_folded_line
is to return a string.get_folded_text
is to return a string.get_folded_node
reminds me of tree-sitter node, which is distinct from what we deal with.get_folded_chunks
is used in help file, but it's plural.get_folded_context
is ambiguous.get_folded_content
implies all the lines in a fold, not a line.Provisionally, I rename it get_fold_virt_text
, which comes from the option name. Either this or get_folded_chunks
seems better in them.
What do you think of it?
I agree with you. A function is more concise than a list in this case.
I'd like to cut off "func" from the function name. It's redundant. Still, it's hard to rename it better.
get_folded_line
is to return a string.get_folded_text
is to return a string.get_folded_node
reminds me of tree-sitter node, which is distinct from what we deal with.get_folded_chunks
is used in help file, but it's plural.get_folded_context
is ambiguous.get_folded_content
implies all the lines in a fold, not a line.Provisionally, I rename it
get_fold_virt_text
, which comes from the option name. Either this orget_folded_chunks
seems better in them.What do you think of it?
Look good, please change ""
to ''
and improve the docs, thanks a lot.
Sorry for the violation.
Force-pushed because the last two commits in doc/example.lua had got conflicted to that of origin/main. Please make sure your last changes are not overwritten there.
Well, may I add the screenshot in README.md?
i
Don't change the struct of doc/exmaple
, do-end will increase unnecessary indentations. enable_get_fold_virt_text_func
should be changed to enable_get_fold_virt_text
.
Well, may I add the screenshot in README.md?
Sorry, please don't. I want to keep the README.md as clean as possible for users.
No problem?
Is that all?
Thanks a lot, I have squashed and merged it.
The option converts the first argument of virt text handler into a list of virt texts on Lua metatable. It's useful when the first lines of folds give little information.
For example, we can see the second lines that show plugin names managed by plugin manager at a glance:
for
for
A sample handler in which folded lines will be concatenated until each
virtText
becomes longer thanminWidth
:In addition, I also suggest such functions to deal with
virtText
s as above be provided for users by, for instance,require('ufo.user-utils')
.