Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

fix(standalone): call user on_init #423

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/rust-tools.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*rust-tools.txt* For NVIM v0.8.0 Last change: 2023 July 10
*rust-tools.txt* For NVIM v0.8.0 Last change: 2023 September 25

==============================================================================
Table of Contents *rust-tools-table-of-contents*
Expand Down
6 changes: 5 additions & 1 deletion lua/rust-tools/standalone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ function M.start_standalone_client()
filetypes = { "rust" },
init_options = { detachedFiles = { vim.api.nvim_buf_get_name(0) } },
name = "rust_analyzer-standalone",
on_init = function(client)
on_init = function(client, initialize_result)
local current_buf = vim.api.nvim_get_current_buf()
vim.lsp.buf_attach_client(0, client.id)
local on_init = rt.config.options.server.on_init
if on_init then
on_init(client, initialize_result)
end
local on_attach = rt.config.options.server.on_attach
if on_attach then
on_attach(client, current_buf)
Expand Down