Skip to content

feat: add API to call did change configuration notification #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions lua/java-core/ls/clients/jdtls-client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ function JdtlsClient:_init(client)
self.client = client
end

---@param args? { client: LspClient }
---@return java-core.JdtlsClient
function JdtlsClient:new(args)
local o = {
client = (args or {}).client,
}

setmetatable(o, self)
self.__index = self
return o
end

---Sends a LSP request
---@param method java-core.JdtlsRequestMethod
---@param params lsp.ExecuteCommandParams
Expand All @@ -77,6 +65,16 @@ function JdtlsClient:request(method, params, buffer)
end)
end

---Sends a notification to LSP
---Returns true if the notification sent successfully
---@param method string
---@param params table
---@return boolean
function JdtlsClient:notify(method, params)
log.debug('sending LSP notify: ' .. method)
return self.client.notify(method, params)
end

---Executes a workspace/executeCommand and returns the result
---@param command string workspace command to execute
---@param params? lsp.LSPAny[]
Expand All @@ -90,7 +88,7 @@ function JdtlsClient:workspace_execute_command(command, params, buffer)
end

---Returns more information about the object the cursor is on
---@param command jdtls.RequestMethod
---@param command java-core.JdtlsRequestMethod
---@param params lsp.CodeActionParams
---@param buffer? number
---@return jdtls.SelectionInfo[]
Expand Down Expand Up @@ -158,6 +156,14 @@ function JdtlsClient:get_capability(...)
return capability
end

---comment
---@param settings JavaConfigurationSettings
---@return boolean
function JdtlsClient:workspace_did_change_configuration(settings)
local params = { settings = settings }
return self:notify('workspace/didChangeConfiguration', params)
end

---Returns true if the LS supports the given command
---@param command_name string name of the command
---@return boolean # true if the command is supported
Expand Down
2 changes: 1 addition & 1 deletion lua/java-core/ls/servers/jdtls/jdtls-types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ M.CompletionMatchCaseOption = {

---@class ConfigurationOptions
---@field maven? MavenOption
---@field runtimes? RuntimeOption
---@field runtimes? RuntimeOption[]
---@field updateBuildConfiguration UpdateBuildConfigurationKind

---@class ContentProvider
Expand Down
Loading