-
Notifications
You must be signed in to change notification settings - Fork 412
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
feat(help): accept patterns for readme #269
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition! See my comments below
@@ -7,23 +7,30 @@ function M.index(plugin) | |||
if Config.options.readme.skip_if_doc_exists and vim.loop.fs_stat(plugin.dir .. "/doc") then | |||
return {} | |||
end | |||
local files = vim.tbl_flatten(vim.tbl_map(function(file) | |||
return vim.fn.expand(plugin.dir .. "/" .. file, false, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also add Util.norm(vim.fn.expan...)
to normalize the paths for windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vim.fn.expand
will return a list. I'm not quite sure when to normalize, should I do it after expanding? Or before? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after should be fine. Or just do it in the loop where you loop over the files, right before where you build the tag_filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. I tested on linux/mac. But not very confident if filename generation would work correctly on Windows.
lua/lazy/help.lua
Outdated
if vim.loop.fs_stat(file) then | ||
local tag_filename = plugin.name | ||
if file:find("lua/") then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to make this more general. So build the filename based on everything after plugin.dir
. So for example:
nui.nvim/lua/nui/popup/README.md
-> nui.nvim-lua-nui-popup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
cd7b9de
to
a47792c
Compare
a47792c
to
6c993f3
Compare
Thanks! |
I don't know if this PR is gonna be accepted, since I don't see many plugins having multiple
README.md
files in thelua/
directory.If it doesn't go with the roadmap or if the
lua/
directory handling seems too specific/hardcoded, feel free to close the PR.