aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-10-28 14:53:09 +0200
committerGitHub <noreply@github.com>2016-10-28 14:53:09 +0200
commit5b514b59880313acafd5c339d4090319ed525ce1 (patch)
tree1052206a6bf80ad1ac3cff490e7dfec1fc7fce9e /src
parentfb4d5b05166235ae32db48cb7eb8d3776ea8386a (diff)
parentc5f5f427c6f8d1b4136bf41171f8f0980561080e (diff)
downloadrneovim-5b514b59880313acafd5c339d4090319ed525ce1.tar.gz
rneovim-5b514b59880313acafd5c339d4090319ed525ce1.tar.bz2
rneovim-5b514b59880313acafd5c339d4090319ed525ce1.zip
Merge #5535 from justinmk/api_level
api: Nvim version + API level
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/private/helpers.c2
-rw-r--r--src/nvim/version.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index c0ee735d1a..208c3b53c8 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -18,6 +18,7 @@
#include "nvim/map.h"
#include "nvim/option.h"
#include "nvim/option_defs.h"
+#include "nvim/version.h"
#include "nvim/eval/typval_encode.h"
#include "nvim/lib/kvec.h"
@@ -763,6 +764,7 @@ Dictionary api_metadata(void)
static Dictionary metadata = ARRAY_DICT_INIT;
if (!metadata.size) {
+ PUT(metadata, "version", DICTIONARY_OBJ(version_dict()));
init_function_metadata(&metadata);
init_error_type_metadata(&metadata);
init_type_metadata(&metadata);
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 498afa9656..7ab8c84569 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -7,6 +7,7 @@
#include <assert.h>
#include <limits.h>
+#include "nvim/api/private/helpers.h"
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/iconv.h"
@@ -2514,6 +2515,17 @@ bool has_vim_patch(int n)
return false;
}
+Dictionary version_dict(void) {
+ Dictionary d = ARRAY_DICT_INIT;
+ PUT(d, "major", INTEGER_OBJ(NVIM_VERSION_MAJOR));
+ PUT(d, "minor", INTEGER_OBJ(NVIM_VERSION_MINOR));
+ PUT(d, "patch", INTEGER_OBJ(NVIM_VERSION_PATCH));
+ PUT(d, "api_level", INTEGER_OBJ(NVIM_API_LEVEL));
+ PUT(d, "api_compatible", INTEGER_OBJ(NVIM_API_LEVEL_COMPAT));
+ PUT(d, "api_prerelease", BOOLEAN_OBJ(NVIM_API_PRERELEASE));
+ return d;
+}
+
void ex_version(exarg_T *eap)
{
// Ignore a ":version 9.99" command.