diff --git a/README.md b/README.md index adb64ec..fc0c3d5 100644 --- a/README.md +++ b/README.md @@ -113,18 +113,9 @@ some of them are bound to Emacs commands: * `lsp-java-create-local` - Create local refactoring * `lsp-java-extract-method` - Extract method refactoring * `lsp-java-add-import` - Add missing import -#### Treemacs -__NOTE__ It works only when using Eclipse Che Language Server. - -[lsp-java](https://github.com/emacs-lsp/lsp-java) provides experimental integration with [treemacs](https://github.com/Alexander-Miller/treemacs) which provides option to navigate through package dependecies, namespaces, classes and resources. -* `lsp-java-treemacs-register` activates [lsp-java](https://github.com/emacs-lsp/lsp-java)/[treemacs](https://github.com/Alexander-Miller/treemacs) integration. -* `lsp-java-treemacs-unregister` deactivates [lsp-java](https://github.com/emacs-lsp/lsp-java)/[treemacs](https://github.com/Alexander-Miller/treemacs) integration. -* `lsp-java-update-project-uris` refresh the project URIs. -#### Classpath browsing -__NOTE__ It works only when using Eclipse Che Language Server. - -[lsp-java](https://github.com/emacs-lsp/lsp-java) the command `lsp-java-classpath-browse` which allows users to browse the structure of current projects classpath. From that view the users could go to the particular item. -![Classpath](images/classpath.png) +#### Dependency viewer +* `lsp-java-dependency-list` - View java dependencies + #### STS4 Integration (experimental) LSP java has integration with [STS4](https://github.com/spring-projects/sts4/) providing the following functionality. diff --git a/icons/vscode/classfile.png b/icons/vscode/classfile.png new file mode 100644 index 0000000..df76efb Binary files /dev/null and b/icons/vscode/classfile.png differ diff --git a/icons/vscode/folder-open.png b/icons/vscode/folder-open.png new file mode 100644 index 0000000..b3a10c2 Binary files /dev/null and b/icons/vscode/folder-open.png differ diff --git a/icons/vscode/folder.png b/icons/vscode/folder.png new file mode 100644 index 0000000..9f9378d Binary files /dev/null and b/icons/vscode/folder.png differ diff --git a/icons/vscode/icon-create.png b/icons/vscode/icon-create.png new file mode 100644 index 0000000..ea2fadb Binary files /dev/null and b/icons/vscode/icon-create.png differ diff --git a/icons/vscode/icon-flat.png b/icons/vscode/icon-flat.png new file mode 100644 index 0000000..f154fdb Binary files /dev/null and b/icons/vscode/icon-flat.png differ diff --git a/icons/vscode/icon-hierarchical.png b/icons/vscode/icon-hierarchical.png new file mode 100644 index 0000000..7bd0356 Binary files /dev/null and b/icons/vscode/icon-hierarchical.png differ diff --git a/icons/vscode/icon-link.png b/icons/vscode/icon-link.png new file mode 100644 index 0000000..6897fc0 Binary files /dev/null and b/icons/vscode/icon-link.png differ diff --git a/icons/vscode/icon-refresh.png b/icons/vscode/icon-refresh.png new file mode 100644 index 0000000..a7a0ff0 Binary files /dev/null and b/icons/vscode/icon-refresh.png differ diff --git a/icons/vscode/icon-unlink.png b/icons/vscode/icon-unlink.png new file mode 100644 index 0000000..4f097ec Binary files /dev/null and b/icons/vscode/icon-unlink.png differ diff --git a/icons/vscode/jar.png b/icons/vscode/jar.png new file mode 100644 index 0000000..34ba22f Binary files /dev/null and b/icons/vscode/jar.png differ diff --git a/icons/vscode/library.png b/icons/vscode/library.png new file mode 100644 index 0000000..bd974b6 Binary files /dev/null and b/icons/vscode/library.png differ diff --git a/icons/vscode/package.png b/icons/vscode/package.png new file mode 100644 index 0000000..7ca88a6 Binary files /dev/null and b/icons/vscode/package.png differ diff --git a/icons/vscode/packagefolder-open.png b/icons/vscode/packagefolder-open.png new file mode 100644 index 0000000..bff40aa Binary files /dev/null and b/icons/vscode/packagefolder-open.png differ diff --git a/icons/vscode/packagefolder.png b/icons/vscode/packagefolder.png new file mode 100644 index 0000000..9c827cc Binary files /dev/null and b/icons/vscode/packagefolder.png differ diff --git a/icons/vscode/project-open.png b/icons/vscode/project-open.png new file mode 100644 index 0000000..72d01e4 Binary files /dev/null and b/icons/vscode/project-open.png differ diff --git a/icons/vscode/project.png b/icons/vscode/project.png new file mode 100644 index 0000000..6cd0635 Binary files /dev/null and b/icons/vscode/project.png differ diff --git a/install/pom.xml b/install/pom.xml index 7670af6..b17812d 100644 --- a/install/pom.xml +++ b/install/pom.xml @@ -43,7 +43,7 @@ process-resources - download-vscode + download-spring-boot wget @@ -53,6 +53,18 @@ ${project.build.directory} + + process-resources + download-java-dependency + + wget + + + https://github.com/emacs-lsp/lsp-java/releases/download/2.2/vscjava.vscode-java-dependency-0.5.1.vsix + java-dependency.zip + ${project.build.directory} + + @@ -67,6 +79,7 @@ + @@ -150,6 +163,24 @@ + + copy-dep-bundles + package + + copy-resources + + + ${jdt.js.server.root}/bundles/ + + + ${project.build.directory}/java-dependency/extension/server/ + + com.microsoft.jdtls.ext.core-0.5.1.jar + + + + + diff --git a/lsp-java-dependency.el b/lsp-java-dependency.el new file mode 100644 index 0000000..a279bfb --- /dev/null +++ b/lsp-java-dependency.el @@ -0,0 +1,181 @@ +;;; lsp-java-dependency.el --- LSP Java treemacs integration -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Ivan Yonchovski + +;; Author: Ivan Yonchovski +;; Keywords: lsp + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Provides integration between `lsp-java' and `treemacs' which aims to provide +;; ide like project explorer. + +;;; Code: + +(with-eval-after-load 'treemacs + (require 'dash) + (require 'lsp-mode) + (require 'lsp-java) + (require 'dash-functional) + + (defun lsp-java-dependency--goto-element (&rest _args) + (if-let ((dep (-some-> (treemacs-node-at-point) + (button-get :dep)))) + (--doto (find-file-noselect (or (-some-> (gethash "uri" dep) + (lsp--uri-to-path)) + (gethash "path" dep))) + + (select-window (get-mru-window nil nil t)) + (switch-to-buffer it)) + (user-error "No element under point."))) + + (treemacs-modify-theme "Default" + :icon-directory (f-join (f-dirname (or load-file-name buffer-file-name)) "icons/vscode") + :config + (progn + (treemacs-create-icon :file "classfile.png" :extensions (classfile) :fallback "-") + (treemacs-create-icon :file "default_folder_opened.png" :extensions (default-folder-opened) :fallback "-") + (treemacs-create-icon :file "default_folder.png" :extensions (default-folder) :fallback "-") + (treemacs-create-icon :file "default_root_folder_opened.png" :extensions (default-root-folder-opened) :fallback "-") + (treemacs-create-icon :file "default_root_folder.png" :extensions (default-root-folder) :fallback "-") + (treemacs-create-icon :file "file_type_class.png" :extensions ("class") :fallback "-") + (treemacs-create-icon :file "file_type_jar.png" :extensions (file-type-jar) :fallback "-") + (treemacs-create-icon :file "folder-open.png" :extensions (folder-open) :fallback "-") + (treemacs-create-icon :file "folder.png" :extensions (folder) :fallback "-") + (treemacs-create-icon :file "folder_type_component_opened.png" :extensions (folder-type-component-opened) :fallback "-") + (treemacs-create-icon :file "folder_type_component.png" :extensions (folder-type-component) :fallback "-") + (treemacs-create-icon :file "folder_type_library_opened.png" :extensions (folder-type-library-opened) :fallback "-") + (treemacs-create-icon :file "folder_type_library.png" :extensions (folder-type-library) :fallback "-") + (treemacs-create-icon :file "folder_type_maven_opened.png" :extensions (folder-type-maven-opened) :fallback "-") + (treemacs-create-icon :file "folder_type_maven.png" :extensions (folder-type-maven) :fallback "-") + (treemacs-create-icon :file "folder_type_package_opened.png" :extensions (folder-type-package-opened) :fallback "-") + (treemacs-create-icon :file "folder_type_package.png" :extensions (folder-type-package) :fallback "-") + (treemacs-create-icon :file "icon-create.png" :extensions (icon-create) :fallback "-") + (treemacs-create-icon :file "icon-flat.png" :extensions (icon-flat) :fallback "-") + (treemacs-create-icon :file "icon-hierarchical.png" :extensions (icon-hierarchical) :fallback "-") + (treemacs-create-icon :file "icon-link.png" :extensions (icon-link) :fallback "-") + (treemacs-create-icon :file "icon-refresh.png" :extensions (icon-refresh) :fallback "-") + (treemacs-create-icon :file "icon-unlink.png" :extensions (icon-unlink) :fallback "-") + (treemacs-create-icon :file "jar.png" :extensions (jar) :fallback "-") + (treemacs-create-icon :file "library.png" :extensions (library) :fallback "-") + (treemacs-create-icon :file "packagefolder-open.png" :extensions (packagefolder-open) :fallback "-") + (treemacs-create-icon :file "packagefolder.png" :extensions (packagefolder) :fallback "-") + (treemacs-create-icon :file "package.png" :extensions (package) :fallback "-") + (treemacs-create-icon :file "project.png" :extensions (java-project) :fallback "-"))) + + (defun lsp-java-dependency--icon (dep expanded) + "Get the symbol for the the kind." + (-let (((&hash "uri" "name" "kind" "entryKind" entry-kind) dep)) + (concat + (if (or (= kind 6) + (= kind 8)) + " " + (treemacs-get-icon-value + (if expanded 'expanded 'collapsed) + nil + lsp-treemacs-theme)) + (if (or (= kind 8) + (= kind 6)) + (treemacs-icon-for-file uri) + (treemacs-get-icon-value + (cond + ((eq kind 5) 'namespace) + ((eq kind 4) 'jar) + ((eq kind 2) 'java-project) + ((eq entry-kind 1) 'package) + ((eq entry-kind 3) 'packagefolder) + ((eq entry-kind 5) 'library)) + nil + lsp-treemacs-theme))))) + + (defun lsp-java-dependency--get-children (dep) + (lsp-java-with-jdtls + (-let (((&hash "projectUri" project-uri "rootPath" root-path "path" "kind" "name") dep)) + (unless (or (= kind 6) + (= kind 8)) + (--map (--doto it + (puthash "projectUri" project-uri it) + (when (= kind 4) + (puthash "rootPath" path it))) + (lsp-send-execute-command "java.getPackageData" + (vector (ht ("kind" kind) + ("path" (unless (eq kind 2) + (if (= 5 kind) + name + path))) + ("rootPath" (unless (eq kind 2) + (or root-path path))) + ("projectUri" project-uri))))))))) + + (treemacs-define-expandable-node lsp-java-dependency + :icon-open-form (lsp-java-dependency--icon (treemacs-button-get node :dep) t) + :icon-closed-form (lsp-java-dependency--icon (treemacs-button-get node :dep) nil) + :query-function (lsp-java-dependency--get-children (treemacs-button-get node :dep)) + :ret-action 'lsp-java-dependency--goto-element + :render-action + (treemacs-render-node + :icon (lsp-java-dependency--icon item nil) + :label-form (propertize (gethash "name" item) 'face 'default) + :state treemacs-lsp-java-dependency-closed-state + :key-form (gethash "name" item) + :more-properties (:dep item))) + + (defun lsp-java-dependency--root-folders () + (lsp-java-with-jdtls + (-mapcat (lambda (root-path) + (let ((project-uri (lsp--path-to-uri root-path))) + (->> project-uri + (lsp-send-execute-command "java.project.list") + (--map (--doto it (puthash "projectUri" project-uri it)))))) + (lsp-session-folders (lsp-session))))) + + (treemacs-define-variadic-node lsp-java-dependency-list + :query-function (lsp-java-dependency--root-folders) + :render-action + (treemacs-render-node + :icon (lsp-java-dependency--icon item nil) + :label-form (propertize (gethash "name" item) 'face 'default) + :state treemacs-lsp-java-dependency-closed-state + :key-form item + :more-properties (:dep item)) + :root-key-form 'LSP-Java-Dependency) + + (defun lsp-java-dependency-refresh () + "Refresh dependecy list." + (interactive) + (condition-case _err + (let ((inhibit-read-only t)) + (with-current-buffer "*LSP Dependency List*" + (treemacs-update-node '(:custom LSP-Symbols) t))) + (error))) + + (defun lsp-java-dependency-list () + "Display error list." + (interactive) + (lsp-java-with-jdtls + (let* ((buffer (get-buffer-create "*LSP Dependency List*")) + (window (display-buffer-in-side-window buffer '((side . right))))) + (select-window window) + (set-window-dedicated-p window t) + (treemacs-initialize) + (setq-local treemacs-default-visit-action 'treemacs-RET-action) + (treemacs-LSP-JAVA-DEPENDENCY-LIST-extension))))) + +(provide 'lsp-java-dependency) + +;; Local Variables: +;; flycheck-disabled-checkers: (emacs-lisp-checkdoc) +;; End: diff --git a/lsp-java-treemacs.el b/lsp-java-treemacs.el deleted file mode 100644 index 5162980..0000000 --- a/lsp-java-treemacs.el +++ /dev/null @@ -1,268 +0,0 @@ -;;; lsp-java-treemacs.el --- LSP Java treemacs integration -*- lexical-binding: t; -*- - -;; Copyright (C) 2018 Ivan Yonchovski - -;; Author: Ivan Yonchovski -;; Keywords: lsp - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Provides integration between `lsp-java' and `treemacs' which aims to provide -;; ide like project explorer. - -;;; Code: - -(require 'dash) -(require 'lsp-mode) -(require 'lsp-java) -(require 'dash-functional) -(require 'treemacs) -(require 'treemacs-extensions) -(require 'treemacs-icons) - -(defface lsp-java-treemacs-directory-face - '((t :inherit treemacs-directory-face)) - "Face used by treemacs for lsp-java directories and packages." - :group 'lsp-java-treemacs) - -(defface lsp-java-treemacs-extension-root-face - '((t :inherit treemacs-directory-face )) - "Face used for the extension root." - :group 'lsp-java-treemacs) - -(defface lsp-java-treemacs-file-face - '((t :inherit treemacs-file-face)) - "Face used by treemacs for files." - :group 'lsp-java-treemacs) - -(defun lsp-java-treemacs--is-root (dir-or-project) - "Return whether DIR-OR-PROJECT is root of a project." - (let ((dir (if (stringp dir-or-project) - dir-or-project - (treemacs-project->path dir-or-project)))) - - (when-lsp-workspace (lsp-java--find-workspace dir) - (-contains? (lsp-java--get-project-uris lsp--cur-workspace) - (lsp--path-to-uri dir))))) - -(defun lsp-java-treemacs--get-libraries (project-uri) - "Get the list of buffers, grouped by their major mode. -PROJECT-URI is the project id of the active project." - (when-lsp-workspace (lsp-java--find-workspace project-uri) - (lsp-send-execute-command "che.jdt.ls.extension.externalLibraries" - (list :projectUri project-uri)))) - -(defun lsp-java-treemacs--library-children (project-uri node-id) - "Get the list of library children. -PROJECT-URI and NODE-ID are the details for the current node." - (when-lsp-workspace (lsp-java--find-workspace project-uri) - (lsp-send-execute-command "che.jdt.ls.extension.libraryChildren" - (list :projectUri project-uri - :nodeId node-id)))) - -(defun lsp-java-treemacs--external-library-children (project-uri node-id path) - "Get the list of external library children. -PROJECT-URI, NODE-ID and PATH are the details for the current node." - (when-lsp-workspace (lsp-java--find-workspace project-uri) - (lsp-send-execute-command "che.jdt.ls.extension.externalLibrariesChildren" - (list :projectUri project-uri - :nodeId node-id - :nodePath path)))) - -(defun lsp-java-treemacs--open-file (_arg) - "Open resource file." - (when-lsp-workspace (lsp-java--find-workspace (treemacs--prop-at-point :project-uri)) - (->> (treemacs--prop-at-point :uri) - lsp--uri-to-path - find-file))) - -(treemacs-define-leaf-node lsp-file treemacs-icon-java - :ret-action 'lsp-java-treemacs--open-file) - -(defmacro lsp-java-treemacs--setup-icon (var file-name &rest extensions) - "Define VAR with its display property being the image created from FILE-NAME. -Insert VAR into `treemacs-icon-hash' for each of the given file EXTENSIONS." - (unless (treemacs--is-image-creation-impossible?) - `(progn - (defvar ,var - (let* ((image-unselected (treemacs--create-image (f-join (f-dirname (or load-file-name buffer-file-name)) ,file-name))) - (image-selected (treemacs--create-image (f-join (f-dirname (or load-file-name buffer-file-name)) ,file-name)))) - (treemacs--set-img-property image-selected :background treemacs--selected-icon-background) - (treemacs--set-img-property image-unselected :background treemacs--not-selected-icon-background) - (concat (propertize " " - 'display image-unselected - 'img-selected image-selected - 'img-unselected image-unselected) - " "))) - (push ,var treemacs--created-icons) - (--each (quote ,extensions) (ht-set! treemacs-icons-hash it ,var)) - ,var))) - -(if (treemacs--is-image-creation-impossible?) - (treemacs--set-icon-save-default - lsp-java-treemacs-jar treemacs-icon-closed-text - lsp-java-treemacs-jar-opened treemacs-icon-open-text - lsp-java-treemacs-package treemacs-icon-closed-text - lsp-java-treemacs-package-opened treemacs-icon-open-text - lsp-java-treemacs-jar-folder treemacs-icon-closed-text - lsp-java-treemacs-jar-folder-opened treemacs-icon-open-text - lsp-java-treemacs-library-folder treemacs-icon-closed-text - lsp-java-treemacs-library-folder-opened treemacs-icon-open-text - lsp-java-treemacs-class treemacs-icon-tag-leaf-text) - (progn - (lsp-java-treemacs--setup-icon lsp-java-treemacs-jar "icons/vscode/file_type_jar.png") - (lsp-java-treemacs--setup-icon lsp-java-treemacs-jar-opened "icons/vscode/file_type_jar.png") - (lsp-java-treemacs--setup-icon lsp-java-treemacs-package "icons/vscode/folder_type_package.png") - (lsp-java-treemacs--setup-icon lsp-java-treemacs-package-opened "icons/vscode/folder_type_package_opened.png") - (lsp-java-treemacs--setup-icon lsp-java-treemacs-jar-folder "icons/vscode/folder_type_component.png") - (lsp-java-treemacs--setup-icon lsp-java-treemacs-jar-folder-opened "icons/vscode/folder_type_component_opened.png") - (lsp-java-treemacs--setup-icon lsp-java-treemacs-library-folder "icons/vscode/folder_type_library.png") - (lsp-java-treemacs--setup-icon lsp-java-treemacs-library-folder-opened "icons/vscode/folder_type_library_opened.png") - (lsp-java-treemacs--setup-icon lsp-java-treemacs-class "icons/vscode/file_type_class.png" "class"))) - -(defmacro treemacs--lsp-node-or-folder () - "Extract common code from nodes." - (let ((more-properties '(:project-uri (button-get btn :project-uri) - :node-path node-path - :node-id (button-get btn :node-id) - :uri uri))) - `(-let (((&hash "name" "entryType" "uri" "path" node-path) item)) - (pcase entryType - ("PACKAGE" - (treemacs-render-node :icon treemacs-icon-package-closed - :label-form name - :state treemacs-package-closed-state - :key-form node-path - :face 'lsp-java-treemacs-directory-face - :more-properties ,more-properties)) - ("FOLDER" - (treemacs-render-node :icon treemacs-icon-folder-closed - :label-form name - :state treemacs-folder-closed-state - :key-form node-path - :face 'lsp-java-treemacs-directory-face - :more-properties ,more-properties)) - ((or "CLASS_FILE" "FILE") - (treemacs-render-node :icon (treemacs-icon-for-file name) - :label-form name - :state treemacs-lsp-file-state - :key-form uri - :face 'lsp-java-treemacs-file-face - :more-properties ,more-properties)))))) - -(treemacs-define-expandable-node package - :icon-open lsp-java-treemacs-package-opened - :icon-closed lsp-java-treemacs-package - :query-function (lsp-java-treemacs--external-library-children - (button-get btn :project-uri) - (button-get btn :node-id) - (button-get btn :node-path)) - :render-action (treemacs--lsp-node-or-folder)) - -(treemacs-define-expandable-node folder - :icon-open lsp-java-treemacs-jar-folder-opened - :icon-closed lsp-java-treemacs-jar-folder - :query-function (lsp-java-treemacs--external-library-children - (button-get btn :project-uri) - (button-get btn :node-id) - (button-get btn :node-path)) - :render-action (treemacs--lsp-node-or-folder)) - -(treemacs-define-expandable-node jar-file - :icon-open lsp-java-treemacs-jar-opened - :icon-closed lsp-java-treemacs-jar - :query-function (lsp-java-treemacs--library-children (button-get btn :project-uri) - (button-get btn :key)) - :render-action (treemacs--lsp-node-or-folder)) - -(treemacs-define-expandable-node external-library - :icon-open lsp-java-treemacs-library-folder-opened - :icon-closed lsp-java-treemacs-library-folder - :query-function (-> btn - (button-get :parent) - (button-get :path) - file-name-as-directory - lsp--path-to-uri - lsp-java-treemacs--get-libraries) - :root-label "External Libraries" - :root-marker t - :root-face 'lsp-java-treemacs-extension-root-face - :root-key-form (lsp--path-to-uri (button-get parent :path)) - :render-action (-let ((project-uri (-> btn - (button-get :parent) - (button-get :path) - lsp--path-to-uri)) - ((&hash "name" "id") item)) - (treemacs-render-node - :icon treemacs-icon-jar-file-closed - :label-form name - :state treemacs-jar-file-closed-state - :face 'lsp-java-treemacs-directory-face - :key-form id - :more-properties (:node-id id :project-uri project-uri - :workspace (lsp-java--find-workspace project-uri))))) - -(defun lsp-java-treemacs--folders-change (added removed) - "Handler for `lsp-workspace-folders-change' hook. -ADDED and REMOVED are pointing which are the changed folders." - (--each added - (treemacs-do-add-project-to-workspace it (f-filename it))) - (--each removed - (-some->> (treemacs-current-workspace) - treemacs-workspace->projects - (-first (lambda (project) (f-equal? it (treemacs-project->path project)))) - treemacs-do-remove-project-from-workspace))) - -(defun lsp-java-treemacs--get-projects () - "Get projects." - (or (when (functionp 'lsp-session) - (lsp-session-folders (lsp-session))) - (hash-table-keys lsp--workspaces))) - -(defun lsp-java-treemacs-register () - "Register `lsp-java' extension." - (interactive) - (treemacs-define-directory-extension - :extension 'treemacs-EXTERNAL-LIBRARY-extension - :position 'top - :predicate 'lsp-java-treemacs--is-root) - (treemacs-define-project-extension - :extension 'treemacs-EXTERNAL-LIBRARY-extension - :position 'top - :predicate 'lsp-java-treemacs--is-root) - - (require 'treemacs) - (unless (eq 'visible (treemacs-current-visibility)) - (treemacs)) - - (mapc (lambda (root-path) - (unless (or (s-equals? (f-canonical root-path) (f-canonical lsp-java-workspace-dir)) - (s-equals? (f-canonical root-path) (f-canonical lsp-java-workspace-cache-dir))) - (treemacs-do-add-project-to-workspace root-path (f-filename root-path)))) - (lsp-java-treemacs--get-projects)) - (add-hook 'lsp-workspace-folders-change 'lsp-java-treemacs--folders-change)) - -(defun lsp-java-treemacs-unregister () - "Unregister extension." - (interactive) - (remove-hook 'lsp-workspace-folders-change 'lsp-java-treemacs--folders-change) - (treemacs-remove-project-extension 'treemacs-EXTERNAL-LIBRARY-extension - 'project-start) - (treemacs-remove-directory-extension 'treemacs-EXTERNAL-LIBRARY-extension - 'directory-start)) - -(provide 'lsp-java-treemacs ) -;;; lsp-java-treemacs.el ends here diff --git a/lsp-java.el b/lsp-java.el index be3b0df..95fcdb7 100644 --- a/lsp-java.el +++ b/lsp-java.el @@ -179,6 +179,10 @@ usually)" "Enable/disable the 'auto build'" :type 'boolean) +(defcustom lsp-java-selection-enabled t + "Enable/disable the 'auto build'" + :type 'boolean) + (defcustom lsp-java-max-concurrent-builds 1 "Max simultaneous project builds" :type 'number) @@ -308,6 +312,7 @@ then list all." ("java.completion.enabled" lsp-java-completion-enabled t) ("java.maxConcurrentBuilds" lsp-java-max-concurrent-builds) ("java.autobuild.enabled" lsp-java-autobuild-enabled t) + ("java.selection.enabled" lsp-java-autobuild-enabled t) ("java.contentProvider.preferred" lsp-java-content-provider-preferred) ("java.import.exclusions" lsp-java-import-exclusions) ("java.saveActions.organizeImports" lsp-java-save-actions-organize-imports t)