Skip to content

Commit 5806549

Browse files
committed
Use lsp-protocol.el
1 parent 6dd0c48 commit 5806549

File tree

4 files changed

+200
-192
lines changed

4 files changed

+200
-192
lines changed

README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,11 @@ Then add the following lines to your `.emacs` and open a file from the any of th
5353
### Quick start
5454
Minimal configuration with [company-lsp](https://github.com/tigersoldier/company-lsp) and [lsp-ui](https://github.com/emacs-lsp/lsp-ui) and [dap-mode](https://github.com/yyoncho/dap-mode/). Now you can explore the methods under `lsp-java-*`, `dap-java-*`, `dap-*`, and `lsp-*`
5555
```elisp
56-
(require 'cc-mode)
56+
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
5757
58-
(condition-case nil
59-
(require 'use-package)
60-
(file-error
61-
(require 'package)
62-
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
63-
(package-initialize)
64-
(package-refresh-contents)
65-
(package-install 'use-package)
66-
(require 'use-package)))
67-
68-
(setq use-package-always-ensure t)
58+
(when (not (package-installed-p 'use-package))
59+
(package-refresh-contents)
60+
(package-install 'use-package))
6961
7062
(use-package projectile)
7163
(use-package flycheck)
@@ -77,7 +69,7 @@ Minimal configuration with [company-lsp](https://github.com/tigersoldier/company
7769
(use-package lsp-ui)
7870
(use-package which-key :config (which-key-mode))
7971
(use-package lsp-java :config (add-hook 'java-mode-hook 'lsp))
80-
(use-package dap-mode :after lsp-mode :config (dap-mode t) (dap-ui-mode t))
72+
(use-package dap-mode :after lsp-mode :config (dap-auto-configure-mode))
8173
(use-package dap-java :ensure nil)
8274
(use-package helm-lsp)
8375
(use-package helm

lsp-java-boot.el

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141

4242
(defvar lsp-java-boot--callback nil)
4343

44+
(eval-when-compile
45+
(lsp-interface
46+
(boot:Lenses (:doc :codeLenses))))
47+
4448
(defun lsp-java-boot--find-tools-jar ()
4549
"Calculate the path to tools.jar."
4650
(let ((tools-jar (or lsp-java-boot-java-tools-jar
@@ -54,7 +58,7 @@
5458
(with-lsp-workspace (lsp-find-workspace 'jdtls nil)
5559
(lsp-request "workspace/executeCommand"
5660
(list :command "sts.java.addClasspathListener"
57-
:arguments (gethash "callbackCommandId" params))
61+
:arguments (lsp-get params :callbackCommandId))
5862
:no-wait t)))
5963

6064
(defun lsp-java-boot--sts-add-classpath-listener (_workspace params)
@@ -63,7 +67,7 @@
6367
(with-lsp-workspace (lsp-find-workspace 'jdtls nil)
6468
(lsp-request "workspace/executeCommand"
6569
(list :command "sts.java.addClasspathListener"
66-
:arguments (gethash "callbackCommandId" params))
70+
:arguments (lsp-get params :callbackCommandId))
6771
:no-wait t))))
6872

6973
(defun lsp-java-boot--lens-backend (_ callback)
@@ -99,19 +103,19 @@ Store CALLBACK to use it `sts/highlight'."
99103
(defun lsp-java-boot--sts-hightlight (workspace params)
100104
"WORKSPACE PARAMS."
101105
(with-lsp-workspace workspace
102-
(-let (((&hash "doc" (&hash "uri" "version") "codeLenses" code-lenses) params))
106+
(-let (((&boot:Lenses :doc (&VersionedTextDocumentIdentifier :uri :version?) :code-lenses) params))
103107
(when-let (buf (find-buffer-visiting (lsp--uri-to-path uri)))
104108
(with-current-buffer buf
105109
(when (and lsp-java-boot--callback lsp-java-boot-lens-mode)
106-
(funcall lsp-java-boot--callback code-lenses version)))))))
110+
(funcall lsp-java-boot--callback code-lenses version?)))))))
107111

108112
(defun lsp-java-boot--server-jar ()
109113
"Return the spring boot jar."
110114
(or (-> lsp-java-server-install-dir
111115
(expand-file-name)
112116
(f-join "boot-server")
113-
f-files
114-
cl-first)
117+
(f-files)
118+
(cl-first))
115119
(lsp-log "Unable to find spring boot server jar.")))
116120

117121
(defun lsp-java-boot--ls-command (port)
@@ -140,11 +144,6 @@ Store CALLBACK to use it `sts/highlight'."
140144
("sts/javadocHoverLink" #'lsp-java-boot--sts-javadoc-hover-link))
141145
:notification-handlers (ht ("sts/highlight" #'lsp-java-boot--sts-hightlight)
142146
("sts/progress" #'ignore))
143-
:initialized-fn (lambda (workspace)
144-
(puthash
145-
"triggerCharacters"
146-
'("." "@" "#" "*")
147-
(gethash "completionProvider" (lsp--workspace-server-capabilities workspace))))
148147
:multi-root t
149148
:add-on? t
150149
:server-id 'boot-ls

0 commit comments

Comments
 (0)