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

Function find_cursor_context

src/code_actions/cursor_context.rs:81–92  ·  view source on GitHub ↗

Walk the AST to find the cursor context at the given byte offset. This is the single entry point that all code actions should use to determine which class-like and member the cursor is on.

(
    statements: &'a Sequence<'a, Statement<'a>>,
    cursor: u32,
)

Source from the content-addressed store, hash-verified

79/// This is the single entry point that all code actions should use to
80/// determine which class-like and member the cursor is on.
81pub(crate) fn find_cursor_context<'a>(
82 statements: &'a Sequence<'a, Statement<'a>>,
83 cursor: u32,
84) -> CursorContext<'a> {
85 for stmt in statements.iter() {
86 let ctx = find_in_statement(stmt, cursor);
87 if !matches!(ctx, CursorContext::None) {
88 return ctx;
89 }
90 }
91 CursorContext::None
92}
93
94// ── AST walk (private) ─────────────────────────────────────────────────────
95

Calls 2

iterMethod · 0.80
find_in_statementFunction · 0.70