Class: LSP::Diagnostic
Overview
export interface Diagnostic
/**
* The range at which the message applies
*/
range: Range;
/**
* The diagnostic's severity. Can be omitted. If omitted it is up to the
* client to interpret diagnostics as error, warning, info or hint.
*/
severity?: DiagnosticSeverity;
/**
* The diagnostic's code, which usually appear in the user interface.
*/
code?: number | string;
/**
* A human-readable string describing the source of this
* diagnostic, e.g. 'typescript' or 'super lint'. It usually
* appears in the user interface.
*/
source?: string;
/**
* The diagnostic's message. It usually appears in the user interface
*/
message: string;
/**
* Additional metadata about the diagnostic.
*/
tags?: DiagnosticTag[];
/**
* An array of related diagnostic information, e.g. when symbol-names within
* a scope collide all definitions can be marked via this property.
*/
relatedInformation?: DiagnosticRelatedInformation[];
Instance Attribute Summary collapse
-
#code ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[].
-
#message ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[].
-
#range ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[].
-
#relatedInformation ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[].
-
#severity ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[].
-
#source ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[].
-
#tags ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[].
Instance Method Summary collapse
- #from_h!(value) ⇒ Object
-
#initialize(initial_hash = nil) ⇒ Diagnostic
constructor
A new instance of Diagnostic.
Methods inherited from LSPBase
Constructor Details
#initialize(initial_hash = nil) ⇒ Diagnostic
Returns a new instance of Diagnostic.
307 308 309 310 |
# File 'lib/lsp/lsp_types.rb', line 307 def initialize(initial_hash = nil) super @optional_method_names = %i[severity code source tags relatedInformation] end |
Instance Attribute Details
#code ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[]
305 306 307 |
# File 'lib/lsp/lsp_types.rb', line 305 def code @code end |
#message ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[]
305 306 307 |
# File 'lib/lsp/lsp_types.rb', line 305 def @message end |
#range ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[]
305 306 307 |
# File 'lib/lsp/lsp_types.rb', line 305 def range @range end |
#relatedInformation ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[]
305 306 307 |
# File 'lib/lsp/lsp_types.rb', line 305 def @relatedInformation end |
#severity ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[]
305 306 307 |
# File 'lib/lsp/lsp_types.rb', line 305 def severity @severity end |
#source ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[]
305 306 307 |
# File 'lib/lsp/lsp_types.rb', line 305 def source @source end |
#tags ⇒ Object
type: Range # type: DiagnosticSeverity # type: number | string # type: string # type: string # type: DiagnosticTag[] # type: DiagnosticRelatedInformation[]
305 306 307 |
# File 'lib/lsp/lsp_types.rb', line 305 def @tags end |
Instance Method Details
#from_h!(value) ⇒ Object
312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/lsp/lsp_types.rb', line 312 def from_h!(value) value = {} if value.nil? self.range = Range.new(value['range']) unless value['range'].nil? self.severity = value['severity'] # Unknown type self.code = value['code'] # Unknown type self.source = value['source'] self. = value['message'] self. = value['tags'].map { |val| val } unless value['tags'].nil? # Unknown array type self. = to_typed_aray(value['relatedInformation'], DiagnosticRelatedInformation) self end |