Skip to content

Instantly share code, notes, and snippets.

View cursive-ide's full-sized avatar

Colin Fleming cursive-ide

View GitHub Profile
@cursive-ide
cursive-ide / parsing.clj
Created August 29, 2014 23:35
Cursive parsing lib example
; Parsers are defined like this - this this for the core.typed defprotocol
(defn binder []
(vector (alt (symbol :into :bindings)
(vector (symbol :into :bindings)))))
(defn type-decl []
(all (keyword :matching :-)
(any :into :types)
(opt (alt (symbol :matching '*
:into :no-resolve)
@cursive-ide
cursive-ide / gist:593ee7421e765d1b0dba
Last active August 29, 2015 14:14
Cursive Macroexpander
The other new feature is an interactive macroexpander. It requires a REPL to perform
the actual expansion, with the current namespace loaded into it. Start by executing
Tools->REPL->View Macro Expansion. This will select the nearest surrounding macro
form and display it in a popup window. You can move the cursor anywhere within the
form and either click the right arrow in the toolbar or use Ctrl/Cmd-right - this
will expand the nearest surrounding macro form and all forms above it up to the
top displayed form - the cursor will be left at the start of the innermost form
that was actually expanded. Give it a try, it’s less confusing than it sounds!
There are also various controls in the toolbar for various sorts of prettification -
you can show and hide metadata, tidy up referred vars and imported classes etc. This
~/d/c/jitpack> lein deps :tree
Retrieving com/github/SquidPony/SquidLib/squidlib/-v3.0.0-b3-g386143b-39/squidlib--v3.0.0-b3-g386143b-39.pom from jitpack
Retrieving com/github/SquidPony/SquidLib/squidlib-parent/-v3.0.0-b3-g386143b-39/squidlib-parent--v3.0.0-b3-g386143b-39.pom from jitpack
Retrieving com/github/SquidPony/SquidLib/squidlib-util/-v3.0.0-b3-g386143b-39/squidlib-util--v3.0.0-b3-g386143b-39.pom from jitpack
Retrieving com/badlogicgames/gdx/gdx/1.9.2/gdx-1.9.2.pom from central
Retrieving com/badlogicgames/gdx/gdx-parent/1.9.2/gdx-parent-1.9.2.pom from central
Retrieving com/github/SquidPony/SquidLib/squidlib/-v3.0.0-b3-g386143b-39/squidlib--v3.0.0-b3-g386143b-39.jar from jitpack
Retrieving com/github/SquidPony/SquidLib/squidlib-util/-v3.0.0-b3-g386143b-39/squidlib-util--v3.0.0-b3-g386143b-39.jar from jitpack
Retrieving com/badlogicgames/gdx/gdx/1.9.2/gdx-1.9.2.jar from central
[clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
; Before
(defn light-keys [symbol language]
(let [states (light.resolve/resolve-states (psi/containing-file symbol) language)]
(loop [current (psi/parent symbol)] ; <- infinite loop if current is nil
(if-let [state (get states current)] ; because psi/parent nil puns
(light.resolve/resolve-keys symbol state)
(if (psi/file? (psi/parent current))
(recur (first (filter psi/significant? (psi/prev-siblings current)))) ; <- first can return nil
(recur (psi/parent current)))))))
@cursive-ide
cursive-ide / bad.bytecode.txt
Last active January 17, 2019 23:44
Clojure JDI problem bytecode before & after
Classfile /Users/colin/dev/cursive-2099/classes/cursive_2099/core$_main.class
Last modified 18/01/2019; size 1271 bytes
MD5 checksum f74ca1f9fccde176d30524a628eaa1ee
Compiled from "core.clj"
public final class cursive_2099.core$_main extends clojure.lang.RestFn
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
Constant pool:
#1 = Utf8 cursive_2099/core$_main
@cursive-ide
cursive-ide / output.txt
Created July 27, 2021 06:13
nREPL testing
Loading src/nrepl_tests/src.clj... done
(let [server (start-server :port 7888)]
(try
(test-on 7888)
(finally
(stop-server server))))
; These are responses from the CLJ version