(id)
identifiers
clojure
(id val?)Where:
- val: identifier name to match *
Matching:
- variable and function names, e.g.
foo - property names in member expressions, e.g.
obj.prop - private property identifiers (with # prefix), e.g.
obj.#private - shorthand properties, e.g.
{ name } - super keyword, e.g.
super - import keyword in dynamic imports, e.g.
import - identifiers in spread elements, e.g.
...spread
Behavior
- Matches identifiers in various contexts: variables, properties, parameters, JSX attributes, and more.
- For private properties like obj.#field, include the # prefix in the query: (id #field).
- Supports JSX namespace names like svg:href using colon notation: (id svg:href).
- The special identifier <> matches JSX fragments.
Examples
Find usages of deprecated variable names before refactoring.
clojure
(id oldConfigName)Selects in lines { 1, 1, 1 } but not in { 2 }:
typescript
const value = oldConfigName.get()
const other = newConfigName.get()
function process(oldConfigName) { }Locate React useState hooks to migrate to a new state management library.
clojure
(call (id /use[A-Z]\w+/))Selects in lines { 1, 2 } but not in { 3 }:
typescript
const [count, setCount] = useState(0)
const data = useMemo(() => {}, [])
const value = customHook()Find components using private fields before refactoring to WeakMaps.
clojure
(mem (id /#\w+/))Selects in lines { 3, 3 } but not in { }:
typescript
class Widget {
#counter = 0
get() { return this.#counter }
set(val) { this.#counter = val }
}Arguments
val
• Identifier • String • Pattern
Does NOT support: Composition — Free-form Selection — Refinement — Replacement