diff --git a/CHANGELOG.org b/CHANGELOG.org index b73f8759eb..cfa29ce774 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -26,6 +26,8 @@ * Add TypeSpec support * Add Tree-sitter query support * Add [[https://github.com/mrjosh/helm-ls][helm-ls]] (YAML Kubernetes Helm) support. + * Add ~lsp-bash-allowed-shells~ to configure supported ~sh-shell~ values. + * Add hint about ~activation-fn~ for unsupported buffers. ** 9.0.0 * Add language server config for QML (Qt Modeling Language) using qmlls. diff --git a/clients/lsp-bash.el b/clients/lsp-bash.el index ff5aa86bab..571c90fb63 100644 --- a/clients/lsp-bash.el +++ b/clients/lsp-bash.el @@ -33,6 +33,12 @@ :link '(url-link "https://github.com/bash-lsp/bash-language-server") :package-version '(lsp-mode . "6.2")) +(defcustom lsp-bash-allowed-shells '(sh bash) + "List of allowed `sh-shell` values that LSP will be enabled for." + :type '(list symbol) + :group 'lsp-bash + :package-version '(lsp-mode . "9.0.1")) + (defcustom lsp-bash-explainshell-endpoint nil "The endpoint to use explainshell.com to answer `onHover' queries. See instructions at https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode" @@ -65,11 +71,11 @@ See instructions at https://marketplace.visualstudio.com/items?itemName=mads-har (defvar sh-shell) (defun lsp-bash-check-sh-shell (&rest _) - "Check whether `sh-shell' is sh or bash. + "Check whether `sh-shell' is supported. -This prevents the Bash server from being turned on in zsh files." - (and (memq major-mode '(sh-mode bash-ts-mode ebuild-mode envrc-file-mode)) - (memq sh-shell '(sh bash)))) +This prevents the Bash server from being turned on for unsupported dialects, e.g. `zsh`." + (and (boundp 'sh-shell) + (memq sh-shell lsp-bash-allowed-shells))) (lsp-register-client (make-lsp-client diff --git a/lsp-mode.el b/lsp-mode.el index 61625c8751..3458490b4d 100644 --- a/lsp-mode.el +++ b/lsp-mode.el @@ -9495,9 +9495,10 @@ You may find the installation instructions at https://emacs-lsp.github.io/lsp-mo This issue might be caused by: 1. The language you are trying to use does not have built-in support in `lsp-mode'. You must install the required support manually. Examples of this are `lsp-java' or `lsp-metals'. 2. The language server that you expect to run is not configured to run for major mode `%s'. You may check that by checking the `:major-modes' that are passed to `lsp-register-client'. -3. `lsp-mode' doesn't have any integration for the language behind `%s'. Refer to https://emacs-lsp.github.io/lsp-mode/page/languages and https://langserver.org/ . -4. You are over `tramp'. In this case follow https://emacs-lsp.github.io/lsp-mode/page/remote/. -5. You have disabled the `lsp-mode' clients for that file. (Check `lsp-enabled-clients' and `lsp-disabled-clients'). +3. The language server that you expect to run has an `:activation-fn` passed to `lsp-register-client` that prevents it supporting this buffer. +4. `lsp-mode' doesn't have any integration for the language behind `%s'. Refer to https://emacs-lsp.github.io/lsp-mode/page/languages and https://langserver.org/ . +5. You are over `tramp'. In this case follow https://emacs-lsp.github.io/lsp-mode/page/remote/. +6. You have disabled the `lsp-mode' clients for that file. (Check `lsp-enabled-clients' and `lsp-disabled-clients'). You can customize `lsp-warn-no-matched-clients' to disable this message." major-mode major-mode major-mode))))))