From 53bd779cc996bfafa6477fccb8c7eb29efa85e6a Mon Sep 17 00:00:00 2001 From: Eric Dallo Date: Sun, 4 Apr 2021 23:16:37 -0300 Subject: [PATCH] ui/treemacs: add +lsp flag --- docs/modules.org | 2 +- modules/config/default/+emacs-bindings.el | 9 ++++- modules/config/default/+evil-bindings.el | 6 ++++ modules/ui/treemacs/README.org | 43 +++++++++++++++++++++++ modules/ui/treemacs/config.el | 4 +++ modules/ui/treemacs/doctor.el | 5 +++ modules/ui/treemacs/packages.el | 2 ++ 7 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 modules/ui/treemacs/README.org create mode 100644 modules/ui/treemacs/doctor.el diff --git a/docs/modules.org b/docs/modules.org index 5b0834ca9..4fffdbaae 100644 --- a/docs/modules.org +++ b/docs/modules.org @@ -212,7 +212,7 @@ Aesthetic modules that affect the Emacs interface or user experience. + [[file:../modules/ui/ophints/README.org][ophints]] - TODO + [[file:../modules/ui/popup/README.org][popup]] =+all +defaults= - Makes temporary/disposable windows less intrusive + [[file:../modules/ui/tabs/README.org][tabs]] - TODO -+ treemacs - TODO ++ [[file:../modules/ui/treemacs/README.org][treemacs]] - =+lsp= - A tree layout file explorer for Emacs + [[file:../modules/ui/unicode/README.org][unicode]] - TODO + vc-gutter - TODO + vi-tilde-fringe - TODO diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index 242ad067e..bca689bf5 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -53,7 +53,14 @@ :desc "Jump to symbol in any workspace" "J" #'lsp-ivy-global-workspace-symbol) (:when (featurep! :completion helm) :desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol - :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol)) + :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol) + (:when (featurep! :ui treemacs +lsp) + :desc "Errors list" "X" #'lsp-treemacs-errors-list + :desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy + :desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t) + :desc "References tree" "R" (cmd!! #'lsp-treemacs-references t) + :desc "Symbols" "S" #'lsp-treemacs-symbols)) + (:when (featurep! :tools lsp +eglot) :desc "LSP Execute code action" "a" #'eglot-code-actions :desc "LSP Rename" "r" #'eglot-rename diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index cdb0d0e81..34c74b383 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -368,6 +368,12 @@ (:when (featurep! :completion helm) :desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol) + (:when (featurep! :ui treemacs +lsp) + :desc "Errors list" "X" #'lsp-treemacs-errors-list + :desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy + :desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t) + :desc "References tree" "R" (cmd!! #'lsp-treemacs-references t) + :desc "Symbols" "S" #'lsp-treemacs-symbols) :desc "LSP" "l" #'+default/lsp-command-map :desc "LSP Rename" "r" #'lsp-rename) (:when (featurep! :tools lsp +eglot) diff --git a/modules/ui/treemacs/README.org b/modules/ui/treemacs/README.org new file mode 100644 index 000000000..26ab5c291 --- /dev/null +++ b/modules/ui/treemacs/README.org @@ -0,0 +1,43 @@ +#+TITLE: ui/treemacs +#+DATE: April 5, 2021 +#+SINCE: v2.0.4 +#+STARTUP: inlineimages nofold + +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#maintainers][Maintainers]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] +- [[#prerequisites][Prerequisites]] +- [[#features][Features]] +- [[#configuration][Configuration]] +- [[#troubleshooting][Troubleshooting]] + +* Description +[[https://github.com/Alexander-Miller/treemacs][Treemacs]] is a file and project explorer similar to NeoTree or vim’s NerdTree, but largely inspired by the Project Explorer in Eclipse. It shows the file system outlines of your projects in a simple tree layout allowing quick navigation and exploration, while also possessing basic file management utilities. + +** Maintainers ++ This module has no dedicated maintainers. + +** Module Flags ++ =+lsp= Enable ~lsp-treemacs~ integration and add shortcuts for common commands. + +** Plugins ++ [[https://github.com/Alexander-Miller/treemacs][treemacs]] ++ [[https://github.com/Alexander-Miller/treemacs/blob/master/src/extra/treemacs-evil.el][treemacs-evil]] ++ [[https://github.com/Alexander-Miller/treemacs/blob/master/src/extra/treemacs-projectile.el][treemacs-projectile]] ++ [[https://github.com/Alexander-Miller/treemacs/blob/master/src/extra/treemacs-magit.el][treemacs-magit]] ++ [[https://github.com/Alexander-Miller/treemacs/blob/master/src/extra/treemacs-persp.el][treemacs-persp]] ++ [[https://github.com/emacs-lsp/lsp-treemacs][lsp-treemacs]] + +* Prerequisites +This module has no prerequisites. + +* Features +# TODO + +* Configuration +# TODO + +* Troubleshooting +# TODO diff --git a/modules/ui/treemacs/config.el b/modules/ui/treemacs/config.el index d92ee0da4..9508f3bbc 100644 --- a/modules/ui/treemacs/config.el +++ b/modules/ui/treemacs/config.el @@ -76,3 +76,7 @@ This must be set before `treemacs' has loaded.") :when (featurep! :ui workspaces) :after treemacs :config (treemacs-set-scope-type 'Perspectives)) + +(use-package! lsp-treemacs + :when (featurep! +lsp) + :after (treemacs lsp)) diff --git a/modules/ui/treemacs/doctor.el b/modules/ui/treemacs/doctor.el new file mode 100644 index 000000000..d01192e25 --- /dev/null +++ b/modules/ui/treemacs/doctor.el @@ -0,0 +1,5 @@ +;;; ui/treemacs/doctor.el -*- lexical-binding: t; -*- + +(assert! (and (not (featurep! :tools lsp +eglot)) + (featurep! +lsp)) + "+lsp flag is not supported with eglot, only with lsp-mode.") diff --git a/modules/ui/treemacs/packages.el b/modules/ui/treemacs/packages.el index 87a28b06a..ecbc23a4d 100644 --- a/modules/ui/treemacs/packages.el +++ b/modules/ui/treemacs/packages.el @@ -10,3 +10,5 @@ (package! treemacs-magit)) (when (featurep! :ui workspaces) (package! treemacs-persp)) +(when (featurep! +lsp) + (package! lsp-treemacs :pin "4cfb46d7fe69cc537a8a86389c5d8d9fd3fbfabe"))