Skip to content

Commit

Permalink
Merge branch 'master' into fix-lsp-unzip-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 authored Sep 30, 2024
2 parents fe48989 + b635d67 commit 9aa4c88
Show file tree
Hide file tree
Showing 37 changed files with 2,386 additions and 307 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
emacs-version:
- 27.2
- 28.2
- 29.3
- 29.4
experimental: [false]
include:
- os: ubuntu-latest
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
* Changelog
** Unreleased 9.0.1
* Add support for [[https://github.com/glehmann/earthlyls][earthlyls]]
* Add support for GNAT Project (~gpr-mode~, ~gpr-ts-mode~).
* Add SQL support
* Add support for Meson build system. (~meson-mode~).
* Add support for go to definition for external files (.dll) in CSharp projects for OmniSharp server.
* Added a new optional ~:action-filter~ argument when defining LSP clients that allows code action requests to be modified before they are sent to the server. This is used by the Haskell language server client to work around an ~lsp-mode~ parsing quirk that incorrectly sends ~null~ values instead of ~false~ in code action requests.
* Add support for C# via the [[https://github.com/dotnet/roslyn/tree/main/src/LanguageServer][Roslyn language server]].
* Add basic support for [[https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics][pull diagnostics]] requests.
* Add ~lsp-flush-delayed-changes-before-next-message~ customization point to enforce throttling document change notifications.
* Add ~lsp-sql-show-tables~ command.
* Fix bug in ~rust-analyzer.check.features~ configuration via ~lsp-rust-checkonsave-features~ Emacs setting: we were defaulting to ~[]~, but ~rust-analyzer~ defaults to inheriting the value from ~rust-analyzer.cargo.features~. The bug resulted in code hidden behind features not getting type checked when those features were enabled by setting ~rust-analyzer.cargo.features~ via the ~lsp-rust-features~ Emacs setting.
* Change ~ruff-lsp~ to ~ruff~ for python lsp client. All ~ruff-lsp~ customizable variable change to ~ruff~. Lsp server command now is ~["ruff" "server"]~ instead of ~["ruff-lsp"]~.
* Add futhark support
* Optimize overlay creation by checking window visibility first
* Replace the per-interface ~(INTERFACE ...)~ pcase forms with a single,
unified ~(lsp-interface INTERFACE ...)~ form. The per-interface forms are no
longer generated. *This is a breaking change.* (See #4430.)
* If asm-lsp is installed, lsp-asm won't try to download it to cache store
* Fix lsp-unzip on windows when unzip was found on the PATH

** 9.0.0
Expand Down
61 changes: 23 additions & 38 deletions clients/lsp-ada.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,31 @@
:tag "Language Server"
:package-version '(lsp-mode . "6.2"))

(lsp-defcustom lsp-ada-project-file "default.gpr"
"Set the project file full path to configure the language server with.
The ~ prefix (for the user home directory) is supported.
See https://github.com/AdaCore/ada_language_server for a per-project
configuration example."
:type 'string
(lsp-defcustom lsp-ada-project-file nil
"GNAT Project file used to configure the Language Server.
Both absolute and relative paths are supported within the project file
name. When a relative path is used, the path is relative to the root
folder.
When the project file is not specified, the Language Server will attempt
to determine the project file itself, either by querying \\='alr\\=', if
the root folder contains an alire.toml file and \\='alr\\=' was found in
the path, or otherwise by searching for a unique project file in the
root folder. For Alire projects, whose project file was discovered by
querying \\='alr\\=', the server will also query and populate the Alire
environment."
:type '(choice (string :tag "File")
(const :tag "Not Specified" nil))
:group 'lsp-ada
:package-version '(lsp-mode . "6.2")
:link '(url-link :tag "Configuration Example"
"https://github.com/AdaCore/ada_language_server")
:package-version '(lsp-mode . "9.0.1")
:lsp-path "ada.projectFile")
;;;###autoload(put 'lsp-ada-project-file 'safe-local-variable 'stringp)

(lsp-defcustom lsp-ada-option-charset "UTF-8"
"The charset to use by the Ada Language server. Defaults to 'UTF-8'."
"The charset to use by the Ada Language server. Defaults to \\='UTF-8\\='."
:type 'string
:group 'lsp-ada
:package-version '(lsp-mode . "6.2")
Expand All @@ -63,12 +76,6 @@
:risky t
:type 'file)

(defcustom lsp-ada-alire-executable "alr"
"The alire executable to run when a project is detected."
:type 'string
:group 'lsp-ada
:package-version '(lsp-mode "9.0.0"))

(defcustom lsp-ada-semantic-token-face-overrides
'(("namespace" . default)
("modifier" . lsp-face-semhl-keyword))
Expand Down Expand Up @@ -132,26 +139,6 @@
(lsp-ada--als-latest-release-url)
"ada-ls"))))

