Class: LanguageServer::Protocol::Interface::Registration

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

Overview

General parameters to register for a capability.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, method:, register_options: nil) ⇒ Registration

Returns a new instance of Registration.



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

def initialize(id:, method:, register_options: nil)
  @attributes = {}

  @attributes[:id] = id
  @attributes[:method] = method
  @attributes[:registerOptions] = register_options if register_options

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



43
44
45
# File 'lib/language_server/protocol/interface/registration.rb', line 43

def attributes
  @attributes
end

Instance Method Details

#idstring

The id used to register the request. The id can be used to deregister the request again.

Returns:

  • (string)


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

def id
  attributes.fetch(:id)
end

#methodstring

The method / capability to register for.

Returns:

  • (string)


31
32
33
# File 'lib/language_server/protocol/interface/registration.rb', line 31

def method
  attributes.fetch(:method)
end

#register_optionsLSPAny

Options necessary for the registration.

Returns:

  • (LSPAny)


39
40
41
# File 'lib/language_server/protocol/interface/registration.rb', line 39

def register_options
  attributes.fetch(:registerOptions)
end

#to_hashObject



45
46
47
# File 'lib/language_server/protocol/interface/registration.rb', line 45

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



49
50
51
# File 'lib/language_server/protocol/interface/registration.rb', line 49

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