spacemacs
spacemacs copied to clipboard
add sonarlint in spacemacs
Discussed in https://github.com/syl20bnr/spacemacs/discussions/15750
Originally posted by chavalife17 September 27, 2022 I tried to install a package that is about sonarlint (https://github.com/emacs-lsp/lsp-sonarlint)
I've used this config after installed this package
dotspacemacs-additional-packages '(
lsp-sonarlint
)
(defun dotspacemacs/user-config ()
"Configuration for user code:
This function is called at the very end of Spacemacs startup, after layer
configuration.
Put your configuration code here, except for variables that should be set
before packages are loaded."
(setq lombok-jar-path
(expand-file-name
"/Users/mypc/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)
)
)
(use-package lsp-sonarlint
:defer t)
(use-package lsp-sonarlint-java
:after lsp-java
:custom (lsp-sonarlint-java-enabled t))
(global-set-key (kbd "C-c m c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
)
my problem is spacemacs can enabled jdtls and lsp-sonarlint but I can't see a suggestion of my code.
When I start spacemacs, I can see a jdtls started message but in sonarlint always has started.
In this image example, in another ide, I can receive a suggestion about method references instanced of lambdas but in spacemacs no

Can someone helps me?
thanks for your answers
I just tried it (thank you for introducing me to this lsp-sonarlint) via both package-install and (use-package) and basically did what you did there.
lsp-sonarlint works for me:

I am not really sure what happened but it didn't work for me once, but after restarting spacemacs it worked again. I'll try to use this package for my daily work and will report if I find anything.
So, after a restart, lsp-sonarlint didn't work anymore for me. So, I did an investigation and found that since you use :defer t for lsp-sonarlint, lsp-sonarlint-java was loaded and configured too soon. Here is the configuration that works for me so far.
(use-package lsp-sonarlint
:defer t)
(use-package lsp-sonarlint-java
:after (lsp-sonarlint lsp-java)
:custom (lsp-sonarlint-java-enabled t))
@chavalife17
please verify whether it works.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Still valid
This should be adding basic support for sonarlint via the lsp layer. I personally think it will need some polishing but so need the lsp-sonarlint package as well. If you need it please consider helping at the package level.