Skip to content

Commit d1af589

Browse files
authored
Provide a better working minimal example (#3031)
* wrap basic example with with-eval-after-load * add a specific example of a file type with web-mode * re-work custom lsp example using a derived/pre-existing major mode * Revert "wrap basic example with with-eval-after-load" This reverts commit 290d5e0.
1 parent a2b98b0 commit d1af589

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/page/adding-new-language.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,23 @@ corresponding mode -\> language id - in this case `(python-mode .
2626

2727
`lsp-mode` is using `lsp-language-id-configuration` to determine what is the
2828
buffer language. When the `major-mode` is not sufficient to determine the
29-
language (e.g. `web-mode` is used for `javascript`, `html`, and `css`) you can put
30-
regex.
29+
language (e.g. `web-mode` is used for `javascript`, `html`, and `css`) you can put regex.
30+
31+
Here's an example of how to set up a custom language server in your `init.el` file:
32+
33+
```elisp
34+
;; Use shopify-cli / theme-check-language-server for Shopify's liquid syntax
35+
(with-eval-after-load 'lsp-mode
36+
(add-to-list 'lsp-language-id-configuration
37+
'(shopify-mode . "shopify"))
38+
39+
(lsp-register-client
40+
(make-lsp-client :new-connection (lsp-stdio-connection "theme-check-language-server")
41+
:activation-fn (lsp-activate-on "shopify")
42+
:server-id 'theme-check)))
43+
```
44+
45+
**Note:** This example assumes that you've already set up a major mode of your own either by [deriving it](https://www.gnu.org/software/emacs/manual/html_node/elisp/Derived-Modes.html) from `web-mode` or perhaps by writing it yourself.
3146

3247
If the language server supports environment variables to control
3348
additional behavior, you can register that by using the

0 commit comments

Comments
 (0)