docs: removed .polydev mentions and changed presets names
fix: presets had improper variable names on call fix: java now builds properly and runs
This commit is contained in:
@@ -21,21 +21,19 @@ function M.run()
|
||||
local root = utils.get_project_root()
|
||||
local out_dir = root .. "/build"
|
||||
|
||||
if not utils.is_dir(out_dir) then
|
||||
vim.fn.mkdir(out_dir, "p")
|
||||
end
|
||||
local cmd = string.format("javac -d %s %s", out_dir, root .. "/src/*.java")
|
||||
local output = vim.fn.system(cmd)
|
||||
local success = vim.v.shell_error == 0
|
||||
|
||||
local compile_command = string.format("javac -d %s %s/*.java", out_dir, root .. "/src")
|
||||
local compile_status = vim.fn.system(compile_command)
|
||||
|
||||
if vim.v.shell_error == 0 then
|
||||
utils.open_float_terminal("java -cp " .. root .. "/build" .. " Main")
|
||||
if not success then
|
||||
local term_buf = utils.open_float_terminal(cmd)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false,
|
||||
vim.list_extend({ "Error during compilation:" }, vim.split(output, "\n", { trimempty = true }))
|
||||
)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
else
|
||||
print("Error during compilation. Opening terminal for details...")
|
||||
local term_buf = utils.open_float_terminal(compile_command)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false, vim.split(compile_status, "\n", { trimempty = true }))
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
utils.open_float_terminal("java -cp " .. root .. "/build" .. " Main")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user