google / vimdoc

Helpfile generation for vim
Apache License 2.0
291 stars 29 forks source link

support .lua file in neovim plugin #131

Open wsdjeg opened 1 year ago

wsdjeg commented 1 year ago

is it possible to add *.lua support?

for example:

lua/plugin_name/init.lua

----
-- This is my function. It does different things to the {required} argument,
-- depending upon the [optional] argument.
function function_name()

end
dbarnett commented 1 year ago

It's possible, but I'm not very familiar yet with how neovim hooks into lua and namespaces it. Any good examples you could point to?

Ideally I'd want to see (a) the lua signatures/definitions, (b) the usage docs for them, and (c) some manually-written vim helpdocs for them that you'd be looking to automatically generate.

If it's anything like vim's python support, I haven't considered that worth generating docs for those pieces because I wouldn't ask users in the plugin instructions to call python directly w/o a vim wrapper, or have python deps between plugins. But the shape of the situation might be a little different with neovim/lua, so I'm interested to see examples.

wsdjeg commented 5 months ago

Hi:, here is some example meybe help:

  1. in lua code, there is not let g:foo = 123, It is vim.g.foo = 123

viml

"" " here is doc let g:foo = 123

lua:


-- here is doc vim.g.foo = 123

  1. there is no function! command in lua

vimL

"" " here is doc for function function! hello#hello() endfunction

  1. there is no :command in lua too.

  2. @section and @parentsection should work well in lua, just need to check if the comment start with:

vim: " @section xxx

lua: -- @section xxx

BTW, we should ignore lsp hover doc. all of them start with ---