Skip to content

Commit cdadf1e

Browse files
committed
fix: improve async profiler jar detection and tmpdir handling
1 parent 14c2d4c commit cdadf1e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lua/kide/lsp/jdtls.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,11 @@ local function get_async_profiler_ddl()
416416
end
417417
local function get_async_profiler_cov()
418418
if M.async_profiler_home then
419-
return vim.fn.glob(M.async_profiler_home .. "/target/jfr-converter-4.0.jar")
419+
for _, value in ipairs(vim.split(vim.fn.glob(M.async_profiler_home .. "/target/jfr-converter-*.jar"), "\n")) do
420+
if not (vim.endswith(value, "-javadoc.jar") or vim.endswith(value, "-sources.jar")) then
421+
return value
422+
end
423+
end
420424
end
421425
end
422426

@@ -461,6 +465,8 @@ local function test_with_profile(test_fn)
461465
:wait()
462466
if result.code == 0 then
463467
utils.open_fn(utils.tmpdir_file("profile.html"))
468+
else
469+
vim.notify("Async Profiler conversion failed: " .. result.stderr, vim.log.levels.ERROR)
464470
end
465471
end,
466472
})

lua/kide/tools/init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,16 @@ M.tmpdir = function()
213213
local tmpdir = vim.env["TMPDIR"] or vim.env["TEMP"]
214214
if not tmpdir then
215215
if M.is_win then
216-
tmpdir = "C:\\Windows\\Temp"
216+
tmpdir = "C:\\Windows\\Temp\\"
217217
else
218-
tmpdir = "/tmp"
218+
tmpdir = "/tmp/"
219219
end
220220
end
221221
return tmpdir
222222
end
223223

224224
M.tmpdir_file = function(file)
225-
return M.tmpdir() .. "/" .. file
225+
return M.tmpdir() .. file
226226
end
227227

228228
M.java_bin = function()

0 commit comments

Comments
 (0)