Skip to content

Commit

Permalink
Merge pull request #29 from mtsmfm/fix-28
Browse files Browse the repository at this point in the history
Fix #28
  • Loading branch information
mtsmfm committed May 1, 2021
2 parents fbdcc04 + fc26c49 commit a8932dc
Show file tree
Hide file tree
Showing 95 changed files with 1,719 additions and 155 deletions.
20 changes: 19 additions & 1 deletion lib/language_server/protocol/interface/annotated_text_edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Interface
#
# A special text edit with an additional change annotation.
#
class AnnotatedTextEdit < TextEdit
class AnnotatedTextEdit
def initialize(range:, new_text:, annotation_id:)
@attributes = {}

Expand All @@ -15,6 +15,24 @@ def initialize(range:, new_text:, annotation_id:)
@attributes.freeze
end

#
# The range of the text document to be manipulated. To insert
# text into a document create a range where start === end.
#
# @return [Range]
def range
attributes.fetch(:range)
end

#
# The string to be inserted. For delete operations use an
# empty string.
#
# @return [string]
def new_text
attributes.fetch(:newText)
end

#
# The actual annotation identifier.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
module LanguageServer
module Protocol
module Interface
class CallHierarchyIncomingCallsParams < PartialResultParams
def initialize(partial_result_token: nil, item:)
class CallHierarchyIncomingCallsParams
def initialize(work_done_token: nil, partial_result_token: nil, item:)
@attributes = {}

@attributes[:workDoneToken] = work_done_token if work_done_token
@attributes[:partialResultToken] = partial_result_token if partial_result_token
@attributes[:item] = item

@attributes.freeze
end

#
# An optional token that a server can use to report work done progress.
#
# @return [ProgressToken]
def work_done_token
attributes.fetch(:workDoneToken)
end

#
# An optional token that a server can use to report partial results (e.g.
# streaming) to the client.
#
# @return [ProgressToken]
def partial_result_token
attributes.fetch(:partialResultToken)
end

# @return [CallHierarchyItem]
def item
attributes.fetch(:item)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module LanguageServer
module Protocol
module Interface
class CallHierarchyOptions < WorkDoneProgressOptions
class CallHierarchyOptions
def initialize(work_done_progress: nil)
@attributes = {}

Expand All @@ -10,6 +10,11 @@ def initialize(work_done_progress: nil)
@attributes.freeze
end

# @return [boolean]
def work_done_progress
attributes.fetch(:workDoneProgress)
end

attr_reader :attributes

def to_hash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
module LanguageServer
module Protocol
module Interface
class CallHierarchyOutgoingCallsParams < PartialResultParams
def initialize(partial_result_token: nil, item:)
class CallHierarchyOutgoingCallsParams
def initialize(work_done_token: nil, partial_result_token: nil, item:)
@attributes = {}

@attributes[:workDoneToken] = work_done_token if work_done_token
@attributes[:partialResultToken] = partial_result_token if partial_result_token
@attributes[:item] = item

@attributes.freeze
end

#
# An optional token that a server can use to report work done progress.
#
# @return [ProgressToken]
def work_done_token
attributes.fetch(:workDoneToken)
end

#
# An optional token that a server can use to report partial results (e.g.
# streaming) to the client.
#
# @return [ProgressToken]
def partial_result_token
attributes.fetch(:partialResultToken)
end

# @return [CallHierarchyItem]
def item
attributes.fetch(:item)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
module LanguageServer
module Protocol
module Interface
class CallHierarchyPrepareParams < WorkDoneProgressParams
def initialize(work_done_token: nil)
class CallHierarchyPrepareParams
def initialize(text_document:, position:, work_done_token: nil)
@attributes = {}

@attributes[:textDocument] = text_document
@attributes[:position] = position
@attributes[:workDoneToken] = work_done_token if work_done_token

@attributes.freeze
end

#
# The text document.
#
# @return [TextDocumentIdentifier]
def text_document
attributes.fetch(:textDocument)
end

#
# The position inside the text document.
#
# @return [Position]
def position
attributes.fetch(:position)
end

#
# An optional token that a server can use to report work done progress.
#
# @return [ProgressToken]
def work_done_token
attributes.fetch(:workDoneToken)
end

attr_reader :attributes

def to_hash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
module LanguageServer
module Protocol
module Interface
class CallHierarchyRegistrationOptions < StaticRegistrationOptions
def initialize(id: nil)
class CallHierarchyRegistrationOptions
def initialize(document_selector:, work_done_progress: nil, id: nil)
@attributes = {}

@attributes[:documentSelector] = document_selector
@attributes[:workDoneProgress] = work_done_progress if work_done_progress
@attributes[:id] = id if id

@attributes.freeze
end

#
# A document selector to identify the scope of the registration. If set to
# null the document selector provided on the client side will be used.
#
# @return [DocumentSelector]
def document_selector
attributes.fetch(:documentSelector)
end

# @return [boolean]
def work_done_progress
attributes.fetch(:workDoneProgress)
end

