|
1 | | -# Clojure LSP |
| 1 | +# Language Server Protocol |
2 | 2 |
|
3 | | -The Language Server Protocol provides a standard set of tools that are used to developer any programming language. These tools are typically provides with a language specific server. |
| 3 | +[:globe_with_meridians: Language Server Protocol](https://microsoft.github.io/language-server-protocol/) provides a standard to provide a common set of development tools, e.g. code completion, syntax highlighting, refactor and language diagnostics. |
4 | 4 |
|
5 | | -clojure-lsp is an implementation of an LSP server, for Clojure and ClojureScript languages. |
| 5 | +Each language requires a specific LSP server implementation. |
| 6 | + |
| 7 | +An editor or plugin provides an LSP client that uses data from language servers, providing information about source code and enabling development tools to understand the code structure. |
| 8 | + |
| 9 | + |
| 10 | +## Clojure LSP |
| 11 | + |
| 12 | +[:globe_with_meridians: clojure-lsp](https://clojure-lsp.io/) is an implementation of an LSP server for Clojure and ClojureScript languages. Clojure LSP is built on top of [clj-kondo]() which provides the static analysis of Clojure and ClojureScript code. |
| 13 | + |
| 14 | +Most Clojure aware editors provide an LSP client. |
6 | 15 |
|
7 | 16 |  |
8 | 17 |
|
9 | 18 |
|
10 | 19 | ## Install |
11 | 20 |
|
12 | | -Follow your preferred option on the [Clojure LSP installation guide](https://clojure-lsp.io/installation/) |
| 21 | +[Clojure LSP installation guide](https://clojure-lsp.io/installation/) covers multiple operating systems. |
| 22 | + |
| 23 | +=== "Linux" |
| 24 | + |
| 25 | + Practicalli recommends downloading the `clojure-lsp-native-linux-amd64` from [GitHub release page](https://github.com/clojure-lsp/clojure-lsp/releases) |
| 26 | + |
| 27 | + Extracts the `clojure-lsp` binary to `~/.local/bin/clojure-lsp` |
| 28 | + |
| 29 | +=== "Homebrew" |
| 30 | + Clojure LSP project provides a custom tap for installing the latest version. |
| 31 | + |
| 32 | + !!! NOTE "" |
| 33 | + ```shell |
| 34 | + brew install clojure-lsp/brew/clojure-lsp-native |
| 35 | + ``` |
13 | 36 |
|
14 | | -Practicalli downloads the clojure-lsp-native-linux-amd64.zip file from [GitHub release page](https://github.com/clojure-lsp/clojure-lsp/releases)and extracts the `clojure-lsp` binary to `~/.local/bin/clojure-lsp`. |
| 37 | + ??? WARNING "Homebrew default package deprecated" |
| 38 | + The `clojure-lsp` formula is deprecated and should not be used. |
15 | 39 |
|
16 | | -`clojure-lsp -v` in a terminal will test if the the install is working. |
| 40 | + `brew remove clojure-lsp` if the default clojure-lsp was installed |
17 | 41 |
|
18 | | -??? HINT "Editors may install Clojure LSP for you" |
| 42 | +Check Clojure LSP server is working via the command line |
| 43 | + |
| 44 | +!!! NOTE "" |
| 45 | + ```shell |
| 46 | + clojure-lsp --version |
| 47 | + ``` |
| 48 | + |
| 49 | + |
| 50 | +??? HINT "Editors may install Clojure LSP" |
19 | 51 | Spacemacs LSP layer will prompt to install a language server when first opening a file of a major mode where LSP is enabled. E.g. when a Clojure related file is opened, the Clojure LSP server is downloaded if not installed (or not found on the Emacs path). |
20 | 52 |
|
| 53 | + Neovim package called mason manages the install of lint & format tools as well as LSP servers. |
| 54 | + |
21 | 55 | VSCode Calva plugin includes the clojure-lsp server, although an external server can be configured. |
22 | 56 |
|
23 | 57 |
|
| 58 | +## Configure |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +??? "Practicalli Clojure LSP Configuration" |
| 63 | + |
| 64 | + |
| 65 | + |
24 | 66 | ## References |
25 | 67 |
|
26 | 68 | * [LSP mode - A guide on disabling / enabling features](https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/) - if the Emacs UI is too cluttered or missing visual features |
|
0 commit comments