aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorTheodor Thornhill2024-04-19 20:40:25 +0200
committerTheodor Thornhill2024-04-19 22:21:38 +0200
commit49ef173b0287e17273e4476df16dca5f2196b11c (patch)
tree965fe6ee54b2cc69684354485ee19d30c74e2e09 /test/lisp
parent82775f21413681b09c888527b5d2fb15354f0793 (diff)
downloademacs-49ef173b0287e17273e4476df16dca5f2196b11c.tar.gz
emacs-49ef173b0287e17273e4476df16dca5f2196b11c.zip
Make publishDiagnostics faster by using cached variable
* lisp/progmodes/eglot.el (eglot--cached-tdi): Move variable. (eglot-handle-notification): Expose 'server' and search through managed buffers for a cached textDocumentIdentifier, which has a file-truename resolved path. * test/lisp/progmodes/eglot-tests.el (eglot-test-basic-symlink): Add regression test for symlink behavior
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/progmodes/eglot-tests.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el
index e501e24f5d2..28579ccde5c 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -436,6 +436,28 @@ directory hierarchy."
436 (flymake-goto-next-error 1 '() t) 436 (flymake-goto-next-error 1 '() t)
437 (should (eq 'flymake-error (face-at-point))))))) 437 (should (eq 'flymake-error (face-at-point)))))))
438 438
439(ert-deftest eglot-test-basic-symlink ()
440 "Test basic symlink support."
441 (skip-unless (executable-find "clangd"))
442 (eglot--with-fixture
443 `(("symlink-project" .
444 (("main.cpp" . "#include\"foo.h\"\nint main() { return foo(); }")
445 ("foo.h" . "int foo();"))))
446 (with-current-buffer
447 (find-file-noselect "symlink-project/main.cpp")
448 (make-symbolic-link "main.cpp" "mainlink.cpp")
449 (eglot--tests-connect)
450 (find-file-noselect "mainlink.cpp")
451 (with-current-buffer
452 (find-file-noselect "foo.h")
453 (goto-char 5)
454 (xref-find-references "foo")
455 (with-current-buffer (get-buffer "*xref*")
456 (end-of-buffer)
457 ;; Expect the xref buffer to not contain duplicate references to
458 ;; main.c and mainlink.c. If it did total lines would be 7.
459 (should (= (line-number-at-pos (point)) 5)))))))
460
439(ert-deftest eglot-test-diagnostic-tags-unnecessary-code () 461(ert-deftest eglot-test-diagnostic-tags-unnecessary-code ()
440 "Test rendering of diagnostics tagged \"unnecessary\"." 462 "Test rendering of diagnostics tagged \"unnecessary\"."
441 (skip-unless (executable-find "clangd")) 463 (skip-unless (executable-find "clangd"))