Class: LanguageServer::Protocol::Interface::Diagnostic
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::Diagnostic
- Defined in:
- lib/language_server/protocol/interface/diagnostic.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#code ⇒ string | number
The diagnostic’s code, which might appear in the user interface.
-
#initialize(range:, severity: nil, code: nil, source: nil, message:, related_information: nil) ⇒ Diagnostic
constructor
A new instance of Diagnostic.
-
#message ⇒ string
The diagnostic’s message.
-
#range ⇒ Range
The range at which the message applies.
-
#related_information ⇒ DiagnosticRelatedInformation[]
An array of related diagnostic information, e.g.
-
#severity ⇒ number
The diagnostic’s severity.
-
#source ⇒ string
A human-readable string describing the source of this diagnostic, e.g.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(range:, severity: nil, code: nil, source: nil, message:, related_information: nil) ⇒ Diagnostic
Returns a new instance of Diagnostic.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 5 def initialize(range:, severity: nil, code: nil, source: nil, message:, related_information: nil) @attributes = {} @attributes[:range] = range @attributes[:severity] = severity if severity @attributes[:code] = code if code @attributes[:source] = source if source @attributes[:message] = @attributes[:relatedInformation] = if @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
69 70 71 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 69 def attributes @attributes end |
Instance Method Details
#code ⇒ string | number
The diagnostic’s code, which might appear in the user interface.
39 40 41 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 39 def code attributes.fetch(:code) end |
#message ⇒ string
The diagnostic’s message.
56 57 58 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 56 def attributes.fetch(:message) end |
#range ⇒ Range
The range at which the message applies.
22 23 24 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 22 def range attributes.fetch(:range) end |
#related_information ⇒ DiagnosticRelatedInformation[]
An array of related diagnostic information, e.g. when symbol-names within a scope collide all definitions can be marked via this property.
65 66 67 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 65 def attributes.fetch(:relatedInformation) end |
#severity ⇒ number
The diagnostic’s severity. Can be omitted. If omitted it is up to the client to interpret diagnostics as error, warning, info or hint.
31 32 33 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 31 def severity attributes.fetch(:severity) end |
#source ⇒ string
A human-readable string describing the source of this diagnostic, e.g. ‘typescript’ or ‘super lint’.
48 49 50 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 48 def source attributes.fetch(:source) end |
#to_hash ⇒ Object
71 72 73 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 71 def to_hash attributes end |
#to_json(*args) ⇒ Object
75 76 77 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 75 def to_json(*args) to_hash.to_json(*args) end |