aboutsummaryrefslogtreecommitdiff
path: root/scripts/lua2dox.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2021-05-01 05:19:48 -0700
committerGitHub <noreply@github.com>2021-05-01 08:19:48 -0400
commit27da5511a0c0b12fcabe29cf38c3f8a0f0b444b9 (patch)
treebd0c6670b2b0cca8400117842ed2abf9668dac90 /scripts/lua2dox.lua
parentca6107cfbc1b9994d8a36494965f0b270dc2b77b (diff)
downloadrneovim-27da5511a0c0b12fcabe29cf38c3f8a0f0b444b9.tar.gz
rneovim-27da5511a0c0b12fcabe29cf38c3f8a0f0b444b9.tar.bz2
rneovim-27da5511a0c0b12fcabe29cf38c3f8a0f0b444b9.zip
docs: Treesitter (#13260)
* doc & fixes: Generate treesitter docs * fixup to treesitter-core * docs(treesitter): fix docs for most functions Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
Diffstat (limited to 'scripts/lua2dox.lua')
-rw-r--r--scripts/lua2dox.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/lua2dox.lua b/scripts/lua2dox.lua
index 1dc4c0a5a0..0b36a1e061 100644
--- a/scripts/lua2dox.lua
+++ b/scripts/lua2dox.lua
@@ -491,6 +491,27 @@ function TLua2DoX_filter.readfile(this,AppStamp,Filename)
end
end
+ -- Big hax
+ if string.find(fn, ":") then
+ -- TODO: We need to add a first parameter of "SELF" here
+ -- local colon_place = string.find(fn, ":")
+ -- local name = string.sub(fn, 1, colon_place)
+ fn = fn:gsub(":", ".", 1)
+ outStream:writeln("/// @param self")
+
+ local paren_start = string.find(fn, "(", 1, true)
+ local paren_finish = string.find(fn, ")", 1, true)
+
+ -- Nothing in between the parens
+ local comma
+ if paren_finish == paren_start + 1 then
+ comma = ""
+ else
+ comma = ", "
+ end
+ fn = string.sub(fn, 1, paren_start) .. "self" .. comma .. string.sub(fn, paren_start + 1)
+ end
+
-- add vanilla function
outStream:writeln(fn_type .. 'function ' .. fn .. '{}')
end