JavaHello / spring-boot.nvim

Neovim + Spring Boot LS
Apache License 2.0
38 stars 7 forks source link

Client spring-boot quit with exit code 1 and signal 0. Check log for errors: ~/.local/state/nvim/lsp.log #12

Closed sangramsingha closed 1 month ago

sangramsingha commented 1 month ago

lsp.log

[START][2024-09-29 19:54:22] LSP logging initiated
[ERROR][2024-09-29 19:54:22] .../vim/lsp/rpc.lua:770    "rpc"   "/home/sangram/programs/sdkman/candidates/java/21.0.4-tem/bin/java" "stderr"    "Error: Unable to access jarfile \n"
[ERROR][2024-09-29 19:54:22] .../vim/lsp/rpc.lua:770    "rpc"   "/home/sangram/programs/sdkman/candidates/java/21.0.4-tem/bin/java" "stderr"    "WARNING: Using incubator modules: jdk.incubator.vector\n"
[ERROR][2024-09-29 19:54:23] .../vim/lsp/rpc.lua:770    "rpc"   "/home/sangram/programs/sdkman/candidates/java/21.0.4-tem/bin/java" "stderr"    "Sept 29, 2024 7:54:23 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic\n"
[ERROR][2024-09-29 19:54:23] .../vim/lsp/rpc.lua:770    "rpc"   "/home/sangram/programs/sdkman/candidates/java/21.0.4-tem/bin/java" "stderr"    "Sept 29, 2024 7:54:23 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic\n"
[WARN][2024-09-29 19:54:28] ...lsp/handlers.lua:135 "The language server jdtls triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless"

spring-boot config

local spring_boot = {
    "JavaHello/spring-boot.nvim", --"eslam-allam/spring-boot.nvim"
    version = "*",
    ft = {"java"},
    dependencies = {
       "mfussenegger/nvim-jdtls",
    },
    config = function(_, opts)

        -- mason for sonarlint-language path
        local mason_registery_status, mason_registery = pcall(require, "mason-registry")
        if not mason_registery_status then
            vim.notify("Mason registery not found", vim.log.levels.ERROR, {title = "Spring boot"})
            return
        end

        -- java enviroments
        local util_status, util = pcall(require, "sangram.util")
        if not util_status then
            vim.notify("java config not found", vim.log.levels.ERROR, {title = "Spring boot"})
            return
        end

        local java_config = util.getJavaList()

        opts.ls_path = mason_registery.get_package("spring-boot-tools"):get_install_path() ..  "/extension/language-server"
        opts.java_cmd = java_config[1].path .. "/bin/java" -- java 21
        opts.jdtls_name = "jdtls"
        opts.log_file = vim.fn.expand("~/.local/state/nvim/spring-boot-ls.log")

        require("spring_boot").setup(opts)

    end
}

And Error notification pop up with message Client not found: spring-boot

Could not figure out anything wrong in config.

sangramsingha commented 1 month ago

Any way its working after updating my config

local spring_boot = {
    "JavaHello/spring-boot.nvim", --"eslam-allam/spring-boot.nvim"
    version = "*",
    ft = {"java"},
    dependencies = {
       "mfussenegger/nvim-jdtls",
    },
    opts = function()
        -- mason for sonarlint-language path
        local mason_registery_status, mason_registery = pcall(require, "mason-registry")
        if not mason_registery_status then
            vim.notify("Mason registery not found", vim.log.levels.ERROR, {title = "Spring boot"})
            return
        end

        -- java enviroments
        local util_status, util = pcall(require, "sangram.util")
        if not util_status then
            vim.notify("java config not found", vim.log.levels.ERROR, {title = "Spring boot"})
            return
        end

        local java_config = util.getJavaList()

        local opts = {}
        opts.ls_path = mason_registery.get_package("spring-boot-tools"):get_install_path() ..  "/extension/language-server"
        -- opts.ls_path = "/home/sangram/.vscode/extensions/vmware.vscode-spring-boot-1.55.1"
        -- vim.notify("spring boot ls path : " .. opts.ls_path, vim.log.levels.INFO, {title = "Spring boot"})
        opts.java_cmd = java_config[1].path .. "/bin/java"
        opts.exploded_ls_jar_data = true
        opts.jdtls_name = "jdtls"
        opts.log_file = "/home/sangram/.local/state/nvim/spring-boot-ls.log"

        return opts
    end
}

return spring_boot