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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of InitializeParams.

Parameters:

  • process_id: (Integer, nil)
  • client_info: (Object) (defaults to: nil)
  • locale: (String) (defaults to: nil)
  • root_path: (String, nil) (defaults to: nil)
  • root_uri: (String, nil)
  • capabilities: (Object)
  • initialization_options: (Object) (defaults to: nil)
  • trace: (Object) (defaults to: nil)
  • work_done_token: (Object) (defaults to: nil)
  • workspace_folders: (Array[untyped], nil) (defaults to: nil)


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

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

  @attributes[:processId] = process_id
  @attributes[:clientInfo] = client_info if client_info
  @attributes[:locale] = locale if locale
  @attributes[:rootPath] = root_path if root_path
  @attributes[:rootUri] = root_uri
  @attributes[:capabilities] = capabilities
  @attributes[:initializationOptions] = initialization_options if initialization_options
  @attributes[:trace] = trace if trace
  @attributes[:workDoneToken] = work_done_token if work_done_token
  @attributes[:workspaceFolders] = workspace_folders if workspace_folders

  @attributes.freeze
end

Instance Attribute Details

#attributesHash[Symbol, untyped] (readonly)

Returns the value of attribute attributes.

Returns:

  • (Hash[Symbol, untyped])


128
129
130
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 128

def attributes
  @attributes
end

Instance Method Details

#capabilitiesClientCapabilities

The capabilities provided by the client (editor or tool)

Returns:



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

def capabilities
  attributes.fetch(:capabilities)
end

#client_info{ name: string; version?: string; }

Information about the client

Returns:

  • ({ name: string; version?: string; })

Since:

  • 3.15.0



40
41
42
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 40

def client_info
  attributes.fetch(:clientInfo)
end

#initialization_optionsLSPAny

User provided initialization options.

Returns:

  • (LSPAny)


94
95
96
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 94

def initialization_options
  attributes.fetch(:initializationOptions)
end

#localestring

The locale the client is currently showing the user interface in. This must not necessarily be the locale of the operating system.

Uses IETF language tags as the value's syntax (See https://en.wikipedia.org/wiki/IETF_language_tag)

Returns:

  • (string)

Since:

  • 3.16.0



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

def locale
  attributes.fetch(:locale)
end

#process_idinteger | nil

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.

Returns:

  • (integer | nil)


30
31
32
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 30

def process_id
  attributes.fetch(:processId)
end

#root_pathstring

Deprecated.

in favour of rootUri.

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

Returns:

  • (string)


66
67
68
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 66

def root_path
  attributes.fetch(:rootPath)
end

#root_uriDocumentUri | nil

Deprecated.

in favour of workspaceFolders.

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

Returns:

  • (DocumentUri | nil)


78
79
80
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 78

def root_uri
  attributes.fetch(:rootUri)
end

#to_hashHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


130
131
132
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 130

def to_hash
  attributes
end

#to_json(*args) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)


134
135
136
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 134

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

#traceTraceValues

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

Returns:

  • (TraceValues)


102
103
104
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 102

def trace
  attributes.fetch(:trace)
end

#work_done_tokenProgressToken

An optional token that a server can use to report work done progress.

Returns:

  • (ProgressToken)


110
111
112
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 110

def work_done_token
  attributes.fetch(:workDoneToken)
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.

Returns:

Since:

  • 3.6.0



124
125
126
# File 'lib/language_server/protocol/interface/initialize_params.rb', line 124

def workspace_folders
  attributes.fetch(:workspaceFolders)
end