mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tree-sitter: rename tree_sitter => treesitter for consistency
This commit is contained in:
parent
4ea5e63aa8
commit
c8f861b739
@ -1,3 +1,4 @@
|
||||
-- TODO: externalize this
|
||||
local a = vim.api
|
||||
_G.a = vim.api
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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
|
@ -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
10
src/nvim/lua/treesitter.h
Normal 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
|
@ -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]
|
||||
|
@ -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()
|
||||
]])
|
Loading…
Reference in New Issue
Block a user