(:ref) - Operators
select references to a value
clojure
(:ref val)Where:
- val: the value to find references to *
Guides
Behavior
- Tracks references through variable assignments, including chains (ref to ref to ref).
- Follows values through object properties, array elements, and destructuring patterns.
- For objects and arrays, tracks paths precisely (x.a.b must match the exact path, not partial paths like x.a).
Examples
Find all places where a specific numeric constant is used via variable references.
clojure
(arr (el _ (:ref (num 1))))Selects in lines { 3, 4 }:
typescript
var a = 1;
var b = 1;
[a];
[b];Locate calls that use a jQuery import, excluding shadowed identifiers.
clojure
(call (:ref (import jquery)))Selects in lines { 9 }:
typescript
import $ from 'jquery';
const jQuery = $;
function x(jQuery) {
return jQuery();
}
$('.button').click()Find where object property values are accessed, tracking through member paths.
clojure
(call log (arg _ (:ref (num 5))))Selects in lines { 2 }:
typescript
var config = { timeout: 5 };
log(config.timeout)
log(config)Track a value through destructuring assignments.
clojure
(call process (arg _ (:ref (num 5))))Selects in lines { 4 }:
typescript
var data = { count: 5 };
var { count: userCount } = data
process(userCount)Find references through transitive assignments (ref to ref).
clojure
(call log (arg _ (:ref (obj))))Selects in lines { 5 }:
typescript
var a = {};
var b = a;
var c = b;
log(c)Track array element access by index.
clojure
(call process (arg _ (:ref (num 7))))Selects in lines { 2 }:
typescript
var items = [7, 8, 9];
process(items[0])
process(items[1])Arguments
val
Does NOT support: Refinement — Replacement