Skip to content

Commit

Permalink
groovy: Fix local vars
Browse files Browse the repository at this point in the history
- Labelled `groovy-backend` as safe local variable.
- Added local variable hooks of groovy mode:
  - `spacemacs//groovy-setup-backend`
  - `spacemacs//groovy-setup-company`

See: syl20bnr#14653
  • Loading branch information
lebensterben authored and wang-d committed Jul 22, 2021
1 parent 933544c commit 6b504a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions layers/+lang/groovy/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"The backend to use for IDE features.
Possible values are `lsp' and `company-groovy'.
If `nil' then 'company-groovy` is the default backend unless `lsp' layer is used")
(put 'groovy-backend 'safe-local-variable #'symbolp)

(defvar groovy-lsp-jar-path "~/groovy-lsp-all.jar"
"The path to the lsp jar file")
6 changes: 3 additions & 3 deletions layers/+lang/groovy/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
org))

(defun groovy/post-init-company ()
(spacemacs//groovy-setup-company))
(add-hook 'groovy-mode-local-vars-hook 'spacemacs//groovy-setup-company))

(defun groovy/post-init-flycheck ()
(spacemacs/enable-flycheck 'groovy-mode))
Expand All @@ -46,6 +46,7 @@
(defun groovy/init-groovy-mode ()
(use-package groovy-mode
:defer t
:hook (groovy-mode-local-vars . spacemacs//groovy-setup-backend)
:init
(progn
(setq lsp-groovy-server-file groovy-lsp-jar-path)
Expand All @@ -58,8 +59,7 @@
"sf" 'groovy-send-definition
"si" 'run-groovy
"sR" 'spacemacs/groovy-send-region-switch
"sr" 'groovy-send-region)
(add-hook 'groovy-mode-hook #'spacemacs//groovy-setup-backend))))
"sr" 'groovy-send-region))))

(defun groovy/pre-init-org ()
(spacemacs|use-package-add-hook org
Expand Down

0 comments on commit 6b504a0

Please sign in to comment.