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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
module LanguageServer
module Protocol
module Interface
class SemanticTokensClientCapabilities
def initialize(dynamic_registration: nil, requests:, token_types:, token_modifiers:, formats:, overlapping_token_support: nil, multiline_token_support: nil, server_cancel_support: nil, augments_syntax_tokens: nil)
@attributes = {}
@attributes[:dynamicRegistration] = dynamic_registration if dynamic_registration
@attributes[:requests] = requests
@attributes[:tokenTypes] = token_types
@attributes[:tokenModifiers] = token_modifiers
@attributes[:formats] = formats
@attributes[:overlappingTokenSupport] = overlapping_token_support if overlapping_token_support
@attributes[:multilineTokenSupport] = multiline_token_support if multiline_token_support
@attributes[:serverCancelSupport] = server_cancel_support if server_cancel_support
@attributes[:augmentsSyntaxTokens] = augments_syntax_tokens if augments_syntax_tokens
@attributes.freeze
end
#
# Whether implementation supports dynamic registration. If this is set to
# `true` the client supports the new `(TextDocumentRegistrationOptions &
# StaticRegistrationOptions)` return value for the corresponding server
# capability as well.
#
# @return [boolean]
def dynamic_registration
attributes.fetch(:dynamicRegistration)
end
#
# Which requests the client supports and might send to the server
# depending on the server's capability. Please note that clients might not
# show semantic tokens or degrade some of the user experience if a range
# or full request is advertised by the client but not provided by the
# server. If for example the client capability `requests.full` and
# `request.range` are both set to true but the server only provides a
# range provider the client might not render a minimap correctly or might
# even decide to not show any semantic tokens at all.
#
# @return [{ range?: boolean | {}; full?: boolean | { delta?: boolean; }; }]
def requests
attributes.fetch(:requests)
end
#
# The token types that the client supports.
#
# @return [string[]]
def token_types
attributes.fetch(:tokenTypes)
end
#
# The token modifiers that the client supports.
#
# @return [string[]]
def token_modifiers
attributes.fetch(:tokenModifiers)
end
#
# The formats the clients supports.
#
# @return ["relative"[]]
def formats
attributes.fetch(:formats)
end
#
# Whether the client supports tokens that can overlap each other.
#
# @return [boolean]
def overlapping_token_support
attributes.fetch(:overlappingTokenSupport)
end
#
# Whether the client supports tokens that can span multiple lines.
#
# @return [boolean]
def multiline_token_support
attributes.fetch(:multilineTokenSupport)
end
#
# Whether the client allows the server to actively cancel a
# semantic token request, e.g. supports returning
# ErrorCodes.ServerCancelled. If a server does the client
# needs to retrigger the request.
#
# @return [boolean]
def server_cancel_support
attributes.fetch(:serverCancelSupport)
end
#
# Whether the client uses semantic tokens to augment existing
# syntax tokens. If set to `true` client side created syntax
# tokens and semantic tokens are both used for colorization. If
# set to `false` the client only uses the returned semantic tokens
# for colorization.
#
# If the value is `undefined` then the client behavior is not
# specified.
#
# @return [boolean]
def augments_syntax_tokens
attributes.fetch(:augmentsSyntaxTokens)
end
attr_reader :attributes
def to_hash
attributes
end
def to_json(*args)
to_hash.to_json(*args)
end
end
end
end
end
|