Skip to content

Commit

Permalink
Merge branch 'master' into exec/improve-lsp--document-highlight-callback
Browse files Browse the repository at this point in the history
  • Loading branch information
eval-exec authored Sep 23, 2024
2 parents f57fd3e + 4abe804 commit 8224a78
Show file tree
Hide file tree
Showing 16 changed files with 358 additions and 189 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
* 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.
* 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


** 9.0.0
* Add language server config for QML (Qt Modeling Language) using qmlls.
* Add new configuration options for lsp-html. Now able to toggle documentation hovers. Custom data is no longer experimental, and is now a vector.
Expand Down
42 changes: 42 additions & 0 deletions clients/lsp-futhark.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
;;; lsp-futhark.el --- lsp-mode futhark integration -*- lexical-binding: t; -*-

;; Copyright (C) 2024 lsp-mode maintainers

;; Keywords: languages

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

;; Client for the futhark language server.

;;; Code:

(require 'lsp-mode)

(defgroup lsp-futhark nil
"LSP support for Futhark, using futhark lsp"
:group 'lsp-mode
:link '(url-link "https://github.com/diku-dk/futhark/tree/master/src/Futhark/LSP")
:package-version `(lsp-mode . "9.0.1"))

(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("futhark" "lsp"))
:activation-fn (lsp-activate-on "futhark")
:server-id 'futhark))

(lsp-consistency-check lsp-futhark)

(provide 'lsp-futhark)
;;; lsp-futhark.el ends here
90 changes: 58 additions & 32 deletions clients/lsp-magik.el
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
:tag "Lsp Magik"
:package-version '(lsp-mode . "9.0.0"))

(defcustom lsp-magik-version "0.9.0"
(defcustom lsp-magik-version "0.10.1"
"Version of LSP server."
:type `string
:group `lsp-magik
Expand All @@ -58,53 +58,89 @@
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))

(defcustom lsp-magik-smallworld-gis nil
"Path to Smallworld Core."
(lsp-defcustom lsp-magik-java-home nil
"Path to Java Runtime, Java 17 minimum."
:type `string
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.0")
:lsp-path "magik.javaHome")

(defcustom lsp-magik-libs-dirs []
"Paths to libs dirs of Smallworld products."
(lsp-defcustom lsp-magik-product-dirs []
"Paths to (compiled, containing a libs/ directory) products."
:type `lsp-string-vector
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.1")
:lsp-path "magik.productDirs")

(defcustom lsp-magik-lint-override-config-file nil
(lsp-defcustom lsp-magik-lint-override-config-file nil
"Override path to magiklintrc.properties."
:type 'string
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.0")
:lsp-path "magik.lint.overrideConfigFile")

(defcustom lsp-magik-typing-type-database-paths []
(lsp-defcustom lsp-magik-typing-type-database-paths []
"Paths to type databases."
:type `lsp-string-vector
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.0")
:lsp-path "magik.typing.typeDatabasePaths")

(defcustom lsp-magik-typing-show-atom-inlay-hints nil
"Show atom type inlay hints."
(lsp-defcustom lsp-magik-typing-show-typing-inlay-hints nil
"Show typing inlay hints."
:type `boolean
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.1")
:lsp-path "magik.typing.showTypingInlayHints")

(defcustom lsp-magik-typing-show-argument-inlay-hints nil
(lsp-defcustom lsp-magik-typing-show-argument-inlay-hints nil
"Show (certain) argument name inlay hints."
:type `boolean
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.1")
:lsp-path "magik.typing.showArgumentInlayHints")

(defcustom lsp-magik-typing-enable-checks nil
(lsp-defcustom lsp-magik-typing-enable-checks nil
"Enable typing checks."
:type `boolean
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.0")
:lsp-path "magik.typing.enableChecks")

(defcustom lsp-magik-typing-index-usages t
"Enable indexing of usages of globals/methods/slots/conditions by methods."
(lsp-defcustom lsp-magik-typing-index-global-usages t
"Enable indexing of usages of globals by methods."
:type `boolean
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.1")
:lsp-path "magik.typing.indexGlobalUsages")

(lsp-defcustom lsp-magik-typing-index-method-usages nil
"Enable indexing of usages of methods by methods."
:type `boolean
:group `lsp-magik
:package-version '(lsp-mode . "9.0.1")
:lsp-path "magik.typing.indexMethodUsages")

(lsp-defcustom lsp-magik-typing-index-slot-usages t
"Enable indexing of usages of slots by methods."
:type `boolean
:group `lsp-magik
:package-version '(lsp-mode . "9.0.1")
:lsp-path "magik.typing.indexSlotUsages")

(lsp-defcustom lsp-magik-typing-index-condition-usages t
"Enable indexing of usages of conditions by methods."
:type `boolean
:group `lsp-magik
:package-version '(lsp-mode . "9.0.1")
:lsp-path "magik.typing.indexConditionUsages")

(lsp-defcustom lsp-magik-typing-cache-indexed-definitions-method-usages t
"Store and load the indexed definitions in the workspace folders."
:type `boolean
:group `lsp-magik
:package-version '(lsp-mode . "9.0.1")
:lsp-path "magik.typing.cacheIndexedDefinitions")

(defcustom lsp-magik-java-path (lambda ()
(cond ((eq system-type 'windows-nt)
Expand All @@ -114,7 +150,7 @@
"Path to Java Runtime, Java 11 minimum."
:type 'string
:group `lsp-magik
:package-version '(lsp-mode . "9.0.0"))
:package-version '(lsp-mode . "9.0.1"))

(lsp-register-client
(make-lsp-client
Expand All @@ -133,16 +169,6 @@
(lsp--set-configuration (lsp-configuration-section "magik"))))
:server-id 'magik))

(lsp-register-custom-settings
`(("magik.smallworldGis" lsp-magik-smallworld-gis)
("magik.libsDirs" lsp-magik-libs-dirs)
("magik.lint.overrideConfigFile" lsp-magik-lint-override-config-file)
("magik.typing.typeDatabasePaths" lsp-magik-typing-type-database-paths)
("magik.typing.showAtomInlayHints" lsp-magik-typing-show-atom-inlay-hints)
("magik.typing.showArgumentInlayHints" lsp-magik-typing-show-argument-inlay-hints)
("magik.typing.enableChecks" lsp-magik-typing-enable-checks)
("magik.typing.indexUsages" lsp-magik-typing-index-usages)))

(lsp-consistency-check lsp-magik)

(provide 'lsp-magik)
Expand Down
2 changes: 1 addition & 1 deletion clients/lsp-nix.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-nix-nixd-server-path))
:major-modes '(nix-mode)
:major-modes '(nix-mode nix-ts-mode)
:server-id 'nixd-lsp
:priority -1))

Expand Down
23 changes: 10 additions & 13 deletions clients/lsp-roslyn.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
:group 'lsp-mode
:package-version '(lsp-mode . "8.0.0"))

(defvar lsp-roslyn--stdpipe-path (expand-file-name
"lsp-roslyn-stdpipe.ps1"
(file-name-directory (file-truename load-file-name)))
(defconst lsp-roslyn--stdpipe-path (expand-file-name
"lsp-roslyn-stdpipe.ps1"
(file-name-directory (locate-library "lsp-roslyn")))
"Path to the `stdpipe' script.
On Windows, this script is used as a proxy for the language server's named pipe.
Unused on other platforms.")
Expand Down Expand Up @@ -81,8 +81,9 @@ Unused on other platforms.")
:package-version '(lsp-mode . "8.0.0")
:group 'lsp-roslyn)

(defcustom lsp-roslyn-package-version "4.9.0-3.23604.10"
"Version of the Roslyn package to install."
(defcustom lsp-roslyn-package-version "4.12.0-3.24470.11"
"Version of the Roslyn package to install.
Gotten from https://dev.azure.com/azure-public/vside/_artifacts/feed/vs-impl/NuGet/Microsoft.CodeAnalysis.LanguageServer.win-x64"
:type 'string
:package-version '(lsp-mode . "8.0.0")
:group 'lsp-roslyn)
Expand Down Expand Up @@ -265,9 +266,9 @@ Assumes it was installed with the server install function."

(defun lsp-roslyn--get-rid ()
"Retrieves the .NET Runtime Identifier (RID) for the current system."
(let* ((is-x64 (string-match-p "x86_64" system-configuration))
(let* ((is-x64 (string-match-p (rx (or "x86_64" "aarch64")) system-configuration))
(is-x86 (and (string-match-p "x86" system-configuration) (not is-x64)))
(is-arm (string-match-p "arm" system-configuration)))
(is-arm (string-match-p (rx (or "arm" "aarch")) system-configuration)))
(if-let ((platform-name (cond
((eq system-type 'gnu/linux) "linux")
((eq system-type 'darwin) "osx")
Expand All @@ -284,12 +285,8 @@ Assumes it was installed with the server install function."
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<configuration>
<packageSources>
<clear />
<add key=\"msft_consumption\" value=\"https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json\" />
<add key=\"vs-impl\" value=\"https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json\" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>"
"The nuget.config to use when downloading Roslyn.")

Expand Down Expand Up @@ -333,7 +330,7 @@ FORCED if specified with prefix argument."
(lsp-async-start-process
callback
error-callback
lsp-roslyn-dotnet-executable "restore" lsp-roslyn-install-path
lsp-roslyn-dotnet-executable "restore" "--interactive" lsp-roslyn-install-path
(format "/p:PackageName=%s" pkg-name)
(format "/p:PackageVersion=%s" lsp-roslyn-package-version))))

Expand Down
24 changes: 24 additions & 0 deletions clients/lsp-ruby-lsp.el
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,35 @@
(if lsp-ruby-lsp-use-bundler '("bundle" "exec"))
'("ruby-lsp")))

(defun lsp-ruby-lsp--open-file (arg_hash)
"Open a file. This function is for code-lens provided by ruby-lsp-rails."
(let* ((arguments (gethash "arguments" arg_hash))
(uri (aref (aref arguments 0) 0))
(path-with-line-number (split-string (lsp--uri-to-path uri) "#L"))
(path (car path-with-line-number))
(line-number (cadr path-with-line-number)))
(find-file path)
(when line-number (forward-line (1- (string-to-number line-number))))))

(defun lsp-ruby-lsp--run-test (arg_hash)
"Run a test file. This function is for code-lens provided by ruby-lsp-rails."
(let* ((arguments (gethash "arguments" arg_hash))
(command (aref arguments 2))
(default-directory (lsp-workspace-root))
(buffer-name "*run test results*")
(buffer (progn
(when (get-buffer buffer-name) (kill-buffer buffer-name))
(generate-new-buffer buffer-name))))
(async-shell-command command buffer)))

(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection #'lsp-ruby-lsp--build-command)
:activation-fn (lsp-activate-on "ruby")
:priority -2
:action-handlers (ht ("rubyLsp.openFile" #'lsp-ruby-lsp--open-file)
("rubyLsp.runTest" #'lsp-ruby-lsp--run-test)
("rubyLsp.runTestInTerminal" #'lsp-ruby-lsp--run-test))
:server-id 'ruby-lsp-ls))

(lsp-consistency-check lsp-ruby-lsp)
Expand Down
Loading

0 comments on commit 8224a78

Please sign in to comment.