Skip to main content

Module completion

Module completion 

Source

Structs§

CompletionCache
Completion cache built from the AST.
DotSegment
A segment of a dot-expression chain.
ScopeContext
Scope context for scope-aware completion resolution. When present, type resolution uses the scope chain at the cursor position instead of the flat first-wins name_to_type map.
ScopeRange
A byte range identifying a scope-creating AST node.
ScopedDeclaration
A declaration found within a specific scope.

Enums§

AccessKind
What kind of access precedes the dot.

Functions§

build_completion_cache
Build a CompletionCache from AST sources and contracts. contracts is the .contracts section of the compiler output (optional).
extract_identifier_before_dot
Extract the identifier before the cursor (the word before the dot). Returns just the last identifier name for backward compatibility.
extract_mapping_value_type
Extract the deepest value type from a mapping typeIdentifier. Peels off all t_mapping$_<key>_$_<value> layers and returns the innermost value type.
extract_node_id_from_type
Extract the trailing node id from a typeIdentifier string. e.g. t_struct$_PoolKey_$8887_storage_ptr → Some(8887) t_contract$_IHooks_$2248 → Some(2248) t_uint256 → None
find_innermost_scope
Find the innermost scope node that contains the given byte position and file. scope_ranges must be sorted by span size ascending (smallest first). Returns the node_id of the smallest scope enclosing the position.
get_chain_completions
Get completions by resolving a full dot-expression chain. This is the main entry point for dot-completions with chaining support.
get_dot_completions
Get completions for a dot-completion request by resolving the full expression chain.
get_general_completions
Get general completions (all known names + static completions).
get_static_completions
Get static completions that never change (keywords, magic globals, global functions, units). These are available immediately without an AST cache.
handle_completion
Handle a completion request.
parse_dot_chain
Parse the expression chain before the dot into segments. e.g. poolManager.swap(key, params). → [(“poolManager”, Plain), (“swap”, Call)] _pools[poolId].fee. → [(“_pools”, Index), (“fee”, Plain)] msg. → [(“msg”, Plain)]
resolve_name_in_scope
Resolve a variable name to its type by walking up the scope chain.