Class: LanguageServer::Protocol::Interface::ShowDocumentParams

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/show_document_params.rb,
sig/language_server/protocol/interface/show_document_params.rbs

Overview

Params to show a document.

Since:

  • 3.16.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri:, external: nil, take_focus: nil, selection: nil) ⇒ ShowDocumentParams

Returns a new instance of ShowDocumentParams.

Parameters:

  • uri: (String)
  • external: (Boolean) (defaults to: nil)
  • take_focus: (Boolean) (defaults to: nil)
  • selection: (Object) (defaults to: nil)

Since:

  • 3.16.0



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

def initialize(uri:, external: nil, take_focus: nil, selection: nil)
  @attributes = {}

  @attributes[:uri] = uri
  @attributes[:external] = external if external
  @attributes[:takeFocus] = take_focus if take_focus
  @attributes[:selection] = selection if selection

  @attributes.freeze
end

Instance Attribute Details

#attributesHash[Symbol, untyped] (readonly)

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.16.0



61
62
63
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 61

def attributes
  @attributes
end

Instance Method Details

#externalboolean

Indicates to show the resource in an external program. To show for example https://code.visualstudio.com/ in the default WEB browser set external to true.

Returns:

  • (boolean)

Since:

  • 3.16.0



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

def external
  attributes.fetch(:external)
end

#selectionRange

An optional selection range if the document is a text document. Clients might ignore the property if an external program is started or the file is not a text file.

Returns:

Since:

  • 3.16.0



57
58
59
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 57

def selection
  attributes.fetch(:selection)
end

#take_focusboolean

An optional property to indicate whether the editor showing the document should take focus or not. Clients might ignore this property if an external program is started.

Returns:

  • (boolean)

Since:

  • 3.16.0



46
47
48
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 46

def take_focus
  attributes.fetch(:takeFocus)
end

#to_hashHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.16.0



63
64
65
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 63

def to_hash
  attributes
end

#to_json(*args) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)

Since:

  • 3.16.0



67
68
69
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 67

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

#uriURI

The document uri to show.

Returns:

  • (URI)

Since:

  • 3.16.0



25
26
27
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 25

def uri
  attributes.fetch(:uri)
end