Class: LSP::DocumentLink

Inherits:
LSPBase show all
Defined in:
lib/lsp/lsp_types.rb

Overview

export interface DocumentLink

/**
 * The range this link applies to.
 */
range: Range;
/**
 * The uri this link points to.
 */
target?: string;
/**
 * The tooltip text when you hover over this link.
 *
 * If a tooltip is provided, is will be displayed in a string that includes instructions on how to
 * trigger the link, such as `{0 (ctrl + click)`. The specific instructions vary depending on OS,
 * user settings, and localization.
 *
 * @since 3.15.0
 */
tooltip?: string;
/**
 * A data entry field that is preserved on a document link between a
 * DocumentLinkRequest and a DocumentLinkResolveRequest.
 */
data?: any;

}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ DocumentLink

Returns a new instance of DocumentLink.



1379
1380
1381
1382
# File 'lib/lsp/lsp_types.rb', line 1379

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[target tooltip data]
end

Instance Attribute Details

#dataObject

type: Range # type: string # type: string # type: any



1377
1378
1379
# File 'lib/lsp/lsp_types.rb', line 1377

def data
  @data
end

#rangeObject

type: Range # type: string # type: string # type: any



1377
1378
1379
# File 'lib/lsp/lsp_types.rb', line 1377

def range
  @range
end

#targetObject

type: Range # type: string # type: string # type: any



1377
1378
1379
# File 'lib/lsp/lsp_types.rb', line 1377

def target
  @target
end

#tooltipObject

type: Range # type: string # type: string # type: any



1377
1378
1379
# File 'lib/lsp/lsp_types.rb', line 1377

def tooltip
  @tooltip
end

Instance Method Details

#from_h!(value) ⇒ Object



1384
1385
1386
1387
1388
1389
1390
1391
# File 'lib/lsp/lsp_types.rb', line 1384

def from_h!(value)
  value = {} if value.nil?
  self.range = Range.new(value['range']) unless value['range'].nil?
  self.target = value['target']
  self.tooltip = value['tooltip']
  self.data = value['data']
  self
end