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

Method try_array_shape_completion

src/completion/handler.rs:870–883  ·  view source on GitHub ↗

Try to offer known array shape keys when the cursor is inside `$var['` or `$var["`. Returns `None` when the cursor is not in an array-key context or when no shape keys could be resolved.

(
        &self,
        content: &str,
        position: Position,
        ctx: &FileContext,
    )

Source from the content-addressed store, hash-verified

868 /// Returns `None` when the cursor is not in an array-key context or
869 /// when no shape keys could be resolved.
870 fn try_array_shape_completion(
871 &self,
872 content: &str,
873 position: Position,
874 ctx: &FileContext,
875 ) -> Option<CompletionResponse> {
876 let ak_ctx = crate::completion::array_shape::detect_array_key_context(content, position)?;
877 let items = self.build_array_key_completions(&ak_ctx, content, position, ctx);
878 if items.is_empty() {
879 None
880 } else {
881 Some(CompletionResponse::Array(items))
882 }
883 }
884
885 // ─── Strategy: member access completion ──────────────────────────────
886

Callers 1

handle_completionMethod · 0.80

Calls 3

detect_array_key_contextFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected