@codua/codeoutline-win32-x64 0.3.2 → 0.3.6
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/DISTRIBUTION.md +26 -1
- package/README.md +39 -4
- package/README.zh-CN.md +30 -3
- package/bin/xnet.exe +0 -0
- package/build-info.json +1 -1
- package/codeoutline +1 -1
- package/codeoutline.cmd +1 -0
- 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} +1 -1
- 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} +16 -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} +97 -11
- 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 +547 -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 +236 -19
- 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} +105 -10
- package/scripts/codeoutline/{editor_install.lua → install/editor_install.lua} +36 -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} +6 -6
- 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} +53 -54
- 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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
-- Explicit unknown-suffix files live in a bounded query overlay, never in idx.
|
|
2
2
|
local M = { MAX_FILES = 4, MAX_BYTES = 2 * 1048576, MAX_PROBES = 16 }
|
|
3
|
-
local graph = require('codeoutline.graph')
|
|
4
|
-
local parse = require('codeoutline.parse')
|
|
5
|
-
local documents = require('codeoutline.documents')
|
|
6
|
-
local paths = require('codeoutline.path')
|
|
7
|
-
local control = require('codeoutline.control')
|
|
3
|
+
local graph = require('codeoutline.analysis.graph')
|
|
4
|
+
local parse = require('codeoutline.parsing.parse')
|
|
5
|
+
local documents = require('codeoutline.query.documents')
|
|
6
|
+
local paths = require('codeoutline.shared.path')
|
|
7
|
+
local control = require('codeoutline.shared.control')
|
|
8
8
|
|
|
9
9
|
local function fork(G)
|
|
10
10
|
local V = setmetatable({}, { __index = G })
|
|
@@ -57,7 +57,7 @@ function M.open(G, idx, query)
|
|
|
57
57
|
result.truncated = true
|
|
58
58
|
else
|
|
59
59
|
local doc = documents.read(real)
|
|
60
|
-
local filters = require('codeoutline.query_filters').parse(query)
|
|
60
|
+
local filters = require('codeoutline.query.query_filters').parse(query)
|
|
61
61
|
local hint = #filters.languages == 1 and filters.languages[1] or nil
|
|
62
62
|
local rec = doc and parse.parse(rel, doc.source, { detect = true, language = hint, ordinary_bindings = true })
|
|
63
63
|
if rec then
|
|
@@ -10,7 +10,7 @@ end
|
|
|
10
10
|
local function renderer(G, initial)
|
|
11
11
|
local lines, references, size = {}, {}, 0
|
|
12
12
|
local function append(line, ids, registration)
|
|
13
|
-
line = require('codeoutline.text').valid(line)
|
|
13
|
+
line = require('codeoutline.shared.text').valid(line)
|
|
14
14
|
local files, seen = {}, {}
|
|
15
15
|
local function add(f) if f and not seen[f] then seen[f] = true; files[#files + 1] = f end end
|
|
16
16
|
for _, id in ipairs(ids or {}) do add(G.node_file[id]) end
|
|
@@ -27,7 +27,7 @@ function M.new(limit)
|
|
|
27
27
|
local seen = {}
|
|
28
28
|
function report:add(entry)
|
|
29
29
|
local key = table.concat({ entry.source or '', entry.target or '', entry.line or '',
|
|
30
|
-
entry.kind or '', entry.reason or '', entry.rule or '', entry.call or '' }, ':')
|
|
30
|
+
entry.kind or '', entry.reason or '', entry.rule or '', entry.call or '', entry.candidate or '' }, ':')
|
|
31
31
|
if seen[key] then return end
|
|
32
32
|
if #self.entries >= (limit or 64) then self.truncated = true; return end
|
|
33
33
|
seen[key] = true
|
|
@@ -82,7 +82,7 @@ function M.path_breakpoints(report, G, searches, connected)
|
|
|
82
82
|
table.sort(candidates, function(a, b)
|
|
83
83
|
if a.priority ~= b.priority then return a.priority > b.priority end
|
|
84
84
|
if #a.path ~= #b.path then return #a.path > #b.path end
|
|
85
|
-
if a.from ~= b.from then return require('codeoutline.graph').before(G, a.from, b.from) end
|
|
85
|
+
if a.from ~= b.from then return require('codeoutline.analysis.graph').before(G, a.from, b.from) end
|
|
86
86
|
if (a.line or 0) ~= (b.line or 0) then return (a.line or 0) < (b.line or 0) end
|
|
87
87
|
return (a.call or '') < (b.call or '')
|
|
88
88
|
end)
|
|
@@ -105,7 +105,7 @@ end
|
|
|
105
105
|
|
|
106
106
|
function M.render_breakpoints(report, G)
|
|
107
107
|
if #report.entries == 0 then return nil end
|
|
108
|
-
local graph = require('codeoutline.graph')
|
|
108
|
+
local graph = require('codeoutline.analysis.graph')
|
|
109
109
|
local function label(id) return G.nodes[id].qualified .. ' (' .. graph.where(G, id) .. ')' end
|
|
110
110
|
local special = false
|
|
111
111
|
for _, entry in ipairs(report.entries) do
|
|
@@ -153,8 +153,12 @@ function M.render(report, G)
|
|
|
153
153
|
if e.call then detail = detail .. ' via ' .. e.call end
|
|
154
154
|
if e.rule then detail = detail .. ' (rule #' .. e.rule .. ', argument ' .. e.argument .. ')' end
|
|
155
155
|
if e.registered_at then detail = detail .. '; registered at ' .. e.registered_at end
|
|
156
|
+
if e.candidate then
|
|
157
|
+
detail = detail .. '; unconfirmed dispatch candidate: ' .. G.nodes[e.candidate].qualified
|
|
158
|
+
.. ' (' .. require('codeoutline.analysis.graph').where(G, e.candidate) .. '); not a call edge'
|
|
159
|
+
end
|
|
156
160
|
append(string.format('- %s:%d %s%s: %s', path, e.line or 0,
|
|
157
|
-
source and source.qualified or '?', target and ' -> ' .. target or '', detail), { e.source, e.target }, e.registered_at)
|
|
161
|
+
source and source.qualified or '?', target and ' -> ' .. target or '', detail), { e.source, e.target or e.candidate }, e.registered_at)
|
|
158
162
|
end
|
|
159
163
|
if report.truncated then append('Evidence limit reached; additional explanations omitted.') end
|
|
160
164
|
return finish()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
-- Per-query search policy. Directory penalties never change graph visibility.
|
|
2
|
-
local rules = require('codeoutline.rules')
|
|
3
|
-
local text = require('codeoutline.text')
|
|
2
|
+
local rules = require('codeoutline.shared.rules')
|
|
3
|
+
local text = require('codeoutline.shared.text')
|
|
4
4
|
local M = { MAX_DIRECTORIES = 32, MAX_PATH_BYTES = 1024, PENALTY = 6 }
|
|
5
5
|
local defaults = { '/3rd/', '^3rd/', '/third_party/', '^third_party/', '/thirdparty/',
|
|
6
6
|
'/vendor/', '^vendor/', '/node_modules/', '/external/', '^external/', '/deps/', '^deps/' }
|
|
@@ -42,10 +42,9 @@ function M.policy(root)
|
|
|
42
42
|
local cache = {}
|
|
43
43
|
local P = { configured = configured, stats = { configured = configured,
|
|
44
44
|
rules = configured and #prefixes or #defaults, checked_files = 0, matched_files = 0 } }
|
|
45
|
-
function P.penalty(path, explicit)
|
|
46
|
-
--
|
|
47
|
-
|
|
48
|
-
if configured and explicit then return 0 end
|
|
45
|
+
function P.penalty(path, explicit, node)
|
|
46
|
+
-- Exact qualified requests bypass both configured and default hints.
|
|
47
|
+
if explicit then return 0 end
|
|
49
48
|
local amount = cache[path]
|
|
50
49
|
if amount == nil then
|
|
51
50
|
amount = 0
|
|
@@ -57,12 +56,16 @@ function M.policy(root)
|
|
|
57
56
|
for _, pattern in ipairs(defaults) do
|
|
58
57
|
if path:find(pattern) then amount = M.PENALTY; break end
|
|
59
58
|
end
|
|
59
|
+
local lower = '/' .. path:lower()
|
|
60
|
+
if lower:match('%.min%.[cm]?js$') or lower:match('%.bundle%.js$') then amount = math.max(amount, 18) end
|
|
61
|
+
if lower:find('/builtins/', 1, true) or lower:find('/typings/', 1, true)
|
|
62
|
+
or lower:match('%.d%.[cm]?ts$') then amount = math.max(amount, 10) end
|
|
60
63
|
end
|
|
61
64
|
cache[path] = amount
|
|
62
65
|
P.stats.checked_files = P.stats.checked_files + 1
|
|
63
66
|
if amount > 0 then P.stats.matched_files = P.stats.matched_files + 1 end
|
|
64
67
|
end
|
|
65
|
-
return amount
|
|
68
|
+
return amount + (not configured and node and (node.decl or node.kind == 'prototype') and 4 or 0)
|
|
66
69
|
end
|
|
67
70
|
return P
|
|
68
71
|
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
-- Declared type relationships over resident headers, resolved only for this query.
|
|
2
2
|
local M = { MAX_CANDIDATES = 512, MAX_SCAN_NODES = 1000000, MAX_FILES = 128,
|
|
3
3
|
MAX_BYTES = 8 * 1024 * 1024, MAX_BASES = 64, MAX_EDGES = 4096 }
|
|
4
|
-
local graph = require('codeoutline.graph')
|
|
5
|
-
local control = require('codeoutline.control')
|
|
4
|
+
local graph = require('codeoutline.analysis.graph')
|
|
5
|
+
local control = require('codeoutline.shared.control')
|
|
6
6
|
local kinds = { class = true, interface = true, struct = true, record = true }
|
|
7
7
|
local languages = { csharp = true, java = true, kotlin = true, typescript = true, cpp = true }
|
|
8
8
|
|
|
9
9
|
function M.validate(query, opts)
|
|
10
|
-
local budget = require('codeoutline.explore').validate(query, opts)
|
|
11
|
-
assert(require('codeoutline.query_filters').parse(query).text ~= '', 'type hierarchy requires an exact type name in addition to filters')
|
|
10
|
+
local budget = require('codeoutline.query.explore').validate(query, opts)
|
|
11
|
+
assert(require('codeoutline.query.query_filters').parse(query).text ~= '', 'type hierarchy requires an exact type name in addition to filters')
|
|
12
12
|
opts = opts or {}
|
|
13
13
|
for _, item in ipairs({ { 'depth', 8, 32 }, { 'max_nodes', 200, 2000 } }) do
|
|
14
14
|
local value = opts[item[1]]
|
|
@@ -37,7 +37,7 @@ local function run(G, idx, query, opts, retry)
|
|
|
37
37
|
relationships_incomplete = false, cycle_detected = false,
|
|
38
38
|
query_stats = { scanned_nodes = 0, candidates = 0, source_files = 0, source_bytes = 0, reverse_unresolved = 0 } }
|
|
39
39
|
local stats, limited = result.query_stats, {}
|
|
40
|
-
local ctx = require('codeoutline.js_resolution').context(G)
|
|
40
|
+
local ctx = require('codeoutline.analysis.js.js_resolution').context(G)
|
|
41
41
|
ctx.include_paths = opts.include_paths
|
|
42
42
|
local loaded, summaries, parents, issues = {}, {}, {}, {}
|
|
43
43
|
local function source(f)
|
|
@@ -57,7 +57,7 @@ local function run(G, idx, query, opts, retry)
|
|
|
57
57
|
return raw
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
|
-
ctx.ordinary = require('codeoutline.ordinary_bindings').context(G, ctx,
|
|
60
|
+
ctx.ordinary = require('codeoutline.analysis.ordinary_bindings').context(G, ctx,
|
|
61
61
|
(idx or G.root) and function(f)
|
|
62
62
|
if idx then return source(f) end
|
|
63
63
|
source(f) -- enforce the same budget for direct graph embeddings
|
|
@@ -120,11 +120,11 @@ local function run(G, idx, query, opts, retry)
|
|
|
120
120
|
end
|
|
121
121
|
local ids
|
|
122
122
|
if language == 'cpp' then
|
|
123
|
-
ids = require('codeoutline.cpp_types').resolve(G, f, base.written, {
|
|
123
|
+
ids = require('codeoutline.analysis.cpp.cpp_types').resolve(G, f, base.written, {
|
|
124
124
|
context = ctx, scope = n.qualified, at = evidence.at, accept = kinds,
|
|
125
125
|
undecorated = true, definitions = true, aliases = function(g) return data(g).aliases end })
|
|
126
126
|
else
|
|
127
|
-
ids = require('codeoutline.implementations').types(G, f, base.written, ctx, n.qualified, evidence.at)
|
|
127
|
+
ids = require('codeoutline.analysis.implementations').types(G, f, base.written, ctx, n.qualified, evidence.at)
|
|
128
128
|
end
|
|
129
129
|
if #ids == 1 and supported(ids[1]) then
|
|
130
130
|
local parent = ids[1]
|
|
@@ -155,10 +155,10 @@ local function run(G, idx, query, opts, retry)
|
|
|
155
155
|
return out
|
|
156
156
|
end
|
|
157
157
|
local ordered = {}
|
|
158
|
-
local filters = require('codeoutline.query_filters').parse(query)
|
|
158
|
+
local filters = require('codeoutline.query.query_filters').parse(query)
|
|
159
159
|
for i, id in ipairs(G.by_qualified[filters.text] or G.by_name[filters.text] or {}) do
|
|
160
160
|
if i % 256 == 0 then control.check() end
|
|
161
|
-
if supported(id) and not G.nodes[id].decl and require('codeoutline.query_filters').id(filters, G, id) then
|
|
161
|
+
if supported(id) and not G.nodes[id].decl and require('codeoutline.query.query_filters').id(filters, G, id) then
|
|
162
162
|
if #ordered >= cap then result.node_limit_reached = true; break end
|
|
163
163
|
ordered[#ordered + 1] = id
|
|
164
164
|
end
|
|
@@ -305,7 +305,7 @@ local function run(G, idx, query, opts, retry)
|
|
|
305
305
|
lines[#lines + 1] = string.format('Unresolved: %s -> %s (%s:%d): %s', entry.name,
|
|
306
306
|
entry.written or '?', entry.file, entry.line, entry.reason)
|
|
307
307
|
end
|
|
308
|
-
local output, cut = require('codeoutline.text').limit(table.concat(lines, '\n'), budget)
|
|
308
|
+
local output, cut = require('codeoutline.shared.text').limit(table.concat(lines, '\n'), budget)
|
|
309
309
|
result.truncated = cut
|
|
310
310
|
return output, result
|
|
311
311
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
-- Query explicit type sites without a separate resident type-use graph.
|
|
2
|
-
local graph, control = require('codeoutline.graph'), require('codeoutline.control')
|
|
2
|
+
local graph, control = require('codeoutline.analysis.graph'), require('codeoutline.shared.control')
|
|
3
3
|
local M = { MAX_FILES = 64, MAX_BYTES = 8 * 1024 * 1024, MAX_NAMES = 32, MAX_SITES = 4096,
|
|
4
4
|
MAX_SCAN_FILES = 20000, MAX_SCAN_BYTES = 256 * 1024 * 1024, TIME_MS = 5000 }
|
|
5
5
|
M.kinds = { class = true, struct = true, union = true, interface = true, enum = true, record = true, typedef = true, annotation_type = true, trait = true }
|
|
6
|
-
local languages = require('codeoutline.type_uses').languages
|
|
6
|
+
local languages = require('codeoutline.analysis.type_uses').languages
|
|
7
7
|
function M.validate(query, opts)
|
|
8
|
-
local budget = require('codeoutline.explore').validate(query, opts)
|
|
9
|
-
assert(require('codeoutline.query_filters').parse(query).text ~= '', 'type references require an exact type name')
|
|
8
|
+
local budget = require('codeoutline.query.explore').validate(query, opts)
|
|
9
|
+
assert(require('codeoutline.query.query_filters').parse(query).text ~= '', 'type references require an exact type name')
|
|
10
10
|
local cap = opts and opts.max_nodes or 200
|
|
11
11
|
assert(type(cap) == 'number' and cap % 1 == 0 and cap >= 1 and cap <= 2000, 'max_nodes must be an integer between 1 and 2000')
|
|
12
12
|
return budget
|
|
@@ -21,7 +21,7 @@ function M.resolve(G, f, from, site, ctx, details, navigation)
|
|
|
21
21
|
local scope = from and from > 0 and G.nodes[from] and G.nodes[from].qualified or ''
|
|
22
22
|
local ids
|
|
23
23
|
if language == 'cpp' then
|
|
24
|
-
ids = require('codeoutline.cpp_types').resolve(G, f, written, { context = ctx, scope = scope,
|
|
24
|
+
ids = require('codeoutline.analysis.cpp.cpp_types').resolve(G, f, written, { context = ctx, scope = scope,
|
|
25
25
|
at = site.at, accept = M.kinds, definitions = true, navigation_alias = navigation })
|
|
26
26
|
elseif language == 'c' then
|
|
27
27
|
local visible = graph.visible_dependencies(G, f, ctx); ids = {}
|
|
@@ -36,26 +36,26 @@ function M.resolve(G, f, from, site, ctx, details, navigation)
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
if #own > 0 then ids = own end
|
|
39
|
-
elseif language == 'go' then ids = require('codeoutline.go_methods').context(G, ctx).types(f, written)
|
|
39
|
+
elseif language == 'go' then ids = require('codeoutline.analysis.go.go_methods').context(G, ctx).types(f, written)
|
|
40
40
|
elseif language == 'rust' then
|
|
41
|
-
local resolver = require('codeoutline.rust_resolution')
|
|
41
|
+
local resolver = require('codeoutline.analysis.rust.rust_resolution')
|
|
42
42
|
local entry = resolver.path(G, f, written, ctx, resolver.scope(G, f, from)); ids = entry and entry.ids or {}
|
|
43
|
-
if not entry and not require('codeoutline.rust_packages').owner(G, f, ctx) then
|
|
43
|
+
if not entry and not require('codeoutline.analysis.rust.rust_packages').owner(G, f, ctx) then
|
|
44
44
|
for _, id in ipairs(G.by_name[written] or {}) do
|
|
45
45
|
if G.node_file[id] == f and G.nodes[id].qualified == written then ids[#ids + 1] = id end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
elseif language == 'typescript' or language == 'arkts' then
|
|
49
|
-
ids = require('codeoutline.ts_implementations').types(G, f, written, ctx)
|
|
49
|
+
ids = require('codeoutline.analysis.js.ts_implementations').types(G, f, written, ctx)
|
|
50
50
|
if #ids == 0 then
|
|
51
51
|
for _, imp in ipairs(G.files[f].js_imports or {}) do
|
|
52
|
-
if imp.local_name == written and imp.imported ~= '*' then ids = require('codeoutline.js_resolution').imported(G, f, imp.path, imp.imported, ctx); break end
|
|
52
|
+
if imp.local_name == written and imp.imported ~= '*' then ids = require('codeoutline.analysis.js.js_resolution').imported(G, f, imp.path, imp.imported, ctx); break end
|
|
53
53
|
end
|
|
54
54
|
if #ids == 0 then
|
|
55
55
|
for _, id in ipairs(G.by_name[written] or {}) do if G.node_file[id] == f and not G.nodes[id].parent then ids[#ids + 1] = id end end
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
|
-
else ids = require('codeoutline.implementations').types(G, f, written, ctx, scope, site.at) end
|
|
58
|
+
else ids = require('codeoutline.analysis.implementations').types(G, f, written, ctx, scope, site.at) end
|
|
59
59
|
local result = {}
|
|
60
60
|
for _, id in ipairs(ids or {}) do if M.kinds[G.nodes[id].kind] then result[#result + 1] = id end end
|
|
61
61
|
return result, #result > 1 and 'ambiguous type' or #result == 0 and 'unresolved type' or nil
|
|
@@ -87,7 +87,7 @@ function M.query(G, idx, targets, opts)
|
|
|
87
87
|
names[name], name_count = true, name_count + 1
|
|
88
88
|
end
|
|
89
89
|
if #targets == 0 then return result end
|
|
90
|
-
local ctx = require('codeoutline.js_resolution').context(G); ctx.include_paths = opts.include_paths
|
|
90
|
+
local ctx = require('codeoutline.analysis.js.js_resolution').context(G); ctx.include_paths = opts.include_paths
|
|
91
91
|
local function source(f)
|
|
92
92
|
if not loaded[f] then
|
|
93
93
|
if stats.source_files >= (opts.max_files or M.MAX_FILES) then limited('type_reference_file_limit') end
|
|
@@ -100,7 +100,7 @@ function M.query(G, idx, targets, opts)
|
|
|
100
100
|
return assert(raw, 'cannot read type reference source')
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
|
-
ctx.ordinary = require('codeoutline.ordinary_bindings').context(G, ctx,
|
|
103
|
+
ctx.ordinary = require('codeoutline.analysis.ordinary_bindings').context(G, ctx,
|
|
104
104
|
(idx or G.root) and function(f) return source(f) end or nil, opts.cache and { cache = opts.cache } or nil)
|
|
105
105
|
stats.ordinary = ctx.ordinary.stats
|
|
106
106
|
local summaries, summary_bytes = {}, 0
|
|
@@ -186,7 +186,7 @@ function M.query(G, idx, targets, opts)
|
|
|
186
186
|
if alias and names[tail] then add_name(alias) end
|
|
187
187
|
for _, hint in ipairs(imp.type_aliases or {}) do if names[hint.name] then add_name(hint.alias) end end
|
|
188
188
|
if imp.imported == 'default' and alias then
|
|
189
|
-
local imported = require('codeoutline.js_resolution').imported(G, f, imp.path, imp.imported, ctx)
|
|
189
|
+
local imported = require('codeoutline.analysis.js.js_resolution').imported(G, f, imp.path, imp.imported, ctx)
|
|
190
190
|
if matches(imported) then add_name(alias) end
|
|
191
191
|
end
|
|
192
192
|
end
|
|
@@ -260,11 +260,11 @@ function M.query(G, idx, targets, opts)
|
|
|
260
260
|
end
|
|
261
261
|
local function run(G, idx, query, opts, retry)
|
|
262
262
|
local budget = M.validate(query, opts)
|
|
263
|
-
local filters = require('codeoutline.query_filters').parse(query)
|
|
263
|
+
local filters = require('codeoutline.query.query_filters').parse(query)
|
|
264
264
|
local ids = {}
|
|
265
265
|
for number, id in ipairs(G.by_qualified[filters.text] or G.by_name[filters.text] or {}) do
|
|
266
266
|
if number % 256 == 0 then control.check() end
|
|
267
|
-
if M.kinds[G.nodes[id].kind] and languages[G.files[G.node_file[id]].language] and require('codeoutline.query_filters').id(filters, G, id) then
|
|
267
|
+
if M.kinds[G.nodes[id].kind] and languages[G.files[G.node_file[id]].language] and require('codeoutline.query.query_filters').id(filters, G, id) then
|
|
268
268
|
ids[#ids + 1] = id
|
|
269
269
|
if #ids > (opts.max_nodes or 200) then break end
|
|
270
270
|
end
|
|
@@ -278,7 +278,7 @@ local function run(G, idx, query, opts, retry)
|
|
|
278
278
|
for _, ref in ipairs(result.references) do lines[#lines + 1] = string.format('- %s:%d [%s] %s', ref.file, ref.line, ref.role, ref.written) end
|
|
279
279
|
if #ids == 0 then lines[#lines + 1] = 'No supported type matched; use an exact type name or qualified name.' end
|
|
280
280
|
if result.incomplete then lines[#lines + 1] = string.format('Coverage incomplete; %d unresolved and %d ambiguous candidate sites.', result.unresolved_sites, result.ambiguous_sites) end
|
|
281
|
-
local output, cut = require('codeoutline.text').limit(table.concat(lines, '\n'), budget, result.node_limit_reached)
|
|
281
|
+
local output, cut = require('codeoutline.shared.text').limit(table.concat(lines, '\n'), budget, result.node_limit_reached)
|
|
282
282
|
result.truncated = cut; return output, result
|
|
283
283
|
end
|
|
284
284
|
function M.run(G, idx, query, opts)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
local source = assert(xutils.realpath(debug.getinfo(1, 'S').source:sub(2))):gsub('\\', '/')
|
|
2
|
-
local scripts = assert(source:match('^(.*)/codeoutline/[^/]+$'))
|
|
2
|
+
local scripts = assert(source:match('^(.*)/codeoutline/runtime/[^/]+$'))
|
|
3
3
|
package.path = scripts .. '/?.lua;' .. package.path
|
|
4
4
|
local service = require('codeoutline.service')
|
|
5
|
-
local paths = require('codeoutline.path')
|
|
6
|
-
local control = require('codeoutline.control')
|
|
7
|
-
local documents = require('codeoutline.documents')
|
|
8
|
-
local lsp = require('codeoutline.lsp')
|
|
9
|
-
local navigation = require('codeoutline.navigation')
|
|
10
|
-
local pool = require('codeoutline.parse_pool')
|
|
11
|
-
require('codeoutline.completion') -- registers lsp_completion
|
|
5
|
+
local paths = require('codeoutline.shared.path')
|
|
6
|
+
local control = require('codeoutline.shared.control')
|
|
7
|
+
local documents = require('codeoutline.query.documents')
|
|
8
|
+
local lsp = require('codeoutline.protocol.lsp')
|
|
9
|
+
local navigation = require('codeoutline.query.navigation')
|
|
10
|
+
local pool = require('codeoutline.indexing.parse_pool')
|
|
11
|
+
require('codeoutline.query.completion') -- registers lsp_completion
|
|
12
12
|
service.configure({ watch = true })
|
|
13
13
|
local shared = assert(xshared.dict('codeoutline_control'))
|
|
14
14
|
|
|
@@ -85,7 +85,7 @@ local gc_every = gc_option('CODEOUTLINE_LSP_GC_EVERY', 1, 0)
|
|
|
85
85
|
local requests = 0
|
|
86
86
|
local gc_delay_ms = gc_option('CODEOUTLINE_LSP_GC_DELAY_MS', 1, 0)
|
|
87
87
|
local gc_step_kb = gc_option('CODEOUTLINE_LSP_GC_STEP_KB', 4096, 1)
|
|
88
|
-
local timer_gc = require('codeoutline.idle_gc').new({
|
|
88
|
+
local timer_gc = require('codeoutline.runtime.idle_gc').new({
|
|
89
89
|
delay_ms = gc_delay_ms,
|
|
90
90
|
busy = function() return active ~= nil or #queue > 0 end,
|
|
91
91
|
request = service.request_collection,
|
|
@@ -141,7 +141,7 @@ return {
|
|
|
141
141
|
assert(xnet.init())
|
|
142
142
|
xtimer.init()
|
|
143
143
|
local threads = tonumber(os.getenv('CODEOUTLINE_INDEX_THREADS') or '') or pool.THREADS
|
|
144
|
-
pool.configure(scripts .. '/codeoutline/parse_worker.lua', math.max(0, math.floor(threads)))
|
|
144
|
+
pool.configure(scripts .. '/codeoutline/runtime/parse_worker.lua', math.max(0, math.floor(threads)))
|
|
145
145
|
assert(xthread.post(1, 'worker_ready'))
|
|
146
146
|
end,
|
|
147
147
|
-- A suspended job still holds its project: sweeping waits for it. Idle
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
-- Parse thread for parse_pool.lua: reads and parses the files it is posted
|
|
2
2
|
-- and posts the results back to the thread that owns the index.
|
|
3
3
|
local source = assert(xutils.realpath(debug.getinfo(1, 'S').source:sub(2))):gsub('\\', '/')
|
|
4
|
-
local scripts = assert(source:match('^(.*)/codeoutline/[^/]+$'))
|
|
4
|
+
local scripts = assert(source:match('^(.*)/codeoutline/runtime/[^/]+$'))
|
|
5
5
|
package.path = scripts .. '/?.lua;' .. package.path
|
|
6
|
-
local index = require('codeoutline.index')
|
|
6
|
+
local index = require('codeoutline.indexing.index')
|
|
7
7
|
local shared = assert(xshared.dict('codeoutline_control'))
|
|
8
8
|
|
|
9
9
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
-- Background update thread: network, verification and installation stay off the
|
|
2
2
|
-- service thread. Checks at startup and then hourly while the service runs.
|
|
3
3
|
local source = assert(xutils.realpath(debug.getinfo(1, 'S').source:sub(2))):gsub('\\', '/')
|
|
4
|
-
local scripts = assert(source:match('^(.*)/codeoutline/[^/]+$'))
|
|
4
|
+
local scripts = assert(source:match('^(.*)/codeoutline/runtime/[^/]+$'))
|
|
5
5
|
package.path = scripts .. '/?.lua;' .. package.path
|
|
6
6
|
local updater = require('codeoutline.updater')
|
|
7
7
|
local INTERVAL_MS = 3600000
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
-- Requests within one Lua state are serialized by the owning transport.
|
|
2
|
-
local index = require('codeoutline.index')
|
|
3
|
-
local explore = require('codeoutline.explore')
|
|
4
|
-
local paths = require('codeoutline.path')
|
|
5
|
-
local control = require('codeoutline.control')
|
|
2
|
+
local index = require('codeoutline.indexing.index')
|
|
3
|
+
local explore = require('codeoutline.query.explore')
|
|
4
|
+
local paths = require('codeoutline.shared.path')
|
|
5
|
+
local control = require('codeoutline.shared.control')
|
|
6
6
|
local M = {}
|
|
7
7
|
-- Loading uses tighter GC thresholds; queries retain the caller's settings.
|
|
8
8
|
local startup_gc = os.getenv('CODEOUTLINE_MEMORY_POLICY') ~= 'default'
|
|
@@ -187,7 +187,7 @@ local function execute_query(engine, root, query, opts)
|
|
|
187
187
|
while true do
|
|
188
188
|
-- A GBK repair commits the decoded file, which renumbers its nodes.
|
|
189
189
|
local symbols, source_index, dynamic = idx:symbols(), idx, nil
|
|
190
|
-
if engine == explore then symbols, source_index, dynamic = require('codeoutline.on_demand').open(symbols, idx, query) end
|
|
190
|
+
if engine == explore then symbols, source_index, dynamic = require('codeoutline.query.on_demand').open(symbols, idx, query) end
|
|
191
191
|
local output, details = engine.run(symbols, source_index, query, opts)
|
|
192
192
|
if dynamic then
|
|
193
193
|
details.on_demand_files, details.on_demand_rejected, details.on_demand_truncated = dynamic.files, dynamic.rejected, dynamic.truncated
|
|
@@ -196,7 +196,7 @@ local function execute_query(engine, root, query, opts)
|
|
|
196
196
|
for _, file in ipairs(dynamic.files) do
|
|
197
197
|
notices[#notices + 1] = string.format('On-demand source: %s (%s, %s); not stored in the index.', file.path, file.language, file.basis)
|
|
198
198
|
end
|
|
199
|
-
output, details.truncated = require('codeoutline.text').limit(table.concat(notices, '\n') .. '\n' .. output,
|
|
199
|
+
output, details.truncated = require('codeoutline.shared.text').limit(table.concat(notices, '\n') .. '\n' .. output,
|
|
200
200
|
opts and opts.budget or explore.DEFAULT_BUDGET, details.truncated or dynamic.truncated)
|
|
201
201
|
end
|
|
202
202
|
end
|
|
@@ -211,7 +211,7 @@ local function execute_query(engine, root, query, opts)
|
|
|
211
211
|
stats.cache_saved, stats.cache_error = saved, err
|
|
212
212
|
end
|
|
213
213
|
result.info.refresh = stats
|
|
214
|
-
result.info.coverage = require('codeoutline.coverage').summarize(result.info)
|
|
214
|
+
result.info.coverage = require('codeoutline.query.coverage').summarize(result.info)
|
|
215
215
|
result.info.resolution = result.info.query_stats and result.info.query_stats.resolution
|
|
216
216
|
result.info.generation = idx.generation
|
|
217
217
|
result.info.projectPath = idx.root
|
|
@@ -232,19 +232,19 @@ function M.explore(root, query, opts)
|
|
|
232
232
|
end
|
|
233
233
|
|
|
234
234
|
function M.callers(root, query, opts)
|
|
235
|
-
return run_query(require('codeoutline.callers'), root, query, opts)
|
|
235
|
+
return run_query(require('codeoutline.query.callers'), root, query, opts)
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
function M.affected(root, files, opts)
|
|
239
|
-
return run_query(require('codeoutline.affected'), root, files, opts)
|
|
239
|
+
return run_query(require('codeoutline.query.affected'), root, files, opts)
|
|
240
240
|
end
|
|
241
241
|
|
|
242
242
|
function M.type_hierarchy(root, query, opts)
|
|
243
|
-
return run_query(require('codeoutline.type_hierarchy'), root, query, opts)
|
|
243
|
+
return run_query(require('codeoutline.query.type_hierarchy'), root, query, opts)
|
|
244
244
|
end
|
|
245
245
|
|
|
246
246
|
function M.type_references(root, query, opts)
|
|
247
|
-
return run_query(require('codeoutline.type_references'), root, query, opts)
|
|
247
|
+
return run_query(require('codeoutline.query.type_references'), root, query, opts)
|
|
248
248
|
end
|
|
249
249
|
|
|
250
250
|
function M.status(root, opts)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
return
|
|
1
|
+
return 25
|
|
@@ -1 +1 @@
|
|
|
1
|
-
return '0.3.
|
|
1
|
+
return '0.3.6'
|