#
# The id used to register the request. The id can be used to deregister
# the request again. See also Registration#id.
#
# @return [string]
def id
attributes.fetch(:id)
end

attr_reader :attributes

def to_hash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module LanguageServer
module Protocol
module Interface
class CodeActionOptions < WorkDoneProgressOptions
class CodeActionOptions
def initialize(work_done_progress: nil, code_action_kinds: nil, resolve_provider: nil)
@attributes = {}

Expand All @@ -12,6 +12,11 @@ def initialize(work_done_progress: nil, code_action_kinds: nil, resolve_provider
@attributes.freeze
end

# @return [boolean]
def work_done_progress
attributes.fetch(:workDoneProgress)
end

#
# CodeActionKinds that this server may return.
#
Expand Down
22 changes: 20 additions & 2 deletions lib/language_server/protocol/interface/code_action_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ module Interface
#
# Params for the CodeActionRequest
#
class CodeActionParams < PartialResultParams
def initialize(partial_result_token: nil, text_document:, range:, context:)
class CodeActionParams
def initialize(work_done_token: nil, partial_result_token: nil, text_document:, range:, context:)
@attributes = {}

@attributes[:workDoneToken] = work_done_token if work_done_token
@attributes[:partialResultToken] = partial_result_token if partial_result_token
@attributes[:textDocument] = text_document
@attributes[:range] = range
Expand All @@ -16,6 +17,23 @@ def initialize(partial_result_token: nil, text_document:, range:, context:)
@attributes.freeze
end

#
# An optional token that a server can use to report work done progress.
#
# @return [ProgressToken]
def work_done_token
attributes.fetch(:workDoneToken)
end

#
# An optional token that a server can use to report partial results (e.g.
# streaming) to the client.
#
# @return [ProgressToken]
def partial_result_token
attributes.fetch(:partialResultToken)
end

#
# The document in which the command was invoked.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,52 @@
module LanguageServer
module Protocol
module Interface
class CodeActionRegistrationOptions < CodeActionOptions
def initialize(work_done_progress: nil, code_action_kinds: nil, resolve_provider: nil)
class CodeActionRegistrationOptions
def initialize(document_selector:, work_done_progress: nil, code_action_kinds: nil, resolve_provider: nil)
@attributes = {}

@attributes[:documentSelector] = document_selector
@attributes[:workDoneProgress] = work_done_progress if work_done_progress
@attributes[:codeActionKinds] = code_action_kinds if code_action_kinds
@attributes[:resolveProvider] = resolve_provider if resolve_provider

@attributes.freeze
end

#
# A document selector to identify the scope of the registration. If set to
# null the document selector provided on the client side will be used.
#
# @return [DocumentSelector]
def document_selector
attributes.fetch(:documentSelector)
end

# @return [boolean]
def work_done_progress
attributes.fetch(:workDoneProgress)
end

#
# CodeActionKinds that this server may return.
#
# The list of kinds may be generic, such as `CodeActionKind.Refactor`,
# or the server may list out every specific kind they provide.
#
# @return [string[]]
def code_action_kinds
attributes.fetch(:codeActionKinds)
end

#
# The server provides support to resolve additional
# information for a code action.
#
# @return [boolean]
def resolve_provider
attributes.fetch(:resolveProvider)
end

attr_reader :attributes

def to_hash
Expand Down
7 changes: 6 additions & 1 deletion lib/language_server/protocol/interface/code_lens_options.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module LanguageServer
module Protocol
module Interface
class CodeLensOptions < WorkDoneProgressOptions
class CodeLensOptions
def initialize(work_done_progress: nil, resolve_provider: nil)
@attributes = {}

Expand All @@ -11,6 +11,11 @@ def initialize(work_done_progress: nil, resolve_provider: nil)
@attributes.freeze
end

# @return [boolean]
def work_done_progress
attributes.fetch(:workDoneProgress)
end

#
# Code lens has a resolve provider as well.
#
Expand Down
22 changes: 20 additions & 2 deletions lib/language_server/protocol/interface/code_lens_params.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
module LanguageServer
module Protocol
module Interface
class CodeLensParams < PartialResultParams
def initialize(partial_result_token: nil, text_document:)
class CodeLensParams
def initialize(work_done_token: nil, partial_result_token: nil, text_document:)
@attributes = {}

@attributes[:workDoneToken] = work_done_token if work_done_token
@attributes[:partialResultToken] = partial_result_token if partial_result_token
@attributes[:textDocument] = text_document

@attributes.freeze
end

#
# An optional token that a server can use to report work done progress.
#
# @return [ProgressToken]
def work_done_token
attributes.fetch(:workDoneToken)
end

#
# An optional token that a server can use to report partial results (e.g.
# streaming) to the client.
#
# @return [ProgressToken]
def partial_result_token
attributes.fetch(:partialResultToken)
end

#
# The document to request code lens for.
#
Expand Down
Loading

0 comments on commit a8932dc

Please sign in to comment.