1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
module LanguageServer
module Protocol
module Interface
class CompletionClientCapabilities
def initialize(dynamic_registration: nil, completion_item: nil, completion_item_kind: nil, context_support: nil, insert_text_mode: nil, completion_list: nil)
@attributes = {}
@attributes[:dynamicRegistration] = dynamic_registration if dynamic_registration
@attributes[:completionItem] = completion_item if completion_item
@attributes[:completionItemKind] = completion_item_kind if completion_item_kind
@attributes[:contextSupport] = context_support if context_support
@attributes[:insertTextMode] = insert_text_mode if insert_text_mode
@attributes[:completionList] = completion_list if completion_list
@attributes.freeze
end
#
# Whether completion supports dynamic registration.
#
# @return [boolean]
def dynamic_registration
attributes.fetch(:dynamicRegistration)
end
#
# The client supports the following `CompletionItem` specific
# capabilities.
#
# @return [{ snippetSupport?: boolean; commitCharactersSupport?: boolean; documentationFormat?: MarkupKind[]; deprecatedSupport?: boolean; preselectSupport?: boolean; tagSupport?: { valueSet: 1[]; }; insertReplaceSupport?: boolean; resolveSupport?: { ...; }; insertTextModeSupport?: { ...; }; labelDetailsSupport?: boolean; }]
def completion_item
attributes.fetch(:completionItem)
end
# @return [{ valueSet?: CompletionItemKind[]; }]
def completion_item_kind
attributes.fetch(:completionItemKind)
end
#
# The client supports to send additional context information for a
# `textDocument/completion` request.
#
# @return [boolean]
def context_support
attributes.fetch(:contextSupport)
end
#
# The client's default when the completion item doesn't provide a
# `insertTextMode` property.
#
# @return [InsertTextMode]
def insert_text_mode
attributes.fetch(:insertTextMode)
end
#
# The client supports the following `CompletionList` specific
# capabilities.
#
# @return [{ itemDefaults?: string[]; }]
def completion_list
attributes.fetch(:completionList)
end
attr_reader :attributes
def to_hash
attributes
end
def to_json(*args)
to_hash.to_json(*args)
end
end
end
end
end
|