Class: LanguageServer::Protocol::Interface::DiagnosticRelatedInformation

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/diagnostic_related_information.rb

Overview

Represents a related message and source code location for a diagnostic. This should be used to point to code locations that cause or are related to a diagnostics, e.g when duplicating a symbol in a scope.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location:, message:) ⇒ DiagnosticRelatedInformation

Returns a new instance of DiagnosticRelatedInformation.



10
11
12
13
14
15
16
17
# File 'lib/language_server/protocol/interface/diagnostic_related_information.rb', line 10

def initialize(location:, message:)
  @attributes = {}

  @attributes[:location] = location
  @attributes[:message] = message

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



35
36
37
# File 'lib/language_server/protocol/interface/diagnostic_related_information.rb', line 35

def attributes
  @attributes
end

Instance Method Details

#locationLocation

The location of this related diagnostic information.

Returns:



23
24
25
# File 'lib/language_server/protocol/interface/diagnostic_related_information.rb', line 23

def location
  attributes.fetch(:location)
end

#messagestring

The message of this related diagnostic information.

Returns:

  • (string)


31
32
33
# File 'lib/language_server/protocol/interface/diagnostic_related_information.rb', line 31

def message
  attributes.fetch(:message)
end

#to_hashObject



37
38
39
# File 'lib/language_server/protocol/interface/diagnostic_related_information.rb', line 37

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



41
42
43
# File 'lib/language_server/protocol/interface/diagnostic_related_information.rb', line 41

def to_json(*args)
  to_hash.to_json(*args)
end