Clojure
The details below describe how to install and configure the Clojure language server.
Installing the Language Server
Details regarding the Clojure server can be found
here and the releases for the
server can be downloaded from
here.
The installation is as simple as downloading the
clojure-lsp-native-windows-amd64.zip file and
extracting the single the executable into a installation folder, similar to the one shown below:
Directory of D:\Utilities\LSP\clojure
18/01/2024 06:45 PM 28,003,022 clojure-lsp-native-windows-amd64.zip
29/12/2023 12:26 PM 28,999,168 clojure-lsp.exe
2 File(s) 57,002,190 bytes
2 Dir(s) 283,507,347,456 bytes free
With the software installed test the installation by running D:\Utilities\LSP\clojure\clojure-lsp.exe --help
at the command line prompt, which should result in the following output:
Clojure development tool implementing LSP
Usage: clojure-lsp <command> [<options>]
All options:
-h, --help Print the available commands and its options
--version Print clojure-lsp version
--verbose Use stdout for clojure-lsp logs instead of default log settings
--trace Deprecated: use --trace-level instead.
--trace-level LEVEL off Enable trace logs between client and server, for debugging. Set to 'messages' for basic traces, or 'verbose' for more detailed traces. Defaults to 'off' for no traces.
-s, --settings SETTINGS Optional settings as edn to use for the specified command. For all available settings, check https://clojure-lsp.io/settings
--log-path PATH Path to use as the log path for clojure-lsp.out, debug purposes only.
--dry false Make no changes to files, only report diffs
--raw false Print only necessary data
-p, --project-root PATH Specify the path to the project root to clojure-lsp consider during analysis startup.
-n, --namespace NS [] Optional namespace to apply the action, all if not supplied. This flag accepts multiple values
--filenames FILENAMES Optional filenames to apply the action. Filenames can be either absolute/relatetive files or directories. This flag accepts filenames separated by comma or double colon.
--ns-exclude-regex REGEX Optional regex representing the namespaces to be excluded during a command
-o, --output EDN Optional settings as edn on how the result should be printed. Check `clojure-lsp.api/diagnostics`/`clojure-lsp.api/dump` for all available options to this flag.
--from FROM Full qualified symbol name or ns only, e.g. my-project/my-var. option for rename/references
--to TO Full qualified symbol name or ns only, e.g. my-project/my-var. option for rename
--analysis EDN Optional settings as edn on how clojure-lsp should consider the analysis. Check `clojure-lsp.api/dump` for all available options to this flag.
Available commands:
listen (or empty) Start clojure-lsp as server, listening to stdin.
clean-ns Organize ns form, removing unused requires/refers/imports and sorting alphabetically.
diagnostics Analyze the project and find all diagnostics (warnings, errors).
format Format code using cljfmt.
rename Rename a symbol and all references across the project, use --from and --to options.
references Find all references of a full qualified symbol across the project and/or dependencies, use --from option.
dump (experimental) Dump all project known data including classpath, source-paths, dep-graph and clj-kondo analysis data.
See https://clojure-lsp.io/settings/ for detailed documentation.
New Clojure Document Type
To add the language server requires the creation of a new Zeus Clojure document type. For details on how to do this refer to the instructions found
here.
Configuration
Start Zeus and use the
Options, Document Types menu to edit the Clojure document type and in the
Language Server panel apply the following configuration settings:
Program Type: Executable
Program: D:\Utilities\LSP\clojure\clojure-lsp.exe
NOTE: The directory details of the executable can be omitted provided the executable installation folder has been added to the system PATH
environment variable.
Using the Language Server
To test the configuration create a simple test.clj
file and fire off a keyboard auto-complete request:
NOTE: In the image above the autocomplete was fired using the Alt+Space keyboard command.
Released: 29th October 2024