Skip to content

Commit 900c6c5

Browse files
authored
feat(lsp): pass client_id to on_initialized (#584)
1 parent cd7deac commit 900c6c5

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

doc/rustaceanvim.txt

+19-19
Original file line numberDiff line numberDiff line change
@@ -156,35 +156,35 @@ rustaceanvim.tools.Opts *rustaceanvim.tools.Opts*
156156

157157
Fields: ~
158158
{executor?} (rustaceanvim.Executor|rustaceanvim.executor_alias)
159-
The executor to use for runnables/debuggables
159+
The executor to use for runnables/debuggables
160160
{test_executor?} (rustaceanvim.Executor|rustaceanvim.test_executor_alias)
161-
The executor to use for runnables that are tests / testables
161+
The executor to use for runnables that are tests / testables
162162
{crate_test_executor?} (rustaceanvim.Executor|rustaceanvim.test_executor_alias)
163-
The executor to use for runnables that are crate test suites (--all-targets)
163+
The executor to use for runnables that are crate test suites (--all-targets)
164164
{cargo_override?} (string)
165-
Set this to override the 'cargo' command for runnables, debuggables (etc., e.g. to 'cross').
166-
If set, this takes precedence over 'enable_nextest'.
165+
Set this to override the 'cargo' command for runnables, debuggables (etc., e.g. to 'cross').
166+
If set, this takes precedence over 'enable_nextest'.
167167
{enable_nextest?} (boolean)
168-
Whether to enable nextest. If enabled, `cargo test` commands will be transformed to `cargo nextest run` commands.
169-
Defaults to `true` if cargo-nextest is detected. Ignored if `cargo_override` is set.
168+
Whether to enable nextest. If enabled, `cargo test` commands will be transformed to `cargo nextest run` commands.
169+
Defaults to `true` if cargo-nextest is detected. Ignored if `cargo_override` is set.
170170
{enable_clippy?} (boolean)
171-
Whether to enable clippy checks on save if a clippy installation is detected.
172-
Default: `true`
173-
{on_initialized?} (fun(health:rustaceanvim.RAInitializedStatus))
174-
Function that is invoked when the LSP server has finished initializing
171+
Whether to enable clippy checks on save if a clippy installation is detected.
172+
Default: `true`
173+
{on_initialized?} (fun(health:rustaceanvim.RAInitializedStatus,client_id:integer))
174+
Function that is invoked when the LSP server has finished initializing
175175
{reload_workspace_from_cargo_toml?} (boolean)
176-
Automatically call `RustReloadWorkspace` when writing to a Cargo.toml file
177-
{hover_actions?} (rustaceanvim.hover-actions.Opts) Options for hover actions
178-
{code_actions?} (rustaceanvim.code-action.Opts) Options for code actions
176+
Automatically call `RustReloadWorkspace` when writing to a Cargo.toml file
177+
{hover_actions?} (rustaceanvim.hover-actions.Opts) Options for hover actions
178+
{code_actions?} (rustaceanvim.code-action.Opts) Options for code actions
179179
{float_win_config?} (rustaceanvim.FloatWinConfig)
180-
Options applied to floating windows.
181-
See |api-win_config|.
180+
Options applied to floating windows.
181+
See |api-win_config|.
182182
{create_graph?} (rustaceanvim.crate-graph.Opts)
183-
Options for showing the crate graph based on graphviz and the dot
183+
Options for showing the crate graph based on graphviz and the dot
184184
{open_url?} (fun(url:string):nil)
185-
If set, overrides how to open URLs
185+
If set, overrides how to open URLs
186186
{rustc?} (rustaceanvim.rustc.Opts)
187-
Options for `rustc`
187+
Options for `rustc`
188188

189189

190190
rustaceanvim.Executor *rustaceanvim.Executor*

lua/rustaceanvim/config/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ vim.g.rustaceanvim = vim.g.rustaceanvim
7878
---@field enable_clippy? boolean
7979
---
8080
---Function that is invoked when the LSP server has finished initializing
81-
---@field on_initialized? fun(health:rustaceanvim.RAInitializedStatus)
81+
---@field on_initialized? fun(health:rustaceanvim.RAInitializedStatus, client_id:integer)
8282
---
8383
---Automatically call `RustReloadWorkspace` when writing to a Cargo.toml file
8484
---@field reload_workspace_from_cargo_toml? boolean

lua/rustaceanvim/config/internal.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ local RustaceanDefaultConfig = {
106106

107107
--- callback to execute once rust-analyzer is done initializing the workspace
108108
--- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
109-
---@type fun(health:rustaceanvim.RAInitializedStatus) | nil
109+
---@type fun(health:rustaceanvim.RAInitializedStatus, client_id:integer) | nil
110110
on_initialized = nil,
111111

112112
--- automatically call RustReloadWorkspace when writing to a Cargo.toml file.

lua/rustaceanvim/server_status.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ see ':h rustaceanvim.lsp.ClientOpts'.
5858
end
5959
-- Load user on_initialized
6060
if config.tools.on_initialized then
61-
config.tools.on_initialized(result)
61+
config.tools.on_initialized(result, ctx.client_id)
6262
end
6363
if config.dap.autoload_configurations then
6464
require('rustaceanvim.commands.debuggables').add_dap_debuggables()

0 commit comments

Comments
 (0)