tree-sitter: rename tree_sitter => treesitter for consistency

This commit is contained in:
Björn Linse 2019-06-15 12:10:12 +02:00
parent 4ea5e63aa8
commit c8f861b739
10 changed files with 24 additions and 23 deletions

View File

@ -1,3 +1,4 @@
-- TODO: externalize this
local a = vim.api
_G.a = vim.api

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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[] = {

10
src/nvim/lua/treesitter.h Normal file
View File

@ -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

View File

@ -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]

View File

@ -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()
]])