Skip to content

Commit cef161d

Browse files
committed
feat(compiler): unify the lsp and coc compilers usage
1 parent 81cef7b commit cef161d

18 files changed

+347
-342
lines changed

.stylua.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
indent_width = 2
2+
column_width = 120
3+
line_endings = "Unix"
4+
indent_type = "Tabs"
5+
quote_style = "AutoPreferDouble"

lua/neotest-java/command/classpath.lua

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ local nio = require("nio")
55
---@param additional_classpath_entries string[]
66
---@return string[]
77
local function get_classpaths(additional_classpath_entries)
8-
additional_classpath_entries = additional_classpath_entries or {}
9-
local bufnr = nio.api.nvim_get_current_buf()
10-
local uri = vim.uri_from_bufnr(bufnr)
11-
local result_classpaths = {}
8+
additional_classpath_entries = additional_classpath_entries or {}
9+
local uri = vim.uri_from_fname(nio.fn.expand("%:p"))
10+
local bufnr = nio.api.nvim_get_current_buf()
11+
local result_classpaths = {}
1212

13-
for _, v in ipairs(additional_classpath_entries) do
14-
table.insert(result_classpaths, v)
15-
end
13+
for _, v in ipairs(additional_classpath_entries) do
14+
table.insert(result_classpaths, v)
15+
end
1616

17-
for _, scope in ipairs({ "runtime", "test" }) do
18-
local options = vim.json.encode({ scope = scope })
19-
local err, result = lsp.execute_command("workspace/executeCommand", {
20-
command = "java.project.getClasspaths",
21-
arguments = { uri, options },
22-
}, bufnr)
23-
if result == nil or err ~= nil then
24-
log.warn(string.format("Unable to resolve [%s] target classpahts", scope))
25-
else
26-
for _, v in ipairs(result.classpaths or {}) do
27-
table.insert(result_classpaths, v)
28-
end
29-
end
30-
end
17+
for _, scope in ipairs({ "runtime", "test" }) do
18+
local options = vim.json.encode({ scope = scope })
19+
local err, result = lsp.execute_command("workspace/executeCommand", {
20+
command = "java.project.getClasspaths",
21+
arguments = { uri, options },
22+
}, bufnr)
23+
if result == nil or err ~= nil then
24+
log.warn(string.format("Unable to resolve [%s] target classpahts", scope))
25+
else
26+
for _, v in ipairs(result.classpaths or {}) do
27+
table.insert(result_classpaths, v)
28+
end
29+
end
30+
end
3131

32-
return result_classpaths
32+
return result_classpaths
3333
end
3434

3535
return get_classpaths

lua/neotest-java/command/junit_command_builder.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ local CommandBuilder = {
1717
---@param node_name? string example: shouldNotFail
1818
---@return CommandBuilder
1919
test_reference = function(self, qualified_name, node_name, type)
20-
if not qualified_name or #qualified_name == 0 then
21-
return self
22-
end
20+
if not qualified_name or #qualified_name == 0 then
21+
return self
22+
end
2323
self._test_references = self._test_references or {}
2424

2525
if type == "dir" then

lua/neotest-java/command/project.lua

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)