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,
)
| 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. |
| 81 | pub(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 |