Skip to content

Commit aa1cfa8

Browse files
refactor: Remove dead code
- jump/param.lua: remove commented-out functions (get_call_spec, get_local_param_id, get_list_index, get_position), dead require for pytrize.input, and debug P() call - strings.lua: remove commented-out split_inside function and incomplete test code - params.lua: delete (entire file was commented out) - input/: delete directory and all four files (init, telescope, nui, builtin — all entirely commented out) - tables.lua: remove unused max_length and contains exports - tables_spec.lua: remove tests for deleted functions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6737334 commit aa1cfa8

10 files changed

Lines changed: 1 addition & 412 deletions

File tree

lua/pytrize/input/builtin.lua

Lines changed: 0 additions & 20 deletions
This file was deleted.

lua/pytrize/input/init.lua

Lines changed: 0 additions & 53 deletions
This file was deleted.

lua/pytrize/input/nui.lua

Lines changed: 0 additions & 68 deletions
This file was deleted.

lua/pytrize/input/telescope.lua

Lines changed: 0 additions & 48 deletions
This file was deleted.

lua/pytrize/jump/param.lua

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ local cs = require('pytrize.call_spec')
44
local nids = require('pytrize.nodeids')
55
local tbls = require('pytrize.tables')
66
local paths = require('pytrize.paths')
7-
-- local prompt_files = require('pytrize.input').prompt_files
87
local warn = require('pytrize.warn').warn
98
local open_file = require('pytrize.jump.util').open_file
109
local get_nodeids_path = require('pytrize.paths').get_nodeids_path
@@ -74,60 +73,6 @@ local function jump_to_nodeid_at_cursor(callback)
7473
end
7574
end
7675

77-
-- local function get_call_spec(call_specs, func_name, param)
78-
-- local found_call_spec
79-
-- for _, call_spec in ipairs(call_specs) do
80-
-- if call_spec.func_name == func_name and cs.has_param(call_spec, param) then
81-
-- found_call_spec = call_spec
82-
-- break
83-
-- end
84-
-- end
85-
-- if found_call_spec == nil then
86-
-- warn("couldn't find the declaration with param " .. param)
87-
-- return
88-
-- end
89-
-- return found_call_spec
90-
-- end
91-
92-
-- local function get_local_param_id(param_order, call_spec, nodeid)
93-
-- local param_ids = {}
94-
-- for idx, p in ipairs(param_order) do
95-
-- if tbls.contains(call_spec.params, p) then
96-
-- table.insert(param_ids, nodeid.params[idx])
97-
-- end
98-
-- end
99-
-- return table.concat(param_ids, '-')
100-
-- end
101-
102-
-- local function get_list_index(param_values, call_spec, param_id)
103-
-- local list_idx = 1
104-
-- local max = tbls.max_length(param_values[call_spec.func_name])
105-
-- while true do
106-
-- if list_idx > max then
107-
-- warn("couldn't find the declaration matching id " .. param_id)
108-
-- return
109-
-- end
110-
-- local pid = params.get_id(param_values[call_spec.func_name], call_spec.params, list_idx)
111-
-- if pid:sub(2, -2) == param_id then
112-
-- break
113-
-- end
114-
-- list_idx = list_idx + 1
115-
-- end
116-
-- return list_idx
117-
-- end
118-
119-
-- local get_position = function(call_spec, list_idx)
120-
-- local list_entry = cs.list_entries(call_spec.call_node)[list_idx]
121-
-- local row, col
122-
-- if list_entry == nil then
123-
-- row, col, _ = cs.get_second_arg_node(call_spec.call_node):start()
124-
-- else
125-
-- row, col, _ = list_entry:start()
126-
-- end
127-
-- return row, col
128-
-- end
129-
130-
13176
local startswith = function(str, sub)
13277
return str:sub(1, sub:len()) == sub
13378
end
@@ -172,39 +117,13 @@ M.to_declaration = function()
172117
nodeid.func_name,
173118
nodeid.file
174119
))
175-
P('call_specs', call_specs)
176120
if #call_specs > 0 then
177121
-- at least jump to the last call spec
178122
local row, col = call_specs[#call_specs].node:start()
179123
vim.api.nvim_win_set_cursor(0, {row + 1, col})
180124
else
181125
open_file(original_buffer)
182126
end
183-
-- local param_values = params.get_values(param_order)
184-
-- if param_values == nil then
185-
-- open_file(original_buffer)
186-
-- return
187-
-- end
188-
-- -- the param under the cursor
189-
-- local param = param_order[param_idx]
190-
-- -- find the call spec
191-
-- local call_spec = get_call_spec(call_specs, nodeid.func_name, param)
192-
-- if call_spec == nil then
193-
-- open_file(original_buffer)
194-
-- return
195-
-- end
196-
-- -- find the param id of the nodeid under the cursor of the call spec
197-
-- local param_id = get_local_param_id(param_order, call_spec, nodeid)
198-
-- -- find the list index
199-
-- local list_idx = get_list_index(param_values, call_spec, param_id)
200-
-- if list_idx == nil then
201-
-- open_file(original_buffer)
202-
-- return
203-
-- end
204-
-- -- find the list entry position
205-
-- local row, col = get_position(call_spec, list_idx)
206-
-- -- jump to position
207-
-- vim.api.nvim_win_set_cursor(0, {row + 1, col})
208127
end)
209128
end
210129

lua/pytrize/params.lua

Lines changed: 0 additions & 59 deletions
This file was deleted.

lua/pytrize/strings.lua

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,3 @@ M.split_once = function(str, sep, kwargs)
1818
end
1919

2020
return M
21-
22-
-- local split_inside = function(str, open, close)
23-
-- local depth = 0
24-
-- local parts = {
25-
-- left = {},
26-
-- middle = {},
27-
-- right = {},
28-
-- }
29-
-- local part = 'left'
30-
-- for i = 1, str:len() do
31-
-- local c = str:sub(i, i)
32-
-- if c == open then
33-
-- if depth == 0 and part == 'left' then
34-
-- part = 'middle'
35-
-- else
36-
-- table.insert(parts[part], c)
37-
-- end
38-
-- depth = depth + 1
39-
-- elseif c == close then
40-
-- depth = depth - 1
41-
-- if depth == 0 and part == 'middle' then
42-
-- part = 'right'
43-
-- else
44-
-- table.insert(parts[part], c)
45-
-- end
46-
-- end
47-
-- end
48-
-- return parts
49-
-- end
50-
--
51-
--
52-
-- P(split_inside('stnreao[tnsreio[]stnreio]
53-

0 commit comments

Comments
 (0)