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 document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri:, external: nil, take_focus: nil, selection: nil) ⇒ 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 https://code.visualstudio.com/ in the default WEB browser set external to true.



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.



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.



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 document uri to show.



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

def uri
  attributes.fetch(:uri)
end