diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-06-15 12:10:12 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-09-28 14:55:43 +0200 |
commit | c8f861b739b4703b1198dc1f88b09edbeb0d9f2e (patch) | |
tree | 747e445f9c559a6bb89fec4bed17bf67525fc335 | |
parent | 4ea5e63aa8c866b4fcc9d10f1a26078d2517f96a (diff) | |
download | rneovim-c8f861b739b4703b1198dc1f88b09edbeb0d9f2e.tar.gz rneovim-c8f861b739b4703b1198dc1f88b09edbeb0d9f2e.tar.bz2 rneovim-c8f861b739b4703b1198dc1f88b09edbeb0d9f2e.zip |
tree-sitter: rename tree_sitter => treesitter for consistency
-rw-r--r-- | runtime/lua/treesitter_demo.lua (renamed from runtime/lua/tree_sitter_demo.lua) | 1 | ||||
-rw-r--r-- | runtime/lua/vim/treesitter.lua (renamed from runtime/lua/vim/tree_sitter.lua) | 0 | ||||
-rw-r--r-- | runtime/plugin/ts_test.vim | 4 | ||||
-rw-r--r-- | src/nvim/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 2 | ||||
-rw-r--r-- | src/nvim/lua/tree_sitter.h | 10 | ||||
-rw-r--r-- | src/nvim/lua/treesitter.c (renamed from src/nvim/lua/tree_sitter.c) | 6 | ||||
-rw-r--r-- | src/nvim/lua/treesitter.h | 10 | ||||
-rw-r--r-- | src/nvim/lua/vim.lua | 6 | ||||
-rw-r--r-- | test/functional/lua/treesitter_spec.lua (renamed from test/functional/lua/tree_sitter_spec.lua) | 6 |
10 files changed, 24 insertions, 23 deletions
diff --git a/runtime/lua/tree_sitter_demo.lua b/runtime/lua/treesitter_demo.lua index bbfd69109d..82c36f94c0 100644 --- a/runtime/lua/tree_sitter_demo.lua +++ b/runtime/lua/treesitter_demo.lua @@ -1,3 +1,4 @@ +-- TODO: externalize this local a = vim.api _G.a = vim.api diff --git a/runtime/lua/vim/tree_sitter.lua b/runtime/lua/vim/treesitter.lua index 1b5f416b67..1b5f416b67 100644 --- a/runtime/lua/vim/tree_sitter.lua +++ b/runtime/lua/vim/treesitter.lua diff --git a/runtime/plugin/ts_test.vim b/runtime/plugin/ts_test.vim index 9420c2c9d3..15192d8dda 100644 --- a/runtime/plugin/ts_test.vim +++ b/runtime/plugin/ts_test.vim @@ -6,8 +6,8 @@ func! TSTest() return end " TODO: module! - lua theparser = vim.tree_sitter.create_parser(0) - lua require'tree_sitter_demo' + lua theparser = vim.treesitter.create_parser(0) + lua require'treesitter_demo' let g:has_ts = v:true endfunc diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 3056c108b4..27977e3a40 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -145,7 +145,7 @@ set(CONV_SOURCES ex_cmds.c ex_docmd.c fileio.c - lua/tree_sitter.c + lua/treesitter.c mbyte.c memline.c message.c diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 23c4fcabbc..8a35f11c71 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -31,7 +31,7 @@ #include "nvim/lua/executor.h" #include "nvim/lua/converter.h" -#include "nvim/lua/tree_sitter.h" +#include "nvim/lua/treesitter.h" #include "luv/luv.h" diff --git a/src/nvim/lua/tree_sitter.h b/src/nvim/lua/tree_sitter.h deleted file mode 100644 index 2ae0ec8371..0000000000 --- a/src/nvim/lua/tree_sitter.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef NVIM_LUA_TREE_SITTER_H -#define NVIM_LUA_TREE_SITTER_H - -#include "tree_sitter/api.h" - -#ifdef INCLUDE_GENERATED_DECLARATIONS -# include "lua/tree_sitter.h.generated.h" -#endif - -#endif // NVIM_LUA_TREE_SITTER_H diff --git a/src/nvim/lua/tree_sitter.c b/src/nvim/lua/treesitter.c index f992639955..794bdc6749 100644 --- a/src/nvim/lua/tree_sitter.c +++ b/src/nvim/lua/treesitter.c @@ -20,9 +20,9 @@ // NOT state-safe, delete when GC is confimed working: static int debug_n_trees = 0, debug_n_cursors = 0; -#define REG_KEY "tree_sitter-private" +#define REG_KEY "treesitter-private" -#include "nvim/lua/tree_sitter.h" +#include "nvim/lua/treesitter.h" #include "nvim/api/private/handle.h" #include "nvim/memline.h" @@ -32,7 +32,7 @@ typedef struct { } Tslua_parser; #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "lua/tree_sitter.c.generated.h" +# include "lua/treesitter.c.generated.h" #endif static struct luaL_Reg parser_meta[] = { diff --git a/src/nvim/lua/treesitter.h b/src/nvim/lua/treesitter.h new file mode 100644 index 0000000000..d59b5e47a0 --- /dev/null +++ b/src/nvim/lua/treesitter.h @@ -0,0 +1,10 @@ +#ifndef NVIM_LUA_TREESITTER_H +#define NVIM_LUA_TREESITTER_H + +#include "tree_sitter/api.h" + +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "lua/treesitter.h.generated.h" +#endif + +#endif // NVIM_LUA_TREESITTER_H diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua index c38926fe24..b67762e48e 100644 --- a/src/nvim/lua/vim.lua +++ b/src/nvim/lua/vim.lua @@ -232,9 +232,9 @@ local function __index(t, key) if key == 'inspect' then t.inspect = require('vim.inspect') return t.inspect - elseif key == 'tree_sitter' then - t.tree_sitter = require('vim.tree_sitter') - return t.tree_sitter + elseif key == 'treesitter' then + t.treesitter = require('vim.treesitter') + return t.treesitter elseif require('vim.shared')[key] ~= nil then -- Expose all `vim.shared` functions on the `vim` module. t[key] = require('vim.shared')[key] diff --git a/test/functional/lua/tree_sitter_spec.lua b/test/functional/lua/treesitter_spec.lua index e25eb47a60..8916e59563 100644 --- a/test/functional/lua/tree_sitter_spec.lua +++ b/test/functional/lua/treesitter_spec.lua @@ -15,7 +15,7 @@ describe('tree-sitter API', function() -- error tests not requiring a parser library it('handles basic errors', function() --eq({false, 'Error executing lua: vim.schedule: expected function'}, - -- meth_pcall(meths.execute_lua, "parser = vim.tree_sitter.create_parser(0, 'nosuchlang')", {})) + -- meth_pcall(meths.execute_lua, "parser = vim.treesitter.create_parser(0, 'nosuchlang')", {})) @@ -34,7 +34,7 @@ describe('tree-sitter API', function() local path = ts_path .. '/bin/c'..(iswin() and '.dll' or '.so') exec_lua([[ local path = ... - vim.tree_sitter.add_language(path,'c') + vim.treesitter.add_language(path,'c') ]], path) end) @@ -46,7 +46,7 @@ describe('tree-sitter API', function() }]]) exec_lua([[ - parser = vim.tree_sitter.create_parser(0, "c") + parser = vim.treesitter.create_parser(0, "c") tree = parser:parse_tree() root = tree:root() ]]) |