Skip to content

Commit 3f79b8e

Browse files
committed
Improving documentation and treemacs/browse classpath
1 parent 42246b5 commit 3f79b8e

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[![MELPA](https://melpa.org/packages/lsp-java-badge.svg)](https://melpa.org/#/lsp-java)
22
[![Build Status](https://travis-ci.com/emacs-lsp/lsp-java.svg?branch=master)](https://travis-ci.com/emacs-lsp/lsp-java)
33
[![Join the chat at https://gitter.im/emacs-lsp/lsp-mode](https://badges.gitter.im/emacs-lsp/lsp-mode.svg)](https://gitter.im/emacs-lsp/lsp-mode?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4+
45
Emacs Java IDE using [Eclipse JDT Language Server](https://projects.eclipse.org/projects/eclipse.jdt.ls).
56
## Features
67
LSP java mode supports the following JDT Features:
@@ -123,10 +124,10 @@ some of them are bound to Emacs commands:
123124
* `lsp-java-extract-method` - Extract method refactoring
124125
* `lsp-java-add-import` - Add missing import
125126
#### Treemacs
126-
[lsp-java](https://github.com/emacs-lsp/lsp-java) provides integration with [treemacs](https://github.com/Alexander-Miller/treemacs) which provides option to navigate through package dependecies, namespaces, classes and resources.
127+
[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.
127128
* `lsp-java-treemacs-register` activates [lsp-java](https://github.com/emacs-lsp/lsp-java)/[treemacs](https://github.com/Alexander-Miller/treemacs) integration.
128129
* `lsp-java-treemacs-unregister` deactivates [lsp-java](https://github.com/emacs-lsp/lsp-java)/[treemacs](https://github.com/Alexander-Miller/treemacs) integration.
129-
* `lsp-java-update-project-uris`
130+
* `lsp-java-update-project-uris` refresh the project URIs.
130131
#### Classpath browsing
131132
[lsp-java](https://github.com/emacs-lsp/lsp-java) the command `lsp-java-browse-classpath` which allows users to browse the structure of current projects classpath. From that view the users could go to the particular item.
132133
![Classpath](images/classpath.png)

images/classpath.png

78.3 KB
Loading

lsp-java-treemacs.el

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,13 @@ ADDED and REMOVED are pointing which are the changed folders."
218218
:position 'project-start
219219
:predicate 'lsp-java-treemacs--is-root)
220220

221+
(require 'treemacs)
222+
(unless (eq 'visible (treemacs-current-visibility))
223+
(treemacs))
221224

222225
(maphash (lambda (root-path workspace)
223-
(unless (or (f-equal? root-path lsp-java-workspace-dir)
224-
(f-equal? root-path lsp-java-workspace-cache-dir))
226+
(unless (or (s-equals? (f-canonical root-path) (f-canonical lsp-java-workspace-dir))
227+
(s-equals? (f-canonical root-path) (f-canonical lsp-java-workspace-cache-dir)))
225228
(treemacs-do-add-project-to-workspace root-path (f-filename root-path))))
226229
lsp--workspaces)
227230
(add-hook 'lsp-workspace-folders-change 'lsp-java-treemacs--folders-change))
@@ -230,8 +233,10 @@ ADDED and REMOVED are pointing which are the changed folders."
230233
"Unregister extension."
231234
(interactive)
232235
(remove-hook 'lsp-workspace-folders-change 'lsp-java-treemacs--folders-change)
233-
(treemacs-remove-extension 'treemacs-EXTERNAL-LIBRARY-extension
234-
'project-start))
236+
(treemacs-remove-project-extension 'treemacs-EXTERNAL-LIBRARY-extension
237+
'project-start)
238+
(treemacs-remove-directory-extension 'treemacs-EXTERNAL-LIBRARY-extension
239+
'directory-start))
235240

236241
(provide 'lsp-java-treemacs )
237242
;;; lsp-java-treemacs.el ends here

lsp-java.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,13 +919,14 @@ PROJECT-URI uri of the item."
919919
"Show currently active sessions."
920920
(interactive)
921921
(let ((uri (lsp--path-to-uri (or buffer-file-name (f-canonical default-directory)))))
922-
(--if-let (lsp-java--find-workspace uri)
922+
(--if-let (or lsp--cur-workspace (lsp-java--find-workspace uri))
923923
(with-lsp-workspace it
924924
(if-let (project-uri (lsp-java--find-project-uri buffer-file-name))
925925
(let ((inhibit-read-only t)
926926
(buf (get-buffer-create "*classpath*")))
927927
(with-current-buffer buf
928928
(erase-buffer)
929+
(lsp-java-classpath-mode)
929930
(setq-local lsp--cur-workspace it)
930931

931932
(when lsp-java-themes-directory
@@ -943,7 +944,6 @@ PROJECT-URI uri of the item."
943944
,@lsp-java-icons-default-root-folder
944945
,@(--map (lsp-java--classpath-render-classpath it project-uri)
945946
(lsp-send-execute-command "che.jdt.ls.extension.classpathTree" project-uri))))
946-
(lsp-java-classpath-mode)
947947
(run-hooks 'lsp-java-classpath-mode-hook))
948948
(funcall lsp-java-pop-buffer-function buf)
949949
(goto-char (point-min)))

0 commit comments

Comments
 (0)