@codua/codeoutline-win32-x64 0.2.6 → 0.3.0
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 +205 -3
- package/README.zh-CN.md +40 -2
- package/bin/xnet.exe +0 -0
- package/build-info.json +1 -1
- package/package.json +1 -1
- package/scripts/codeoutline/affected.lua +145 -0
- package/scripts/codeoutline/automatic_events.lua +202 -0
- package/scripts/codeoutline/cache_repairs.lua +47 -0
- package/scripts/codeoutline/callers.lua +56 -16
- package/scripts/codeoutline/cargo_toml.lua +125 -0
- package/scripts/codeoutline/command.lua +26 -4
- package/scripts/codeoutline/common.lua +48 -7
- package/scripts/codeoutline/completion.lua +126 -22
- package/scripts/codeoutline/coverage.lua +63 -0
- package/scripts/codeoutline/cpp_bindings.lua +46 -11
- package/scripts/codeoutline/cpp_fragments.lua +143 -0
- package/scripts/codeoutline/cpp_implementations.lua +340 -0
- package/scripts/codeoutline/cpp_includes.lua +156 -0
- package/scripts/codeoutline/cpp_macros.lua +279 -0
- package/scripts/codeoutline/cpp_receivers.lua +342 -0
- package/scripts/codeoutline/cpp_types.lua +285 -29
- package/scripts/codeoutline/definition_candidates.lua +186 -0
- package/scripts/codeoutline/dispatch_aliases.lua +10 -5
- package/scripts/codeoutline/documents.lua +22 -9
- package/scripts/codeoutline/explore.lua +243 -122
- package/scripts/codeoutline/external_headers.lua +176 -0
- package/scripts/codeoutline/foreign.lua +23 -3
- package/scripts/codeoutline/function_values.lua +69 -0
- package/scripts/codeoutline/go_methods.lua +931 -0
- package/scripts/codeoutline/go_modules.lua +329 -0
- package/scripts/codeoutline/graph.lua +322 -67
- package/scripts/codeoutline/implementations.lua +403 -0
- package/scripts/codeoutline/index.lua +161 -28
- package/scripts/codeoutline/index_worker.lua +11 -4
- package/scripts/codeoutline/indirect.lua +4 -2
- package/scripts/codeoutline/js_evidence.lua +2 -1
- package/scripts/codeoutline/js_resolution.lua +40 -12
- package/scripts/codeoutline/js_workspace.lua +325 -0
- package/scripts/codeoutline/lang/c.lua +15 -2
- package/scripts/codeoutline/lang/cpp.lua +32 -18
- package/scripts/codeoutline/lang/csharp.lua +1 -1
- package/scripts/codeoutline/lang/js.lua +56 -20
- package/scripts/codeoutline/lang/rust.lua +9 -1
- package/scripts/codeoutline/language_detect.lua +100 -0
- package/scripts/codeoutline/lsp.lua +173 -23
- package/scripts/codeoutline/lua_bindings.lua +151 -47
- package/scripts/codeoutline/lua_callback_loops.lua +210 -0
- package/scripts/codeoutline/main.lua +32 -7
- package/scripts/codeoutline/mcp.lua +52 -9
- package/scripts/codeoutline/navigation.lua +351 -65
- package/scripts/codeoutline/on_demand.lua +93 -0
- package/scripts/codeoutline/ordinary_bindings.lua +210 -34
- package/scripts/codeoutline/parse.lua +18 -2
- package/scripts/codeoutline/parse_pool.lua +1 -1
- package/scripts/codeoutline/parse_worker.lua +1 -1
- package/scripts/codeoutline/python_bindings.lua +2 -2
- package/scripts/codeoutline/query_filters.lua +65 -0
- package/scripts/codeoutline/query_report.lua +56 -19
- package/scripts/codeoutline/resolution.lua +23 -0
- package/scripts/codeoutline/rust_packages.lua +203 -0
- package/scripts/codeoutline/rust_resolution.lua +301 -0
- package/scripts/codeoutline/search_ranking.lua +70 -0
- package/scripts/codeoutline/service.lua +47 -7
- package/scripts/codeoutline/shared_events.lua +369 -0
- package/scripts/codeoutline/static_dispatch.lua +46 -11
- package/scripts/codeoutline/text.lua +3 -2
- package/scripts/codeoutline/ts_implementations.lua +81 -0
- package/scripts/codeoutline/type_bases.lua +61 -0
- package/scripts/codeoutline/type_hierarchy.lua +324 -0
- package/scripts/codeoutline/type_references.lua +291 -0
- package/scripts/codeoutline/type_uses.lua +260 -0
- package/scripts/codeoutline/update_sequence.lua +1 -1
- package/scripts/codeoutline/version.lua +1 -1
|
@@ -26,6 +26,9 @@ 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
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,
|
|
29
32
|
ordinary_bindings = opts and opts.ordinary_bindings,
|
|
30
33
|
collect_foreign = opts and opts.foreign, omit_signatures = opts and opts.omit_signatures }
|
|
31
34
|
end
|
|
@@ -42,6 +45,12 @@ end
|
|
|
42
45
|
-- ti/tj: token range the node covers (used for ref attribution, then dropped).
|
|
43
46
|
-- ni/nj: declaration name tokens; range_end overrides a synthetic block end.
|
|
44
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
|
|
45
54
|
local parent = f.parent and r.nodes[f.parent]
|
|
46
55
|
local sep = f.sep or '.'
|
|
47
56
|
f.qualified = parent and (parent.qualified .. sep .. f.name) or ((r.prefix and (r.prefix .. sep) or '') .. f.name)
|
|
@@ -63,6 +72,7 @@ end
|
|
|
63
72
|
-- Record every call site in token range [a, b].
|
|
64
73
|
local MEMBER = { ['.'] = true, ['->'] = true, ['::'] = true, ['?.'] = true }
|
|
65
74
|
function M.add_calls(r, T, a, b)
|
|
75
|
+
if r.cpp_aliases_only then return end
|
|
66
76
|
local skip = r.skip_calls
|
|
67
77
|
local member = r.member_ops or MEMBER -- Lua adds ':' (obj:method())
|
|
68
78
|
for _, x in ipairs(T:calls(a, b)) do
|
|
@@ -88,6 +98,7 @@ end
|
|
|
88
98
|
local BEFORE = { [','] = true, ['('] = true, ['='] = true, ['{'] = true, ['&'] = true }
|
|
89
99
|
local AFTER = { [','] = true, [')'] = true, ['}'] = true, [';'] = true }
|
|
90
100
|
function M.add_value_refs(r, T, a, b)
|
|
101
|
+
if r.cpp_aliases_only then return end
|
|
91
102
|
local seen = {}
|
|
92
103
|
for _, x in ipairs(T:idents(a, b)) do
|
|
93
104
|
local p, q = x - 1, x + 1
|
|
@@ -134,11 +145,19 @@ end
|
|
|
134
145
|
|
|
135
146
|
-- Drop parser-internal fields so the result is plain data.
|
|
136
147
|
function M.finish(r, T)
|
|
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
|
|
137
155
|
if T and r.collect_foreign and (r.language == 'c' or r.language == 'cpp') then
|
|
138
156
|
require('codeoutline.foreign').collect(r, T)
|
|
139
157
|
end
|
|
140
158
|
r.collect_foreign = nil
|
|
141
159
|
M.assign_refs(r)
|
|
160
|
+
if r.type_use_refs then M.assign_refs({ nodes = r.nodes, refs = r.type_use_refs }) end
|
|
142
161
|
if T then require('codeoutline.static_dispatch').collect(r, T) end
|
|
143
162
|
r.collect_static_dispatch = nil
|
|
144
163
|
-- Query-only parse: preserve normal declaration/call attribution, but do
|
|
@@ -150,15 +169,21 @@ function M.finish(r, T)
|
|
|
150
169
|
end
|
|
151
170
|
if T then require('codeoutline.js_evidence').collect(r, T) end
|
|
152
171
|
if T and r.ordinary_bindings then
|
|
172
|
+
require('codeoutline.cpp_macros').collect(r, T)
|
|
153
173
|
require('codeoutline.python_bindings').collect(r, T)
|
|
154
|
-
require('codeoutline.cpp_bindings').collect(r, T)
|
|
174
|
+
require('codeoutline.cpp_bindings').collect(r, T, r.type_use_refs)
|
|
175
|
+
require('codeoutline.cpp_receivers').collect(r, T)
|
|
155
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)
|
|
156
180
|
end
|
|
157
181
|
if T then require('codeoutline.indirect').collect(r, T) end
|
|
158
182
|
r.collect_dispatch = nil
|
|
183
|
+
local original_refs = r.refs
|
|
159
184
|
local name, from, kind, line, recv = {}, {}, {}, {}, {}
|
|
160
|
-
local js_receiver = r.js_imports and {}
|
|
161
|
-
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 {}
|
|
162
187
|
local binding = (r.python_imports or r.has_bindings) and {}
|
|
163
188
|
r.has_bindings = nil
|
|
164
189
|
local start, stop = r.ranges and T and {}, r.ranges and T and {}
|
|
@@ -173,11 +198,27 @@ function M.finish(r, T)
|
|
|
173
198
|
end
|
|
174
199
|
end
|
|
175
200
|
r.refs = { name = name, from = from, kind = kind, line = line, recv = recv, start = start or nil, stop = stop or nil }
|
|
176
|
-
r.refs.js_receiver = js_receiver
|
|
177
|
-
r.refs.lua_binding = lua_binding
|
|
201
|
+
r.refs.js_receiver = js_receiver or nil
|
|
202
|
+
r.refs.lua_binding = lua_binding or nil
|
|
178
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
|
|
179
220
|
for i, n in ipairs(r.nodes) do
|
|
180
|
-
n.ti, n.tj = nil, nil
|
|
221
|
+
n.ti, n.tj, n.type_token = nil, nil, nil
|
|
181
222
|
if not r.ranges then
|
|
182
223
|
-- Rebuild: deleting keys does not shrink Lua table allocations.
|
|
183
224
|
local compact = {}
|
|
@@ -190,7 +231,7 @@ function M.finish(r, T)
|
|
|
190
231
|
r.nodes[i] = compact
|
|
191
232
|
end
|
|
192
233
|
end
|
|
193
|
-
r.ranges, r.omit_signatures = nil, nil
|
|
234
|
+
r.ranges, r.omit_signatures, r.defer_analysis = nil, nil, nil
|
|
194
235
|
r.prefix, r.skip_calls = nil, nil
|
|
195
236
|
return r
|
|
196
237
|
end
|
|
@@ -37,8 +37,8 @@ end
|
|
|
37
37
|
local WRAPPERS = {}
|
|
38
38
|
for word in ([[Option Box Rc Arc RefCell Cell Mutex RwLock Weak unique_ptr shared_ptr weak_ptr Ptr Ref
|
|
39
39
|
Optional Nullable Promise Future Lazy]]):gmatch('%S+') do WRAPPERS[word] = true end
|
|
40
|
-
local TYPE_AFTER = { go = true, rust = true, typescript = true, javascript = true, python = true, kotlin = true }
|
|
41
|
-
local DYNAMIC = { lua = true, python = true, javascript = true, typescript = true }
|
|
40
|
+
local TYPE_AFTER = { go = true, rust = true, typescript = true, arkts = true, javascript = true, python = true, kotlin = true }
|
|
41
|
+
local DYNAMIC = { lua = true, python = true, javascript = true, typescript = true, arkts = true }
|
|
42
42
|
|
|
43
43
|
local function text_of(T, i) return T.s[i] and T:text(i) or '' end
|
|
44
44
|
local function is(T, i, s) return T.k[i] == 'op' and text_of(T, i) == s end
|
|
@@ -113,7 +113,7 @@ local function declared(node, language)
|
|
|
113
113
|
rest = rest:sub(#params + 1):gsub('^%s+', '')
|
|
114
114
|
if rest:sub(1, 1) == '(' then rest = rest:match('^%((.-)[,%)]') or '' end
|
|
115
115
|
return normalize(rest)
|
|
116
|
-
elseif language == 'typescript' or language == 'javascript' or language == 'kotlin' then
|
|
116
|
+
elseif language == 'typescript' or language == 'arkts' or language == 'javascript' or language == 'kotlin' then
|
|
117
117
|
local after = sig:match('%)%s*:%s*([^{=]+)$')
|
|
118
118
|
return after and normalize(after)
|
|
119
119
|
elseif language == 'lua' then
|
|
@@ -307,7 +307,7 @@ local function declarations(T, a, b, language, skip, out)
|
|
|
307
307
|
local k = i + 1
|
|
308
308
|
while T.k[k] == 'id' do add(k); if is(T, k + 1, ',') then k = k + 2 else break end end
|
|
309
309
|
elseif kw(T, i, 'as') and T.k[i + 1] == 'id' then add(i + 1) end
|
|
310
|
-
elseif language == 'javascript' or language == 'typescript' or language == 'kotlin' then
|
|
310
|
+
elseif language == 'javascript' or language == 'typescript' or language == 'arkts' or language == 'kotlin' then
|
|
311
311
|
if (kw(T, i, 'let') or kw(T, i, 'const') or kw(T, i, 'var') or kw(T, i, 'val')) and T.k[i + 1] == 'id' then
|
|
312
312
|
local k, type = i + 2, nil
|
|
313
313
|
if is(T, k, ':') then
|
|
@@ -399,14 +399,14 @@ local function module_aliases(T, language)
|
|
|
399
399
|
end
|
|
400
400
|
j = j + 1
|
|
401
401
|
end
|
|
402
|
-
elseif (language == 'javascript' or language == 'typescript') then
|
|
402
|
+
elseif (language == 'javascript' or language == 'typescript' or language == 'arkts') then
|
|
403
403
|
if kw(T, i, 'import') and is(T, i + 1, '*') and T.k[i + 3] == 'id' and T.k[i + 5] == 'str' then
|
|
404
404
|
out[text_of(T, i + 3)] = { kind = 'import', path = text_of(T, i + 5):sub(2, -2) }
|
|
405
405
|
elseif kw(T, i, 'import') and T.k[i + 1] == 'id' and T.k[i + 3] == 'str' then
|
|
406
406
|
out[text_of(T, i + 1)] = { kind = 'import', path = text_of(T, i + 3):sub(2, -2) }
|
|
407
407
|
elseif (kw(T, i, 'const') or kw(T, i, 'let') or kw(T, i, 'var')) and T.k[i + 1] == 'id' and is(T, i + 2, '=') then
|
|
408
408
|
local value = initializer(T, i + 3, math.min(T.n, i + 6))
|
|
409
|
-
if value.module then out[text_of(T, i + 1)] = { kind = '
|
|
409
|
+
if value.module then out[text_of(T, i + 1)] = { kind = 'require', path = value.module } end
|
|
410
410
|
end
|
|
411
411
|
elseif language == 'go' and kw(T, i, 'import') then
|
|
412
412
|
local first, last = i + 1, i + 2
|
|
@@ -451,6 +451,7 @@ Completion.__index = Completion
|
|
|
451
451
|
function Completion:types(name, f, scope, at)
|
|
452
452
|
if not name then return {} end
|
|
453
453
|
f = f or self.f
|
|
454
|
+
if self.V.files[f].language == 'go' then return require('codeoutline.go_methods').context(self.V, self.V.js_context).types(f, name) end
|
|
454
455
|
local accept = self.language == 'lua' and LUA_TYPES or TYPES
|
|
455
456
|
local direct, paired = navigation.deps(self.V, f)
|
|
456
457
|
if self.V.files[f].language == 'csharp' then
|
|
@@ -458,15 +459,20 @@ function Completion:types(name, f, scope, at)
|
|
|
458
459
|
at or (f == self.f and self.offset) or 0, self.V.js_context, { scope = scope })
|
|
459
460
|
return ids
|
|
460
461
|
end
|
|
462
|
+
if self.V.files[f].language == 'java' or self.V.files[f].language == 'kotlin' then
|
|
463
|
+
local owner = self.fn and self.rec.nodes[self.fn] or self.owner and self.rec.nodes[self.owner]
|
|
464
|
+
scope = scope or owner and owner.qualified
|
|
465
|
+
return require('codeoutline.implementations').types(self.V, f, name, self.V.js_context, scope, at)
|
|
466
|
+
end
|
|
461
467
|
if self.V.files[f].language == 'cpp' then
|
|
462
468
|
if not scope and f == self.f then
|
|
463
469
|
local owner = self.fn and self.rec.nodes[self.fn] or self.owner and self.rec.nodes[self.owner]
|
|
464
470
|
scope = owner and (CALLABLE[owner.kind] and owner.qualified:match('^(.*)::[^:]+$') or owner.qualified)
|
|
465
471
|
end
|
|
466
472
|
if at == nil and f == self.f then at = self.offset end
|
|
467
|
-
local ids
|
|
468
|
-
{ scope = scope, at = at or nil,
|
|
469
|
-
|
|
473
|
+
local ids = require('codeoutline.cpp_types').resolve(self.V, f, name,
|
|
474
|
+
{ scope = scope, at = at or nil, context = self.V.js_context, accept = TYPES, forward = true })
|
|
475
|
+
return ids
|
|
470
476
|
end
|
|
471
477
|
local found = graph.resolve(self.V, f, nil, name, 'call', nil, direct, paired, accept) or {}
|
|
472
478
|
if #found == 0 then
|
|
@@ -496,7 +502,7 @@ function Completion:types(name, f, scope, at)
|
|
|
496
502
|
end
|
|
497
503
|
|
|
498
504
|
function Completion:expired()
|
|
499
|
-
if
|
|
505
|
+
if xtimer.now_ms() > self.deadline then self.incomplete = true; return true end
|
|
500
506
|
return false
|
|
501
507
|
end
|
|
502
508
|
|
|
@@ -504,6 +510,13 @@ end
|
|
|
504
510
|
function Completion:members(ids, depth, seen)
|
|
505
511
|
depth, seen = depth or 0, seen or {}
|
|
506
512
|
local V, out = self.V, {}
|
|
513
|
+
if self.language == 'go' then
|
|
514
|
+
local methods = require('codeoutline.go_methods').context(V, V.js_context)
|
|
515
|
+
for _, id in ipairs(ids) do
|
|
516
|
+
for _, entry in ipairs(methods.members({ id = id, pointer = false, addressable = true }, self.f)) do out[#out + 1] = entry end
|
|
517
|
+
end
|
|
518
|
+
return out
|
|
519
|
+
end
|
|
507
520
|
local function add(name, kind, node, f)
|
|
508
521
|
out[#out + 1] = { name = name, kind = kind, node = node, file = f }
|
|
509
522
|
end
|
|
@@ -523,9 +536,18 @@ function Completion:members(ids, depth, seen)
|
|
|
523
536
|
if c.parent == n then add(c.name, c.kind, c, f) end
|
|
524
537
|
end
|
|
525
538
|
-- Out-of-line members anywhere: `Box::area`, Go methods, Lua `M.f` / `M:f`.
|
|
526
|
-
for _, entry in ipairs(self:owned(node.qualified, graph.family(language))) do
|
|
539
|
+
for _, entry in ipairs(self:owned(node.qualified, graph.family(language))) do
|
|
540
|
+
if self:expired() then break end
|
|
541
|
+
local owner = language == 'cpp' and require('codeoutline.cpp_types').owner(V, entry.file, entry.node, V.js_context)
|
|
542
|
+
local parent = entry.node.parent and V.files[entry.file].nodes[entry.node.parent]
|
|
543
|
+
local legacy = language == 'cpp' and not owner and (not parent or not TYPES[parent.kind])
|
|
544
|
+
and not require('codeoutline.cpp_includes').policy(V, self.f, V.js_context).configured
|
|
545
|
+
if language ~= 'cpp' or owner == id or legacy then
|
|
546
|
+
out[#out + 1] = entry
|
|
547
|
+
end
|
|
548
|
+
end
|
|
527
549
|
-- Attributes assigned in methods (Python, JS) or on Lua tables.
|
|
528
|
-
if T and (language == 'python' or language == 'javascript' or language == 'typescript' or language == 'lua') then
|
|
550
|
+
if T and (language == 'python' or language == 'javascript' or language == 'typescript' or language == 'arkts' or language == 'lua') then
|
|
529
551
|
local first, last = 1, T.n
|
|
530
552
|
if target.start_byte and language ~= 'lua' then
|
|
531
553
|
first, last = nil, nil
|
|
@@ -760,6 +782,11 @@ end
|
|
|
760
782
|
-- A receiver: { types = ids } or { modules = files }.
|
|
761
783
|
function Completion:receiver(item, depth)
|
|
762
784
|
local name = item.name
|
|
785
|
+
if self.language == 'go' then
|
|
786
|
+
local receiver = require('codeoutline.go_methods').context(self.V, self.V.js_context).receiver(self.f, name, self.offset)
|
|
787
|
+
if receiver == false then return { go_blocked = true } end
|
|
788
|
+
if receiver then return { go_receiver = receiver } end
|
|
789
|
+
end
|
|
763
790
|
if self.language == 'lua' then
|
|
764
791
|
local target, bound = require('codeoutline.lua_bindings').receiver(
|
|
765
792
|
self.V, self.rec, self.T, name, self.offset, self.V.js_context.lua)
|
|
@@ -799,6 +826,12 @@ function Completion:receiver(item, depth)
|
|
|
799
826
|
if namespace then return { csharp_namespace = namespace } end
|
|
800
827
|
if known then return #ids > 0 and { types = ids, static = not item.call } or nil end
|
|
801
828
|
end
|
|
829
|
+
if self.language == 'cpp' then
|
|
830
|
+
local ids = self:types(name)
|
|
831
|
+
if #ids == 0 then return nil end
|
|
832
|
+
if self.V.nodes[ids[1]].kind == 'namespace' then return { cpp_namespace = self.V.nodes[ids[1]].qualified } end
|
|
833
|
+
return { types = ids, static = true }
|
|
834
|
+
end
|
|
802
835
|
local ids = self:types(name)
|
|
803
836
|
if #ids > 0 then return { types = ids, static = true } end
|
|
804
837
|
-- Dynamic languages: a global table with members defined elsewhere, or a
|
|
@@ -809,6 +842,36 @@ end
|
|
|
809
842
|
|
|
810
843
|
function Completion:entries(target)
|
|
811
844
|
if not target then return {} end
|
|
845
|
+
if target.go_blocked or target.cxx_blocked then return {} end
|
|
846
|
+
if target.go_receiver then return require('codeoutline.go_methods').context(self.V, self.V.js_context).members(target.go_receiver, self.f) end
|
|
847
|
+
if target.cxx_receiver then
|
|
848
|
+
local receivers = require('codeoutline.cpp_receivers').context(self.V, self.V.js_context)
|
|
849
|
+
local out, names = {}, {}
|
|
850
|
+
for _, entry in ipairs(self:members({ target.cxx_receiver.id })) do
|
|
851
|
+
if self:expired() then break end
|
|
852
|
+
if not names[entry.name] then
|
|
853
|
+
names[entry.name] = true
|
|
854
|
+
for _, id in ipairs(receivers.members(target.cxx_receiver, entry.name, target.cxx_op)) do
|
|
855
|
+
out[#out + 1] = { name = self.V.nodes[id].name, kind = self.V.nodes[id].kind,
|
|
856
|
+
node = self.V.nodes[id], file = self.V.node_file[id] }
|
|
857
|
+
end
|
|
858
|
+
end
|
|
859
|
+
end
|
|
860
|
+
return out
|
|
861
|
+
end
|
|
862
|
+
if target.rust_module then return require('codeoutline.rust_resolution').members(self.V, target.rust_module, self.V.js_context) end
|
|
863
|
+
if target.cpp_namespace then
|
|
864
|
+
local bindings, result = require('codeoutline.cpp_types'), {}
|
|
865
|
+
local any = setmetatable({}, { __index = function() return true end })
|
|
866
|
+
for _, entry in ipairs(bindings.namespace_members(self.V, self.f, target.cpp_namespace, self.V.js_context, self.offset,
|
|
867
|
+
nil, nil, function() return self:expired() end)) do
|
|
868
|
+
if self:expired() then break end
|
|
869
|
+
local ids = bindings.resolve(self.V, self.f, '::' .. target.cpp_namespace .. '::' .. entry.name,
|
|
870
|
+
{ context = self.V.js_context, at = self.offset, accept = any })
|
|
871
|
+
if #ids > 0 then result[#result + 1] = entry end
|
|
872
|
+
end
|
|
873
|
+
return result
|
|
874
|
+
end
|
|
812
875
|
if target.csharp_namespace ~= nil then
|
|
813
876
|
return require('codeoutline.csharp_bindings').namespace_members(self.V, self.f, target.csharp_namespace, self.V.js_context)
|
|
814
877
|
end
|
|
@@ -835,14 +898,26 @@ end
|
|
|
835
898
|
-- Type of a receiver chain, element by element.
|
|
836
899
|
function Completion:chain(chain, depth)
|
|
837
900
|
depth = depth or 0
|
|
901
|
+
if self.rust_static and require('codeoutline.rust_packages').owner(self.V, self.f, self.V.js_context) then
|
|
902
|
+
local names, plain = {}, true
|
|
903
|
+
for _, element in ipairs(chain) do names[#names + 1] = element.name; if element.call then plain = false end end
|
|
904
|
+
if plain then
|
|
905
|
+
local scope = require('codeoutline.rust_resolution').scope(self.V, self.f, self.fn and self.V.id_of[self.f][self.fn])
|
|
906
|
+
local found = require('codeoutline.rust_resolution').path(self.V, self.f, table.concat(names, '::'), self.V.js_context, scope)
|
|
907
|
+
if found and found.module then return { rust_module = found.module } end
|
|
908
|
+
end
|
|
909
|
+
end
|
|
838
910
|
local target = self:receiver(chain[1], depth)
|
|
839
911
|
for k = 2, #chain do
|
|
840
912
|
if not target or self:expired() then return nil end
|
|
841
|
-
local element, next_ids, next_files, next_module, next_namespace, next_static = chain[k], {}, nil, nil, nil, nil
|
|
913
|
+
local element, next_ids, next_files, next_module, next_namespace, next_static, next_cpp = chain[k], {}, nil, nil, nil, nil, nil
|
|
842
914
|
for _, entry in ipairs(self:entries(target)) do
|
|
843
915
|
if entry.name == element.name then
|
|
844
916
|
local node = entry.node
|
|
845
|
-
if self.language == '
|
|
917
|
+
if self.language == 'cpp' and node.kind == 'namespace' then next_cpp = node.qualified
|
|
918
|
+
elseif self.language == 'cpp' and TYPES[node.kind] then
|
|
919
|
+
for _, id in ipairs(self:types('::' .. node.qualified)) do next_ids[#next_ids + 1] = id end
|
|
920
|
+
elseif self.language == 'csharp' and node.kind == 'namespace' then next_namespace = node.qualified
|
|
846
921
|
elseif self.language == 'csharp' and TYPES[node.kind] then
|
|
847
922
|
next_static = not element.call
|
|
848
923
|
local ids = require('codeoutline.csharp_bindings').types(self.V, self.f, 'global::' .. node.qualified, self.offset, self.V.js_context)
|
|
@@ -868,7 +943,7 @@ function Completion:chain(chain, depth)
|
|
|
868
943
|
end
|
|
869
944
|
end
|
|
870
945
|
end
|
|
871
|
-
target = next_namespace and { csharp_namespace = next_namespace } or #next_ids > 0 and { types = next_ids, static = next_static }
|
|
946
|
+
target = next_cpp and { cpp_namespace = next_cpp } or next_namespace and { csharp_namespace = next_namespace } or #next_ids > 0 and { types = next_ids, static = next_static }
|
|
872
947
|
or (next_module and { modules = next_files, module_name = next_module } or nil)
|
|
873
948
|
end
|
|
874
949
|
return target
|
|
@@ -881,7 +956,7 @@ local function receiver_chain(T, op, member)
|
|
|
881
956
|
local call = false
|
|
882
957
|
if is(T, i, ')') and T.m[i] then call = true; i = T.m[i] - 1 end
|
|
883
958
|
if is(T, i, '>') and T.m[i] then i = T.m[i] - 1 end
|
|
884
|
-
if not (T.k[i] == 'id' or (T.k[i] == 'kw' and SELF[text_of(T, i)])) then
|
|
959
|
+
if not (T.k[i] == 'id' or (T.k[i] == 'kw' and (SELF[text_of(T, i)] or text_of(T, i) == 'crate' or text_of(T, i) == 'super'))) then
|
|
885
960
|
if call or #chain == 0 then return nil end
|
|
886
961
|
break
|
|
887
962
|
end
|
|
@@ -904,10 +979,10 @@ end
|
|
|
904
979
|
function M.complete(req)
|
|
905
980
|
local doc = navigation.request_doc(req)
|
|
906
981
|
if not doc then return { items = {} } end
|
|
907
|
-
local V = navigation.view(req.session, req.root)
|
|
982
|
+
local V = navigation.view(req.session, req.root, req.includePaths)
|
|
908
983
|
local f = V.add(doc)
|
|
909
984
|
if not f then return { items = {} } end
|
|
910
|
-
local self = setmetatable({ V = V, f = f, doc = doc, deadline =
|
|
985
|
+
local self = setmetatable({ V = V, f = f, doc = doc, deadline = xtimer.now_ms() + M.BUDGET_SECONDS * 1000,
|
|
911
986
|
incomplete = false }, Completion)
|
|
912
987
|
self.rec, self.T = full(V, f)
|
|
913
988
|
if not self.rec or not self.T then return { items = {} } end
|
|
@@ -921,13 +996,36 @@ function M.complete(req)
|
|
|
921
996
|
local op = t
|
|
922
997
|
if t and (T.k[t] == 'id' or T.k[t] == 'kw') and T.e[t] >= offset then op = t - 1 end
|
|
923
998
|
local is_member = op and op >= 1 and T.k[op] == 'op' and member[text_of(T, op)] and T.e[op] <= offset
|
|
999
|
+
self.rust_static = self.language == 'rust' and is_member and text_of(T, op) == '::'
|
|
924
1000
|
if req.trigger and not is_member then return { items = {} } end
|
|
925
1001
|
self.fn, self.owner = self:scope()
|
|
1002
|
+
local prefix = t and T.k[t] == 'id' and T.e[t] >= offset
|
|
1003
|
+
and doc.source:sub(T.s[t], offset):lower() or ''
|
|
926
1004
|
self.aliases = module_aliases(T, self.language)
|
|
1005
|
+
if self.language == 'go' then self.aliases = require('codeoutline.go_modules').aliases(V, f, V.js_context) end
|
|
927
1006
|
local entries = {}
|
|
928
1007
|
if is_member then
|
|
929
1008
|
local chain = receiver_chain(T, op, member)
|
|
930
|
-
local target
|
|
1009
|
+
local target
|
|
1010
|
+
if self.language == 'go' then
|
|
1011
|
+
local methods = require('codeoutline.go_methods')
|
|
1012
|
+
local expression = methods.expression(T, op - 1)
|
|
1013
|
+
if expression and expression.kind ~= 'binding_value' then
|
|
1014
|
+
local receiver = methods.context(V, V.js_context).expression_receiver(f, expression)
|
|
1015
|
+
target = receiver and { go_receiver = receiver } or { go_blocked = true }
|
|
1016
|
+
end
|
|
1017
|
+
elseif self.language == 'c' or self.language == 'cpp' then
|
|
1018
|
+
local receivers = require('codeoutline.cpp_receivers')
|
|
1019
|
+
local expression, _, _, call = receivers.expression(T, op - 1)
|
|
1020
|
+
if call then
|
|
1021
|
+
local source = self.fn and V.id_of[f][self.fn]
|
|
1022
|
+
local receiver = receivers.context(V, V.js_context).receiver(f, expression, source)
|
|
1023
|
+
local valid = receiver and (text_of(T, op) == '->' and receiver.pointer == 1
|
|
1024
|
+
or text_of(T, op) == '.' and receiver.pointer == 0)
|
|
1025
|
+
target = valid and { cxx_receiver = receiver, cxx_op = text_of(T, op) } or { cxx_blocked = true }
|
|
1026
|
+
end
|
|
1027
|
+
end
|
|
1028
|
+
target = target or chain and self:chain(chain)
|
|
931
1029
|
entries = self:entries(target)
|
|
932
1030
|
if self.language == 'lua' and text_of(T, op) == ':' then
|
|
933
1031
|
local methods = {}
|
|
@@ -997,6 +1095,12 @@ function M.complete(req)
|
|
|
997
1095
|
end
|
|
998
1096
|
end
|
|
999
1097
|
end
|
|
1098
|
+
if self.language == 'cpp' and not self:expired() then
|
|
1099
|
+
local owner = self.fn and self.rec.nodes[self.fn] or self.owner and self.rec.nodes[self.owner]
|
|
1100
|
+
local scope = owner and (CALLABLE[owner.kind] and owner.qualified:match('^(.*)::[^:]+$') or owner.qualified)
|
|
1101
|
+
for _, entry in ipairs(require('codeoutline.cpp_types').imported_members(V, f, scope, offset, V.js_context,
|
|
1102
|
+
function() return self:expired() end, prefix)) do entries[#entries + 1] = entry end
|
|
1103
|
+
end
|
|
1000
1104
|
if self.owner or self.fn then
|
|
1001
1105
|
local ids = self:self_types()
|
|
1002
1106
|
for _, entry in ipairs(self:members(ids)) do entries[#entries + 1] = entry end
|
|
@@ -1004,8 +1108,6 @@ function M.complete(req)
|
|
|
1004
1108
|
end
|
|
1005
1109
|
-- Preserve editor-side fuzzy filtering, but keep prefix matches ahead of
|
|
1006
1110
|
-- unrelated items when a large include tree exceeds the response limit.
|
|
1007
|
-
local prefix = t and T.k[t] == 'id' and T.e[t] >= offset
|
|
1008
|
-
and doc.source:sub(T.s[t], offset):lower() or ''
|
|
1009
1111
|
if prefix ~= '' and #entries > M.MAX_ITEMS then
|
|
1010
1112
|
local ordered = {}
|
|
1011
1113
|
for _, entry in ipairs(entries) do
|
|
@@ -1024,7 +1126,9 @@ function M.complete(req)
|
|
|
1024
1126
|
items[#items + 1] = item_for(entry, self.language, V, not self:expired())
|
|
1025
1127
|
end
|
|
1026
1128
|
end
|
|
1027
|
-
return { items = items, incomplete = self.incomplete
|
|
1129
|
+
return { items = items, incomplete = self.incomplete or V.js_context.include_incomplete
|
|
1130
|
+
or V.js_context.workspace_incomplete or V.js_context.go_incomplete or V.js_context.go_methods_incomplete
|
|
1131
|
+
or V.js_context.cpp_receivers_incomplete or V.js_context.rust_incomplete }
|
|
1028
1132
|
end
|
|
1029
1133
|
|
|
1030
1134
|
navigation.register('lsp_completion', function(req)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
-- Small agent-facing status, independent of source text and temporary node IDs.
|
|
2
|
+
local M = {}
|
|
3
|
+
|
|
4
|
+
function M.relations(info)
|
|
5
|
+
local result = {}
|
|
6
|
+
local stats = info.query_stats or {}
|
|
7
|
+
for reason in pairs(stats.incomplete_reasons or {}) do result[#result + 1] = reason end
|
|
8
|
+
local shared = stats.events and stats.events.shared
|
|
9
|
+
for reason in pairs(shared and shared.incomplete_reasons or {}) do
|
|
10
|
+
result[#result + 1] = 'shared_events.' .. reason
|
|
11
|
+
end
|
|
12
|
+
if info.relationships_incomplete and #result == 0 then result[1] = 'relationship_analysis_incomplete' end
|
|
13
|
+
table.sort(result); return result
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
function M.summarize(info)
|
|
17
|
+
info = info or {}
|
|
18
|
+
local reasons, seen = {}, {}
|
|
19
|
+
local function add(reason)
|
|
20
|
+
if not seen[reason] then seen[reason] = true; reasons[#reasons + 1] = reason end
|
|
21
|
+
end
|
|
22
|
+
for _, reason in ipairs(M.relations(info)) do add(reason) end
|
|
23
|
+
local flags = {
|
|
24
|
+
truncated = 'output_truncated', seed_selection_limited = 'seed_selection_limited',
|
|
25
|
+
seed_limit_reached = 'seed_candidate_limit', path_search_limited = 'path_search_limit',
|
|
26
|
+
depth_limit_reached = 'depth_limit', node_limit_reached = 'node_limit', time_limit_reached = 'time_limit',
|
|
27
|
+
candidate_limit_reached = 'candidate_limit', cycle_detected = 'inheritance_cycle',
|
|
28
|
+
evidence_truncated = 'evidence_omitted', unresolved_candidates_truncated = 'definition_candidates_omitted',
|
|
29
|
+
path_breakpoints_truncated = 'path_breakpoints_omitted', on_demand_truncated = 'on_demand_limit',
|
|
30
|
+
}
|
|
31
|
+
for flag, reason in pairs(flags) do if info[flag] then add(reason) end end
|
|
32
|
+
if info.unresolved_files and #info.unresolved_files > 0 then add('unresolved_files') end
|
|
33
|
+
if info.files_without_symbols and #info.files_without_symbols > 0 then add('files_without_symbols') end
|
|
34
|
+
if info.on_demand_rejected and #info.on_demand_rejected > 0 then add('on_demand_rejected') end
|
|
35
|
+
if info.unresolved and #info.unresolved > 0 then add('unresolved_types') end
|
|
36
|
+
if (info.unresolved_sites or 0) > 0 then add('unresolved_type_sites') end
|
|
37
|
+
if (info.ambiguous_sites or 0) > 0 then add('ambiguous_type_sites') end
|
|
38
|
+
if info.query_stats and (info.query_stats.reverse_unresolved or 0) > 0 then add('unresolved_reverse_types') end
|
|
39
|
+
local resolution = info.query_stats and info.query_stats.resolution
|
|
40
|
+
if resolution then
|
|
41
|
+
if resolution.unresolved_sites > 0 then add('unresolved_calls') end
|
|
42
|
+
if resolution.ambiguous_sites > 0 then add('ambiguous_calls') end
|
|
43
|
+
if resolution.counts_limited then add('resolution_count_limit') end
|
|
44
|
+
end
|
|
45
|
+
if info.incomplete and #reasons == 0 then add('analysis_incomplete') end
|
|
46
|
+
table.sort(reasons)
|
|
47
|
+
return { scope = 'indexed_static_analysis', partial = #reasons > 0, reasons = reasons,
|
|
48
|
+
output_truncated = info.truncated == true, relationships_incomplete = info.relationships_incomplete == true,
|
|
49
|
+
selection_limited = info.seed_selection_limited == true or info.seed_limit_reached == true }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
function M.error(message)
|
|
53
|
+
message = tostring(message or '')
|
|
54
|
+
local code, retryable = 'query_failed', false
|
|
55
|
+
if message:find('source changed', 1, true) or message:find('source snapshot changed', 1, true) then
|
|
56
|
+
code, retryable = 'source_changed', true
|
|
57
|
+
elseif message:find('deadline exceeded', 1, true) then code, retryable = 'deadline_exceeded', true
|
|
58
|
+
elseif message:find('queue is full', 1, true) or message:find('queue wait exceeded', 1, true) then code, retryable = 'busy', true
|
|
59
|
+
elseif message:lower():find('cancelled', 1, true) then code = 'cancelled' end
|
|
60
|
+
return { code = code, retryable = retryable, retryAfterMs = code == 'busy' and 250 or nil }
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
return M
|
|
@@ -8,12 +8,25 @@ local boundary = { [';'] = true, ['{'] = true, ['}'] = true, ['('] = true, [',']
|
|
|
8
8
|
local primitive = { auto = true, int = true, double = true, float = true, char = true, bool = true,
|
|
9
9
|
long = true, short = true, unsigned = true, signed = true, void = true }
|
|
10
10
|
|
|
11
|
-
function M.collect(r, T)
|
|
12
|
-
if r.language ~= 'cpp' then return end
|
|
11
|
+
function M.collect(r, T, type_refs)
|
|
12
|
+
if r.language ~= 'cpp' and r.language ~= 'c' then return end
|
|
13
13
|
require('codeoutline.cpp_types').collect(r, T)
|
|
14
|
+
local refs = r.refs
|
|
15
|
+
if type_refs and #type_refs > 0 then
|
|
16
|
+
refs = {}; for _, ref in ipairs(r.refs) do refs[#refs + 1] = ref end
|
|
17
|
+
for _, ref in ipairs(type_refs) do refs[#refs + 1] = ref end
|
|
18
|
+
end
|
|
14
19
|
local wanted = {}
|
|
15
|
-
for _, ref in ipairs(
|
|
16
|
-
if ref.kind == '
|
|
20
|
+
for _, ref in ipairs(refs) do
|
|
21
|
+
if ref.kind == 'type' and not ref.recv then wanted[ref.name] = true
|
|
22
|
+
elseif r.language == 'c' then -- ordinary C call resolution is unchanged
|
|
23
|
+
elseif ref.kind == 'call' or ref.kind == 'ref' or ref.kind == 'member_call' and T:text(ref.tok - 1) == '::' then
|
|
24
|
+
if T:text(ref.tok) == ref.name then
|
|
25
|
+
ref.binding = require('codeoutline.cpp_types').evidence(T, ref.tok)
|
|
26
|
+
r.has_bindings = true
|
|
27
|
+
if ref.kind == 'call' or ref.kind == 'ref' then wanted[ref.name] = true end
|
|
28
|
+
end
|
|
29
|
+
elseif ref.kind == 'member_call' and ref.recv and ref.recv ~= 'this' then wanted[ref.recv] = true end
|
|
17
30
|
end
|
|
18
31
|
if not next(wanted) then return end
|
|
19
32
|
r.has_bindings = true
|
|
@@ -54,15 +67,17 @@ function M.collect(r, T)
|
|
|
54
67
|
end
|
|
55
68
|
end
|
|
56
69
|
end
|
|
57
|
-
for _, ref in ipairs(
|
|
58
|
-
|
|
70
|
+
for _, ref in ipairs(refs) do
|
|
71
|
+
local bare = (r.language == 'cpp' and (ref.kind == 'call' or ref.kind == 'ref')) or ref.kind == 'type' and not ref.recv
|
|
72
|
+
if bare or ref.kind == 'member_call' and ref.recv and T:text(ref.tok - 1) ~= '::' then
|
|
59
73
|
local best
|
|
60
|
-
for _, b in ipairs(bindings[ref.recv] or {}) do
|
|
74
|
+
for _, b in ipairs(bindings[bare and ref.name or ref.recv] or {}) do
|
|
61
75
|
if b.a <= ref.tok and ref.tok <= b.b and b.token < ref.tok
|
|
62
76
|
and (not best or b.a > best.a or b.a == best.a and b.token > best.token) then best = b end
|
|
63
77
|
end
|
|
64
78
|
if best then
|
|
65
|
-
ref.
|
|
79
|
+
if ref.kind == 'type' then ref.type_use.value_shadowed = true
|
|
80
|
+
else ref.binding = bare and 'cpp:?' or 'cpp:type:' .. best.type .. '\0' .. (T.s[best.token] - 1) end
|
|
66
81
|
-- A chain's tail is not the simple local sharing that name.
|
|
67
82
|
if T:text(ref.tok - 3) == '.' or T:text(ref.tok - 3) == '->' then ref.binding = 'cpp:?' end
|
|
68
83
|
end
|
|
@@ -70,8 +85,16 @@ function M.collect(r, T)
|
|
|
70
85
|
end
|
|
71
86
|
end
|
|
72
87
|
|
|
73
|
-
function M.resolve(G, f, src, name, evidence, deps, ctx)
|
|
88
|
+
function M.resolve(G, f, src, name, evidence, deps, ctx, accept)
|
|
74
89
|
if G.files[f].language ~= 'cpp' or not evidence or evidence:sub(1, 4) ~= 'cpp:' then return nil end
|
|
90
|
+
local written, position = evidence:match('^cpp:name:(.-)%z(%d+)$')
|
|
91
|
+
if written then
|
|
92
|
+
local scope = src and G.nodes[src].qualified
|
|
93
|
+
if src and (G.nodes[src].kind == 'function' or G.nodes[src].kind == 'method') then scope = scope:match('^(.*)::[^:]+$') end
|
|
94
|
+
local ids, known = require('codeoutline.cpp_types').resolve(G, f, written,
|
|
95
|
+
{ scope = scope, at = tonumber(position), deps = deps, context = ctx, accept = accept, definitions = true })
|
|
96
|
+
return ids, not known and 'unresolved c++ name' or nil
|
|
97
|
+
end
|
|
75
98
|
local ty = evidence:match('^cpp:type:(.+)$')
|
|
76
99
|
if not ty then return {} end
|
|
77
100
|
local written, at = ty:match('^(.-)%z(%d+)$')
|
|
@@ -82,6 +105,19 @@ function M.resolve(G, f, src, name, evidence, deps, ctx)
|
|
|
82
105
|
end
|
|
83
106
|
local scope = src and G.nodes[src].qualified:match('^(.*)::[^:]+$')
|
|
84
107
|
local result, seen, emitted = {}, {}, {}
|
|
108
|
+
local definition_owners = {}
|
|
109
|
+
local configured = require('codeoutline.cpp_includes').policy(G, f, ctx).configured
|
|
110
|
+
local function belongs(id, cls)
|
|
111
|
+
if definition_owners[id] == nil then
|
|
112
|
+
definition_owners[id] = require('codeoutline.cpp_types').owner(G, G.node_file[id], G.nodes[id], ctx) or false
|
|
113
|
+
end
|
|
114
|
+
if definition_owners[id] == cls then return true end
|
|
115
|
+
-- Keep legacy class-outside hints when there is no configured policy
|
|
116
|
+
-- and the defining file provides no class evidence (e.g. forced includes).
|
|
117
|
+
local node = G.nodes[id]
|
|
118
|
+
local parent = node.parent and G.files[G.node_file[id]].nodes[node.parent]
|
|
119
|
+
return not configured and definition_owners[id] == false and (not parent or not types[parent.kind])
|
|
120
|
+
end
|
|
85
121
|
local function members(cls, depth)
|
|
86
122
|
control.check()
|
|
87
123
|
if seen[cls] or depth > 8 then return end
|
|
@@ -90,9 +126,8 @@ function M.resolve(G, f, src, name, evidence, deps, ctx)
|
|
|
90
126
|
local matches, has_definition = {}, false
|
|
91
127
|
for _, id in ipairs(G.by_name[name] or {}) do
|
|
92
128
|
local n = G.nodes[id]
|
|
93
|
-
local owner = n.parent and G.files[G.node_file[id]].nodes[n.parent]
|
|
94
129
|
if n.qualified == q and G.files[G.node_file[id]].language == 'cpp'
|
|
95
|
-
and (
|
|
130
|
+
and belongs(id, cls) then
|
|
96
131
|
matches[#matches + 1] = id
|
|
97
132
|
if not n.decl and n.kind ~= 'prototype' then has_definition = true end
|
|
98
133
|
end
|