Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant checks from lsp-credo.el, add note to docs #4115

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions clients/lsp-credo.el
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ be available here: https://github.com/elixir-tools/credo-language-server/release

(lsp-register-client
(make-lsp-client
:new-connection
(lsp-stdio-connection
(lambda ()
`(,(or (executable-find (cl-first lsp-credo-command))
(lsp-package-path 'credo-language-server))
,@(cl-rest lsp-credo-command))))
:new-connection (lsp-stdio-connection lsp-credo-command)
:activation-fn (lsp-activate-on "elixir")
:priority -1
:add-on? t
Expand Down
11 changes: 11 additions & 0 deletions docs/page/adding-new-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ corresponding mode -\> language id - in this case `(python-mode .
buffer language. When the `major-mode` is not sufficient to determine the
language (e.g. `web-mode` is used for `javascript`, `html`, and `css`) you can put regex.

**Note:** In the above example, when a new client is created using
`make-lsp-client`, a new connection to the language server is created
using `lsp-stdio-connection`. Please carefully check its
documentation, as the function checks for various things (e.g. testing
for the executable in PATH) and handles respective errors. Often
while adding a server, the LSP client author might do these checks
themselves, but without handling the errors correctly. This leads to
features like `lsp-install-server` breaking for other users; e.g. see
[this issue](https://github.com/emacs-lsp/lsp-mode/issues/3415). This
is a common mistake that keeps reoccurring.

Here's an example of how to set up a custom language server in your `init.el` file:

```elisp
Expand Down
Loading