Find the innermost scope that contains `offset`. Returns the `scope_start` (opening brace offset) of the innermost function/method/closure body that contains the cursor, or `0` when the cursor is in top-level code.
(&self, offset: u32)
| 527 | /// function/method/closure body that contains the cursor, or `0` when |
| 528 | /// the cursor is in top-level code. |
| 529 | pub fn find_enclosing_scope(&self, offset: u32) -> u32 { |
| 530 | let mut best: u32 = 0; |
| 531 | for &(start, end) in &self.scopes { |
| 532 | if start <= offset && offset <= end && start > best { |
| 533 | best = start; |
| 534 | } |
| 535 | } |
| 536 | best |
| 537 | } |
| 538 | |
| 539 | /// Determine the effective scope for a variable reference at `offset`. |
| 540 | /// |
no outgoing calls