Closed jamilraichouni closed 2 months ago
As a workaround you could make the underlying request directly with something like client.request_sync("java/buildWorkspace", false, 5000, bufnr)
You won't get the logic that populates the quickfix list with errors if there are any, but if all you want is to have the compilation and then trigger something that should be good enough. I also use that in my dotfiles.
(client
is either from on_attach/LspAttach, or you can get it via vim.lsp.get_clients({ name = "jdtls" })[1]
)
Thank you @mfussenegger ,
I replaced
require("jdtls").compile("full")
with
local bufnr = vim.api.nvim_get_current_buf()
local client = vim.lsp.get_clients({ name = "jdtls", bufnr = bufnr })[1]
local resp = client.request_sync("java/buildWorkspace", true, 5000, bufnr)
if resp.result > 1 then
require("jdtls").compile("full")
return
end
That is a solution that is okax for not too big projects and I get the errors in the quickfix list.
Looks like resp.result
equals 1
in the case of a successful compilation.
Problem Statement
I have no chance to know when
.class
file creation, compilation viaM.compile({type})
, is completed before I start to pack and deploy the according.jar
file.Ideas or possible solutions
Make run of
M.compile({type})
snychroneous and provide return code, error message(s) etc.