Skip to content

feat: add listOverridableMethods and addOverridableMethods commands #83

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
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
39 changes: 39 additions & 0 deletions lua/java-core/ls/clients/jdtls-client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ local await = async.wait_handle_error
---| 'java/move'
---| 'java/searchSymbols'
---| 'java/getMoveDestinations'
---| 'java/listOverridableMethods'
---| 'java/addOverridableMethods'

---@alias jdtls.CodeActionCommand
---| 'extractVariable'
Expand Down Expand Up @@ -114,6 +116,19 @@ end
---@field name string
---@field type string

---@class jdtls.listOverridableMethodsResponse
---@field methods jdtls.OverridableMethod[]
---@field type string

---@class jdtls.OverridableMethod
---@field key string
---@field bindingKey string
---@field declaringClass string
---@field declaringClassType string
---@field name string
---@field parameters string[]
---@field unimplemented boolean

---@class jdtls.MoveDestinationsResponse
---@field errorMessage? string
---@field destinations jdtls.InstanceMethodMoveDestination[]|jdtls.ResourceMoveDestination[]
Expand Down Expand Up @@ -287,6 +302,30 @@ function JdtlsClient:java_get_refactor_edit(
return self:request('java/getRefactorEdit', params, buffer)
end

---Returns a list of methods that can be overridden
---@param params lsp.CodeActionParams
---@param buffer? number
---@return jdtls.listOverridableMethodsResponse
function JdtlsClient:list_overridable_methods(params, buffer)
return self:request('java/listOverridableMethods', params, buffer)
end

---Returns a list of methods that can be overridden
---@param context lsp.CodeActionParams
---@param overridable_methods jdtls.OverridableMethod[]
---@param buffer? number
---@return lsp.WorkspaceEdit
function JdtlsClient:add_overridable_methods(
context,
overridable_methods,
buffer
)
return self:request('java/addOverridableMethods', {
context = context,
overridableMethods = overridable_methods,
}, buffer)
end

---Compile the workspace
---@param is_full_compile boolean if true, a complete full compile of the
---workspace will be executed
Expand Down
Loading