Class: LanguageServer::Protocol::Interface::InitializeParams

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(process_id:, root_path: nil, root_uri:, initialization_options: nil, capabilities:, trace: nil, workspace_folders: nil) ⇒ InitializeParams

Returns a new instance of InitializeParams.



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

def initialize(process_id:, root_path: nil, root_uri:, initialization_options: nil, capabilities:, trace: nil, workspace_folders: nil)
  @attributes = {}

  @attributes[:processId] = process_id
  @attributes[:rootPath] = root_path if root_path
  @attributes[:rootUri] = root_uri
  @attributes[:initializationOptions] = initialization_options if initialization_options
  @attributes[:capabilities] = capabilities
  @attributes[:trace] = trace if trace
  @attributes[:workspaceFolders] = workspace_folders if workspace_folders

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



85
86
87
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 85

def attributes
  @attributes
end

Instance Method Details

#capabilitiesClientCapabilities

The capabilities provided by the client (editor or tool)

Returns:



60
61
62
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 60

def capabilities
  attributes.fetch(:capabilities)
end

#initialization_optionsany

User provided initialization options.

Returns:

  • (any)


52
53
54
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 52

def initialization_options
  attributes.fetch(:initializationOptions)
end

#process_idnumber

The process Id of the parent process that started the server. Is null if the process has not been started by another process. If the parent process is not alive then the server should exit (see exit notification) its process.

Returns:

  • (number)


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

def process_id
  attributes.fetch(:processId)
end

#root_pathstring

The rootPath of the workspace. Is null if no folder is open.

Returns:

  • (string)


34
35
36
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 34

def root_path
  attributes.fetch(:rootPath)
end

#root_uristring

The rootUri of the workspace. Is null if no folder is open. If both ‘rootPath` and `rootUri` are set `rootUri` wins.

Returns:

  • (string)


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

def root_uri
  attributes.fetch(:rootUri)
end

#to_hashObject



87
88
89
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 87

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



91
92
93
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 91

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

#trace"off" | "messages" | "verbose"

The initial trace setting. If omitted trace is disabled (‘off’).

Returns:

  • ("off" | "messages" | "verbose")


68
69
70
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 68

def trace
  attributes.fetch(:trace)
end

#workspace_foldersWorkspaceFolder[]

The workspace folders configured in the client when the server starts. This property is only available if the client supports workspace folders. It can be ‘null` if the client supports workspace folders but none are configured.

Since 3.6.0

Returns:



81
82
83
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 81

def workspace_folders
  attributes.fetch(:workspaceFolders)
end