Skip to content

(:nearest) - Operators

refine the selection to the nearest enclosing value if available

clojure
(:nearest anchor val)

Where:

  1. anchor: enclosing value to refine to *
  2. val: value to find *

Guides

Behavior

  • Yields the matched value in case the anchor could not be resolved.

Examples

Find match arms that call log::debug!()

clojure
(:nearest (match-arm) (call log::debug!))

Selects in lines { 4, 12 }:

rust
fn main(args: Vec<String>) {
  for arg in args {
    match arg.as_str() {
      "--help" => {
        log::debug!("is asking for help")
      }

      _ => {}
    };
  }

  log::debug!("done")
}

Arguments

anchor

  1. (:kind)
  2. (:ref)
  3. (:text)
  4. ...language selectors

Does NOT support: CompositionRefinementReplacement

val

  1. inherit

Copyright © 2022-present Semantic Works, Inc.