Skip to content

Commit ba34d2d

Browse files
authored
Merge pull request #36 from mathieuroblin/master
Add support for snitch's defmethod * Fixes #31
2 parents 0499cc8 + 2ee35ca commit ba34d2d

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Changes to Calva Power Tools
44

55
## [Unreleased]
66

7+
- [Add support for defmethod* (Snitch)](https://github.com/BetterThanTomorrow/calva-power-tools/issues/31)
8+
79
## [v0.0.10] - 2025-06-25
810

911
- [Change `cpt.showCommands` command search `>CPT` to `>[CPT]` for more accurate filtering](https://github.com/BetterThanTomorrow/calva-power-tools/issues/32)

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,22 @@
154154
{
155155
"command": "cpt.snitch.instrumentTopLevelForm",
156156
"category": "[CPT] Snitch",
157-
"title": "Instrument Top Level defn/let/fn"
157+
"title": "Instrument Top Level defn/defmethod/let/fn"
158158
},
159159
{
160160
"command": "cpt.snitch.instrumentCurrentForm",
161161
"category": "[CPT] Snitch",
162-
"title": "Instrument Current Form defn/let/fn"
162+
"title": "Instrument Current Form defn/defmethod/let/fn"
163163
},
164164
{
165165
"command": "cpt.snitch.getSnitchedDefnResults",
166166
"category": "[CPT] Snitch",
167-
"title": "Get Snitched defn Results"
167+
"title": "Get Snitched defn/defmethod Results"
168168
},
169169
{
170170
"command": "cpt.snitch.reconstructLastDefnCallToClipboard",
171171
"category": "[CPT] Snitch",
172-
"title": "Reconstruct Last defn Call to Clipboard"
172+
"title": "Reconstruct Last defn/defmethod Call to Clipboard"
173173
},
174174
{
175175
"command": "cpt.performance.loadDecompilerDependency",

src/calva_power_tools/tool/snitch.cljs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
(defn- instrument-form [form]
1313
(let [snitched (.replace form
14-
#"\b(defn-?|fn|let)(?=\s)"
14+
#"\b(defn-?|defmethod|fn|let)(?=\s)"
1515
(fn [s]
1616
(case (string/trim s)
17-
"defn-" "defn*"
18-
"defn" "defn*"
19-
"let" "*let"
20-
"fn" "*fn"
17+
"defn-" "defn*"
18+
"defn" "defn*"
19+
"defmethod" "defmethod*"
20+
"let" "*let"
21+
"fn" "*fn"
2122
s)))]
2223
(calva/execute-calva-command! "calva.runCustomREPLCommand"
2324
#js {:snippet snitched})))

0 commit comments

Comments
 (0)