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:, tags: nil, 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 ⇒ DiagnosticSeverity
The diagnostic’s severity.
-
#source ⇒ string
A human-readable string describing the source of this diagnostic, e.g.
-
#tags ⇒ DiagnosticTag[]
Additional metadata about the diagnostic.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(range:, severity: nil, code: nil, source: nil, message:, tags: nil, related_information: nil) ⇒ Diagnostic
Returns a new instance of Diagnostic.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 5 def initialize(range:, severity: nil, code: nil, source: nil, message:, tags: nil, 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[:tags] = if @attributes[:relatedInformation] = if @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
78 79 80 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 78 def attributes @attributes end |
Instance Method Details
#code ⇒ string | number
The diagnostic’s code, which might appear in the user interface.
40 41 42 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 40 def code attributes.fetch(:code) end |
#message ⇒ string
The diagnostic’s message.
57 58 59 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 57 def attributes.fetch(:message) end |
#range ⇒ Range
The range at which the message applies.
23 24 25 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 23 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.
74 75 76 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 74 def attributes.fetch(:relatedInformation) end |
#severity ⇒ DiagnosticSeverity
The diagnostic’s severity. Can be omitted. If omitted it is up to the client to interpret diagnostics as error, warning, info or hint.
32 33 34 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 32 def severity attributes.fetch(:severity) end |
#source ⇒ string
A human-readable string describing the source of this diagnostic, e.g. ‘typescript’ or ‘super lint’.
49 50 51 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 49 def source attributes.fetch(:source) end |
#tags ⇒ DiagnosticTag[]
Additional metadata about the diagnostic.
65 66 67 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 65 def attributes.fetch(:tags) end |
#to_hash ⇒ Object
80 81 82 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 80 def to_hash attributes end |
#to_json(*args) ⇒ Object
84 85 86 |
# File 'lib/language_server/protocol/interface/diagnostic.rb', line 84 def to_json(*args) to_hash.to_json(*args) end |