Skip to content

Features#

Above you can find all available features that clojure-lsp provide with examples using Emacs lsp-mode client.

Find a function/var definition#

Find all references of a function, var, keyword or namespace alias#

Show all workspace/project symbols#

Show all symbols on current file#

Rename symbols#

Document highlight on hover showing symbol usages#

Code actions#

Name Example
Clean namespace require/imports
Add missing require
Add known common require
Add known common import
Add suggested alias require
Inline symbol
Extract function
Move to let
Change coll to map,vector,set,list
Thread first/all last
Create private function
Resolve macro as...

Code lenses showing symbol references#

Format a whole file or range#

Signature help#

Semantic tokens#

Experimental: apply color on client editor for each known token

Call hierarchy#

Show the incoming or outgoing call hierarchy of a function/variable as a lazy tree

Incoming#

Show functions that call the current one recursively

Outgoing#

Show functions that the current one call, recursively

Execute command#

Commands that client can request. Some code actions use these commands as actions.

Refactoring#

Commands that change/refactor the code, most of them are available via code actions.

Clean namespace *#
Add import to namespace#
Add missing namespace *#
Cycle privacy of def/defn#
Cycle collection (#{}, {}, [], ())#
Change collection to {}, (), #{}, []#
Extract Function *#
Create private function *#
Inline Symbol *#
Expand let#
Introduce let#
Move expression to let#
Thread first expression#
Thread last expression#
Thread first all *#
Thread last all *#
Unwind all#
Unwind thread#

Resolve macro as *#

This code action should be wrapped by the LSP client to provide the missing arguments beside the existing return by the code action:

  • The macro which should resolve as e.g. clojure.core/def
  • The clj-kondo configuration to save the new setting. e.g /home/user/.clj-kondo/config.edn

For an example, check how Emacs LSP client handles that.

* Available via code actions too

Dev#

Server information#

Return basic information about the server.

Cursor information#

Return debug information about the element at point.

Custom message to client during any server process#

During some process, clojure-lsp send messages to client informing some proccess, warning or error.

Diagnostics (linter)#

Most linters come from clj-kondo that clojure-lsp uses under the hood to lint the code and retrieve the analysis to make most of features work.

Below you can find the custom linters implemented on clojure-lsp side:

unused-public-var#

For more information on how to configure it, check the diagnostics settings section.


Last update: April 8, 2021