Search code examples
clojureneovimlanguage-server-protocol

clojure-lsp in neovim is not navigating to function definitions/namespaces


I'm using neovim with clojure lsp for clojure development. My neovim config are exactly same as this repo.

The autosuggesting is working fine with this configuration. But when I like to navigate to function/namespace definitions, it is not working.

For example, I've local repository which it in github here. Let's say I'm working on the file src/clj/guestbook/routes/home.clj. I'm trying to click and navigate to save-message! in line 39. But command + click or ctrl + click is not working.

function navigation not working

Similarly when I try to navigate the namespaces, command + click is enabled as in the below image.

namespace navigation not working

But when I click the namespace, it open the browser with link guestbook.middleware as in the below image.

namespace navigation not working

nvim version -

% nvim --version
NVIM v0.9.0-dev-730+g0344bfad0-dirty
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/HEAD-0344bfa/share/nvim"

Run :checkhealth for more info

clojure-lsp details -

% clojure-lsp --version
clojure-lsp 2022.12.09-16.00.34-nightly
clj-kondo 2022.12.08

Any idea how to make clojure lsp navigation work in neovim?


Solution

  • Hey this setup doesn't have any custom bind for the mouse command you using, so probably you getting the default nvim behaviour when ctrl + clicking in the forms.

    You probably want gd to Go to Definition of a function or namespace, to use it navigate your cursor over an function name or namespace and press gand then d.

    You can check all the presets command listed here.