1

I've seen a sonarlint config for emacs using lsp in this link of github, and I've tried to install this without success. I've already installed lsp-sonarlint using MELPA and I've added this in additional-packages config.

this is my config on spacemacs (I've omitted some lines):

dotspacemacs-configuration-layers
   '(
     auto-completion
     better-defaults
     emacs-lisp
     git
     helm
     lsp
     markdown
     ;;multiple-cursors
     org
     (shell :variables
            shell-default-height 30
            shell-default-position 'bottom)
     (xclipboard :variables xclipboard-enable-cliphist t)
     ;; spell-checking
     syntax-checking
     version-control
     (java :variables java-backend 'lsp)
     dap
     yaml
     treemacs
     )
...
...
 dotspacemacs-additional-packages '(
                                      multiple-cursors
                                      lsp-sonarlint
                                      )
...
...
(defun dotspacemacs/user-load ()
  (require 'lsp-sonarlint)
  (require 'lsp-sonarlint-java)
  (use-package lsp-sonarlint
    :after lsp-java)
  (setq lsp-sonarlint-java-enabled t)
  (use-package lsp-sonarlint-java
    :after lsp-java)
)


(defun dotspacemacs/user-config ()
  (setq lombok-jar-path
        (expand-file-name
         "/lombok/lombok.jar"
         )
        )

  (setq lsp-java-vmargs `(
                          "-XX:+UseParallelGC"
                          "-XX:GCTimeRatio=4"
                          "-XX:AdaptiveSizePolicyWeight=90"
                          "-Dsun.zip.disableMemoryMapping=true"
                          "-Xmx1G"
                          "-Xms100m"
                          ,(concat "-javaagent:" lombok-jar-path)
                          )
        )

)

The problem is sonarlint-server is ready but I can't see suggestions of this. For example in this part

 public Maybe<Out> findOut(String key, String mapName) {
   return sharedMemoryService.getObject(mapName, key)
     .map(item -> (Out) item);
 }

In vscode or another ide in , I've received a suggestion about third line like this: Replace this lambda with method reference 'Out.class::cast'. (sonar.java.source not set. Assuming 8 or greater.)

Could someone show me where my configuration is wrong, please?

thank you for your answers.

1 Answer 1

1

I found the solution with help.

I was wrong in position of configuration.

the right way is:

(defun dotspacemacs/user-config ()

  (setq lombok-jar-path
        (expand-file-name
         "/Users/myUser/lombok/lombok.jar"
         )
        )

  (setq lsp-java-vmargs `(
                          "-XX:+UseParallelGC"
                          "-XX:GCTimeRatio=4"
                          "-XX:AdaptiveSizePolicyWeight=90"
                          "-Dsun.zip.disableMemoryMapping=true"
                          "-Xmx1G"
                          "-Xms100m"
                          ,(concat "-javaagent:" lombok-jar-path)
                          )
        )
  (require 'lsp-sonarlint)
  (require 'lsp-sonarlint-java)
  (use-package lsp-sonarlint
    :after lsp-java)
  (setq lsp-sonarlint-java-enabled t)
  (use-package lsp-sonarlint-java
    :after lsp-java)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.