ops/:ref+
matches both a value AND its references (union of referent and all dereferenced usages)
clojure
(:ref+ val)Where:
- val: the value to find (both definition and usages) *
Expanding into:
clojure
(:or \1 (:ref \1))Behavior
- Equivalent to (:or val (:ref val)) - matches the original value or any references to it.
- Useful when you want to find all occurrences of a value regardless of whether it's the definition or a usage.
Examples
Find all occurrences of a specific number, both literal and referenced.
clojure
(arr (el _ (:ref+ (num 1))))Selects in lines { 2, 3 } but not in { }:
typescript
var a = 1;
[1];
[a];Locate all usages of an imported module, including the import itself.
clojure
(:ref+ (import react))Selects in lines { 1, 1, 1 } but not in { }:
typescript
import React from 'react';
React.useState()
const x = ReactFind all instances of an object literal and where it's referenced.
clojure
(call process (arg _ (:ref+ (obj))))Selects in lines { 2, 3 } but not in { }:
typescript
var config = { debug: true };
process({})
process(config)Track both the definition and all uses of a string constant.
clojure
(:ref+ (str API_KEY))Selects in lines { 1, 1, 1 } but not in { }:
typescript
const key = "API_KEY";
fetch(url, { headers: { "API_KEY": value } })
fetch(url, { headers: { [key]: value } })Arguments
val
Does NOT support: Refinement — Replacement