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 | 96d5d6a7454f4e35860dc3d93cb3a447263859d7 (patch) | |
| tree | 28d4463fc11867125c6dbb87a46c71b273870108 /tests | |
| parent | 96ee689709ca45866e985fff2179c0e6797ec697 (diff) | |
| download | dotemacs-96d5d6a7454f4e35860dc3d93cb3a447263859d7.tar.gz dotemacs-96d5d6a7454f4e35860dc3d93cb3a447263859d7.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 |
