Skip to content

Commit a0e3562

Browse files
authored
feat: add API to call did change configuration notification (#76)
1 parent da4dafe commit a0e3562

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

lua/java-core/ls/clients/jdtls-client.lua

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@ function JdtlsClient:_init(client)
4343
self.client = client
4444
end
4545

46-
---@param args? { client: LspClient }
47-
---@return java-core.JdtlsClient
48-
function JdtlsClient:new(args)
49-
local o = {
50-
client = (args or {}).client,
51-
}
52-
53-
setmetatable(o, self)
54-
self.__index = self
55-
return o
56-
end
57-
5846
---Sends a LSP request
5947
---@param method java-core.JdtlsRequestMethod
6048
---@param params lsp.ExecuteCommandParams
@@ -77,6 +65,16 @@ function JdtlsClient:request(method, params, buffer)
7765
end)
7866
end
7967

68+
---Sends a notification to LSP
69+
---Returns true if the notification sent successfully
70+
---@param method string
71+
---@param params table
72+
---@return boolean
73+
function JdtlsClient:notify(method, params)
74+
log.debug('sending LSP notify: ' .. method)
75+
return self.client.notify(method, params)
76+
end
77+
8078
---Executes a workspace/executeCommand and returns the result
8179
---@param command string workspace command to execute
8280
---@param params? lsp.LSPAny[]
@@ -90,7 +88,7 @@ function JdtlsClient:workspace_execute_command(command, params, buffer)
9088
end
9189

9290
---Returns more information about the object the cursor is on
93-
---@param command jdtls.RequestMethod
91+
---@param command java-core.JdtlsRequestMethod
9492
---@param params lsp.CodeActionParams
9593
---@param buffer? number
9694
---@return jdtls.SelectionInfo[]
@@ -158,6 +156,14 @@ function JdtlsClient:get_capability(...)
158156
return capability
159157
end
160158

159+
---comment
160+
---@param settings JavaConfigurationSettings
161+
---@return boolean
162+
function JdtlsClient:workspace_did_change_configuration(settings)
163+
local params = { settings = settings }
164+
return self:notify('workspace/didChangeConfiguration', params)
165+
end
166+
161167
---Returns true if the LS supports the given command
162168
---@param command_name string name of the command
163169
---@return boolean # true if the command is supported

lua/java-core/ls/servers/jdtls/jdtls-types.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ M.CompletionMatchCaseOption = {
8989

9090
---@class ConfigurationOptions
9191
---@field maven? MavenOption
92-
---@field runtimes? RuntimeOption
92+
---@field runtimes? RuntimeOption[]
9393
---@field updateBuildConfiguration UpdateBuildConfigurationKind
9494

9595
---@class ContentProvider

0 commit comments

Comments
 (0)