@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
|
@@ -118,7 +118,7 @@ function M.collect(r, T)
|
|
|
118
118
|
end
|
|
119
119
|
local declaration_prefixes = {}
|
|
120
120
|
for index, n in ipairs(r.nodes) do
|
|
121
|
-
if index % 128 == 0 then require('codeoutline.control').check() end
|
|
121
|
+
if index % 128 == 0 then require('codeoutline.shared.control').check() end
|
|
122
122
|
local ni = n.type_token
|
|
123
123
|
if ni and (callable[n.kind] or containers[n.kind] or n.kind == 'typedef') then
|
|
124
124
|
local a = n.ti
|
|
@@ -5,7 +5,7 @@ local source = debug.getinfo(1, 'S').source:sub(2):gsub('\\', '/')
|
|
|
5
5
|
local scripts = assert(source:match('^(.*)/codeoutline/[^/]+$'), 'cannot locate installed scripts')
|
|
6
6
|
package.path = scripts .. '/?.lua;' .. package.path
|
|
7
7
|
local svc = require('codeoutline.service')
|
|
8
|
-
local explore = require('codeoutline.explore')
|
|
8
|
+
local explore = require('codeoutline.query.explore')
|
|
9
9
|
|
|
10
10
|
local argv = {}
|
|
11
11
|
if type(arg) == 'table' then
|
|
@@ -154,6 +154,7 @@ Example: codeoutline editors --editors vscode,cursor
|
|
|
154
154
|
--port PORT selects the service port (default 19876).
|
|
155
155
|
--project PATH also removes agent configuration and supported usage instructions from that project.
|
|
156
156
|
--service-only keeps agent integrations and editor clients.
|
|
157
|
+
Also removes codeoutline.* settings from VS Code/Cursor user settings and named profiles.
|
|
157
158
|
--purge also deletes default ~/.codeoutline data after cleanup succeeds.
|
|
158
159
|
The npm package remains installed; run npm uninstall -g codeoutline afterward.
|
|
159
160
|
For a single full-cleanup command on global npm installations, use codeoutline remove.
|
|
@@ -164,6 +165,7 @@ Example: codeoutline uninstall --project . --purge
|
|
|
164
165
|
--port PORT selects the service port (default 19876).
|
|
165
166
|
--project PATH also removes agent configuration and supported usage instructions from that project.
|
|
166
167
|
Stops the service, removes startup registration and integrations, and purges ~/.codeoutline.
|
|
168
|
+
Also removes codeoutline.* settings from VS Code/Cursor user settings and named profiles.
|
|
167
169
|
Only after successful cleanup and runtime exit does the launcher run npm uninstall -g codeoutline.
|
|
168
170
|
Cleanup failure keeps the package for retry; npm failure returns a nonzero exit status.
|
|
169
171
|
Requires the global npm launcher; native/local installations should use uninstall instead.
|
|
@@ -377,7 +379,7 @@ local function doctor(root)
|
|
|
377
379
|
end)
|
|
378
380
|
local idx
|
|
379
381
|
check('project', function()
|
|
380
|
-
idx = require('codeoutline.index').open(root)
|
|
382
|
+
idx = require('codeoutline.indexing.index').open(root)
|
|
381
383
|
return idx.root
|
|
382
384
|
end)
|
|
383
385
|
check('enumerator', function()
|
|
@@ -412,10 +414,10 @@ local function run()
|
|
|
412
414
|
return require('codeoutline.updater').run(options.check and 'check' or 'update', options)
|
|
413
415
|
end
|
|
414
416
|
if command == 'editors' then
|
|
415
|
-
return require('codeoutline.editor_install').run(os.getenv('CODEOUTLINE_INITIAL') or install, options)
|
|
417
|
+
return require('codeoutline.install.editor_install').run(os.getenv('CODEOUTLINE_INITIAL') or install, options)
|
|
416
418
|
end
|
|
417
419
|
if command == 'agents' or command == 'install' and (options.list or options.print or options['print-config']) then
|
|
418
|
-
return require('codeoutline.agent_install').run(options)
|
|
420
|
+
return require('codeoutline.install.agent_install').run(options)
|
|
419
421
|
end
|
|
420
422
|
if command == 'remove' then
|
|
421
423
|
assert(os.getenv('CODEOUTLINE_REMOVE_READY'), 'remove requires the npm launcher; use uninstall --purge for a native installation')
|
|
@@ -423,7 +425,7 @@ local function run()
|
|
|
423
425
|
options.purge = true
|
|
424
426
|
end
|
|
425
427
|
if command == 'daemon' or command == 'install' or command == 'uninstall' or command == 'remove' then
|
|
426
|
-
local daemon = require('codeoutline.daemon')
|
|
428
|
+
local daemon = require('codeoutline.install.daemon')
|
|
427
429
|
local port = tonumber(options.port or daemon.PORT)
|
|
428
430
|
assert(port and port % 1 == 0 and port >= 1 and port <= 65535, 'invalid --port')
|
|
429
431
|
if command == 'daemon' then
|
|
@@ -464,7 +466,7 @@ local function run()
|
|
|
464
466
|
if automatic then say('Global npm setup: installing detected integrations by default. Use --foreground-scripts for per-application choices.') end
|
|
465
467
|
options.installing = true
|
|
466
468
|
say('Step 1/2: AI agents - codeoutline_explore over MCP')
|
|
467
|
-
local agent_ok, agent_result = pcall(require('codeoutline.agent_install').run, options)
|
|
469
|
+
local agent_ok, agent_result = pcall(require('codeoutline.install.agent_install').run, options)
|
|
468
470
|
if not agent_ok then io.stderr:write('codeoutline: ', tostring(agent_result), '\n') end
|
|
469
471
|
if not agent_ok or agent_result ~= 0 then integrations_ok = false end
|
|
470
472
|
if not npm and not agent_ok then return 1 end
|
|
@@ -472,7 +474,7 @@ local function run()
|
|
|
472
474
|
local editor_selection = options.editors or os.getenv('CODEOUTLINE_EDITORS')
|
|
473
475
|
if editor_selection == '' then editor_selection = nil end
|
|
474
476
|
local editor_options = { editors = editor_selection or (automatic and 'all' or options.yes and 'none' or nil) }
|
|
475
|
-
local ok, result = pcall(require('codeoutline.editor_install').run, os.getenv('CODEOUTLINE_INITIAL') or install, editor_options)
|
|
477
|
+
local ok, result = pcall(require('codeoutline.install.editor_install').run, os.getenv('CODEOUTLINE_INITIAL') or install, editor_options)
|
|
476
478
|
if not ok then io.stderr:write('codeoutline: ', tostring(result), '\n') end
|
|
477
479
|
if not ok or result ~= 0 then integrations_ok = false end
|
|
478
480
|
if not npm then status = ok and result or 1 end
|
|
@@ -502,8 +504,8 @@ local function run()
|
|
|
502
504
|
say(stopped and 'service on port ' .. port .. ' stopped' or 'service on port ' .. port .. ' is still running')
|
|
503
505
|
if not stopped then status = 1 end
|
|
504
506
|
if not options['service-only'] then
|
|
505
|
-
if attempt(function() return require('codeoutline.agent_install').remove(options) end) ~= 0 then status = 1 end
|
|
506
|
-
if attempt(function() return require('codeoutline.editor_install').remove() end) ~= 0 then status = 1 end
|
|
507
|
+
if attempt(function() return require('codeoutline.install.agent_install').remove(options) end) ~= 0 then status = 1 end
|
|
508
|
+
if attempt(function() return require('codeoutline.install.editor_install').remove() end) ~= 0 then status = 1 end
|
|
507
509
|
end
|
|
508
510
|
if options.purge and status == 0 then
|
|
509
511
|
attempt(function()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
-- Include-driven admission of unknown suffixes from the normal file listing.
|
|
2
|
-
local paths = require('codeoutline.path')
|
|
3
|
-
local parse = require('codeoutline.parse')
|
|
4
|
-
local includes = require('codeoutline.cpp_includes')
|
|
5
|
-
local control = require('codeoutline.control')
|
|
2
|
+
local paths = require('codeoutline.shared.path')
|
|
3
|
+
local parse = require('codeoutline.parsing.parse')
|
|
4
|
+
local includes = require('codeoutline.analysis.cpp.cpp_includes')
|
|
5
|
+
local control = require('codeoutline.shared.control')
|
|
6
6
|
local M = { MAX_FILES = 4096, MAX_BYTES = 67108864, MAX_DEPTH = 32 }
|
|
7
7
|
local function c_family(rec) return rec and (rec.language == 'c' or rec.language == 'cpp') end
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
-- index.lua — per-project symbol index: which files exist, what each one
|
|
2
2
|
-- defines and calls, kept fresh incrementally and cached on disk.
|
|
3
3
|
--
|
|
4
|
-
-- local index = require('codeoutline.index')
|
|
4
|
+
-- local index = require('codeoutline.indexing.index')
|
|
5
5
|
-- local idx = index.open('C:/src/proj') -- loads the cache if present
|
|
6
6
|
-- local stats = idx:refresh() -- reparses only changed files
|
|
7
7
|
-- idx:save()
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
-- Tools that restore an older mtime at the same size are not detected by a
|
|
15
15
|
-- full refresh; a watcher reports them.
|
|
16
16
|
|
|
17
|
-
local ci = require('codeoutline.parse')
|
|
18
|
-
local paths = require('codeoutline.path')
|
|
19
|
-
local control = require('codeoutline.control')
|
|
20
|
-
local graph = require('codeoutline.graph')
|
|
21
|
-
local pool = require('codeoutline.parse_pool')
|
|
22
|
-
local fragments = require('codeoutline.cpp_fragments')
|
|
17
|
+
local ci = require('codeoutline.parsing.parse')
|
|
18
|
+
local paths = require('codeoutline.shared.path')
|
|
19
|
+
local control = require('codeoutline.shared.control')
|
|
20
|
+
local graph = require('codeoutline.analysis.graph')
|
|
21
|
+
local pool = require('codeoutline.indexing.parse_pool')
|
|
22
|
+
local fragments = require('codeoutline.indexing.cpp_fragments')
|
|
23
23
|
|
|
24
24
|
local M = {}
|
|
25
25
|
local INDEX_PARSE = { ranges = false, omit_signatures = true }
|
|
@@ -35,8 +35,8 @@ end
|
|
|
35
35
|
-- rebuilds stale caches instead of silently reusing old parse results.
|
|
36
36
|
M.VERSION = (function()
|
|
37
37
|
local parts = {}
|
|
38
|
-
for _, m in ipairs({ 'xscan', 'text', 'common', 'type_uses', 'indirect', 'dispatch_aliases', 'static_dispatch', 'js_evidence', 'python_bindings', 'cpp_bindings', 'cpp_types', 'csharp_bindings', 'lua_bindings', 'foreign', 'foreign_lua', 'parse', 'lang.c', 'lang.cpp', 'lang.lua', 'lang.python',
|
|
39
|
-
'cpp_receivers', 'cpp_macros', 'cpp_includes', 'cpp_fragments', 'language_detect', 'go_methods', 'function_values', 'implementations', 'cpp_implementations', 'ts_implementations', 'type_bases', 'automatic_events', 'shared_events', 'lua_callback_loops', 'lang.java', 'lang.kotlin', 'lang.go', 'lang.js', 'lang.csharp', 'lang.rust' }) do
|
|
38
|
+
for _, m in ipairs({ 'parsing.xscan', 'shared.text', 'parsing.common', 'analysis.receivers', 'analysis.type_uses', 'analysis.indirect', 'analysis.dispatch_aliases', 'analysis.static_dispatch', 'analysis.js.js_evidence', 'analysis.python.python_bindings', 'analysis.cpp.cpp_bindings', 'analysis.cpp.cpp_types', 'analysis.csharp.csharp_bindings', 'analysis.lua.lua_bindings', 'analysis.foreign', 'analysis.lua.foreign_lua', 'parsing.parse', 'lang.c', 'lang.cpp', 'lang.lua', 'lang.python',
|
|
39
|
+
'analysis.cpp.cpp_receivers', 'analysis.cpp.cpp_macros', 'analysis.cpp.cpp_includes', 'indexing.cpp_fragments', 'parsing.language_detect', 'analysis.go.go_methods', 'analysis.go.go_frameworks', 'analysis.function_values', 'analysis.implementations', 'analysis.cpp.cpp_implementations', 'analysis.js.ts_implementations', 'analysis.type_bases', 'analysis.automatic_events', 'analysis.shared_events', 'analysis.lua.lua_callback_loops', 'lang.java', 'lang.kotlin', 'lang.go', 'lang.js', 'lang.csharp', 'lang.rust' }) do
|
|
40
40
|
local file = package.searchpath and package.searchpath('codeoutline.' .. m, package.path)
|
|
41
41
|
local h = file and io.open(file, 'rb')
|
|
42
42
|
if h then parts[#parts + 1] = h:read('a'); h:close() end
|
|
@@ -173,7 +173,7 @@ function Index:load()
|
|
|
173
173
|
destination[rec.path] = rec
|
|
174
174
|
end
|
|
175
175
|
for _, rec in ipairs(t.files) do validate(rec, records) end
|
|
176
|
-
local patches = require('codeoutline.cache_repairs').load(self.cache_path, envelope.sha256, M.VERSION, paths.key(self.root))
|
|
176
|
+
local patches = require('codeoutline.indexing.cache_repairs').load(self.cache_path, envelope.sha256, M.VERSION, paths.key(self.root))
|
|
177
177
|
local valid, applied = pcall(function()
|
|
178
178
|
local result = {}
|
|
179
179
|
for path, rec in pairs(patches) do
|
|
@@ -210,7 +210,7 @@ function Index:save()
|
|
|
210
210
|
return false, 'runtime requires cmsgpack, xcompress, temp_file and replace_file'
|
|
211
211
|
end
|
|
212
212
|
if self.repair_only and self.cache_hash then
|
|
213
|
-
local ok, err = require('codeoutline.cache_repairs').save(self.cache_path, self.cache_hash,
|
|
213
|
+
local ok, err = require('codeoutline.indexing.cache_repairs').save(self.cache_path, self.cache_hash,
|
|
214
214
|
M.VERSION, paths.key(self.root), self.repair_records)
|
|
215
215
|
if ok then
|
|
216
216
|
self.saved_generation, self.encoding_dirty, self.repair_only = self.generation, false, false
|
|
@@ -268,7 +268,7 @@ end
|
|
|
268
268
|
-- Symbol tables over the records, built on first use and then kept current
|
|
269
269
|
-- by commit(). Hosts that never resolve names do not pay for them.
|
|
270
270
|
function Index:symbols()
|
|
271
|
-
local ctx = require('codeoutline.lua_bindings').context(self)
|
|
271
|
+
local ctx = require('codeoutline.analysis.lua.lua_bindings').context(self)
|
|
272
272
|
if not self.symbol_tables or table.concat(self.symbol_tables.lua_global_export_tables, '\0')
|
|
273
273
|
~= table.concat(ctx.global_export_tables, '\0') then
|
|
274
274
|
self.symbol_tables = graph.build(self, ctx)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
-- by size (largest first onto the least-loaded thread) and posted in chunks,
|
|
14
14
|
-- so results stream back and a cancelled pass stops within a chunk.
|
|
15
15
|
|
|
16
|
-
local control = require('codeoutline.control')
|
|
16
|
+
local control = require('codeoutline.shared.control')
|
|
17
17
|
|
|
18
18
|
local M = {}
|
|
19
19
|
M.THREADS = package.config:sub(1, 1) == '\\' and 8 or 6
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
-- Small, lossless JSON/JSONC editor for MCP entries. No reserialization of
|
|
1
|
+
-- Small, lossless JSON/JSONC editor for MCP entries and editor settings. No reserialization of
|
|
2
2
|
-- surrounding settings: comments, key order and unrelated bytes survive.
|
|
3
3
|
local M = {}
|
|
4
4
|
local function encode(value) return assert(xutils.json_pack(value)) end
|
|
@@ -136,6 +136,26 @@ function M.has(text, path)
|
|
|
136
136
|
return true
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
+
-- Editor settings also allow language-specific override objects. Only inspect
|
|
140
|
+
-- those containers, never unrelated nested objects that happen to use our name.
|
|
141
|
+
function M.remove_editor_settings(text)
|
|
142
|
+
if text == '' then return text, false end
|
|
143
|
+
local root, paths = parse(text), {}
|
|
144
|
+
local function collect(node, parent)
|
|
145
|
+
for key, child in pairs(node.children) do
|
|
146
|
+
if key:match('^codeoutline%.') then
|
|
147
|
+
paths[#paths + 1] = parent and { parent, key } or { key }
|
|
148
|
+
elseif not parent and key:match('^%[.*%]$') and child.kind == '{' then
|
|
149
|
+
collect(child, key)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
collect(root)
|
|
154
|
+
table.sort(paths, function(a, b) return table.concat(a, '\0') < table.concat(b, '\0') end)
|
|
155
|
+
for _, path in ipairs(paths) do text = M.json(text, path, {}, true, false) end
|
|
156
|
+
return text, #paths > 0
|
|
157
|
+
end
|
|
158
|
+
|
|
139
159
|
-- TOML keeps all unrelated tables verbatim. Reject ambiguous inline/dotted
|
|
140
160
|
-- definitions rather than risk producing a duplicate table.
|
|
141
161
|
function M.toml(text, url, remove, force)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
-- Register the shared HTTP MCP service in supported agent configurations.
|
|
2
|
-
local config = require('codeoutline.agent_config')
|
|
2
|
+
local config = require('codeoutline.install.agent_config')
|
|
3
3
|
local M = {}
|
|
4
4
|
local windows = package.config:sub(1, 1) == '\\'
|
|
5
5
|
local function exists(path) return path and xutils.stat(path).exists end
|
|
@@ -237,7 +237,7 @@ function M.run(options)
|
|
|
237
237
|
say('Detected AI tools: ' .. #available .. '. Confirm each tool; Enter accepts the default.')
|
|
238
238
|
local chosen = {}
|
|
239
239
|
for _, target in ipairs(available) do
|
|
240
|
-
local answer = require('codeoutline.install_prompt').confirm(
|
|
240
|
+
local answer = require('codeoutline.install.install_prompt').confirm(
|
|
241
241
|
(options.remove and 'Remove codeoutline_explore from ' or 'Enable codeoutline_explore (MCP) for ') .. target.name .. ' (' .. target.id .. ')?',
|
|
242
242
|
not options.remove)
|
|
243
243
|
if answer == nil then break end
|
|
@@ -36,16 +36,18 @@ end
|
|
|
36
36
|
function M.detect()
|
|
37
37
|
local kind, h = platform(), home()
|
|
38
38
|
local vscode, cursor, zed = on_path('code'), on_path('cursor'), on_path('zed') or on_path('zeditor')
|
|
39
|
-
local zed_data
|
|
39
|
+
local zed_data, config
|
|
40
40
|
if kind == 'windows' then
|
|
41
41
|
local local_app = os.getenv('LOCALAPPDATA') or h .. '/AppData/Local'
|
|
42
42
|
local program = os.getenv('ProgramFiles') or 'C:/Program Files'
|
|
43
|
+
config = os.getenv('APPDATA') or h .. '/AppData/Roaming'
|
|
43
44
|
vscode = vscode or first({ local_app .. '/Programs/Microsoft VS Code/bin/code.cmd', program .. '/Microsoft VS Code/bin/code.cmd' })
|
|
44
45
|
cursor = cursor or first({ local_app .. '/Programs/cursor/resources/app/bin/cursor.cmd', program .. '/cursor/resources/app/bin/cursor.cmd' })
|
|
45
46
|
zed = zed or first({ local_app .. '/Programs/Zed/bin/zed.exe', local_app .. '/Programs/Zed/zed.exe',
|
|
46
47
|
program .. '/Zed/bin/zed.exe', program .. '/Zed/zed.exe' })
|
|
47
48
|
zed_data = local_app .. '/Zed'
|
|
48
49
|
elseif kind == 'darwin' then
|
|
50
|
+
config = h .. '/Library/Application Support'
|
|
49
51
|
for _, dir in ipairs({ '/Applications', h .. '/Applications' }) do
|
|
50
52
|
vscode = vscode or first({ dir .. '/Visual Studio Code.app/Contents/Resources/app/bin/code' })
|
|
51
53
|
cursor = cursor or first({ dir .. '/Cursor.app/Contents/Resources/app/bin/cursor' })
|
|
@@ -53,14 +55,15 @@ function M.detect()
|
|
|
53
55
|
end
|
|
54
56
|
zed_data = h .. '/Library/Application Support/Zed'
|
|
55
57
|
else
|
|
58
|
+
config = os.getenv('XDG_CONFIG_HOME') or h .. '/.config'
|
|
56
59
|
vscode = vscode or first({ '/usr/share/code/bin/code', '/snap/bin/code' })
|
|
57
60
|
cursor = cursor or first({ '/opt/Cursor/resources/app/bin/cursor', h .. '/.local/bin/cursor' })
|
|
58
61
|
zed = zed or first({ h .. '/.local/bin/zed' })
|
|
59
62
|
zed_data = (os.getenv('XDG_DATA_HOME') or h .. '/.local/share') .. '/zed'
|
|
60
63
|
end
|
|
61
64
|
return {
|
|
62
|
-
{ id = 'vscode', name = 'VS Code', command = vscode, detected = vscode ~= nil, extensions = h .. '/.vscode/extensions' },
|
|
63
|
-
{ id = 'cursor', name = 'Cursor', command = cursor, detected = cursor ~= nil, extensions = h .. '/.cursor/extensions' },
|
|
65
|
+
{ id = 'vscode', name = 'VS Code', command = vscode, detected = vscode ~= nil, extensions = h .. '/.vscode/extensions', user = config .. '/Code/User' },
|
|
66
|
+
{ id = 'cursor', name = 'Cursor', command = cursor, detected = cursor ~= nil, extensions = h .. '/.cursor/extensions', user = config .. '/Cursor/User' },
|
|
64
67
|
{ id = 'zed', name = 'Zed', command = zed, data = zed_data, detected = zed ~= nil },
|
|
65
68
|
}
|
|
66
69
|
end
|
|
@@ -127,7 +130,7 @@ function M.run(root, options)
|
|
|
127
130
|
say('Detected editors: ' .. #available .. '. Confirm each editor; Enter installs it.')
|
|
128
131
|
local chosen = {}
|
|
129
132
|
for _, editor in ipairs(available) do
|
|
130
|
-
local answer = require('codeoutline.install_prompt').confirm('Install CodeOutline LSP for ' .. editor.name .. ' (' .. editor.id .. ')?', true)
|
|
133
|
+
local answer = require('codeoutline.install.install_prompt').confirm('Install CodeOutline LSP for ' .. editor.name .. ' (' .. editor.id .. ')?', true)
|
|
131
134
|
if answer == nil then break end
|
|
132
135
|
if answer then chosen[#chosen + 1] = editor.id end
|
|
133
136
|
end
|
|
@@ -167,7 +170,7 @@ function M.run(root, options)
|
|
|
167
170
|
return status
|
|
168
171
|
end
|
|
169
172
|
|
|
170
|
-
-- Remove
|
|
173
|
+
-- Remove our extension and VS Code/Cursor user settings, including profiles.
|
|
171
174
|
-- Continue with other editors when one editor is unavailable or reports errors.
|
|
172
175
|
function M.remove()
|
|
173
176
|
local status = 0
|
|
@@ -181,6 +184,31 @@ function M.remove()
|
|
|
181
184
|
assert(not exists(target), 'extension directory remains: ' .. target)
|
|
182
185
|
end
|
|
183
186
|
for _, editor in ipairs(M.detect()) do
|
|
187
|
+
-- Settings cleanup does not require a working editor CLI. Keep errors
|
|
188
|
+
-- independent so a damaged profile cannot block its peers or extension removal.
|
|
189
|
+
if editor.user then
|
|
190
|
+
local paths = { editor.user .. '/settings.json' }
|
|
191
|
+
for _, entry in ipairs(xutils.list_dir(editor.user .. '/profiles') or {}) do
|
|
192
|
+
if entry.dir then paths[#paths + 1] = editor.user .. '/profiles/' .. entry.name .. '/settings.json' end
|
|
193
|
+
end
|
|
194
|
+
for _, path in ipairs(paths) do
|
|
195
|
+
local ok, err = pcall(function()
|
|
196
|
+
if not exists(path) then return end
|
|
197
|
+
local before = read(path)
|
|
198
|
+
local after, changed = require('codeoutline.install.agent_config').remove_editor_settings(before)
|
|
199
|
+
if not changed then return end
|
|
200
|
+
local temp = assert(xutils.temp_file(assert(path:match('^(.*)/[^/]+$'))))
|
|
201
|
+
local saved, reason = pcall(function()
|
|
202
|
+
write(temp, after)
|
|
203
|
+
assert(read(path) == before, 'editor settings changed; close the editor and retry')
|
|
204
|
+
assert(xutils.replace_file(temp, path), 'cannot update editor settings')
|
|
205
|
+
end)
|
|
206
|
+
if not saved then os.remove(temp); error(reason) end
|
|
207
|
+
say('Removed CodeOutline settings from ' .. path)
|
|
208
|
+
end)
|
|
209
|
+
if not ok then io.stderr:write('codeoutline: cannot clean ', path, ': ', tostring(err), '\n'); status = 1 end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
184
212
|
local ok, err = pcall(function()
|
|
185
213
|
if editor.id == 'zed' then
|
|
186
214
|
for _, kind in ipairs({ 'installed', 'work', 'staging' }) do
|
|
@@ -192,7 +220,7 @@ function M.remove()
|
|
|
192
220
|
local index = editor.data .. '/extensions/index.json'
|
|
193
221
|
if exists(index) then
|
|
194
222
|
local before = read(index)
|
|
195
|
-
local after, changed = require('codeoutline.agent_config').json(before,
|
|
223
|
+
local after, changed = require('codeoutline.install.agent_config').json(before,
|
|
196
224
|
{ 'extensions', 'codeoutline' }, {}, true, false)
|
|
197
225
|
if changed then
|
|
198
226
|
local temp = assert(xutils.temp_file(editor.data .. '/extensions'))
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
-- does it: keep the first live #if branch (xscan pp_first_branch), so both
|
|
8
8
|
-- arms of an #ifdef never meet in one token stream.
|
|
9
9
|
|
|
10
|
-
local xscan = require('codeoutline.xscan')
|
|
11
|
-
local common = require('codeoutline.common')
|
|
10
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
11
|
+
local common = require('codeoutline.parsing.common')
|
|
12
12
|
|
|
13
13
|
local M = {}
|
|
14
14
|
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
-- Built on the C parser's helpers rather than its main loop, so C results
|
|
8
8
|
-- stay exactly as validated. Qualified names use '::'.
|
|
9
9
|
|
|
10
|
-
local xscan = require('codeoutline.xscan')
|
|
11
|
-
local common = require('codeoutline.common')
|
|
10
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
11
|
+
local common = require('codeoutline.parsing.common')
|
|
12
12
|
local c = require('codeoutline.lang.c')
|
|
13
13
|
|
|
14
14
|
local M = {}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
-- operators, properties (accessor and expression-bodied), fields, events,
|
|
5
5
|
-- delegates, enum members, attributes, and calls.
|
|
6
6
|
|
|
7
|
-
local xscan = require('codeoutline.xscan')
|
|
8
|
-
local common = require('codeoutline.common')
|
|
7
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
8
|
+
local common = require('codeoutline.parsing.common')
|
|
9
9
|
|
|
10
10
|
local M = {}
|
|
11
11
|
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
-- stmt_end(): a statement runs to the end of its line, extended across any
|
|
8
8
|
-- bracket group that spans lines.
|
|
9
9
|
|
|
10
|
-
local xscan = require('codeoutline.xscan')
|
|
11
|
-
local common = require('codeoutline.common')
|
|
10
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
11
|
+
local common = require('codeoutline.parsing.common')
|
|
12
12
|
|
|
13
13
|
local M = {}
|
|
14
14
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
-- declarations track angle depth themselves; bodies need no generics
|
|
7
7
|
-- handling because they are only scanned for call sites.
|
|
8
8
|
|
|
9
|
-
local xscan = require('codeoutline.xscan')
|
|
10
|
-
local common = require('codeoutline.common')
|
|
9
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
10
|
+
local common = require('codeoutline.parsing.common')
|
|
11
11
|
|
|
12
12
|
local M = {}
|
|
13
13
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
-- file is scanned for definition patterns at any depth; ranges come from
|
|
9
9
|
-- the bracket match table and nesting from containing ranges.
|
|
10
10
|
|
|
11
|
-
local xscan = require('codeoutline.xscan')
|
|
12
|
-
local common = require('codeoutline.common')
|
|
11
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
12
|
+
local common = require('codeoutline.parsing.common')
|
|
13
13
|
|
|
14
14
|
local M = {}
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
-- Kotlin declarations and call sites over xscan; deliberately not a type checker.
|
|
2
|
-
local xscan = require('codeoutline.xscan')
|
|
3
|
-
local common = require('codeoutline.common')
|
|
2
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
3
|
+
local common = require('codeoutline.parsing.common')
|
|
4
4
|
local M = {}
|
|
5
5
|
|
|
6
6
|
M.config = {
|
|
@@ -102,6 +102,8 @@ local function angles(T, i, b)
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
local function annotation(T, i, b, skip)
|
|
105
|
+
-- Qualified receivers use @ as a label separator, not an annotation.
|
|
106
|
+
if word(T, i - 1, 'this') or word(T, i - 1, 'super') then return i + 1 end
|
|
105
107
|
local j = i + 1
|
|
106
108
|
if is(T, j + 1, ':') then j = j + 2 end -- @file:JvmName, @get:Inject
|
|
107
109
|
if is(T, j, '[') and T.m[j] then return T.m[j] + 1 end
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
-- Lua blocks close with keywords, not brackets, so the parser pairs
|
|
7
7
|
-- function/if/do/repeat with end/until itself; brackets come from xscan.
|
|
8
8
|
|
|
9
|
-
local xscan = require('codeoutline.xscan')
|
|
10
|
-
local common = require('codeoutline.common')
|
|
9
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
10
|
+
local common = require('codeoutline.parsing.common')
|
|
11
11
|
|
|
12
12
|
local M = {}
|
|
13
13
|
|
|
@@ -229,7 +229,7 @@ function M.parse(path, src, language, opts)
|
|
|
229
229
|
r.refs = kept
|
|
230
230
|
if not r.dispatch_only then
|
|
231
231
|
common.assign_refs(r)
|
|
232
|
-
require('codeoutline.lua_bindings').collect(r, T, bm)
|
|
232
|
+
require('codeoutline.analysis.lua.lua_bindings').collect(r, T, bm)
|
|
233
233
|
end
|
|
234
234
|
r.member_ops = nil
|
|
235
235
|
return common.finish(r, T), T
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
-- xscan's indent mode turns blocks into indent..dedent pairs in the match
|
|
5
5
|
-- table, so a block's extent is one lookup and nesting falls out of recursion.
|
|
6
6
|
|
|
7
|
-
local xscan = require('codeoutline.xscan')
|
|
8
|
-
local common = require('codeoutline.common')
|
|
7
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
8
|
+
local common = require('codeoutline.parsing.common')
|
|
9
9
|
|
|
10
10
|
local M = {}
|
|
11
11
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
-- qualified by the implementing type, `impl Trait for Type` recorded),
|
|
5
5
|
-- type aliases, consts / statics, macro_rules!, and calls incl. `name!(..)`.
|
|
6
6
|
|
|
7
|
-
local xscan = require('codeoutline.xscan')
|
|
8
|
-
local common = require('codeoutline.common')
|
|
7
|
+
local xscan = require('codeoutline.parsing.xscan')
|
|
8
|
+
local common = require('codeoutline.parsing.common')
|
|
9
9
|
|
|
10
10
|
local M = {}
|
|
11
11
|
|
|
@@ -285,7 +285,7 @@ function M.parse(path, src, language, opts)
|
|
|
285
285
|
parse_items(T, r, 1, T.n, nil, nil, false)
|
|
286
286
|
-- '::' is the path separator: fix qualified names built with '.'
|
|
287
287
|
for _, n in ipairs(r.nodes) do n.qualified = n.qualified:gsub('%.', '::') end
|
|
288
|
-
if r.ordinary_bindings then require('codeoutline.rust_resolution').collect(r, T) end
|
|
288
|
+
if r.ordinary_bindings then require('codeoutline.analysis.rust.rust_resolution').collect(r, T) end
|
|
289
289
|
return common.finish(r, T), T
|
|
290
290
|
end
|
|
291
291
|
|
|
@@ -4,10 +4,10 @@ local source = assert(xutils.realpath(debug.getinfo(1, 'S').source:sub(2))):gsub
|
|
|
4
4
|
local scripts = assert(source:match('^(.*)/codeoutline/[^/]+$'))
|
|
5
5
|
local install = assert(scripts:match('^(.*)/scripts$'))
|
|
6
6
|
package.path = scripts .. '/?.lua;' .. package.path
|
|
7
|
-
local paths = require('codeoutline.path')
|
|
8
|
-
local mcp = require('codeoutline.mcp')
|
|
9
|
-
local http = require('codeoutline.http')
|
|
10
|
-
local daemon = require('codeoutline.daemon')
|
|
7
|
+
local paths = require('codeoutline.shared.path')
|
|
8
|
+
local mcp = require('codeoutline.protocol.mcp')
|
|
9
|
+
local http = require('codeoutline.protocol.http')
|
|
10
|
+
local daemon = require('codeoutline.install.daemon')
|
|
11
11
|
local options = { ALLOW_ROOT = {}, ALLOW_HOST = {}, ALLOW_ORIGIN = {} }
|
|
12
12
|
for _, argument in ipairs(arg or {}) do
|
|
13
13
|
local key, value = argument:match('^([A-Z_]+)=(.*)$')
|
|
@@ -18,7 +18,7 @@ end
|
|
|
18
18
|
assert((options.STDIO == '1') ~= (options.HTTP == '1'), 'Specify exactly one of STDIO=1 or HTTP=1')
|
|
19
19
|
local lsp_mode = options.LSP == '1'
|
|
20
20
|
assert(not lsp_mode or options.STDIO == '1', 'LSP=1 requires STDIO=1')
|
|
21
|
-
local lsp = lsp_mode and require('codeoutline.lsp')
|
|
21
|
+
local lsp = lsp_mode and require('codeoutline.protocol.lsp')
|
|
22
22
|
local lsp_reader = lsp_mode and lsp.reader()
|
|
23
23
|
local managed = options.DAEMON == '1'
|
|
24
24
|
assert(not managed or options.HTTP == '1', 'DAEMON=1 requires HTTP=1')
|
|
@@ -129,13 +129,13 @@ return {
|
|
|
129
129
|
end
|
|
130
130
|
os.remove(daemon.stop_file(config.port))
|
|
131
131
|
end
|
|
132
|
-
assert(xthread.create_thread(2, 'INDEX', scripts .. '/codeoutline/index_worker.lua'))
|
|
132
|
+
assert(xthread.create_thread(2, 'INDEX', scripts .. '/codeoutline/runtime/index_worker.lua'))
|
|
133
133
|
indexing = true
|
|
134
134
|
-- Launchers enable this for serve; the background service updates unless
|
|
135
135
|
-- disabled. Updating never delays or blocks requests.
|
|
136
136
|
local auto_update = os.getenv('CODEOUTLINE_AUTO_UPDATE')
|
|
137
137
|
if auto_update == '1' or (managed and auto_update ~= '0') then
|
|
138
|
-
updating = xthread.create_thread(3, 'UPDATE', scripts .. '/codeoutline/update_worker.lua') and true
|
|
138
|
+
updating = xthread.create_thread(3, 'UPDATE', scripts .. '/codeoutline/runtime/update_worker.lua') and true
|
|
139
139
|
end
|
|
140
140
|
if options.STDIO == '1' then
|
|
141
141
|
assert(xutils.read_stdin, 'Rebuild runtime for nonblocking stdin support')
|
|
@@ -146,12 +146,12 @@ return {
|
|
|
146
146
|
else stdio = mcp.new(config, submit, cancel) end
|
|
147
147
|
else
|
|
148
148
|
-- Packages ship the codec as lib/xhttp_codec.lua; a source checkout
|
|
149
|
-
-- reads it from the
|
|
149
|
+
-- reads it from the core submodule directory.
|
|
150
150
|
local codec_path = options.RUNTIME_ROOT and options.RUNTIME_ROOT .. '/scripts/core/share/xhttp_codec.lua'
|
|
151
151
|
or install .. '/lib/xhttp_codec.lua'
|
|
152
152
|
local probe = io.open(codec_path, 'rb')
|
|
153
153
|
if probe then probe:close()
|
|
154
|
-
else codec_path = install .. '/
|
|
154
|
+
else codec_path = install .. '/core/scripts/core/share/xhttp_codec.lua' end
|
|
155
155
|
codec = dofile(codec_path)
|
|
156
156
|
if not managed then listen()
|
|
157
157
|
else
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
-- refs and a table per ref costs several times the data it carries.
|
|
21
21
|
|
|
22
22
|
local M = {}
|
|
23
|
-
local text = require('codeoutline.text')
|
|
23
|
+
local text = require('codeoutline.shared.text')
|
|
24
24
|
|
|
25
25
|
function M.new(path, language, opts)
|
|
26
26
|
return { path = path, language = language, nodes = {}, refs = {}, imports = {},
|
|
@@ -146,45 +146,48 @@ end
|
|
|
146
146
|
-- Drop parser-internal fields so the result is plain data.
|
|
147
147
|
function M.finish(r, T)
|
|
148
148
|
if r.cpp_aliases_only then
|
|
149
|
-
require('codeoutline.cpp_types').collect(r, T)
|
|
149
|
+
require('codeoutline.analysis.cpp.cpp_types').collect(r, T)
|
|
150
150
|
r.cpp_aliases_only = nil
|
|
151
151
|
return r
|
|
152
152
|
end
|
|
153
|
-
if T then require('codeoutline.function_values').collect(r, T) end
|
|
154
|
-
if T and not r.defer_analysis and r.collect_type_uses ~= false and (r.ranges or r.ordinary_bindings) then require('codeoutline.type_uses').collect(r, T) end
|
|
153
|
+
if T then require('codeoutline.analysis.function_values').collect(r, T) end
|
|
154
|
+
if T and not r.defer_analysis and r.collect_type_uses ~= false and (r.ranges or r.ordinary_bindings) then require('codeoutline.analysis.type_uses').collect(r, T) end
|
|
155
155
|
if T and r.collect_foreign and (r.language == 'c' or r.language == 'cpp') then
|
|
156
|
-
require('codeoutline.foreign').collect(r, T)
|
|
156
|
+
require('codeoutline.analysis.foreign').collect(r, T)
|
|
157
157
|
end
|
|
158
158
|
r.collect_foreign = nil
|
|
159
159
|
M.assign_refs(r)
|
|
160
160
|
if r.type_use_refs then M.assign_refs({ nodes = r.nodes, refs = r.type_use_refs }) end
|
|
161
|
-
if T then require('codeoutline.static_dispatch').collect(r, T) end
|
|
161
|
+
if T then require('codeoutline.analysis.static_dispatch').collect(r, T) end
|
|
162
162
|
r.collect_static_dispatch = nil
|
|
163
163
|
-- Query-only parse: preserve normal declaration/call attribution, but do
|
|
164
164
|
-- not build binding evidence or compact records that will be discarded.
|
|
165
165
|
if r.dispatch_only then
|
|
166
|
-
require('codeoutline.indirect').collect(r, T)
|
|
166
|
+
require('codeoutline.analysis.indirect').collect(r, T)
|
|
167
167
|
r.dispatch_only, r.collect_dispatch = nil, nil
|
|
168
168
|
return r
|
|
169
169
|
end
|
|
170
|
-
if T then require('codeoutline.js_evidence').collect(r, T) end
|
|
170
|
+
if T then require('codeoutline.analysis.js.js_evidence').collect(r, T) end
|
|
171
171
|
if T and r.ordinary_bindings then
|
|
172
|
-
require('codeoutline.cpp_macros').collect(r, T)
|
|
173
|
-
require('codeoutline.python_bindings').collect(r, T)
|
|
174
|
-
require('codeoutline.cpp_bindings').collect(r, T, r.type_use_refs)
|
|
175
|
-
require('codeoutline.cpp_receivers').collect(r, T)
|
|
176
|
-
if r.language == 'csharp' then require('codeoutline.csharp_bindings').collect(r, T) end
|
|
177
|
-
require('codeoutline.implementations').collect(r, T)
|
|
178
|
-
require('codeoutline.
|
|
179
|
-
require('codeoutline.
|
|
172
|
+
require('codeoutline.analysis.cpp.cpp_macros').collect(r, T)
|
|
173
|
+
require('codeoutline.analysis.python.python_bindings').collect(r, T)
|
|
174
|
+
require('codeoutline.analysis.cpp.cpp_bindings').collect(r, T, r.type_use_refs)
|
|
175
|
+
require('codeoutline.analysis.cpp.cpp_receivers').collect(r, T)
|
|
176
|
+
if r.language == 'csharp' then require('codeoutline.analysis.csharp.csharp_bindings').collect(r, T) end
|
|
177
|
+
require('codeoutline.analysis.implementations').collect(r, T)
|
|
178
|
+
if r.language == 'go' then require('codeoutline.analysis.go.go_frameworks').collect(r, T) end
|
|
179
|
+
require('codeoutline.analysis.automatic_events').collect(r, T)
|
|
180
|
+
require('codeoutline.analysis.shared_events').collect(r, T)
|
|
180
181
|
end
|
|
181
|
-
if T then require('codeoutline.
|
|
182
|
+
if T and not r.defer_analysis and (r.ranges or r.ordinary_bindings) then require('codeoutline.analysis.receivers').collect(r, T) end
|
|
183
|
+
if T then require('codeoutline.analysis.indirect').collect(r, T) end
|
|
182
184
|
r.collect_dispatch = nil
|
|
183
185
|
local original_refs = r.refs
|
|
184
186
|
local name, from, kind, line, recv = {}, {}, {}, {}, {}
|
|
185
187
|
local js_receiver = not r.defer_analysis and r.js_imports and (r.ranges or r.ordinary_bindings) and {}
|
|
186
188
|
local lua_binding = not r.defer_analysis and r.lua_imports and (r.ranges or r.ordinary_bindings) and {}
|
|
187
189
|
local binding = (r.python_imports or r.has_bindings) and {}
|
|
190
|
+
local receiver = r.receivers and {}
|
|
188
191
|
r.has_bindings = nil
|
|
189
192
|
local start, stop = r.ranges and T and {}, r.ranges and T and {}
|
|
190
193
|
for i, ref in ipairs(r.refs) do
|
|
@@ -192,6 +195,7 @@ function M.finish(r, T)
|
|
|
192
195
|
if js_receiver then js_receiver[i] = ref.js_receiver or '' end
|
|
193
196
|
if lua_binding then lua_binding[i] = ref.lua_binding or '' end
|
|
194
197
|
if binding then binding[i] = ref.binding or '' end
|
|
198
|
+
if receiver then receiver[i] = ref.receiver or '' end
|
|
195
199
|
if start then
|
|
196
200
|
local named = T:text(ref.tok) == ref.name
|
|
197
201
|
start[i], stop[i] = named and T.s[ref.tok] - 1 or false, named and T.e[ref.tok] or false
|
|
@@ -201,6 +205,7 @@ function M.finish(r, T)
|
|
|
201
205
|
r.refs.js_receiver = js_receiver or nil
|
|
202
206
|
r.refs.lua_binding = lua_binding or nil
|
|
203
207
|
r.refs.binding = binding
|
|
208
|
+
r.refs.receiver = receiver
|
|
204
209
|
if r.type_use_refs and #r.type_use_refs > 0 then
|
|
205
210
|
r.type_sites = {}
|
|
206
211
|
local positions = {}
|