forked from AckslD/nvim-pytrize.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.lua
More file actions
68 lines (55 loc) · 1.47 KB
/
api.lua
File metadata and controls
68 lines (55 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
local M = {}
M.clear = function(bufnr)
local marks = require('pytrize.marks')
if bufnr == nil then bufnr = 0 end
marks.clear(bufnr)
end
M.set = function(bufnr)
local cs = require('pytrize.call_spec')
local marks = require('pytrize.marks')
if bufnr == nil then bufnr = 0 end
marks.clear(bufnr)
local call_specs_per_func = cs.get_calls(bufnr)
if call_specs_per_func == nil then
return
end
for _, call_specs in pairs(call_specs_per_func) do
for _, call_spec in ipairs(call_specs) do
for _, entry_spec in ipairs(call_spec.entries) do
local entry_row = entry_spec.node:start()
marks.set{
bufnr = bufnr,
text = entry_spec.id,
row = entry_row,
}
for _, item_spec in ipairs(entry_spec.items) do
local item_row = item_spec.node:start()
if item_row ~= entry_row then
marks.set{
bufnr = bufnr,
text = item_spec.id,
row = item_spec.node:start(),
}
end
end
end
end
end
end
M.jump = function()
local jump = require('pytrize.jump')
jump.to_param_declaration()
end
M.jump_fixture = function()
local jump = require('pytrize.jump')
jump.to_fixture_declaration()
end
M.rename_fixture = function()
local rename = require('pytrize.rename')
rename.rename_fixture()
end
M.fixture_usages = function()
local usages = require('pytrize.usages')
usages.show_usages()
end
return M