Skip to content

Commit

Permalink
feat(lsp): pass client_id to on_initialized
Browse files Browse the repository at this point in the history
feat(lsp): pass `client_id` to `on_initialized`

feat(lsp): pass client_id to on_initialized (#582) (#583)
  • Loading branch information
mrcjkb committed Nov 18, 2024
1 parent cd7deac commit 320cb14
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
38 changes: 19 additions & 19 deletions doc/rustaceanvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,35 +156,35 @@ rustaceanvim.tools.Opts *rustaceanvim.tools.Opts*

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


rustaceanvim.Executor *rustaceanvim.Executor*
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ vim.g.rustaceanvim = vim.g.rustaceanvim
---@field enable_clippy? boolean
---
---Function that is invoked when the LSP server has finished initializing
---@field on_initialized? fun(health:rustaceanvim.RAInitializedStatus)
---@field on_initialized? fun(health:rustaceanvim.RAInitializedStatus, client_id:integer)
---
---Automatically call `RustReloadWorkspace` when writing to a Cargo.toml file
---@field reload_workspace_from_cargo_toml? boolean
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/config/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ local RustaceanDefaultConfig = {

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

--- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/server_status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ see ':h rustaceanvim.lsp.ClientOpts'.
end
-- Load user on_initialized
if config.tools.on_initialized then
config.tools.on_initialized(result)
config.tools.on_initialized(result, ctx.client_id)
end
if config.dap.autoload_configurations then
require('rustaceanvim.commands.debuggables').add_dap_debuggables()
Expand Down

0 comments on commit 320cb14

Please sign in to comment.