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
|
module LanguageServer
module Protocol
module Interface
class PublishDiagnosticsClientCapabilities
def initialize(related_information: nil, tag_support: nil, version_support: nil, code_description_support: nil, data_support: nil)
@attributes = {}
@attributes[:relatedInformation] = related_information if related_information
@attributes[:tagSupport] = tag_support if tag_support
@attributes[:versionSupport] = version_support if version_support
@attributes[:codeDescriptionSupport] = code_description_support if code_description_support
@attributes[:dataSupport] = data_support if data_support
@attributes.freeze
end
#
# Whether the clients accepts diagnostics with related information.
#
# @return [boolean]
def related_information
attributes.fetch(:relatedInformation)
end
#
# Client supports the tag property to provide meta data about a diagnostic.
# Clients supporting tags have to handle unknown tags gracefully.
#
# @return [{ valueSet: DiagnosticTag[]; }]
def tag_support
attributes.fetch(:tagSupport)
end
#
# Whether the client interprets the version property of the
# `textDocument/publishDiagnostics` notification's parameter.
#
# @return [boolean]
def version_support
attributes.fetch(:versionSupport)
end
#
# Client supports a codeDescription property
#
# @return [boolean]
def code_description_support
attributes.fetch(:codeDescriptionSupport)
end
#
# Whether code action supports the `data` property which is
# preserved between a `textDocument/publishDiagnostics` and
# `textDocument/codeAction` request.
#
# @return [boolean]
def data_support
attributes.fetch(:dataSupport)
end
attr_reader :attributes
def to_hash
attributes
end
def to_json(*args)
to_hash.to_json(*args)
end
end
end
end
end
|