Open sata opened 3 years ago
(defun lsp--all-watchable-directories (dir ignored-directories visited)
"Traverse DIR recursively and return a list of paths that should have watchers set on them.
IGNORED-DIRECTORIES will be used for exclusions. Visited keeps
track of visited paths to avoid infinite recursion when encountering symlink loops"
(let* ((dir (if (f-symlink? dir)
(file-truename dir)
dir)))
(puthash dir t visited)
(apply #'nconc
;; the directory itself is assumed to be part of the set
(list dir)
;; collect all subdirectories that are watchable
(-map
(lambda (path)
(let ((subpath (f-join dir path)))
(if (not (gethash subpath visited nil))
(lsp--all-watchable-directories subpath ignored-directories visited))))
;; but only look at subdirectories that are watchable
(-filter (lambda (path) (lsp--path-is-watchable-directory path dir ignored-directories))
(directory-files dir))))))
This patch seems to make it work. Basically tracking if one has visited the path or not when recursing down into sub directories.
I can make a PR if it makes sense to you as well?
Also have to update the invocation in lsp-watch-root-folder
with additional argument (make-hash-table)
Hmm, having same issue. Hope this PR will be merged soon
Thank you for the bug report
lsp-mode
related packages.where
lsp-start-plain.el
can be downloaded here.Bug description
Given a directory structure of:
lsp--all-watchable-directories
will fail withrecursive (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
as the function recursively will chase thedir-symlink
without checking depth or if it's a cyclic symlink.Backtrace:
Steps to reproduce
lsp-start-plan.el
go-mode
to the list of modescontrollers/bucket_controllers.go
Expected behavior
Expect symloops to be detected and ignored and be able to interact with
gopls
.Which Language Server did you use?
gopls
OS
Linux
Error callstack