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

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

Overview

Params to show a resource.

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.



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

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

#attributesObject (readonly)

Returns the value of attribute attributes.



59
60
61
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 59

def attributes
  @attributes
end

Instance Method Details

#externalboolean

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

Returns:

  • (boolean)


33
34
35
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 33

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:



55
56
57
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 55

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)


44
45
46
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 44

def take_focus
  attributes.fetch(:takeFocus)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



65
66
67
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 65

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

#uristring

The uri to show.

Returns:

  • (string)


23
24
25
# File 'lib/language_server/protocol/interface/show_document_params.rb', line 23

def uri
  attributes.fetch(:uri)
end