diff --git a/CHANGELOG.org b/CHANGELOG.org index cace99780a..bd4cc93354 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -10,6 +10,7 @@ * 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. ** 9.0.0 * Add language server config for QML (Qt Modeling Language) using qmlls. diff --git a/clients/lsp-rust.el b/clients/lsp-rust.el index 6a6a4ae82b..48c17181fd 100644 --- a/clients/lsp-rust.el +++ b/clients/lsp-rust.el @@ -187,6 +187,7 @@ the latest build duration." (defcustom lsp-rust-features [] "List of features to activate. +Corresponds to the `rust-analyzer` setting `rust-analyzer.cargo.features`. Set this to `\"all\"` to pass `--all-features` to cargo." :type 'lsp-string-vector :group 'lsp-rust-rls @@ -596,9 +597,15 @@ The command should include `--message=format=json` or similar option." :group 'lsp-rust-analyzer :package-version '(lsp-mode . "8.0.2")) -(defcustom lsp-rust-analyzer-checkonsave-features [] +(defcustom lsp-rust-analyzer-checkonsave-features nil "List of features to activate. -Set this to `\"all\"` to pass `--all-features` to cargo." +Corresponds to the `rust-analyzer` setting `rust-analyzer.check.features`. +When set to `nil` (default), the value of `lsp-rust-features' is inherited. +Set this to `\"all\"` to pass `--all-features` to cargo. +Note: setting this to `nil` means \"unset\", whereas setting this +to `[]` (empty vector) means \"set to empty list of features\", +which overrides any value that would otherwise be inherited from +`lsp-rust-features'." :type 'lsp-string-vector :group 'lsp-rust-rust-analyzer :package-version '(lsp-mode . "8.0.2")) @@ -1666,11 +1673,22 @@ https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.m :merge (:glob ,(lsp-json-bool lsp-rust-analyzer-imports-merge-glob)) :prefix ,lsp-rust-analyzer-import-prefix) :lruCapacity ,lsp-rust-analyzer-lru-capacity + ;; This `checkOnSave` is called `check` in the `rust-analyzer` docs, not + ;; `checkOnSave`, but the `rust-analyzer` source code shows that both names + ;; work. The `checkOnSave` name has been supported by `rust-analyzer` for a + ;; long time, whereas the `check` name was introduced here in 2023: + ;; https://github.com/rust-lang/rust-analyzer/commit/d2bb62b6a81d26f1e41712e04d4ac760f860d3b3 :checkOnSave ( :enable ,(lsp-json-bool lsp-rust-analyzer-cargo-watch-enable) :command ,lsp-rust-analyzer-cargo-watch-command :extraArgs ,lsp-rust-analyzer-cargo-watch-args :allTargets ,(lsp-json-bool lsp-rust-analyzer-check-all-targets) - :features ,lsp-rust-analyzer-checkonsave-features + ;; We need to distinguish between setting this to the empty + ;; vector, and not setting it at all, which `rust-analyzer` + ;; interprets as "inherit from + ;; `rust-analyzer.cargo.features`". We use `nil` to mean + ;; "unset". + ,@(when (vectorp lsp-rust-analyzer-checkonsave-features) + `(:features ,lsp-rust-analyzer-checkonsave-features)) :overrideCommand ,lsp-rust-analyzer-cargo-override-command) :highlightRelated ( :breakPoints (:enable ,(lsp-json-bool lsp-rust-analyzer-highlight-breakpoints)) :closureCaptures (:enable ,(lsp-json-bool lsp-rust-analyzer-highlight-closure-captures)) diff --git a/clients/lsp-tex.el b/clients/lsp-tex.el index ca6f475837..31c4701686 100644 --- a/clients/lsp-tex.el +++ b/clients/lsp-tex.el @@ -46,7 +46,7 @@ (lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-digestif-executable) - :major-modes '(plain-tex-mode latex-mode context-mode texinfo-mode LaTex-mode) + :major-modes '(plain-tex-mode latex-mode context-mode texinfo-mode LaTeX-mode) :priority (if (eq lsp-tex-server 'digestif) 1 -1) :server-id 'digestif)) diff --git a/docs/manual-language-docs/lsp-sqls.md b/docs/manual-language-docs/lsp-sqls.md index b8b2b6c410..54f7f5474a 100644 --- a/docs/manual-language-docs/lsp-sqls.md +++ b/docs/manual-language-docs/lsp-sqls.md @@ -14,7 +14,10 @@ root_file: docs/manual-language-docs/lsp-sqls.md ``` -Alternatively, you can leave `lsp-sqls-workspace-config-path` to the default "workspace" value, and put a json file in `/.sqls/config.json` containing +## Storing Configuration in `/.sqls/config.json` + +Alternatively, you can store your configuration in the project root at `/.sqls/config.json`: + ``` { "sqls": { @@ -29,4 +32,29 @@ Alternatively, you can leave `lsp-sqls-workspace-config-path` to the default "wo } ``` -Now lsp should start in sql-mode buffers, and you can pick a server connection with `M-x lsp-execute-code-action` and "Switch Connections" (or directly with `M-x lsp-sql-switch-connection`). You can change database with `M-x lsp-execute-code-action` and "Switch Database" (or `M-x lsp-sql-switch-database`). +In this case, you need to set `lsp-sqls-workspace-config-path` to "root": + +```emacs-lisp +(setq lsp-sqls-workspace-config-path "root") +``` + +## Storing Configuration in the Current Directory + +If you want to configure it for the current directory, you can create a `.sqls/config.json` file: + +``` +.sqls/config.json +target.sql +``` + +For this setup, ensure that `lsp-sqls-workspace-config-path` is set to "workspace": + +```emacs-lisp +(setq lsp-sqls-workspace-config-path "workspace") +``` + +# Switching Connections and Databases + +Now, lsp should start in sql-mode buffers. You can choose a server connection using `M-x lsp-execute-code-action` and then selecting "Switch Connections", or directly with `M-x lsp-sql-switch-connection`. + +To change the database, use `M-x lsp-execute-code-action` and select "Switch Database" (or `M-x lsp-sql-switch-database`).