Skip to main content

parse_at_cursor

Function parse_at_cursor 

Source
pub fn parse_at_cursor(buffer: &str, cursor: usize) -> Option<AtToken>
Expand description

Detect an @-file-reference trigger at the cursor position.

§Rules (grok-build parity)

  • @ must be at a word boundary: preceded by whitespace, start of buffer, or a non-alphanumeric delimiter.
  • Email guard: @ preceded by alphanumeric or _ is NOT a trigger (foo@bar.com, user_name@host).
  • @! toggles hidden-file display (the ! is consumed).
  • path:N or path:N-M parses a line range.
  • Any whitespace in the text after @ closes the token (no trigger).

Returns None when no trigger is active.