(defun lsp-ada--environment ()
"Add environmental variables if needed."
(let ((project-root (lsp-workspace-root)))
;; When there is an alire project, include its environment
(when (file-exists-p
(concat (file-name-as-directory project-root)
"alire.toml"))
(let ((alr-executable (executable-find lsp-ada-alire-executable)))
(if alr-executable
;; Transform output variables to environment
(let ((env-output (shell-command-to-string (concat alr-executable " printenv --unix"))))
(let ((var-strings (split-string env-output "\n")))
(mapcar (lambda (string)
(if (string-match (rx "export" space (group (one-or-more ascii)) "=" "\"" (group (one-or-more ascii)) "\"") string)
(let ((var-name (match-string 1 string))
(var-value (match-string 2 string)))
(cons var-name var-value))))
var-strings)))
(lsp--error "Found alire.toml but the executable %s could not be found" alr-executable))))))

(lsp-dependency
'ada-ls
'(:download :url lsp-ada--als-latest-release-url
Expand All @@ -175,8 +162,7 @@
:semantic-tokens-faces-overrides `( :types ,lsp-ada-semantic-token-face-overrides
:modifiers ,lsp-ada-semantic-token-modifier-face-overrides)
:server-id 'ada-ls
:synchronize-sections '("ada")
:environment-fn 'lsp-ada--environment))
:synchronize-sections '("ada")))

(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection
Expand All @@ -186,8 +172,7 @@
:priority -1
:download-server-fn (lambda (_client callback error-callback _update?)
(lsp-package-ensure 'ada-ls callback error-callback))
:server-id 'gpr-ls
:environment-fn #'lsp-ada--environment))
:server-id 'gpr-ls))

(lsp-consistency-check lsp-ada)

Expand Down
9 changes: 4 additions & 5 deletions clients/lsp-angular.el
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ Has no effects when `lsp-clients-angular-language-server-command' is set."
;; so we "cache" its results after running once
(setq lsp-clients-angular-language-server-command
(list
"node"
(f-join node-modules-path "@angular/language-server")
"--ngProbeLocations"
node-modules-path
"ngserver"
"--stdio"
"--tsProbeLocations"
node-modules-path
"--stdio"))
"--ngProbeLocations"
(f-join node-modules-path "@angular/language-server/node_modules/")))
lsp-clients-angular-language-server-command))))
:activation-fn
(lambda (&rest _args)
Expand Down
3 changes: 2 additions & 1 deletion clients/lsp-asm.el
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ Will update if UPDATE? is t."
(make-lsp-client
:new-connection (lsp-stdio-connection
#'lsp-asm--server-command
(lambda () (f-exists? lsp-asm-store-path)))
(lambda () (or (executable-find "asm-lsp")
(f-exists? lsp-asm-store-path))))
:major-modes lsp-asm-active-modes
:priority -1
:server-id 'asm-lsp
Expand Down
44 changes: 39 additions & 5 deletions clients/lsp-csharp.el
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,30 @@ Usually this is to be set in your .dir-locals.el on the project root directory."
:group 'lsp-csharp-omnisharp
:type 'file)


(defcustom lsp-csharp-omnisharp-enable-decompilation-support
nil
"Decompile bytecode when browsing method metadata for types in assemblies.
Otherwise only declarations for the methods are visible (the default)."
:group 'lsp-csharp
:type 'boolean)

(defcustom lsp-csharp-csharpls-use-dotnet-tool t
"Whether to use a dotnet tool version of the expected C#
language server; only available for csharp-ls"
:group 'lsp-csharp
:type 'boolean
:risky t)

(defcustom lsp-csharp-csharpls-use-local-tool nil
"Whether to use csharp-ls as a global or local dotnet tool.
Note: this variable has no effect if
lsp-csharp-csharpls-use-dotnet-tool is nil."
:group 'lsp-csharp
:type 'boolean
:risky t)

(lsp-dependency
'omnisharp-roslyn
`(:download :url lsp-csharp-omnisharp-roslyn-download-url
Expand Down Expand Up @@ -485,6 +502,15 @@ filename is returned so lsp-mode can display this file."
(with-temp-buffer (insert-file-contents metadata-file-name)
(buffer-string))))))

(defun lsp-csharp--cls-find-executable ()
(or (when lsp-csharp-csharpls-use-dotnet-tool
(if lsp-csharp-csharpls-use-local-tool
(list "dotnet" "tool" "run" "csharp-ls")
(list "csharp-ls")))
(executable-find "csharp-ls")
(f-join (or (getenv "USERPROFILE") (getenv "HOME"))
".dotnet" "tools" "csharp-ls")))

(defun lsp-csharp--cls-make-launch-cmd ()
"Return command line to invoke csharp-ls."

Expand All @@ -504,16 +530,24 @@ filename is returned so lsp-mode can display this file."

(t nil)))

(csharp-ls-exec (or (executable-find "csharp-ls")
(f-join (or (getenv "USERPROFILE") (getenv "HOME"))
".dotnet" "tools" "csharp-ls")))
(csharp-ls-exec (lsp-csharp--cls-find-executable))

(solution-file-params (when lsp-csharp-solution-file
(list "-s" lsp-csharp-solution-file))))
(append startup-wrapper
(list csharp-ls-exec)
(if (listp csharp-ls-exec)
csharp-ls-exec
(list csharp-ls-exec))
solution-file-params)))

(defun lsp-csharp--cls-test-csharp-ls-present ()
"Return non-nil if dotnet tool csharp-ls is installed as a dotnet tool."
(string-match-p "csharp-ls"
(shell-command-to-string
(if lsp-csharp-csharpls-use-local-tool
"dotnet tool list"
"dotnet tool list -g"))))

(defun lsp-csharp--cls-download-server (_client callback error-callback update?)
"Install/update csharp-ls language server using `dotnet tool'.
Expand All @@ -522,7 +556,7 @@ Will update if UPDATE? is t"
(lsp-async-start-process
callback
error-callback
"dotnet" "tool" (if update? "update" "install") "-g" "csharp-ls"))
"dotnet" "tool" (if update? "update" "install") (if lsp-csharp-csharpls-use-local-tool "" "-g") "csharp-ls"))

