Skip to content

Commit 38de345

Browse files
committed
Migrate to from che-jdt-ls to jdt-ls
- exposed a lot of configuration settings - added lsp-java-generate-to-string - added lsp-java-generate-equals-and-hash-code - added lsp-java-generate-overrides - changed lsp-java-organize-imports to work interactivelly - added lsp-java-add-throws
1 parent e9b9030 commit 38de345

File tree

4 files changed

+424
-182
lines changed

4 files changed

+424
-182
lines changed

README.md

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
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)
44

55
Emacs Java IDE using [Eclipse JDT Language Server](https://projects.eclipse.org/projects/eclipse.jdt.ls).
6+
7+
__ANNOUNCEMENT__ `lsp-java` switching from Eclipse [eclipse.che.jdt](https://github.com/eclipse/che-ls-jdt) to directly using [Eclipse JDT Language Server](https://projects.eclipse.org/projects/eclipse.jdt.ls) due to the fact that [che-ls-jdt](https://github.com/eclipse/che-ls-jdt) does not bump upstream components often enough. As a result all Che dependent methods(Treemacs integation and browse classpath) won't work. If you still want to use [eclipse.che.jdt](https://github.com/eclipse/che-ls-jdt) functionality you may set `lsp-java-jdt-download-url` to `http://download.eclipse.org/che/che-ls-jdt/snapshots/che-jdt-language-server-latest.tar.gz` and call `lsp-java-update-server`.
8+
69
## Features
710
LSP java mode supports the following JDT Features:
811
* As you type reporting of parsing and compilation errors (via [flycheck](https://github.com/flycheck/flycheck)/[lsp-ui](https://github.com/emacs-lsp/lsp-ui))
@@ -98,6 +101,9 @@ Minimal configuration with [company-lsp](https://github.com/tigersoldier/company
98101
* `lsp-java-actionable-notifications` - Resolve actionable notifications
99102
* `lsp-java-update-user-settings` - Update user settings (Check the options in the table bellow.)
100103
* `lsp-java-update-server` - Update server instalation.
104+
* `lsp-java-generate-to-string` - Generate `toString` method.
105+
* `lsp-java-generate-equals-and-hash-code` - Generate `equals` and `hashCode` methods.
106+
* `lsp-java-generate-overrides` - Generate method `overrides`
101107
#### Refactoring
102108
LSP Java provides rich set of refactorings via [Eclipse JDT Language Server](https://projects.eclipse.org/projects/eclipse.jdt.ls) code actions and
103109
some of them are bound to Emacs commands:
@@ -109,11 +115,15 @@ some of them are bound to Emacs commands:
109115
* `lsp-java-extract-method` - Extract method refactoring
110116
* `lsp-java-add-import` - Add missing import
111117
#### Treemacs
118+
__NOTE__ It works only when using Eclipse Che Language Server.
119+
112120
[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.
113121
* `lsp-java-treemacs-register` activates [lsp-java](https://github.com/emacs-lsp/lsp-java)/[treemacs](https://github.com/Alexander-Miller/treemacs) integration.
114122
* `lsp-java-treemacs-unregister` deactivates [lsp-java](https://github.com/emacs-lsp/lsp-java)/[treemacs](https://github.com/Alexander-Miller/treemacs) integration.
115123
* `lsp-java-update-project-uris` refresh the project URIs.
116124
#### Classpath browsing
125+
__NOTE__ It works only when using Eclipse Che Language Server.
126+
117127
[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.
118128
![Classpath](images/classpath.png)
119129
#### STS4 Integration (experimental)
@@ -210,29 +220,61 @@ hovers while editing Spring Boot Properties in either `.properties` or `.yml` fo
210220
`lsp-java` provides a frontend for [Spring Initializr](https://start.spring.io/) which simplifies the creation of Spring Boot projects directly from Emacs via `lsp-java-spring-initializr`.
211221
![Create Spring boot project](images/boot.png)
212222
## Supported settings
213-
* `lsp-java-server-install-dir` - Install directory for eclipsejdtls-server
214-
* `lsp-java-java-path` - Path of the java executable
215-
* `lsp-java-workspace-dir` - LSP java workspace directory
216-
* `lsp-java-workspace-cache-dir` - LSP java workspace cache directory
217-
* `lsp-java-vmargs` - Specifies extra VM arguments used to launch the Java Language Server
218-
* `lsp-java-incomplete-classpath` - Specifies the severity of the message when the classpath is incomplete for a Java file
219-
* `lsp-java-update-build-configuration` - Specifies how modifications on build files update the Java classpath/configuration
223+
* `lsp-java-server-install-dir` -
224+
"Install directory for eclipse.jdt.ls-server.
225+
The slash is expected at the end."
226+
* `lsp-java-jdt-download-url` - JDT JS download url.
227+
Use http://download.eclipse.org/che/che-ls-jdt/snapshots/che-jdt-language-server-latest.tar.gz if you want to use Eclipse Che JDT LS.
228+
* `lsp-java-java-path` - Path of the java executable.
229+
* `lsp-java-progress-string` - Java progress status as reported by the language server.
230+
* `lsp-java-workspace-dir` - LSP java workspace directory.
231+
* `lsp-java-workspace-cache-dir` - LSP java workspace cache directory.
232+
* `lsp-java-themes-directory` - Directory containing themes.
233+
* `lsp-java-theme` - Theme to use.
234+
* `lsp-java-pop-buffer-function` - The function which will be used for showing the helper windows.
235+
* `lsp-java-vmargs` - Specifies extra VM arguments used to launch the Java Language Server. Eg. use `-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication` to bypass class verification,increase the heap size to 1GB and enable String deduplication with the G1 Garbage collector
236+
* `lsp-java-9-args` - Specifies arguments specific to java 9 and later.
237+
* `lsp-java-errors-incomplete-classpath-severity` - Specifies the severity of the message when the classpath is incomplete for a Java file
238+
* `lsp-java-configuration-check-project-settings-exclusions` - Checks if the extension-generated project settings files (.project, .classpath, .factorypath, .settings/) should be excluded from the file explorer.
239+
* `lsp-java-configuration-update-build-configuration` - Specifies how modifications on build files update the Java classpath/configuration
240+
* `lsp-java-trace-server` - Traces the communication between VS Code and the Java language server.
241+
* `lsp-java-import-gradle-enabled` - Enable/disable the Gradle importer.
242+
* `lsp-java-import-maven-enabled` - Enable/disable the Maven importer.
243+
* `lsp-java-maven-download-sources` - Enable/disable eager download of Maven source artifacts.
244+
* `lsp-java-references-code-lens-enabled` - Enable/disable the references code lens.
245+
* `lsp-java-signature-help-enabled` - Enable/disable the signature help.
246+
* `lsp-java-implementations-code-lens-enabled` - Enable/disable the implementations code lens.
247+
* `lsp-java-configuration-maven-user-settings` - Path to Maven's settings.xml
248+
* `lsp-java-format-enabled` - Enable/disable default Java formatter
249+
* `lsp-java-save-actions-organize-imports ` - Enable/disable auto organize imports on save action
220250
* `lsp-java-import-exclusions` - Configure glob patterns for excluding folders
221-
* `lsp-java-favorite-static-members` - Defines a list of static members or types with static members
222-
* `lsp-java-import-order` - Defines the sorting order of import statements
223-
* `lsp-java-trace-server` - Traces the communication between Emacs and the Java language server
224-
* `lsp-java-enable-file-watch` - Defines whether the client will monitor the files for changes
225-
* `lsp-java-format-enabled` - Specifies whether or not formatting is enabled on the language server
226-
* `lsp-java-format-settings-url` - Specifies the file path to the formatter xml url
227-
* `lsp-java-format-settings-profile` - Specifies the formatter profile name
228-
* `lsp-java-format-comments-enabled` - Preference key used to include the comments during the formatting
229-
* `lsp-java-save-action-organize-imports` - Organize imports on save
230-
* `lsp-java-bundles` - List of bundles that will be loaded in the JDT server
231-
* `lsp-java-import-gradle-enabled` - Enable/disable the Gradle importer
232-
* `lsp-java-import-maven-enabled` - Enable/disable the Maven importer
233-
* `lsp-java-auto-build` - Enable/disable the 'auto build'
234-
* `lsp-java-progress-report` - [Experimental] Enable/disable progress reports from background processes on the server
235-
* `lsp-java-completion-guess-arguments` - When set to true, method arguments are guessed when a method is selected from as list of code assist proposals.
251+
* `lsp-java-content-provider-preferred` - Preferred content provider (a 3rd party decompiler id, usually)
252+
* `lsp-java-autobuild-enabled` - Enable/disable the 'auto build'
253+
* `lsp-java-max-concurrent-builds` - Max simultaneous project builds
254+
* `lsp-java-completion-enabled` - Enable/disable code completion support
255+
* `lsp-java-completion-overwrite` - When set to true, code completion overwrites the current text. When set to false, code is simply added instead.
256+
* `lsp-java-completion-guess-method-arguments` - When set to true, method arguments are guessed when a method is selected from as list of code assist proposals.
257+
* `lsp-java-completion-favorite-static-members` - Defines a list of static members or types with static members. Content assist will propose those static members even if the import is missing.
258+
* `lsp-java-completion-import-order` - Defines the sorting order of import statements. A package or type name prefix (e.g. 'org.eclipse') is a valid entry. An import is always added to the most specific group.
259+
* `lsp-java-folding-range-enabled` - Enable/disable smart folding range support. If disabled, it will use the default indentation-based folding range provided by VS Code.
260+
* `indentation-based` - [Experimental] Enable/disable progress reports from background processes on the server.
261+
* `lsp-java-progress-reports-enabled` - [Experimental] Enable/disable progress reports from background processes on the server.
262+
* `lsp-java-format-settings-url` - Specifies the url or file path to the [Eclipse formatter xml settings](https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings).
263+
* `lsp-java-format-settings-profile` - Optional formatter profile name from the Eclipse formatter settings.
264+
* `lsp-java-format-comments-enabled` - Includes the comments during code formatting.
265+
* `lsp-java-format-on-type-enabled` - Enable/disable automatic block formatting when typing `;`, `<enter>` or `}`
266+
* `lsp-java-bundles` - List of bundles that will be loaded in the JDT server.
267+
* `lsp-java-code-generation-hash-code-equals-use-java7objects` - Use Objects.hash and Objects.equals when generating the hashCode and equals methods. This setting only applies to Java 7 and higher.
268+
* `lsp-java-code-generation-hash-code-equals-use-instanceof` - Use 'instanceof' to compare types when generating the hashCode and equals methods.
269+
* `lsp-java-code-generation-use-blocks` - Use blocks in 'if' statements when generating the methods.
270+
* `lsp-java-code-generation-generate-comments` - Generate method comments when generating the methods.
271+
* `lsp-java-code-generation-to-string-template` - The template for generating the toString method.
272+
* `lsp-java-code-generation-to-string-code-style` - The code style for generating the toString method.
273+
* `lsp-java-code-generation-to-string-skip-null-values` - Skip null values when generating the toString method.
274+
* `lsp-java-code-generation-to-string-list-array-contents` - List contents of arrays instead of using native toString().
275+
* `lsp-java-code-generation-to-string-limit-elements` - Limit number of items in arrays/collections/maps to list, if 0 then list all.
276+
* `lsp-java-inhibit-message` - If non-nil, inhibit java messages echo via `inhibit-message'.
277+
236278
## Additional packages
237279
* [lsp-ui](https://github.com/emacs-lsp/lsp-ui) : Flycheck, documentation and code actions support.
238280
* [company-lsp](https://github.com/tigersoldier/company-lsp) : LSP company backend.

install/pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
<goal>wget</goal>
3737
</goals>
3838
<configuration>
39-
<url>http://download.eclipse.org/che/che-ls-jdt/snapshots/che-jdt-language-server-latest.tar.gz</url>
40-
<outputFileName>che-jdt-language-server-latest.tar.gz</outputFileName>
39+
<url>${jdt.download.url}</url>
40+
<outputFileName>jdt-language-server-latest.tar.gz</outputFileName>
41+
<skipCache>true</skipCache>
4142
<outputDirectory>${project.build.directory}</outputDirectory>
4243
</configuration>
4344
</execution>
@@ -65,7 +66,7 @@
6566
<phase>process-resources</phase>
6667
<configuration>
6768
<tasks>
68-
<untar src="${project.build.directory}/che-jdt-language-server-latest.tar.gz" compression="gzip" dest="${jdt.js.server.root}"/>
69+
<untar src="${project.build.directory}/jdt-language-server-latest.tar.gz" compression="gzip" dest="${jdt.js.server.root}"/>
6970
<unzip src="${project.build.directory}/vscode-extension.zip" dest="${project.build.directory}/vscode-extension-extracted"/>
7071
</tasks>
7172
</configuration>

lsp-java-boot.el

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@
6262
:arguments (gethash "callbackCommandId" params))
6363
:no-wait t))))
6464

65-
(defun lsp-java-boot--workspace-execute-client-command (_jdt-ls-workspace params)
66-
"PARAMS is the classpath info."
67-
(ignore
68-
(with-lsp-workspace (lsp-find-workspace 'boot-ls nil)
69-
(-let (((&hash "command" "arguments") params))
70-
(lsp-request "workspace/executeCommand"
71-
(list :command command :arguments arguments)
72-
:no-wait t)))))
73-
7465
(defun lsp-java-boot--lens-backend (_ callback)
7566
"Boot backend.
7667
Store CALLBACK to use it `sts/highlight'."

0 commit comments

Comments
 (0)