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:, 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.



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

#attributesObject (readonly)

Returns the value of attribute attributes.



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 } | nil

Information about the client

Returns:

  • ({ name:string, version:string } | nil)

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 | nil

User provided initialization options.

Returns:

  • (LSPAny | nil)


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

def initialization_options
  attributes.fetch(:initializationOptions)
end

#localestring | nil

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 en.wikipedia.org/wiki/IETF_language_tag)

Returns:

  • (string | nil)

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 | null

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 | null)


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

def process_id
  attributes.fetch(:processId)
end

#root_pathstring | null

Deprecated.

in favour of rootUri.

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

Returns:

  • (string | null)


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

def root_path
  attributes.fetch(:rootPath)
end

#root_uriDocumentUri | null

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 | null)


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

def root_uri
  attributes.fetch(:rootUri)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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

#trace"off" | "messages" | "compact" | "verbose" | nil

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

Returns:

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


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

def trace
  attributes.fetch(:trace)
end

#work_done_tokenProgressToken | nil

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

Returns:

  • (ProgressToken | nil)


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

def work_done_token
  attributes.fetch(:workDoneToken)
end

#workspace_foldersWorkspaceFolder[] | null

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