1/ clojure-lsp is the most important #Clojure dev tool you're not using. Here's why you owe it to yourself to give it a try if you're an #Emacs or #Vim user. Thread:

First, what is LSP (Language Server Protocol)?
2/ LSP is the name of a language-agnostic interface that lets editors provide IDE-like code navigation features like find-definition and find-references. A language server (like clojure-lsp) is a process that implements this interface for a target language.
3/ In a pluralistic world, LSP provides an escape from the NxM problem (the dreaded matrix of N editors and M languages).
4/ Because any editor that implements the protocol can launch a language server as a background process, the hard work of writing a parser for a target language only needs to be done once.

Does LSP depend on an active REPL, you ask?
5/ The answer, fortunately, is no. Using a REPL for tooling is clunky at best: it's hard to set up, slow to start, awkward for CLJS and unhappily couples the editor to the runtime env.
6/ The right approach to Clojure(Script) tooling, pioneered by Cursive, is also clojure-lsp's: static analysis.

With LSP enabled, your Emacs or Vim is more interactive because it now groks Clojure. Here are a few examples of what you can do.
7/ I'll talk about Emacs commands but the functionality exists in all supported editors.

`lsp-find-definition` (often mapped to ctrl-click) allows you do jump from a name to the corresponding defn (or def or ns).
8/ `lsp-find-references` takes the reverse route: starting from a definition, you can go through a list of places in the codebase where the var has been used.

If all you want is to view the docstring, try `lsp-describe-thing-at-point`.
9/ This command works with vars in your project as well as dependencies read from classpath jars.

Also if you move the cursor on top of a let binding, your editor will highlight all references within the body.
10/ The highlighter isn't string-based: it knows the language well enough to understand what's in scope and what isn't.

Can the static approach work if Clojure is a dynamic language? Yes! In fact Clojure(Script) lends itself well to static analysis - better than Python or Ruby.
11/ In a codebase with tens of thousands of LOC and many dependencies, navigation works well (although there is always room for improvement). Try it with your own project!
12/ Once you get over the initial speed bump (you may want to override source paths or ignore classpath in `.lsp/config.edn`), clojure-lsp works reliably today. And it's only going to get better as more and more people use it. https://github.com/snoe/clojure-lsp
13/ PS, did I mention that clojure-lsp also supports IDE-like edits and refactorings like `lsp-rename` (rename functions or arguments) and `lsp-clojure-add-missing-libspec` (automatically add ns requires)?
You can follow @pesterhazy.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: