Hello Colin,
since a couple of days I experience a substantial slowdown in the editor for a specific type of a Clojure function. Yes :)
I have a project with several files and I experience the editing as smooth in all other files. In that specific file I can comfortably edit source in/around all functions/macros except in one.
Now - this one looks a bit like that (it is a part of some code generator - that’s why such a pattern):
(defn emit-some-source [input ...]
(let [...
sym-a ...
sym-b ...
efn `(do
(defn ~(symbol (name ...)) [~sym-a ...]
~(let [...]
`(let [~sym-c ...]
~(if ...
(let [...]
`(do
(let [...]
(as-> ~sym-d ~sym-e
(somefn [~@(...)] ~sym-... ~sym-... ~sym-...)
(somefn2 [~@(...)] ~sym-... ~sym-... ~sym-...)
(somefn3 [~@(...)] ~sym-... ~sym-... ~sym-...)
~(if ...
`(let [...]
...
))))))
(do
`(let [...]
(as-> ...
(somefn [~@(...)] ~sym-... ~sym-... ~sym-...)
(somefn2 [~@(...)] ~sym-... ~sym-... ~sym-...)
(somefn3 [~@(...)] ~sym-... ~sym-... ~sym-...)
~(if ...
`(let [...]
...)
...)))
))))))]
...
))
If I try to just type somewhere in the middle of that a code, then the IDE freezes for several seconds and then prints several characters at once, to the point that it is uneditable. I assume that the lot of quoting/backquoting require more involved work in Cursive. It worked actually until few days ago - this code experienced several refactoring without problems in Cursive. There has been no update from Cursive in the meantime, but I remember to have updated to IntelliJ 2016.3.4 last week, just don’t remember before or after the slowdown. So - if you edit the actual example above, Cursive will work without problems - but in the actual code there are about 40 symbols and another 20 vars, several functions have around 10 parameters, so it feels like I have hit some threshold on the number of nested levels of back quoting and/or symbols. Again - editing other functions/macros in the same or other files doesn’t seem to affect Cursive, but they don’t have that much levels of nesting and number of symbols.
Can you help? (I would immensely value if I don’t have to refactor it in Emacs or elsewhere, as this layout/pattern of the code aligns well with the problem and the code remains readable).
If you need the actual source code, please leave me an e-mail address on which I should send it.
With best regards
Plamen