Skip to content

Commit af5e04c

Browse files
committed
Prefer vim.treesitter.query.parse for nvim 0.9+
Fixes deprecation warnings on nightly
1 parent 65ccab8 commit af5e04c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lua/dap-python.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,10 @@ local function get_nodes(query_text, predicate)
213213
local end_row = api.nvim_win_get_cursor(0)[1]
214214
local ft = api.nvim_buf_get_option(0, 'filetype')
215215
assert(ft == 'python', 'test_method of dap-python only works for python files, not ' .. ft)
216-
local query = vim.treesitter.parse_query(ft, query_text)
216+
local query = (vim.treesitter.query.parse
217+
and vim.treesitter.query.parse(ft, query_text)
218+
or vim.treesitter.parse_query(ft, query_text)
219+
)
217220
assert(query, 'Could not parse treesitter query. Cannot find test')
218221
local parser = vim.treesitter.get_parser(0)
219222
local root = (parser:parse()[1]):root()

0 commit comments

Comments
 (0)