@codua/codeoutline-win32-x64 0.2.4 → 0.2.9

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.
Files changed (77) hide show
  1. package/README.md +205 -3
  2. package/README.zh-CN.md +40 -2
  3. package/bin/xnet.exe +0 -0
  4. package/build-info.json +1 -1
  5. package/package.json +1 -1
  6. package/scripts/codeoutline/affected.lua +145 -0
  7. package/scripts/codeoutline/automatic_events.lua +202 -0
  8. package/scripts/codeoutline/cache_repairs.lua +47 -0
  9. package/scripts/codeoutline/callers.lua +56 -16
  10. package/scripts/codeoutline/cargo_toml.lua +125 -0
  11. package/scripts/codeoutline/command.lua +26 -4
  12. package/scripts/codeoutline/common.lua +65 -9
  13. package/scripts/codeoutline/completion.lua +221 -65
  14. package/scripts/codeoutline/coverage.lua +63 -0
  15. package/scripts/codeoutline/cpp_bindings.lua +151 -0
  16. package/scripts/codeoutline/cpp_fragments.lua +143 -0
  17. package/scripts/codeoutline/cpp_implementations.lua +340 -0
  18. package/scripts/codeoutline/cpp_includes.lua +156 -0
  19. package/scripts/codeoutline/cpp_macros.lua +279 -0
  20. package/scripts/codeoutline/cpp_receivers.lua +342 -0
  21. package/scripts/codeoutline/cpp_types.lua +456 -0
  22. package/scripts/codeoutline/csharp_bindings.lua +498 -0
  23. package/scripts/codeoutline/definition_candidates.lua +180 -0
  24. package/scripts/codeoutline/dispatch_aliases.lua +479 -0
  25. package/scripts/codeoutline/documents.lua +32 -9
  26. package/scripts/codeoutline/explore.lua +274 -119
  27. package/scripts/codeoutline/external_headers.lua +171 -0
  28. package/scripts/codeoutline/foreign.lua +79 -14
  29. package/scripts/codeoutline/foreign_lua.lua +146 -19
  30. package/scripts/codeoutline/function_values.lua +69 -0
  31. package/scripts/codeoutline/go_methods.lua +931 -0
  32. package/scripts/codeoutline/go_modules.lua +329 -0
  33. package/scripts/codeoutline/graph.lua +346 -63
  34. package/scripts/codeoutline/implementations.lua +403 -0
  35. package/scripts/codeoutline/index.lua +165 -27
  36. package/scripts/codeoutline/index_worker.lua +11 -4
  37. package/scripts/codeoutline/indirect.lua +116 -40
  38. package/scripts/codeoutline/js_evidence.lua +32 -3
  39. package/scripts/codeoutline/js_resolution.lua +72 -10
  40. package/scripts/codeoutline/js_workspace.lua +325 -0
  41. package/scripts/codeoutline/lang/c.lua +15 -2
  42. package/scripts/codeoutline/lang/cpp.lua +7 -4
  43. package/scripts/codeoutline/lang/csharp.lua +15 -3
  44. package/scripts/codeoutline/lang/js.lua +56 -20
  45. package/scripts/codeoutline/lang/rust.lua +9 -1
  46. package/scripts/codeoutline/language_detect.lua +100 -0
  47. package/scripts/codeoutline/lsp.lua +173 -23
  48. package/scripts/codeoutline/lua_bindings.lua +228 -54
  49. package/scripts/codeoutline/lua_callback_loops.lua +210 -0
  50. package/scripts/codeoutline/lua_literal.lua +38 -0
  51. package/scripts/codeoutline/main.lua +32 -7
  52. package/scripts/codeoutline/mcp.lua +52 -9
  53. package/scripts/codeoutline/navigation.lua +593 -147
  54. package/scripts/codeoutline/on_demand.lua +93 -0
  55. package/scripts/codeoutline/ordinary_bindings.lua +396 -0
  56. package/scripts/codeoutline/parse.lua +18 -2
  57. package/scripts/codeoutline/parse_pool.lua +1 -1
  58. package/scripts/codeoutline/parse_worker.lua +1 -1
  59. package/scripts/codeoutline/python_bindings.lua +112 -0
  60. package/scripts/codeoutline/query_filters.lua +65 -0
  61. package/scripts/codeoutline/query_report.lua +135 -8
  62. package/scripts/codeoutline/resolution.lua +23 -0
  63. package/scripts/codeoutline/rules.lua +127 -0
  64. package/scripts/codeoutline/rust_packages.lua +203 -0
  65. package/scripts/codeoutline/rust_resolution.lua +301 -0
  66. package/scripts/codeoutline/search_ranking.lua +70 -0
  67. package/scripts/codeoutline/service.lua +47 -7
  68. package/scripts/codeoutline/shared_events.lua +369 -0
  69. package/scripts/codeoutline/static_dispatch.lua +569 -0
  70. package/scripts/codeoutline/text.lua +3 -2
  71. package/scripts/codeoutline/ts_implementations.lua +81 -0
  72. package/scripts/codeoutline/type_bases.lua +61 -0
  73. package/scripts/codeoutline/type_hierarchy.lua +324 -0
  74. package/scripts/codeoutline/type_references.lua +290 -0
  75. package/scripts/codeoutline/type_uses.lua +260 -0
  76. package/scripts/codeoutline/update_sequence.lua +1 -1
  77. package/scripts/codeoutline/version.lua +1 -1
