@codua/codeoutline-win32-x64 0.3.3 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/README.zh-CN.md +11 -1
- package/bin/xnet.exe +0 -0
- package/build-info.json +1 -1
- package/editors/codeoutline.vsix +0 -0
- package/editors/zed/extension.wasm +0 -0
- package/package.json +1 -1
- package/scripts/codeoutline/{automatic_events.lua → analysis/automatic_events.lua} +4 -4
- package/scripts/codeoutline/{cpp_bindings.lua → analysis/cpp/cpp_bindings.lua} +7 -7
- package/scripts/codeoutline/{cpp_implementations.lua → analysis/cpp/cpp_implementations.lua} +3 -3
- package/scripts/codeoutline/{cpp_includes.lua → analysis/cpp/cpp_includes.lua} +3 -3
- package/scripts/codeoutline/{cpp_macros.lua → analysis/cpp/cpp_macros.lua} +3 -3
- package/scripts/codeoutline/{cpp_receivers.lua → analysis/cpp/cpp_receivers.lua} +7 -7
- package/scripts/codeoutline/{cpp_types.lua → analysis/cpp/cpp_types.lua} +5 -5
- package/scripts/codeoutline/{csharp_bindings.lua → analysis/csharp/csharp_bindings.lua} +78 -41
- package/scripts/codeoutline/{dispatch_aliases.lua → analysis/dispatch_aliases.lua} +3 -3
- package/scripts/codeoutline/{foreign.lua → analysis/foreign.lua} +2 -2
- package/scripts/codeoutline/{function_values.lua → analysis/function_values.lua} +2 -2
- package/scripts/codeoutline/analysis/go/go_frameworks.lua +327 -0
- package/scripts/codeoutline/{go_methods.lua → analysis/go/go_methods.lua} +2 -2
- package/scripts/codeoutline/{go_modules.lua → analysis/go/go_modules.lua} +2 -2
- package/scripts/codeoutline/{graph.lua → analysis/graph.lua} +53 -47
- package/scripts/codeoutline/{implementations.lua → analysis/implementations.lua} +18 -9
- package/scripts/codeoutline/{indirect.lua → analysis/indirect.lua} +71 -13
- package/scripts/codeoutline/{js_evidence.lua → analysis/js/js_evidence.lua} +4 -3
- package/scripts/codeoutline/{js_resolution.lua → analysis/js/js_resolution.lua} +2 -2
- package/scripts/codeoutline/{js_workspace.lua → analysis/js/js_workspace.lua} +2 -2
- package/scripts/codeoutline/{ts_implementations.lua → analysis/js/ts_implementations.lua} +3 -3
- package/scripts/codeoutline/{foreign_lua.lua → analysis/lua/foreign_lua.lua} +3 -3
- package/scripts/codeoutline/{lua_bindings.lua → analysis/lua/lua_bindings.lua} +136 -12
- package/scripts/codeoutline/{lua_callback_loops.lua → analysis/lua/lua_callback_loops.lua} +1 -1
- package/scripts/codeoutline/{ordinary_bindings.lua → analysis/ordinary_bindings.lua} +45 -21
- package/scripts/codeoutline/{python_bindings.lua → analysis/python/python_bindings.lua} +2 -2
- package/scripts/codeoutline/analysis/receivers.lua +559 -0
- package/scripts/codeoutline/{rust_packages.lua → analysis/rust/rust_packages.lua} +2 -2
- package/scripts/codeoutline/analysis/rust/rust_resolution.lua +609 -0
- package/scripts/codeoutline/{shared_events.lua → analysis/shared_events.lua} +3 -3
- package/scripts/codeoutline/{static_dispatch.lua → analysis/static_dispatch.lua} +5 -5
- package/scripts/codeoutline/{type_uses.lua → analysis/type_uses.lua} +1 -1
- package/scripts/codeoutline/cli.lua +1 -1
- package/scripts/codeoutline/command.lua +10 -8
- package/scripts/codeoutline/{cpp_fragments.lua → indexing/cpp_fragments.lua} +4 -4
- package/scripts/codeoutline/{index.lua → indexing/index.lua} +12 -12
- package/scripts/codeoutline/{parse_pool.lua → indexing/parse_pool.lua} +1 -1
- package/scripts/codeoutline/{agent_config.lua → install/agent_config.lua} +21 -1
- package/scripts/codeoutline/{agent_install.lua → install/agent_install.lua} +2 -2
- package/scripts/codeoutline/{editor_install.lua → install/editor_install.lua} +34 -6
- package/scripts/codeoutline/lang/c.lua +2 -2
- package/scripts/codeoutline/lang/cpp.lua +2 -2
- package/scripts/codeoutline/lang/csharp.lua +2 -2
- package/scripts/codeoutline/lang/go.lua +2 -2
- package/scripts/codeoutline/lang/java.lua +2 -2
- package/scripts/codeoutline/lang/js.lua +2 -2
- package/scripts/codeoutline/lang/kotlin.lua +4 -2
- package/scripts/codeoutline/lang/lua.lua +3 -3
- package/scripts/codeoutline/lang/python.lua +2 -2
- package/scripts/codeoutline/lang/rust.lua +3 -3
- package/scripts/codeoutline/main.lua +9 -9
- package/scripts/codeoutline/{common.lua → parsing/common.lua} +22 -17
- package/scripts/codeoutline/{language_detect.lua → parsing/language_detect.lua} +1 -1
- package/scripts/codeoutline/{parse.lua → parsing/parse.lua} +4 -4
- package/scripts/codeoutline/{http.lua → protocol/http.lua} +1 -1
- package/scripts/codeoutline/{lsp.lua → protocol/lsp.lua} +4 -4
- package/scripts/codeoutline/{mcp.lua → protocol/mcp.lua} +9 -9
- package/scripts/codeoutline/{affected.lua → query/affected.lua} +6 -6
- package/scripts/codeoutline/{callers.lua → query/callers.lua} +9 -9
- package/scripts/codeoutline/{completion.lua → query/completion.lua} +37 -49
- package/scripts/codeoutline/{definition_candidates.lua → query/definition_candidates.lua} +19 -13
- package/scripts/codeoutline/{documents.lua → query/documents.lua} +4 -4
- package/scripts/codeoutline/{explore.lua → query/explore.lua} +85 -25
- package/scripts/codeoutline/{external_headers.lua → query/external_headers.lua} +6 -6
- package/scripts/codeoutline/{navigation.lua → query/navigation.lua} +172 -57
- package/scripts/codeoutline/{on_demand.lua → query/on_demand.lua} +6 -6
- package/scripts/codeoutline/{query_report.lua → query/query_report.lua} +9 -5
- package/scripts/codeoutline/{search_ranking.lua → query/search_ranking.lua} +10 -7
- package/scripts/codeoutline/{type_hierarchy.lua → query/type_hierarchy.lua} +11 -11
- package/scripts/codeoutline/{type_references.lua → query/type_references.lua} +17 -17
- package/scripts/codeoutline/{index_worker.lua → runtime/index_worker.lua} +10 -10
- package/scripts/codeoutline/{parse_worker.lua → runtime/parse_worker.lua} +2 -2
- package/scripts/codeoutline/{update_worker.lua → runtime/update_worker.lua} +1 -1
- package/scripts/codeoutline/service.lua +11 -11
- package/scripts/codeoutline/update_sequence.lua +1 -1
- package/scripts/codeoutline/version.lua +1 -1
- package/scripts/codeoutline/rust_resolution.lua +0 -301
- /package/scripts/codeoutline/{lua_literal.lua → analysis/lua/lua_literal.lua} +0 -0
- /package/scripts/codeoutline/{resolution.lua → analysis/resolution.lua} +0 -0
- /package/scripts/codeoutline/{cargo_toml.lua → analysis/rust/cargo_toml.lua} +0 -0
- /package/scripts/codeoutline/{type_bases.lua → analysis/type_bases.lua} +0 -0
- /package/scripts/codeoutline/{cache_repairs.lua → indexing/cache_repairs.lua} +0 -0
- /package/scripts/codeoutline/{daemon.lua → install/daemon.lua} +0 -0
- /package/scripts/codeoutline/{install_prompt.lua → install/install_prompt.lua} +0 -0
- /package/scripts/codeoutline/{xscan.lua → parsing/xscan.lua} +0 -0
- /package/scripts/codeoutline/{lsp_trace.lua → protocol/lsp_trace.lua} +0 -0
- /package/scripts/codeoutline/{coverage.lua → query/coverage.lua} +0 -0
- /package/scripts/codeoutline/{query_filters.lua → query/query_filters.lua} +0 -0
- /package/scripts/codeoutline/{idle_gc.lua → runtime/idle_gc.lua} +0 -0
- /package/scripts/codeoutline/{control.lua → shared/control.lua} +0 -0
- /package/scripts/codeoutline/{path.lua → shared/path.lua} +0 -0
- /package/scripts/codeoutline/{rules.lua → shared/rules.lua} +0 -0
- /package/scripts/codeoutline/{text.lua → shared/text.lua} +0 -0
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
-- grouped by file, as `line<TAB>code` like the Read tool
|
|
11
11
|
-- 3. callers / callees of the named symbols (locations only)
|
|
12
12
|
-- 4. other matches that did not fit, as pointers
|
|
13
|
-
-- Big bodies
|
|
13
|
+
-- Big bodies keep their head/tail and relevant call windows; classes over the limit collapse to a
|
|
14
14
|
-- member outline; anything past the budget becomes a pointer line.
|
|
15
15
|
|
|
16
|
-
local graph = require('codeoutline.graph')
|
|
17
|
-
local text = require('codeoutline.text')
|
|
18
|
-
local control = require('codeoutline.control')
|
|
16
|
+
local graph = require('codeoutline.analysis.graph')
|
|
17
|
+
local text = require('codeoutline.shared.text')
|
|
18
|
+
local control = require('codeoutline.shared.control')
|
|
19
19
|
|
|
20
20
|
local M = {}
|
|
21
21
|
|
|
@@ -27,7 +27,7 @@ function M.validate(query, opts)
|
|
|
27
27
|
assert(type(query) == 'string' and query:find('%S') and #query <= 4096 and not query:find('%z'),
|
|
28
28
|
'query must contain 1-4096 bytes of non-empty text without NUL')
|
|
29
29
|
assert(text.valid(query) == query, 'query must be valid UTF-8')
|
|
30
|
-
require('codeoutline.query_filters').parse(query)
|
|
30
|
+
require('codeoutline.query.query_filters').parse(query)
|
|
31
31
|
assert(opts == nil or type(opts) == 'table', 'options must be a table')
|
|
32
32
|
local budget = M.DEFAULT_BUDGET
|
|
33
33
|
if opts and opts.budget ~= nil then budget = opts.budget end
|
|
@@ -79,6 +79,14 @@ local function terms(query)
|
|
|
79
79
|
local key = kind .. ':' .. text
|
|
80
80
|
if not seen[key] then seen[key] = true; out[#out + 1] = { kind = kind, text = text } end
|
|
81
81
|
end
|
|
82
|
+
-- A path is one term, not a bag of directory names such as src/login.
|
|
83
|
+
query = query:gsub('\\', '/'):gsub('[%w_%-%./]+%.[%a][%w_]*', function(path)
|
|
84
|
+
local ext = path:match('%.(%a+)$')
|
|
85
|
+
if path:find('/') or ext and require('codeoutline.parsing.parse').EXTENSIONS[ext:lower()] then
|
|
86
|
+
add('file', path); return string.rep(' ', #path)
|
|
87
|
+
end
|
|
88
|
+
return path
|
|
89
|
+
end)
|
|
82
90
|
for chain in query:gmatch('[%a_][%w_]*[%.:%->]+[%a_][%w_%.:%->]*') do
|
|
83
91
|
if chain:match('%.%a+$') and chain:match('^[%w_/%-]+%.%a+$') and not chain:find('::') then
|
|
84
92
|
add('file', chain)
|
|
@@ -108,10 +116,10 @@ local function terms(query)
|
|
|
108
116
|
end
|
|
109
117
|
|
|
110
118
|
local function find_seeds(G, query, filters, ranking)
|
|
111
|
-
local predicate = require('codeoutline.query_filters')
|
|
119
|
+
local predicate = require('codeoutline.query.query_filters')
|
|
112
120
|
local function seed_score(id, exact, explicit)
|
|
113
121
|
local s = (KIND_WEIGHT[G.nodes[id].kind] or 1) + (exact and 20 or 0)
|
|
114
|
-
return s - ranking.penalty(G.files[G.node_file[id]].path, explicit)
|
|
122
|
+
return s - ranking.penalty(G.files[G.node_file[id]].path, explicit, G.nodes[id])
|
|
115
123
|
end
|
|
116
124
|
local cands = {} -- id -> score
|
|
117
125
|
local files = {} -- file indices named in the query
|
|
@@ -204,14 +212,13 @@ local function find_seeds(G, query, filters, ranking)
|
|
|
204
212
|
end
|
|
205
213
|
if query == '' then
|
|
206
214
|
local count = 0
|
|
207
|
-
-- With
|
|
215
|
+
-- With either policy, select the candidate window from preferred
|
|
208
216
|
-- files first so an early generated directory cannot fill all 512 slots.
|
|
209
|
-
for pass = 1,
|
|
217
|
+
for pass = 1, 2 do
|
|
210
218
|
for _, f in ipairs(G.file_order) do
|
|
211
219
|
control.check()
|
|
212
220
|
local rec = G.files[f]
|
|
213
|
-
if predicate.file(filters, rec) and (
|
|
214
|
-
or (ranking.penalty(rec.path) > 0) == (pass == 2)) then
|
|
221
|
+
if predicate.file(filters, rec) and (ranking.penalty(rec.path) > 0) == (pass == 2) then
|
|
215
222
|
for i, id in ipairs(G.id_of[f]) do
|
|
216
223
|
if i % 256 == 0 then control.check() end
|
|
217
224
|
if predicate.id(filters, G, id) then
|
|
@@ -300,9 +307,9 @@ local function render_range(lines, a, b, out)
|
|
|
300
307
|
end
|
|
301
308
|
end
|
|
302
309
|
|
|
303
|
-
-- Source block for one node,
|
|
310
|
+
-- Source block for one node, capped at `full` source lines, preserving call sites.
|
|
304
311
|
-- Classes/structs over the limit collapse to their member outline.
|
|
305
|
-
local function node_block(G, idx, id, full)
|
|
312
|
+
local function node_block(G, idx, id, full, focus)
|
|
306
313
|
local node = G.nodes[id]
|
|
307
314
|
local lines = file_lines(idx, G.files[G.node_file[id]].path)
|
|
308
315
|
local a, b = node.line, math.max(node.end_line, node.line)
|
|
@@ -322,16 +329,62 @@ local function node_block(G, idx, id, full)
|
|
|
322
329
|
for _, k in ipairs(kids) do
|
|
323
330
|
local kn = G.nodes[k]
|
|
324
331
|
if not rows[kn.line] then row_lines[#row_lines + 1] = kn.line end
|
|
325
|
-
rows[kn.line] = require('codeoutline.navigation').detail(G, G.node_file[k], kn).sig or kn.name
|
|
332
|
+
rows[kn.line] = require('codeoutline.query.navigation').detail(G, G.node_file[k], kn).sig or kn.name
|
|
326
333
|
end
|
|
327
334
|
for _, ln in ipairs(row_lines) do
|
|
328
335
|
out[#out + 1] = string.format('%d\t %s', ln, rows[ln])
|
|
329
336
|
end
|
|
330
337
|
out[#out + 1] = string.format('\t... (%s body of %d lines outlined; explore a member for its source)', node.kind, span)
|
|
331
338
|
else
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
339
|
+
local selected, count = {}, 0
|
|
340
|
+
local function keep(first, last)
|
|
341
|
+
for line = math.max(a, first), math.min(b, last) do
|
|
342
|
+
if not selected[line] and count < full then selected[line], count = true, count + 1 end
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
local head, tail = math.min(32, math.floor(full / 3)), math.min(8, math.floor(full / 8))
|
|
346
|
+
keep(a, a + head - 1); keep(b - tail + 1, b)
|
|
347
|
+
local points, seen = {}, {}
|
|
348
|
+
for _, line in ipairs(focus or {}) do
|
|
349
|
+
if line >= a and line <= b and not selected[line] and not seen[line] and #points < 4 then
|
|
350
|
+
points[#points + 1], seen[line] = line, true
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
-- When no named path spans the body, sample actual call sites
|
|
354
|
+
-- across it rather than spending every line on the function head.
|
|
355
|
+
if #points == 0 then
|
|
356
|
+
local refs, calls = G.files[G.node_file[id]].refs, {}
|
|
357
|
+
local from = id - G.id_of[G.node_file[id]][1] + 1
|
|
358
|
+
for i, line in ipairs(refs.line) do
|
|
359
|
+
if i % 128 == 0 then control.check() end
|
|
360
|
+
if refs.from[i] == from and line > a + head and line < b - tail
|
|
361
|
+
and (refs.kind[i] == 'call' or refs.kind[i] == 'member_call') then
|
|
362
|
+
calls[#calls + 1] = line
|
|
363
|
+
if (refs.name[i] == 'pcall' or refs.name[i] == 'xpcall') and not seen[line] and #points < 2 then
|
|
364
|
+
points[#points + 1], seen[line] = line, true
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
table.sort(calls)
|
|
369
|
+
for i = 1, math.min(3, #calls) do
|
|
370
|
+
local line = calls[math.ceil(#calls * i / (math.min(3, #calls) + 1))]
|
|
371
|
+
if not seen[line] and #points < 4 then points[#points + 1], seen[line] = line, true end
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
local radius = math.max(0, math.min(12, math.floor((full - count) / math.max(1, #points) / 2) - 1))
|
|
375
|
+
for _, line in ipairs(points) do keep(line - radius, line + radius) end
|
|
376
|
+
if #points == 0 then
|
|
377
|
+
keep(a, a + math.min(M.CUT_HEAD, full - tail) - 1)
|
|
378
|
+
keep(b - M.CUT_TAIL + 1, b)
|
|
379
|
+
end
|
|
380
|
+
local ordered = {}; for line in pairs(selected) do ordered[#ordered + 1] = line end
|
|
381
|
+
table.sort(ordered)
|
|
382
|
+
local previous = a - 1
|
|
383
|
+
for _, line in ipairs(ordered) do
|
|
384
|
+
if line > previous + 1 then out[#out + 1] = string.format('\t... (%d lines omitted) ...', line - previous - 1) end
|
|
385
|
+
render_range(lines, line, line, out); previous = line
|
|
386
|
+
end
|
|
387
|
+
if previous < b then out[#out + 1] = string.format('\t... (%d lines omitted) ...', b - previous) end
|
|
335
388
|
end
|
|
336
389
|
end
|
|
337
390
|
return table.concat(out, '\n'), span > full
|
|
@@ -342,7 +395,7 @@ local function label(G, id)
|
|
|
342
395
|
return string.format('%s %s (%s)', node.kind, node.qualified, graph.where(G, id))
|
|
343
396
|
end
|
|
344
397
|
|
|
345
|
-
local edge_label = require('codeoutline.query_report').edge_label
|
|
398
|
+
local edge_label = require('codeoutline.query.query_report').edge_label
|
|
346
399
|
|
|
347
400
|
local function candidate_text(G, idx, report, in_order)
|
|
348
401
|
if #report.entries == 0 then return nil end
|
|
@@ -385,11 +438,11 @@ local function run(G, idx, query, opts)
|
|
|
385
438
|
local query_opts = {}
|
|
386
439
|
for key, value in pairs(opts) do query_opts[key] = value end
|
|
387
440
|
query_opts.explain = true
|
|
388
|
-
local ranking = require('codeoutline.search_ranking').policy(G.root or idx.root)
|
|
441
|
+
local ranking = require('codeoutline.query.search_ranking').policy(G.root or idx.root)
|
|
389
442
|
G = graph.query(G, query_opts)
|
|
390
443
|
G.stats.ranking = ranking.stats
|
|
391
444
|
file_cache, source_cache = {}, {}
|
|
392
|
-
local filters = require('codeoutline.query_filters').parse(query)
|
|
445
|
+
local filters = require('codeoutline.query.query_filters').parse(query)
|
|
393
446
|
local ranked, named_files = find_seeds(G, filters.text, filters, ranking)
|
|
394
447
|
|
|
395
448
|
-- Seeds: top-ranked, but at most 3 definitions per name so one generic
|
|
@@ -416,7 +469,7 @@ local function run(G, idx, query, opts)
|
|
|
416
469
|
|
|
417
470
|
-- Spine: nodes on call paths between seeds.
|
|
418
471
|
local flows, spine, on_spine, flow_edges, flow_files, non_call_paths = {}, {}, {}, {}, {}, false
|
|
419
|
-
local reports = require('codeoutline.query_report')
|
|
472
|
+
local reports = require('codeoutline.query.query_report')
|
|
420
473
|
local searches, missed, connected = {}, {}, {}
|
|
421
474
|
local path_limited = false
|
|
422
475
|
for _, a in ipairs(seeds) do
|
|
@@ -566,6 +619,13 @@ local function run(G, idx, query, opts)
|
|
|
566
619
|
elseif #candidates.entries > 0 then candidate_cut = true end
|
|
567
620
|
omitted = omitted or candidate_cut
|
|
568
621
|
|
|
622
|
+
local focus = {}
|
|
623
|
+
for _, hops in ipairs(flow_edges) do
|
|
624
|
+
for _, hop in ipairs(hops) do
|
|
625
|
+
focus[hop.source] = focus[hop.source] or {}
|
|
626
|
+
focus[hop.source][#focus[hop.source] + 1] = hop.line
|
|
627
|
+
end
|
|
628
|
+
end
|
|
569
629
|
local reserve = math.floor(budget * 0.15) -- keep room for sections 3-4
|
|
570
630
|
for _, f in ipairs(file_order) do
|
|
571
631
|
local rec = G.files[f]
|
|
@@ -577,8 +637,8 @@ local function run(G, idx, query, opts)
|
|
|
577
637
|
checked_source(idx, rec.path)
|
|
578
638
|
local ol = {}
|
|
579
639
|
for _, node in ipairs(rec.nodes) do
|
|
580
|
-
if not node.parent and node.kind ~= 'macro' and require('codeoutline.query_filters').node(filters, rec, node) then
|
|
581
|
-
ol[#ol + 1] = string.format('%d\t%s %s', node.line, node.kind, require('codeoutline.navigation').detail(G, f, node).sig or node.name)
|
|
640
|
+
if not node.parent and node.kind ~= 'macro' and require('codeoutline.query.query_filters').node(filters, rec, node) then
|
|
641
|
+
ol[#ol + 1] = string.format('%d\t%s %s', node.line, node.kind, require('codeoutline.query.navigation').detail(G, f, node).sig or node.name)
|
|
582
642
|
end
|
|
583
643
|
if #ol >= 60 then ol[#ol + 1] = '\t...'; break end
|
|
584
644
|
end
|
|
@@ -587,7 +647,7 @@ local function run(G, idx, query, opts)
|
|
|
587
647
|
elseif items.outline then omitted = true end
|
|
588
648
|
for _, item in ipairs(items) do
|
|
589
649
|
if not shown[item.id] and used + #header + 16 < budget - reserve then
|
|
590
|
-
local block, source_cut = node_block(G, idx, item.id, item.full)
|
|
650
|
+
local block, source_cut = node_block(G, idx, item.id, item.full, focus[item.id])
|
|
591
651
|
omitted = omitted or source_cut
|
|
592
652
|
local need = #block + (wrote_header and 0 or #header + 1) + 1
|
|
593
653
|
if used + need < budget - reserve then
|
|
@@ -664,7 +724,7 @@ local function run(G, idx, query, opts)
|
|
|
664
724
|
end
|
|
665
725
|
|
|
666
726
|
if G.incomplete then
|
|
667
|
-
local reasons = require('codeoutline.coverage').relations({ relationships_incomplete = true, query_stats = G.stats })
|
|
727
|
+
local reasons = require('codeoutline.query.coverage').relations({ relationships_incomplete = true, query_stats = G.stats })
|
|
668
728
|
prepend('Relationships incomplete: ' .. table.concat(reasons, ', ') .. '.')
|
|
669
729
|
end
|
|
670
730
|
if path_limited then
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
-- Declaration navigation in selected external headers. Never extend the index.
|
|
2
2
|
local M = { MAX_FILES = 64, MAX_PROJECT_FILES = 128, MAX_BYTES = 4 * 1024 * 1024,
|
|
3
3
|
MAX_FILE_BYTES = 1024 * 1024, CACHE_FILES = 32, CACHE_BYTES = 8 * 1024 * 1024, TIME_MS = 500 }
|
|
4
|
-
local paths, control = require('codeoutline.path'), require('codeoutline.control')
|
|
4
|
+
local paths, control = require('codeoutline.shared.path'), require('codeoutline.shared.control')
|
|
5
5
|
local cache, order, cache_bytes, scanner = {}, {}, 0, nil
|
|
6
6
|
local function directory(file) return file:match('^(.*)/[^/]+$') end
|
|
7
7
|
local function existing(file)
|
|
@@ -31,7 +31,7 @@ local function read(file, info)
|
|
|
31
31
|
if not scanner then
|
|
32
32
|
local config = {}; for k, v in pairs(require('codeoutline.lang.c').config) do config[k] = v end
|
|
33
33
|
config.pp_first_branch = false
|
|
34
|
-
scanner = require('codeoutline.xscan').lang(config)
|
|
34
|
+
scanner = require('codeoutline.parsing.xscan').lang(config)
|
|
35
35
|
end
|
|
36
36
|
local T = scanner:tokenize(source)
|
|
37
37
|
local imports = {}
|
|
@@ -58,7 +58,7 @@ local function declarations(entry, name, type_site, prefix)
|
|
|
58
58
|
local source = prefix and entry.source:lower() or entry.source
|
|
59
59
|
if not source:find('%f[%w_$]' .. escaped .. (prefix and '' or '%f[^%w_$]')) then return {} end
|
|
60
60
|
if not entry.nodes then
|
|
61
|
-
local rec = require('codeoutline.parse').parse(entry.file, entry.source, { type_uses = false, analysis = false })
|
|
61
|
+
local rec = require('codeoutline.parsing.parse').parse(entry.file, entry.source, { type_uses = false, analysis = false })
|
|
62
62
|
entry.nodes = rec and rec.nodes or {}
|
|
63
63
|
local weight = #entry.nodes * 256
|
|
64
64
|
if cache[paths.key(entry.file)] == entry then
|
|
@@ -72,7 +72,7 @@ local function declarations(entry, name, type_site, prefix)
|
|
|
72
72
|
for _, node in ipairs(entry.nodes) do
|
|
73
73
|
if (prefix and node.name:sub(1, #name):lower() == name or not prefix and node.name == name)
|
|
74
74
|
and node.qualified == node.name and not node.parent and node.name_start
|
|
75
|
-
and (type_site and require('codeoutline.type_references').kinds[node.kind]
|
|
75
|
+
and (type_site and require('codeoutline.query.type_references').kinds[node.kind]
|
|
76
76
|
or not type_site and (node.kind == 'prototype' or node.kind == 'function')) then
|
|
77
77
|
result[#result + 1] = { node = node, file = entry.file, source = entry.source,
|
|
78
78
|
declaration = node.kind == 'prototype' or node.decl == true }
|
|
@@ -87,8 +87,8 @@ function M.find(G, f, site, ctx, system_directories, completion)
|
|
|
87
87
|
and not site.recv and site.evidence and site.evidence.written == site.name
|
|
88
88
|
and not site.evidence.value_shadowed
|
|
89
89
|
if not site or site.recv or not type_site and (site.kind ~= 'call'
|
|
90
|
-
or not require('codeoutline.definition_candidates').allowed(site)) then return {}, info end
|
|
91
|
-
local includes = require('codeoutline.cpp_includes')
|
|
90
|
+
or not require('codeoutline.query.definition_candidates').allowed(site)) then return {}, info end
|
|
91
|
+
local includes = require('codeoutline.analysis.cpp.cpp_includes')
|
|
92
92
|
local headers, queued, projects, visited, project_queued = {}, {}, { f }, {}, { [f] = true }
|
|
93
93
|
local defaults, started = nil, xtimer.now_ms()
|
|
94
94
|
local function expired()
|