class LanguageServer::Protocol::Interface::Diagnostic

Attributes

attributes[R]

Public Class Methods

new(range:, severity: nil, code: nil, code_description: nil, source: nil, message:, tags: nil, related_information: nil, data: nil) click to toggle source
# File lib/language_server/protocol/interface/diagnostic.rb, line 5
def initialize(range:, severity: nil, code: nil, code_description: nil, source: nil, message:, tags: nil, related_information: nil, data: nil)
  @attributes = {}

  @attributes[:range] = range
  @attributes[:severity] = severity if severity
  @attributes[:code] = code if code
  @attributes[:codeDescription] = code_description if code_description
  @attributes[:source] = source if source
  @attributes[:message] = message
  @attributes[:tags] = tags if tags
  @attributes[:relatedInformation] = related_information if related_information
  @attributes[:data] = data if data

  @attributes.freeze
end

Public Instance Methods

code() click to toggle source

The diagnostic's code, which might appear in the user interface.

@return [string | number]

# File lib/language_server/protocol/interface/diagnostic.rb, line 42
def code
  attributes.fetch(:code)
end
code_description() click to toggle source

An optional property to describe the error code.

@return [CodeDescription]

# File lib/language_server/protocol/interface/diagnostic.rb, line 50
def code_description
  attributes.fetch(:codeDescription)
end
data() click to toggle source

A data entry field that is preserved between a `textDocument/publishDiagnostics` notification and `textDocument/codeAction` request.

@return [unknown]

# File lib/language_server/protocol/interface/diagnostic.rb, line 94
def data
  attributes.fetch(:data)
end
message() click to toggle source

The diagnostic's message.

@return [string]

# File lib/language_server/protocol/interface/diagnostic.rb, line 67
def message
  attributes.fetch(:message)
end
range() click to toggle source

The range at which the message applies.

@return [Range]

# File lib/language_server/protocol/interface/diagnostic.rb, line 25
def range
  attributes.fetch(:range)
end
severity() click to toggle source

The diagnostic's severity. Can be omitted. If omitted it is up to the client to interpret diagnostics as error, warning, info or hint.

@return [DiagnosticSeverity]

# File lib/language_server/protocol/interface/diagnostic.rb, line 34
def severity
  attributes.fetch(:severity)
end
source() click to toggle source

A human-readable string describing the source of this diagnostic, e.g. 'typescript' or 'super lint'.

@return [string]

# File lib/language_server/protocol/interface/diagnostic.rb, line 59
def source
  attributes.fetch(:source)
end
tags() click to toggle source

Additional metadata about the diagnostic.

@return [DiagnosticTag

# File lib/language_server/protocol/interface/diagnostic.rb, line 75
def tags
  attributes.fetch(:tags)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/diagnostic.rb, line 100
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/diagnostic.rb, line 104
def to_json(*args)
  to_hash.to_json(*args)
end