This repository was archived by the owner on Nov 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathjava-debug-client.lua
More file actions
82 lines (68 loc) · 2.13 KB
/
java-debug-client.lua
File metadata and controls
82 lines (68 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
local JDTLSClient = require('java-core.ls.clients.jdtls-client')
---@class JavaCoreDebugClient: JavaCoreJdtlsClient
local M = JDTLSClient:new()
---@class JavaDebugResolveMainClassRecord
---@field mainClass string
---@field projectName string
---@field fileName string
---@alias JavaDebugResolveMainClassResponse JavaDebugResolveMainClassRecord[]
---Returns a list of main classes in the current workspace
---@return Promise
function M:resolve_main_class()
return self:execute_command('vscode.java.resolveMainClass')
end
---@alias JavaDebugResolveClasspathResponse string[][]
---Returns module paths and class paths of a given main class
---@param project_name string
---@param main_class string
---@return Promise
function M:resolve_classpath(main_class, project_name)
return self:execute_command(
'vscode.java.resolveClasspath',
{ main_class, project_name }
)
end
---@alias JavaDebugResolveJavaExecutableResponse string
---Returns the path to java executable for a given main class
---@param project_name string
---@param main_class string
---@return Promise
function M:resolve_java_executable(main_class, project_name)
return self:execute_command('vscode.java.resolveJavaExecutable', {
main_class,
project_name,
})
end
---@alias JavaDebugCheckProjectSettingsResponse boolean
---Returns true if the project settings is the expected
---@param project_name string
---@param main_class string
---@param inheritedOptions boolean
---@param expectedOptions { [string]: any }
---@return Promise
function M:check_project_settings(
main_class,
project_name,
inheritedOptions,
expectedOptions
)
return self:execute_command(
'vscode.java.checkProjectSettings',
vim.fn.json_encode({
className = main_class,
projectName = project_name,
inheritedOptions = inheritedOptions,
expectedOptions = expectedOptions,
})
)
end
---@alias JavaDebugStartDebugSessionResponse integer
---Starts a debug session and returns the port number
---@return Promise
function M:start_debug_session()
return self:execute_command('vscode.java.startDebugSession')
end
function M:build_workspace()
return self:execute_command('vscode.java.buildWorkspace')
end
return M