MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / with_chain_resolution_cache

Function with_chain_resolution_cache

src/completion/resolver.rs:93–102  ·  view source on GitHub ↗

Activate the thread-local chain resolution cache. While the returned guard is alive, `resolve_target_classes` caches its results by subject text so that shared chain prefixes are resolved only once. Nested activations are no-ops — the outermost guard owns the cache.

()

Source from the content-addressed store, hash-verified

91///
92/// Nested activations are no-ops — the outermost guard owns the cache.
93pub(crate) fn with_chain_resolution_cache() -> ChainCacheGuard {
94 let already_active = CHAIN_CACHE.with(|cell| cell.borrow().is_some());
95 if already_active {
96 return ChainCacheGuard { owns: false };
97 }
98 CHAIN_CACHE.with(|cell| {
99 *cell.borrow_mut() = Some(HashMap::new());
100 });
101 ChainCacheGuard { owns: true }
102}
103
104/// Type alias for the optional function-loader closure passed through
105/// the resolution chain. Reduces clippy `type_complexity` warnings.

Callers 5

runFunction · 0.85
with_file_contentMethod · 0.85
handle_completionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected