Skip to content
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

Code generator cannot generate proper Ruby codes for interfaces extending multiple interfaces #28

Closed
tomoasleep opened this issue Apr 30, 2021 · 2 comments

Comments

@tomoasleep
Copy link

Some interfaces in LSP extends multiple interfaces such as the following WorkspaceSymbolParams.
However, in Ruby code, the interface class only extends the last interface class (WorkspaceSymbolParams class only extends PartialResultParams class), so the Ruby class is not compatible with the corresponding LSP interface.

For example, this WorkspaceSymbolParams interface (link) extends WorkDoneProgressParams interface (link) which has workDoneToken property and PartialResultParams interface (link) which has partialResultToken property.
Therefore, this WorkspaceSymbolParams interface has query, workDoneToken, and partialResultToken properties.

/**
 * The parameters of a Workspace Symbol Request.
 */
interface WorkspaceSymbolParams extends WorkDoneProgressParams,
	PartialResultParams {
	/**
	 * A query string to filter symbols by. Clients may send an empty
	 * string here to request all symbols.
	 */
	query: string;
}

However, in Ruby code, the interface class WorkspaceSymbolParams only extends PartialResultParams class, so WorkspaceSymbolParams does not allow workDoneToken propety of WorkDoneProgressParams class.

module LanguageServer
module Protocol
module Interface
#
# The parameters of a Workspace Symbol Request.
#
class WorkspaceSymbolParams < PartialResultParams
def initialize(partial_result_token: nil, query:)
@attributes = {}
@attributes[:partialResultToken] = partial_result_token if partial_result_token
@attributes[:query] = query
@attributes.freeze
end
#
# A query string to filter symbols by. Clients may send an empty
# string here to request all symbols.
#
# @return [string]
def query
attributes.fetch(:query)
end
attr_reader :attributes
def to_hash
attributes
end
def to_json(*args)
to_hash.to_json(*args)
end
end
end
end
end

@mtsmfm
Copy link
Owner

mtsmfm commented Apr 30, 2021

Thank you for reporting, I'll have a look at

@mtsmfm mtsmfm closed this as completed in a8932dc May 1, 2021
@mtsmfm
Copy link
Owner

mtsmfm commented May 1, 2021

@tomoasleep Fixed in 3.16.0.1. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants