diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-11 17:17:53 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-11 17:17:53 -0500 |
| commit | 6a9ab533a52797ab585a4a99a10de09c2c568428 (patch) | |
| tree | 96026fb631e09fd56b2be0fc6b8b7303c1713aa9 /tests | |
| parent | 39dba091171327ff9f8beb5a31eed3136b9d78cf (diff) | |
| download | dotemacs-6a9ab533a52797ab585a4a99a10de09c2c568428.tar.gz dotemacs-6a9ab533a52797ab585a4a99a10de09c2c568428.zip | |
refactor(prog-lsp): replace obsolete lsp-eldoc-hook
lsp-mode 9.0.0 made `lsp-eldoc-hook' an obsolete alias for Emacs's `eldoc-documentation-functions', and `lsp-managed-mode' already adds `lsp-eldoc-function' to that buffer-local hook. Dropped the obsolete `(setq lsp-eldoc-hook nil)'. `cj/lsp--disable-eldoc-hover' now removes `lsp-eldoc-function' from the buffer-local `eldoc-documentation-functions' via `lsp-managed-mode-hook', which clears the obsolete-variable byte-compile warning. Tests cover the hook removal, leaving the default `eldoc-documentation-functions' value alone, and the module no longer naming `lsp-eldoc-hook'.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-prog-lsp--add-file-watch-ignored-extras.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test-prog-lsp--add-file-watch-ignored-extras.el b/tests/test-prog-lsp--add-file-watch-ignored-extras.el index 255832e4..6213b58c 100644 --- a/tests/test-prog-lsp--add-file-watch-ignored-extras.el +++ b/tests/test-prog-lsp--add-file-watch-ignored-extras.el @@ -16,6 +16,10 @@ ;; activates lsp-mode. In the test environment, this stub provides the value ;; cell `add-to-list' needs. (defvar lsp-file-watch-ignored-directories nil) +(defvar eldoc-documentation-functions nil) + +(defun lsp-eldoc-function (&rest _args) + "Stub lsp-mode Eldoc function for tests.") (require 'prog-lsp) @@ -83,5 +87,29 @@ (should-error (cj/lsp--add-file-watch-ignored-extras) :type 'wrong-type-argument))) +(ert-deftest test-prog-lsp--disable-eldoc-hover-removes-lsp-provider-locally () + "Normal: remove lsp-mode's Eldoc provider from the buffer-local hook." + (with-temp-buffer + (setq-local eldoc-documentation-functions + '(lsp-eldoc-function eldoc-documentation-default)) + (cj/lsp--disable-eldoc-hover) + (should-not (memq #'lsp-eldoc-function eldoc-documentation-functions)) + (should (memq 'eldoc-documentation-default eldoc-documentation-functions)))) + +(ert-deftest test-prog-lsp--disable-eldoc-hover-does-not-touch-default-value () + "Boundary: disabling LSP Eldoc in one buffer leaves the default hook alone." + (let ((eldoc-documentation-functions '(lsp-eldoc-function))) + (with-temp-buffer + (setq-local eldoc-documentation-functions '(lsp-eldoc-function)) + (cj/lsp--disable-eldoc-hover) + (should-not (memq #'lsp-eldoc-function eldoc-documentation-functions))) + (should (memq #'lsp-eldoc-function eldoc-documentation-functions)))) + +(ert-deftest test-prog-lsp--module-no-obsolete-lsp-eldoc-hook-reference () + "Regression: prog-lsp should not reference obsolete `lsp-eldoc-hook'." + (with-temp-buffer + (insert-file-contents (expand-file-name "modules/prog-lsp.el" user-emacs-directory)) + (should-not (re-search-forward "\\_<lsp-eldoc-hook\\_>" nil t)))) + (provide 'test-prog-lsp--add-file-watch-ignored-extras) ;;; test-prog-lsp--add-file-watch-ignored-extras.el ends here |
