aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/version.lua
diff options
context:
space:
mode:
authorJames Trew <66286082+jamestrew@users.noreply.github.com>2025-06-30 12:55:29 -0400
committerGitHub <noreply@github.com>2025-06-30 09:55:29 -0700
commit4034476dd362b577024cfe6cac011ed82ef1ef38 (patch)
treed196ec6471a6b072e70f1f55370a2adfbfa6ce91 /runtime/lua/vim/version.lua
parentd6d1bfd20da05e8bd40441ecdc0ac75af66f77eb (diff)
downloadrneovim-4034476dd362b577024cfe6cac011ed82ef1ef38.tar.gz
rneovim-4034476dd362b577024cfe6cac011ed82ef1ef38.tar.bz2
rneovim-4034476dd362b577024cfe6cac011ed82ef1ef38.zip
doc(vim.version): options formatting #34716
Diffstat (limited to 'runtime/lua/vim/version.lua')
-rw-r--r--runtime/lua/vim/version.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/lua/vim/version.lua b/runtime/lua/vim/version.lua
index 6aa3aae781..958acb2abc 100644
--- a/runtime/lua/vim/version.lua
+++ b/runtime/lua/vim/version.lua
@@ -435,6 +435,15 @@ function M.gt(v1, v2)
return M.cmp(v1, v2) == 1
end
+---@class vim.version.parse.Opts
+---@inlinedoc
+---
+--- If `true`, no coercion is attempted on input not conforming to semver v2.0.0.
+--- If `false`, `parse()` attempts to coerce input such as "1.0", "0-x", "tmux 3.2a" into valid
+--- versions.
+--- (default: `false`)
+---@field strict? boolean
+
--- Parses a semantic version string and returns a version object which can be used with other
--- `vim.version` functions. For example "1.0.1-rc1+build.2" returns:
---
@@ -446,11 +455,8 @@ end
---@since 11
---
---@param version string Version string to parse.
----@param opts table|nil Optional keyword arguments:
---- - strict (boolean): Default false. If `true`, no coercion is attempted on
---- input not conforming to semver v2.0.0. If `false`, `parse()` attempts to
---- coerce input such as "1.0", "0-x", "tmux 3.2a" into valid versions.
----@return vim.Version? parsed_version Version object or `nil` if input is invalid.
+---@param opts vim.version.parse.Opts? Options for parsing.
+---@return vim.Version? # `Version` object or `nil` if input is invalid.
function M.parse(version, opts)
assert(type(version) == 'string', create_err_msg(version))
opts = opts or { strict = false }