Skip to content

Commit

Permalink
Add simple configurations for Emacs integration (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedengran authored Oct 31, 2023
1 parent 6de5657 commit 104e9e6
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/language-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Once installed, you can run the language server using `cypher-language-server --

Below you can find a few examples in Typescript on how to send messages to that server.

For integrations with other editors, see [Integrating with other editors](#integrating-with-other-editors).

### Using ipc

```typescript
Expand Down Expand Up @@ -139,3 +141,35 @@ reader.listen((data) => {

initialize();
```

### Integrating with other editors

#### Emacs

##### With `lsp-mode`

```elisp
(with-eval-after-load 'lsp-mode
(add-to-list 'lsp-language-id-configuration
;; '(cypher-mode . "cypher")) ;; use this if you have a cypher-mode installed
'(".*cypher" . "cypher")) ;; otherwise, you can simply match on file ending with a regex
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("cypher-language-server" "--stdio"))
:activation-fn (lsp-activate-on "cypher")
:server-id 'cypher)))
```

If you want semantic highlighting, remember to set

```elisp
(setq lsp-semantic-tokens-enable t)
```

##### With `eglot`

As of Emacs 29, `eglot` is built in. In `eglot`, a language server needs to be associate with a specific major mode. Install any available `cypher-mode` in order to get the server running with `eglot`. Note also that `eglot` does not support semantic highlighting.

```elisp
(add-to-list 'Eglot-server-programs '((cypher-mode) "cypher-language-server" "--stdio")))
```

0 comments on commit 104e9e6

Please sign in to comment.