tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.74k stars 139 forks source link

gf on `clojure.core/map` jumps to forward declaration instead of definition #345

Closed frenchy64 closed 5 years ago

frenchy64 commented 5 years ago

There's a surprising difference between gf and [<C-d> on clojure.core/map: gf jumps to the forward-declaration of map instead of its definition.

I noticed map is forward-declared without :declared metadata with simply (def map). This might have something to do with it.

Minimal example:

clojure.core/map ; `gf` incorrectly jumps to `(def map)`
                 ; `[<C-d>` works
tpope commented 5 years ago

The short answer is use [<C-d>. gf is by design entirely static analysis, which is more than adequate for its stated purpose of "go to file", but is easily tripped up when it comes to finding declarations. Getting it to be 100% reliable isn't really feasible, but patches welcome.