From e596822b53d584a282802a24d62bfdfec14988c9 Mon Sep 17 00:00:00 2001 From: Yu-Fu Fu Date: Fri, 4 Oct 2024 17:57:39 -0400 Subject: [PATCH] fix dir-locals-find-file returning directory with trailing / by using directory-file-name --- lsp-bridge.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lsp-bridge.el b/lsp-bridge.el index 77460eb001..ab4646d76f 100644 --- a/lsp-bridge.el +++ b/lsp-bridge.el @@ -981,10 +981,9 @@ So we build this macro to restore postion after code format." ;; Fetch project root path by `lsp-bridge-get-project-path-by-filepath' if it set by user. (funcall lsp-bridge-get-project-path-by-filepath filename) ;; Otherwise try to search up `.dir-locals.el' file - (let ((result (dir-locals-find-file filename))) - (if (consp result) - (car result) - result)))) + (let* ((result (dir-locals-find-file filename)) + (dir (if (consp result) (car result) result))) + (when dir (directory-file-name dir))))) (defun lsp-bridge--get-language-id-func (project-path file-path server-name extension-name) (if lsp-bridge-get-language-id