diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-11-23 12:31:49 +0100 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2022-12-02 16:05:00 +0100 |
commit | 0b05bd87c04f9cde5c84a062453619349e370795 (patch) | |
tree | 06acf9582bbebe0bdb0f84777c17c71aced62a97 /runtime/lua/vim/shared.lua | |
parent | 9e1187e4896bebb481a3f9595155f2a40adbc45e (diff) | |
download | rneovim-0b05bd87c04f9cde5c84a062453619349e370795.tar.gz rneovim-0b05bd87c04f9cde5c84a062453619349e370795.tar.bz2 rneovim-0b05bd87c04f9cde5c84a062453619349e370795.zip |
docs(gen): support language annotation in docstrings
Diffstat (limited to 'runtime/lua/vim/shared.lua')
-rw-r--r-- | runtime/lua/vim/shared.lua | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index f4a57c13c8..9129500866 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -102,11 +102,11 @@ end --- Splits a string at each instance of a separator. --- --- Examples: ---- <pre> ---- split(":aa::b:", ":") => {'','aa','','b',''} ---- split("axaby", "ab?") => {'','x','y'} ---- split("x*yz*o", "*", {plain=true}) => {'x','yz','o'} ---- split("|x|y|z|", "|", {trimempty=true}) => {'x', 'y', 'z'} +--- <pre>lua +--- split(":aa::b:", ":") --> {'','aa','','b',''} +--- split("axaby", "ab?") --> {'','x','y'} +--- split("x*yz*o", "*", {plain=true}) --> {'x','yz','o'} +--- split("|x|y|z|", "|", {trimempty=true}) --> {'x', 'y', 'z'} --- </pre> --- ---@see |vim.gsplit()| @@ -383,7 +383,7 @@ end --- Return `nil` if the key does not exist. --- --- Examples: ---- <pre> +--- <pre>lua --- vim.tbl_get({ key = { nested_key = true }}, 'key', 'nested_key') == true --- vim.tbl_get({ key = {}}, 'key', 'nested_key') == nil --- </pre> @@ -495,9 +495,9 @@ end --- Counts the number of non-nil values in table `t`. --- ---- <pre> ---- vim.tbl_count({ a=1, b=2 }) => 2 ---- vim.tbl_count({ 1, 2 }) => 2 +--- <pre>lua +--- vim.tbl_count({ a=1, b=2 }) --> 2 +--- vim.tbl_count({ 1, 2 }) --> 2 --- </pre> --- ---@see https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua @@ -571,7 +571,7 @@ end --- Validates a parameter specification (types and values). --- --- Usage example: ---- <pre> +--- <pre>lua --- function user.new(name, age, hobbies) --- vim.validate{ --- name={name, 'string'}, @@ -583,24 +583,24 @@ end --- </pre> --- --- Examples with explicit argument values (can be run directly): ---- <pre> +--- <pre>lua --- vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}} ---- => NOP (success) +--- --> NOP (success) --- --- vim.validate{arg1={1, 'table'}} ---- => error('arg1: expected table, got number') +--- --> error('arg1: expected table, got number') --- --- vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}} ---- => error('arg1: expected even number, got 3') +--- --> error('arg1: expected even number, got 3') --- </pre> --- --- If multiple types are valid they can be given as a list. ---- <pre> +--- <pre>lua --- vim.validate{arg1={{'foo'}, {'table', 'string'}}, arg2={'foo', {'table', 'string'}}} ---- => NOP (success) +--- --> NOP (success) --- --- vim.validate{arg1={1, {'string', table'}}} ---- => error('arg1: expected string|table, got number') +--- --> error('arg1: expected string|table, got number') --- --- </pre> --- @@ -735,7 +735,7 @@ end --- If {create} is `nil`, this will create a defaulttable whose constructor function is --- this function, effectively allowing to create nested tables on the fly: --- ---- <pre> +--- <pre>lua --- local a = vim.defaulttable() --- a.b.c = 1 --- </pre> |