Code Monkey home page Code Monkey logo

Comments (1)

smile13241324 avatar smile13241324 commented on July 17, 2024

Hi @resendecode,

I am working with jdtls as well and its working most of the time, I sometimes also have mysterious freezes and company-capf timeouts but this only happens occasionally. Upgrading my lsp server to the latest version and upgrading lsp-mode also lowered the frequency of these issues.

Ok with this being said, lets try some troubleshooting. First I would like to have your system details this is the content of what spacemacs/report-issue returns to you.

Then we should make sure that your config is proper.
Here is my java config:

     (java :variables
      java-backend 'lsp)

As you see I do not have given any path, instead lsp-mode asked me to install jdtls which it will then do into your spacemacs directory. Also you should make sure you configure the java settings, the defaults are horribly underrated for a non toy lsp server.

I.e. here is what I am using in my user-config:

  ;; Setup lsp
  (defconst lsp-java-lombok-jar-path (expand-file-name
                                      (locate-user-emacs-file
                                       (f-join ".cache" "lombok.jar"))))
  (defun smile13241324/lombok-download ()
    "Download the latest Lombok JAR file and install it into `lsp-java-lombok-jar-path'."
    (interactive)
    (if (and (y-or-n-p (format "Download the latest Lombok JAR into %s? "
                               lsp-java-lombok-jar-path))
             (or (not (file-exists-p lsp-java-lombok-jar-path))
                 (y-or-n-p (format "The Lombok JAR already exists at %s, overwrite? "
                                   lsp-java-lombok-jar-path))))
        (progn
          (mkdir (file-name-directory lsp-java-lombok-jar-path) t)
          (message "Downloading Lombok JAR into %s" lsp-java-lombok-jar-path)
          (url-copy-file "https://projectlombok.org/downloads/lombok.jar" lsp-java-lombok-jar-path t))
      (message "Aborted.")))

  (defun smile13241324/setup-lsp-java-vmargs ()
    (setq lsp-java-vmargs '("-XX:+UseZGC" "-XX:+ZGenerational" "-Xmx20G" "-Xms20G" "-XX:MaxMetaspaceSize=10G" "-XX:+UseStringDeduplication"))
    (setq lsp-java-vmargs
          (append lsp-java-vmargs
                  (list (concat "-javaagent:" lsp-java-lombok-jar-path)))))

  ;; Setup lsp java with productive settings
  (setq lsp-java-jdt-download-url "https://www.eclipse.org/downloads/download.php?file=/jdtls/milestones/1.36.0/jdt-language-server-1.36.0-202405301306.tar.gz")

  ;; Setup the lsp-java vmargs
  (smile13241324/setup-lsp-java-vmargs)

When this does not solve your issue, you should execute company-diag and post the output.

from spacemacs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.