@@ -25,7 +25,12 @@ local text = require('codeoutline.text')
25
25
  function M.new(path, language, opts)
26
26
  return { path = path, language = language, nodes = {}, refs = {}, imports = {},
27
27
  ranges = not opts or opts.ranges ~= false, collect_dispatch = opts and opts.dispatch,
28
- dispatch_only = opts and opts.dispatch_only }
28
+ dispatch_only = opts and opts.dispatch_only, collect_static_dispatch = opts and opts.static_dispatch,
29
+ cpp_aliases_only = opts and opts.cpp_aliases_only,
30
+ collect_type_uses = opts and opts.type_uses,
31
+ defer_analysis = opts and opts.analysis == false or nil,
32
+ ordinary_bindings = opts and opts.ordinary_bindings,
33
+ collect_foreign = opts and opts.foreign, omit_signatures = opts and opts.omit_signatures }
29
34
  end
30
35
 
31
36
  -- Collapse a token span into a one-line signature.
@@ -40,6 +45,12 @@ end
40
45
  -- ti/tj: token range the node covers (used for ref attribution, then dropped).
41
46
  -- ni/nj: declaration name tokens; range_end overrides a synthetic block end.
42
47
  function M.add_node(r, T, f)
48
+ if not r.defer_analysis and r.collect_type_uses ~= false and (r.ranges or r.ordinary_bindings)
49
+ and r.language ~= 'lua' and r.language ~= 'python' and r.language ~= 'javascript' then f.type_token = f.ni or f.ti end
50
+ if r.ordinary_bindings and (r.language == 'c' or r.language == 'cpp') then
51
+ r.cpp_declaration_tokens = r.cpp_declaration_tokens or {}
52
+ r.cpp_declaration_tokens[#r.nodes + 1] = f.ni or f.ti
53
+ end
43
54
  local parent = f.parent and r.nodes[f.parent]
44
55
  local sep = f.sep or '.'
45
56
  f.qualified = parent and (parent.qualified .. sep .. f.name) or ((r.prefix and (r.prefix .. sep) or '') .. f.name)
@@ -61,6 +72,7 @@ end
61
72
  -- Record every call site in token range [a, b].
62
73
  local MEMBER = { ['.'] = true, ['->'] = true, ['::'] = true, ['?.'] = true }
63
74
  function M.add_calls(r, T, a, b)
75
+ if r.cpp_aliases_only then return end
64
76
  local skip = r.skip_calls
65
77
  local member = r.member_ops or MEMBER -- Lua adds ':' (obj:method())
66
78
  for _, x in ipairs(T:calls(a, b)) do
@@ -86,6 +98,7 @@ end
86
98
  local BEFORE = { [','] = true, ['('] = true, ['='] = true, ['{'] = true, ['&'] = true }
87
99
  local AFTER = { [','] = true, [')'] = true, ['}'] = true, [';'] = true }
88
100
  function M.add_value_refs(r, T, a, b)
101
+ if r.cpp_aliases_only then return end
89
102
  local seen = {}
90
103
  for _, x in ipairs(T:idents(a, b)) do
91
104
  local p, q = x - 1, x + 1
@@ -132,10 +145,21 @@ end
132
145
 
133
146
  -- Drop parser-internal fields so the result is plain data.
134
147
  function M.finish(r, T)
135
- if T and (r.language == 'c' or r.language == 'cpp') then
148
+ if r.cpp_aliases_only then
149
+ require('codeoutline.cpp_types').collect(r, T)
150
+ r.cpp_aliases_only = nil
151
+ return r
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
155
+ if T and r.collect_foreign and (r.language == 'c' or r.language == 'cpp') then
136
156
  require('codeoutline.foreign').collect(r, T)
137
157
  end
158
+ r.collect_foreign = nil
138
159
  M.assign_refs(r)
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
162
+ r.collect_static_dispatch = nil
139
163
  -- Query-only parse: preserve normal declaration/call attribution, but do
140
164
  -- not build binding evidence or compact records that will be discarded.
141
165
  if r.dispatch_only then
@@ -144,38 +168,70 @@ function M.finish(r, T)
144
168
  return r
145
169
  end
146
170
  if T then require('codeoutline.js_evidence').collect(r, T) end
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.automatic_events').collect(r, T)
179
+ require('codeoutline.shared_events').collect(r, T)
180
+ end
147
181
  if T then require('codeoutline.indirect').collect(r, T) end
148
182
  r.collect_dispatch = nil
183
+ local original_refs = r.refs
149
184
  local name, from, kind, line, recv = {}, {}, {}, {}, {}
150
- local js_receiver = r.js_imports and {}
151
- local lua_binding = r.lua_imports and {}
185
+ local js_receiver = not r.defer_analysis and r.js_imports and (r.ranges or r.ordinary_bindings) and {}
186
+ local lua_binding = not r.defer_analysis and r.lua_imports and (r.ranges or r.ordinary_bindings) and {}
187
+ local binding = (r.python_imports or r.has_bindings) and {}
188
+ r.has_bindings = nil
152
189
  local start, stop = r.ranges and T and {}, r.ranges and T and {}
153
190
  for i, ref in ipairs(r.refs) do
154
191
  name[i], from[i], kind[i], line[i], recv[i] = ref.name, ref.from, ref.kind, ref.line, ref.recv or false
155
192
  if js_receiver then js_receiver[i] = ref.js_receiver or '' end
156
193
  if lua_binding then lua_binding[i] = ref.lua_binding or '' end
194
+ if binding then binding[i] = ref.binding or '' end
157
195
  if start then
158
196
  local named = T:text(ref.tok) == ref.name
159
197
  start[i], stop[i] = named and T.s[ref.tok] - 1 or false, named and T.e[ref.tok] or false
160
198
  end
161
199
  end
162
200
  r.refs = { name = name, from = from, kind = kind, line = line, recv = recv, start = start or nil, stop = stop or nil }
163
- r.refs.js_receiver = js_receiver
164
- r.refs.lua_binding = lua_binding
201
+ r.refs.js_receiver = js_receiver or nil
202
+ r.refs.lua_binding = lua_binding or nil
203
+ r.refs.binding = binding
204
+ if r.type_use_refs and #r.type_use_refs > 0 then
205
+ r.type_sites = {}
206
+ local positions = {}
207
+ for i, ref in ipairs(r.type_use_refs) do
208
+ local site = ref.type_use
209
+ site.name, site.from, site.recv = ref.name, ref.from, ref.recv
210
+ r.type_sites[i] = site
211
+ if site.role ~= 'construction' then positions[ref.tok] = ref.name end
212
+ end
213
+ for i, ref in ipairs(original_refs) do
214
+ if positions[ref.tok] == ref.name then
215
+ r.type_exclusions = r.type_exclusions or {}; r.type_exclusions[i] = true
216
+ end
217
+ end
218
+ end
219
+ r.type_use_refs, r.collect_type_uses = nil, nil
165
220
  for i, n in ipairs(r.nodes) do
166
- n.ti, n.tj = nil, nil
221
+ n.ti, n.tj, n.type_token = nil, nil, nil
167
222
  if not r.ranges then
168
223
  -- Rebuild: deleting keys does not shrink Lua table allocations.
169
224
  local compact = {}
170
225
  for key, value in pairs(n) do
171
- if key ~= 'start_byte' and key ~= 'end_byte' and key ~= 'name_start' and key ~= 'name_end' then
226
+ if key ~= 'start_byte' and key ~= 'end_byte' and key ~= 'name_start' and key ~= 'name_end'
227
+ and not (r.omit_signatures and key == 'sig') then
172
228
  compact[key] = value
173
229
  end
174
230
  end
175
231
  r.nodes[i] = compact
176
232
  end
177
233
  end
178
- r.ranges = nil
234
+ r.ranges, r.omit_signatures, r.defer_analysis = nil, nil, nil
179
235
  r.prefix, r.skip_calls = nil, nil
180
236
  return r
181
237
  end