emacs-ccls hierarchy ❤️ lsp-treemacs

很久沒有寫Emacs Lisp,今天發現Daniel Martin給emacs-ccls (ccls C++ language server的lsp-mode client)貢獻了一個PR https://github.com/MaskRay/emacs-ccls/pull/74/ ,把原有的M-x ccls-call-hierarchy M-x ccls-inheritance-hierarchy M-x ccls-member-hierarchy (LSP Extensions · MaskRay/ccls Wiki · GitHub)實現用lsp-treemacs重寫。簡單嘗試了下。打開一個hierarchy後,在新window裏,TAB展開節點,RET visit file:line。

發現了幾處不好用的地方:

  • When I call ccls-call-hierarchy , the *LSP Lookup* window does not get focus. How can I make it get the focus?
  • The old code expands 2 levels of nodes ( :levels 2 ). The lsp-treemacs implementation does not seem to do so.
  • Is there an ivy-call mode? With the old implementation, when I pressed j or k in the tree window, Emacs jumped to the file:line without exiting tree navigation. With the new implementation, am I supposed to press j RET j RET j RET to navigate 3 items?

這些問題能克服嗎?

我用doom-emacs,對個別lsp-mode套件指定:load-path使用本地倉庫:

;; modules/private/my-cc/config.el
(use-package! ccls
  :load-path "~/Dev/Emacs/emacs-ccls"
  :hook ((c-mode-local-vars c++-mode-local-vars objc-mode-local-vars) . +ccls|enable)
  :config
  ...

;; modules/private/my-cc/packages.el
(package! ccls :ignore t)

嘗試這個PR,只要把本地~/Dev/Emacs/emacs-ccls切換到相應danielmartin的branch即可。

以上圖紀念昨天給lld PPC port實現的兩個功能。至此,FreeBSD powerpc64的lib32 buildworld除kernel可全部用lld連接。

4 个赞