[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 05fe647 7/8: Per #667: add a passing test demonst
From: |
Stefan Monnier |
Subject: |
[elpa] externals/eglot 05fe647 7/8: Per #667: add a passing test demonstrating clangd + TRAMP works |
Date: |
Wed, 14 Apr 2021 18:53:08 -0400 (EDT) |
branch: externals/eglot
commit 05fe6472cb1766e4dafae7562b8793d96d0bb271
Author: JoΓ£o TΓ‘vora <joaotavora@gmail.com>
Commit: JoΓ£o TΓ‘vora <joaotavora@gmail.com>
Per #667: add a passing test demonstrating clangd + TRAMP works
... It works at least within the minimal, well-controlled reproducible
settings of this test. Maybe if we knew something more about the
setup of the user who submitted this report we would be able to
concoct a failing test, but we don't.
* eglot-tests.el (subr-x): Require it
(eglot--make-file-or-dir): Return expanded file name.
(eglot-tests--lsp-abiding-column-1): New helper.
(eglot-lsp-abiding-column): Use it.
(eglot--tramp-test): Fix `skip-unless` condition.
(eglot--tramp-test-2): New test.
---
eglot-tests.el | 30 +++++++++++++++++++++++++-----
eglot.el | 11 ++++++++++-
2 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index dac953b..6e9ceeb 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -30,6 +30,7 @@
(require 'edebug)
(require 'python) ; python-mode-hook
(require 'company nil t)
+(require 'subr-x)
;;; Helpers
@@ -63,7 +64,7 @@ then restored."
(with-temp-buffer
(insert content)
(write-region nil nil file-or-dir-name nil 'nomessage))
- (list file-or-dir-name))
+ (list (expand-file-name file-or-dir-name)))
(t
(eglot--error "Expected a string or a directory spec")))))
@@ -722,9 +723,7 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
(should (looking-back "\"foo.bar\": \""))
(should (looking-at "fb\"$"))))))
-(ert-deftest eglot-lsp-abiding-column ()
- "Test basic `eglot-lsp-abiding-column' and
`eglot-move-to-lsp-abiding-column'"
- (skip-unless (executable-find "clangd"))
+(defun eglot-tests--lsp-abiding-column-1 ()
(eglot--with-fixture
'(("project" .
(("foo.c" . "const char write_data[] =
u8\"ππππ
πππππππππππππ π‘π€π²\";"))))
@@ -746,6 +745,11 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
(funcall eglot-move-to-column-function 71)
(should (looking-at "p")))))))
+(ert-deftest eglot-lsp-abiding-column ()
+ "Test basic `eglot-lsp-abiding-column' and
`eglot-move-to-lsp-abiding-column'"
+ (skip-unless (executable-find "clangd"))
+ (eglot-tests--lsp-abiding-column-1))
+
(ert-deftest eglot-ensure ()
"Test basic `eglot-ensure' functionality"
(skip-unless (executable-find "pyls"))
@@ -1103,7 +1107,7 @@ will assume it exists."
(ert-deftest eglot--tramp-test ()
"Ensure LSP servers can be used over TRAMP."
- (skip-unless (or (>= emacs-major-version 27) (executable-find "pyls")))
+ (skip-unless (and (>= emacs-major-version 27) (executable-find "pyls")))
;; Set up a loopback TRAMP method thatβs just a shell so the remote
;; host is really just the local host.
(let ((tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-path))
@@ -1118,6 +1122,22 @@ will assume it exists."
;; method, fixtures will be automatically made βremote".
(eglot-tests--auto-detect-running-server-1)))
+(ert-deftest eglot--tramp-test-2 ()
+ "Ensure LSP servers can be used over TRAMP."
+ (skip-unless (or (>= emacs-major-version 27) (executable-find "clangd")))
+ ;; Set up a loopback TRAMP method thatβs just a shell so the remote
+ ;; host is really just the local host.
+ (let ((tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-path))
+ (tramp-methods '(("loopback"
+ (tramp-login-program "/bin/sh")
+ (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell-login ("-l"))
+ (tramp-remote-shell-args ("-c")))))
+ (temporary-file-directory (concat "/loopback::"
+ temporary-file-directory))
+ (eglot-server-programs '((c-mode "clangd"))))
+ (eglot-tests--lsp-abiding-column-1) ))
+
(ert-deftest eglot--path-to-uri-windows ()
(should (string-prefix-p "file:///"
(eglot--path-to-uri "c:/Users/Foo/bar.lisp")))
diff --git a/eglot.el b/eglot.el
index cbde1b7..20f5995 100644
--- a/eglot.el
+++ b/eglot.el
@@ -25,7 +25,7 @@
;;; Commentary:
;; Simply M-x eglot should be enough to get you started, but here's a
-;; little info (see the accompanying README.md or the URL for more).
+ ;; little info (see the accompanying README.md or the URL for more).
;;
;; M-x eglot starts a server via a shell-command guessed from
;; `eglot-server-programs', using the current major-mode (for whatever
@@ -2791,6 +2791,15 @@ If NOERROR, return predicate, else erroring function."
if (file-directory-p f) append (eglot--files-recursively f)
else collect (expand-file-name f))))
+(defun eglot--directories-recursively (&optional dir)
+ "Because `directory-files-recursively' isn't complete in 26.3."
+ (cons (setq dir (expand-file-name (or dir default-directory)))
+ (cl-loop with default-directory = dir
+ with completion-regexp-list = '("^[^.]")
+ for f in (file-name-all-completions "" dir)
+ if (file-directory-p f) append (eglot--files-recursively f)
+ else collect (expand-file-name f))))
+
(defun eglot--directories-matched-by-globs (dir globs)
"Discover subdirectories of DIR with files matched by one of GLOBS.
Each element of GLOBS is either an uncompiled glob-string or a
- [elpa] externals/eglot updated (2fbcab2 -> fc221c8), Stefan Monnier, 2021/04/14
- [elpa] externals/eglot f930a09 1/8: Fix #596: generalize eglot-flymake-backend, Stefan Monnier, 2021/04/14
- [elpa] externals/eglot c65a032 5/8: Close #652: add :company-kind to eglot-completion-at-point, Stefan Monnier, 2021/04/14
- [elpa] externals/eglot c34ec42 2/8: Per #645: Attempt to speed up initial directory/glob correspondence, Stefan Monnier, 2021/04/14
- [elpa] externals/eglot 05fe647 7/8: Per #667: add a passing test demonstrating clangd + TRAMP works,
Stefan Monnier <=
- [elpa] externals/eglot fc221c8 8/8: Overhaul bug reporting template, Stefan Monnier, 2021/04/14
- [elpa] externals/eglot 8a5598d 3/8: Fix #650: Highlight relevant part of xref hits using xref-match face, Stefan Monnier, 2021/04/14
- [elpa] externals/eglot a79bb5f 4/8: Overhaul bug-reporting template, Stefan Monnier, 2021/04/14
- [elpa] externals/eglot dd51bf2 6/8: Merge pull request #656 from mohkale/company-kind, Stefan Monnier, 2021/04/14