(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection #'lsp-csharp--cls-make-launch-cmd)
Expand Down
29 changes: 29 additions & 0 deletions clients/lsp-cucumber.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,35 @@ This is only for development use."
:type 'list
:group 'lsp-cucumber)

(lsp-defcustom lsp-cucumber-features
["src/test/**/*.feature" "features/**/*.feature" "tests/**/*.feature" "*specs*/**/*.feature"]
"Configure where the extension should look for .feature files."
:type '(repeat string)
:group 'lsp-cucumber
:package-version '(lsp-mode . "9.0.0")
:lsp-path "cucumber.features")

(lsp-defcustom lsp-cucumber-glue
["*specs*/**/*.cs" "features/**/*.js" "features/**/*.jsx" "features/**/*.php" "features/**/*.py" "features/**/*.rs" "features/**/*.rb" "features/**/*.ts" "features/**/*.tsx" "features/**/*_test.go" "**/*_test.go" "src/test/**/*.java" "tests/**/*.py" "tests/**/*.rs"]
"Configure where the extension should look for source code where
step definitions and parameter types are defined."
:type '(repeat string)
:group 'lsp-cucumber
:package-version '(lsp-mode . "9.0.0")
:lsp-path "cucumber.glue")

(lsp-defcustom lsp-cucumber-parameter-types []
"Configure parameters types to convert output parameters to your own types.
Details at https://github.com/cucumber/cucumber-expressions#custom-parameter-types.
Sample:
[(:name \"actor\"
:regexp \"[A-Z][a-z]+\")]"
:type '(lsp-repeatable-vector plist)
:group 'lsp-cucumber
:package-version '(lsp-mode . "9.0.0")
:lsp-path "cucumber.parameterTypes")

(defun lsp-cucumber--server-command ()
"Generate startup command for Cucumber language server."
(or (and lsp-cucumber-server-path
Expand Down
94 changes: 94 additions & 0 deletions clients/lsp-earthly.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
;;; lsp-earthly.el --- earthlyls client -*- lexical-binding: t; -*-

;; Copyright (C) 2024 Samuel Loury

;; Author: Samuel Loury <[email protected]>
;; Keywords: earthly lsp

;; 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 Earthfile

;;; Code:

(require 'lsp-mode)

(defgroup lsp-earthly nil
"LSP support for Earthfile."
:group 'lsp-mode
:link '(url-link "https://github.com/glehmann/earthlyls")
:package-version `(lsp-mode . "9.0.0"))

(defcustom lsp-earthly-active-modes
'(earthfile-mode)
"List of major mode that work with earthlyls."
:type '(list symbol)
:group 'lsp-earthly)

(defcustom lsp-earthly-home-url
"https://github.com/glehmann/earthlyls"
"Url we use to install earthlyls."
:type 'string
:group 'lsp-earthly
:package-version '(lsp-mode . "9.0.0"))

(defcustom lsp-earthly-store-path (f-join lsp-server-install-dir "earthly")
"The path to the file in which `earthlyls' will be stored."
:type 'file
:group 'lsp-earthly
:package-version '(lsp-mode . "9.0.0"))

(defun lsp-earthly--download-server (_client callback error-callback update?)
"Install/update earthly-ls language server using `cargo install'.
Will invoke CALLBACK or ERROR-CALLBACK based on result.
Will update if UPDATE? is t."
(when update?
(ignore-errors (delete-directory lsp-earthly-store-path t)))
(lsp-async-start-process
callback
error-callback
"cargo" "install" "--git" lsp-earthly-home-url "--root"
lsp-earthly-store-path "earthlyls"))

(defun lsp-earthly--executable ()
"Return earthlyls executable."
(let ((local (f-join lsp-earthly-store-path "bin"
(if (eq system-type 'windows-nt)
"earthlyls.exe"
"earthlyls"))))
(or (and (f-exists? local) local)
(executable-find "earthlyls")
(user-error "`earthlyls' is not installed; for installation see %s for more information" lsp-earthly-home-url))))

(defun lsp-earthly--server-command ()
"Startup command for the earthlyls server."
(list (lsp-earthly--executable)))

(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection
#'lsp-earthly--server-command
(lambda () (f-exists? lsp-earthly-store-path)))
:major-modes lsp-earthly-active-modes
:priority -1
:server-id 'earthlyls
:download-server-fn #'lsp-earthly--download-server))

(lsp-consistency-check lsp-earthly)

(provide 'lsp-earthly)
;;; lsp-earthly.el ends here
2 changes: 1 addition & 1 deletion clients/lsp-elixir.el
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Leave as default to let `executable-find' search for it."
:type '(repeat string)
:package-version '(lsp-mode . "8.0.0"))

(defcustom lsp-elixir-ls-version "v0.20.0"
(defcustom lsp-elixir-ls-version "v0.22.0"
"Elixir-Ls version to download.
It has to be set before `lsp-elixir.el' is loaded and it has to
be available here: https://github.com/elixir-lsp/elixir-ls/releases/"
Expand Down
2 changes: 1 addition & 1 deletion clients/lsp-eslint.el
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
:group 'lsp-eslint
:package-version '(lsp-mode . "8.0.0"))

(defcustom lsp-eslint-download-url "https://github.com/emacs-lsp/lsp-server-binaries/blob/master/dbaeumer.vscode-eslint-2.2.2.vsix?raw=true"
(defcustom lsp-eslint-download-url "https://github.com/emacs-lsp/lsp-server-binaries/blob/master/dbaeumer.vscode-eslint-3.0.10.vsix?raw=true"
"ESLint language server download url."
:type 'string
:group 'lsp-eslint
Expand Down
Loading

0 comments on commit 9aa4c88

Please sign in to comment.