|
18 | 18 | ;; You should have received a copy of the GNU General Public License |
19 | 19 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
|
21 | | -;;; Commentary: Java specific adapter for LSP mode |
| 21 | +;;; Commentary: |
| 22 | + |
| 23 | +;; Java specific adapter for LSP mode |
22 | 24 |
|
23 | 25 | ;;; Code: |
24 | 26 | (require 'cc-mode) |
|
29 | 31 | (require 'f) |
30 | 32 | (require 'tree-widget) |
31 | 33 | (require 'request) |
| 34 | +(require 'cl-lib) |
32 | 35 |
|
33 | 36 | (defgroup lsp-java nil |
34 | 37 | "JDT emacs frontend." |
@@ -560,10 +563,10 @@ NOT-FOUND-MESSAGE will be used if there is no matching action." |
560 | 563 | (let ((actions (cl-remove-if-not |
561 | 564 | (lambda (item) (string-match regexp (gethash "title" item))) |
562 | 565 | (lsp-get-or-calculate-code-actions)))) |
563 | | - (case (length actions) |
| 566 | + (pcase (length actions) |
564 | 567 | (0 (error (or not-found-message "Unable to find action"))) |
565 | 568 | (1 (lsp-execute-code-action (car actions))) |
566 | | - (t (lsp-execute-code-action (lsp--select-action actions)))))) |
| 569 | + (_ (lsp-execute-code-action (lsp--select-action actions)))))) |
567 | 570 |
|
568 | 571 | (defun lsp-java-extract-to-local-variable (arg) |
569 | 572 | "Extract local variable refactoring. |
@@ -844,13 +847,13 @@ PROJECT-URI uri of the item." |
844 | 847 |
|
845 | 848 | (cl-defmethod lsp-execute-command |
846 | 849 | ((_server (eql jdtls)) (command (eql java.show.references)) params) |
847 | | - (if-let (refs (third params)) |
| 850 | + (if-let (refs (cl-third params)) |
848 | 851 | (xref--show-xrefs (lsp--locations-to-xref-items refs) nil) |
849 | 852 | (user-error "No references"))) |
850 | 853 |
|
851 | 854 | (cl-defmethod lsp-execute-command |
852 | 855 | ((_server (eql jdtls)) (command (eql java.show.implementations)) params) |
853 | | - (if-let (refs (third params)) |
| 856 | + (if-let (refs (cl-third params)) |
854 | 857 | (xref--show-xrefs (lsp--locations-to-xref-items refs) nil) |
855 | 858 | (user-error "No implementations"))) |
856 | 859 |
|
@@ -897,10 +900,10 @@ PROJECT-URI uri of the item." |
897 | 900 | :headers '(("Accept" . "application/vnd.initializr.v2.1+json")) |
898 | 901 | :success (cl-function |
899 | 902 | (lambda (&key data &allow-other-keys) |
900 | | - (flet ((ask (message key) (alist-get 'id |
901 | | - (lsp--completing-read message |
902 | | - (alist-get 'values (alist-get key data)) |
903 | | - (-partial 'alist-get 'name))))) |
| 903 | + (cl-flet ((ask (message key) (alist-get 'id |
| 904 | + (lsp--completing-read message |
| 905 | + (alist-get 'values (alist-get key data)) |
| 906 | + (-partial 'alist-get 'name))))) |
904 | 907 | (condition-case _err |
905 | 908 | (-let* ((group-id (read-string "Enter group name: " "com.example")) |
906 | 909 | (artifact-id (read-string "Enter artifactId: " "demo")) |
@@ -934,7 +937,7 @@ PROJECT-URI uri of the item." |
934 | 937 | rest)) |
935 | 938 | (if (-contains? deps dep) |
936 | 939 | (setq deps (remove dep deps)) |
937 | | - (pushnew dep deps))) |
| 940 | + (cl-pushnew dep deps))) |
938 | 941 | (let ((download-url (format "%sstarter.zip?type=%s&language=%s&groupId=%s&artifactId=%s&packaging=%s&bootVersion=%s&baseDir=%s&dependencies=%s" |
939 | 942 | base-url type language group-id artifact-id packaging boot-version artifact-id (s-join "," deps)))) |
940 | 943 | (message "Downloading template from %s" download-url) |
|
0 commit comments