-
-
Notifications
You must be signed in to change notification settings - Fork 890
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
Add credo-language-server support #4068
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1f13d8f
Add credo-language-server support
wkirschbaum b2bd768
Fix lsp-credo copyright
wkirschbaum 8246f4e
Add automatic installation to lsp-credo
wkirschbaum 8af6e66
Use new download link for lsp-credo
wkirschbaum 07393ba
Add lsp-credo to lsp-client-packages
wkirschbaum f04d0db
Set multi-root to nil for lsp-credo
wkirschbaum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
;;; lsp-credo.el --- lsp-mode Credo integration -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) 2023 Wilhelm H Kirschbaum | ||
|
||
;; Author: Wilhelm H Kirschbaum | ||
;; Keywords: lsp, elixir, credo | ||
|
||
;; This program is free software; you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation, either version 3 of the License, or | ||
;; (at your option) any later version. | ||
|
||
;; This program is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU General Public License for more details. | ||
|
||
;; You should have received a copy of the GNU General Public License | ||
;; along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; Commentary: | ||
|
||
;; LSP Client for Elixir Credo | ||
|
||
;;; Code: | ||
|
||
(require 'lsp-mode) | ||
|
||
(defgroup lsp-credo nil | ||
"Settings for credo language server." | ||
:group 'lsp-mode | ||
:link '(url-link "https://github.com/elixir-tools/credo-language-server") | ||
:package-version '(lsp-mode . "8.0.1")) | ||
|
||
(defcustom lsp-credo-command '("credo-language-server" "--stdio=true") | ||
"The command that starts credo-language-server." | ||
:type '(repeat :tag "List of string values" string) | ||
:group 'lsp-credo | ||
:package-version '(lsp-mode . "8.0.1")) | ||
|
||
(defcustom lsp-credo-version "0.1.2" | ||
"Credo language server version to download. | ||
It has to be set before `lsp-credo.el' is loaded and it has to | ||
be available here: https://github.com/elixir-tools/credo-language-server/releases." | ||
:type 'string | ||
:group 'lsp-credo | ||
:package-version '(lsp-mode . "8.0.1")) | ||
|
||
(defcustom lsp-credo-download-url | ||
(format (concat "https://github.com/elixir-tools/credo-language-server" | ||
"/releases/download/v%s/credo-language-server") | ||
lsp-credo-version) | ||
"Automatic download url for credo-language-server." | ||
:type 'string | ||
:group 'lsp-credo | ||
:package-version '(lsp-mode . "8.0.1")) | ||
|
||
(defcustom lsp-credo-binary-path | ||
(f-join lsp-server-install-dir | ||
"credo-language-server" | ||
"credo-language-server") | ||
"The path to `credo-language-server' binary." | ||
:type 'file | ||
:group 'lsp-credo | ||
:package-version '(lsp-mode . "8.0.1")) | ||
|
||
(lsp-dependency | ||
'credo-language-server | ||
`(:download :url lsp-credo-download-url | ||
:store-path ,(f-join lsp-server-install-dir | ||
"credo-language-server" | ||
"credo-language-server") | ||
:binary-path lsp-credo-binary-path | ||
:set-executable? t)) | ||
|
||
(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)))) | ||
:activation-fn (lsp-activate-on "elixir") | ||
:priority -1 | ||
:add-on? t | ||
:multi-root nil | ||
:server-id 'credo-language-server | ||
:download-server-fn | ||
(lambda (_client callback error-callback _update?) | ||
(lsp-package-ensure 'credo-language-server callback error-callback)))) | ||
|
||
(lsp-consistency-check lsp-credo) | ||
|
||
(provide 'lsp-credo) | ||
|
||
;;; lsp-credo.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be easier for you if i make sure the bin/credo-language-server script is always uploaded as an asset on the github release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, i updated the PR to use the new release file structure.