1

Refresh generated nvim config

This commit is contained in:
2024-06-03 21:11:20 +02:00
parent fd506d4921
commit 50723ef645
2114 changed files with 84528 additions and 44473 deletions

View File

@ -234,12 +234,13 @@ RustcOpts *RustcOpts*
RustaceanLspClientOpts *RustaceanLspClientOpts*
Fields: ~
{auto_attach?} (boolean|fun(bufnr:integer):boolean) Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found.
{cmd?} (string[]|fun():string[]) Command and arguments for starting rust-analyzer
{settings?} (table|fun(project_root:string|nil,default_settings:table):table) Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration.
{standalone?} (boolean) Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time.
{logfile?} (string) The path to the rust-analyzer log file.
{load_vscode_settings?} (boolean) Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options. Default: false
{auto_attach?} (boolean|fun(bufnr:integer):boolean) Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found.
{cmd?} (string[]|fun():string[]) Command and arguments for starting rust-analyzer
{root_dir?} (string|fun(filename:string,default:fun(filename:string):string|nil):string|nil) The directory to use for the attached LSP. Can be a function, which may return nil if no server should attach. The second argument contains the default implementation, which can be used for fallback behavior.
{settings?} (table|fun(project_root:string|nil,default_settings:table):table) Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration.
{standalone?} (boolean) Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time.
{logfile?} (string) The path to the rust-analyzer log file.
{load_vscode_settings?} (boolean) Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options. Default: false
RustaceanDapOpts *RustaceanDapOpts*

View File

@ -46,19 +46,12 @@ end
vim.g.loaded_rustaceanvim = true
local bufnr = vim.api.nvim_get_current_buf()
local auto_attach = config.server.auto_attach
if type(auto_attach) == 'function' then
local bufnr = vim.api.nvim_get_current_buf()
auto_attach = auto_attach(bufnr)
end
if auto_attach then
-- Defer for a smoother experience on low-end devices
vim.api.nvim_create_autocmd('BufEnter', {
buffer = bufnr,
group = vim.api.nvim_create_augroup('RustaceanvimAttach', { clear = true }),
callback = function()
require('rustaceanvim.lsp').start()
end,
})
require('rustaceanvim.lsp').start()
end

View File

@ -1,21 +0,0 @@
Line 1-1
Line 1-2
Line 1-3
Line 1-4
Line 1-5
Line 1-6
Line 1-7
Line 1-8
Line 1-9
Line 1-10
Line 1-11
Line 1-12
Line 1-13
Line 1-14
Line 1-15
Line 1-16
Line 1-17
Line 1-18
Line 1-19
Line 1-20
Line 1-21

View File

@ -1,21 +0,0 @@
Line 2-1
Line 2-2
Line 2-3
Line 2-4
Line 2-5
Line 2-6
Line 2-7
Line 2-8
Line 2-9
Line 2-10
Line 2-11
Line 2-12
Line 2-13
Line 2-14
Line 2-15
Line 2-16
Line 2-17
Line 2-18
Line 2-19
Line 2-20
Line 2-21

View File

@ -1,17 +0,0 @@
vim.cmd('hi DevIconLicense guifg=#111111')
vim.cmd('hi DevIconMakefile guifg=#222222')
vim.cmd('hi DevIconGif guifg=#333333')
vim.cmd('hi DevIconLua guifg=#444444')
vim.cmd('hi DevIconTxt guifg=#555555')
vim.cmd('hi DevIconDefault guifg=#666666')
return {
get_icon = function(filename, _, options)
if filename == 'LICENSE' then return '', 'DevIconLicense' end
if filename == 'Makefile' then return '', 'DevIconMakefile' end
if vim.endswith(filename, 'gif') then return '', 'DevIconGif' end
if vim.endswith(filename, 'lua') then return '', 'DevIconLua' end
if vim.endswith(filename, 'txt') then return '', 'DevIconTxt' end
if (options or {}).default then return '', 'DevIconDefault' end
end,
}

View File

@ -1,5 +0,0 @@
Error Warning Info Hint
Error
Warning
Info
Hint

View File

@ -1,4 +0,0 @@
Error
Warning
Info
Hint

View File

@ -1,34 +0,0 @@
local severity = vim.diagnostic.severity
_G.diag_ns = vim.api.nvim_create_namespace('mock-diagnostics')
-- Open files
vim.cmd('edit tests/dir-extra/mocks/diagnostic-file-1')
_G.buf_id_1 = vim.api.nvim_get_current_buf()
vim.cmd('edit tests/dir-extra/mocks/diagnostic-file-2')
_G.buf_id_2 = vim.api.nvim_get_current_buf()
-- Define diagnostic
--stylua: ignore
_G.diagnostic_arr = {
-- Several entries on one line
{ bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 0, end_col = 5, message = 'Error 1', severity = severity.ERROR },
{ bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 6, end_col = 13, message = 'Warning 1', severity = severity.WARN },
{ bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 14, end_col = 18, message = 'Info 1', severity = severity.INFO },
{ bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 19, end_col = 23, message = 'Hint 1', severity = severity.HINT },
-- Entries on separate lines not at line start
{ bufnr = buf_id_1, lnum = 1, end_lnum = 1, col = 2, end_col = 7, message = 'Error 2', severity = severity.ERROR },
{ bufnr = buf_id_1, lnum = 2, end_lnum = 2, col = 2, end_col = 9, message = 'Warning 2', severity = severity.WARN },
{ bufnr = buf_id_1, lnum = 3, end_lnum = 3, col = 2, end_col = 6, message = 'Info 2', severity = severity.INFO },
{ bufnr = buf_id_1, lnum = 4, end_lnum = 4, col = 2, end_col = 6, message = 'Hint 2', severity = severity.HINT },
-- Another buffer
{ bufnr = buf_id_2, lnum = 0, end_lnum = 0, col = 0, end_col = 5, message = 'Error 3', severity = severity.ERROR },
{ bufnr = buf_id_2, lnum = 1, end_lnum = 1, col = 0, end_col = 7, message = 'Warning 3', severity = severity.WARN },
{ bufnr = buf_id_2, lnum = 2, end_lnum = 2, col = 0, end_col = 4, message = 'Info 3', severity = severity.INFO },
{ bufnr = buf_id_2, lnum = 3, end_lnum = 3, col = 0, end_col = 4, message = 'Hint 3', severity = severity.HINT },
}
-- Set diagnostic
vim.diagnostic.set(diag_ns, buf_id_1, vim.tbl_filter(function(x) return x.bufnr == buf_id_1 end, _G.diagnostic_arr), {})
vim.diagnostic.set(diag_ns, buf_id_2, vim.tbl_filter(function(x) return x.bufnr == buf_id_2 end, _G.diagnostic_arr), {})

View File

@ -1,18 +0,0 @@
commit 1111111111111111111111111111111111111111
Author: Mini Nvim <mini.nvim@emailaddress.com>
Date: Thu Jan 1 11:11:11 1970 +0300
Initial commit.
diff --git a/git-files/git-file-1 b/git-files/git-file-1
index 1111111..0123456 100644
--- a/git-files/git-file-1
+++ b/git-files/git-file-1
@@ -1,5 +1,5 @@
Line 1-1
-Line 1-2
Line 1-3
Line 1-4
Line 1-5
+Line 1-6

View File

@ -1,47 +0,0 @@
diff --git a/git-files/git-file-1 b/git-files/git-file-1
index c139d4e..234d24d 100644
--- a/git-files/git-file-1
+++ b/git-files/git-file-1
@@ -1,4 +1,3 @@
-Line 1-1
Line 1-2
Line 1-3
Line 1-4
@@ -9,6 +8,7 @@ Line 1-8
Line 1-9
Line 1-10
Line 1-11
+Line new
Line 1-12
Line 1-13
Line 1-14
@@ -18,4 +18,4 @@ Line 1-17
Line 1-18
Line 1-19
Line 1-20
-Line 1-21
+Line changed
diff --git a/git-files/git-file-2 b/git-files/git-file-2
index e45e3de..bd830d0 100644
--- a/git-files/git-file-2
+++ b/git-files/git-file-2
@@ -1,5 +1,4 @@
Line 2-1
-Line 2-2
Line 2-3
Line 2-4
Line 2-5
@@ -10,10 +9,11 @@ Line 2-9
Line 2-10
Line 2-11
Line 2-12
+Line new
Line 2-13
Line 2-14
Line 2-15
-Line 2-16
+Line changed
Line 2-17
Line 2-18
Line 2-19

View File

@ -1,23 +0,0 @@
diff --git a/git-files/git-file-1 b/git-files/git-file-1
index c139d4e..234d24d 100644
--- a/git-files/git-file-1
+++ b/git-files/git-file-1
@@ -1 +0,0 @@
-Line 1-1
@@ -11,0 +11 @@ Line 1-11
+Line new
@@ -21 +21 @@ Line 1-20
-Line 1-21
+Line changed
diff --git a/git-files/git-file-2 b/git-files/git-file-2
index e45e3de..bd830d0 100644
--- a/git-files/git-file-2
+++ b/git-files/git-file-2
@@ -2 +1,0 @@ Line 2-1
-Line 2-2
@@ -12,0 +12 @@ Line 2-12
+Line new
@@ -16 +16 @@ Line 2-15
-Line 2-16
+Line changed

View File

@ -1,57 +0,0 @@
diff --git a/git-files/git-file-1 b/git-files/git-file-1
index c139d4e..234d24d 100644
--- a/git-files/git-file-1
+++ b/git-files/git-file-1
@@ -1,21 +1,21 @@
-Line 1-1
Line 1-2
Line 1-3
Line 1-4
Line 1-5
Line 1-6
Line 1-7
Line 1-8
Line 1-9
Line 1-10
Line 1-11
+Line new
Line 1-12
Line 1-13
Line 1-14
Line 1-15
Line 1-16
Line 1-17
Line 1-18
Line 1-19
Line 1-20
-Line 1-21
+Line changed
diff --git a/git-files/git-file-2 b/git-files/git-file-2
index e45e3de..bd830d0 100644
--- a/git-files/git-file-2
+++ b/git-files/git-file-2
@@ -1,21 +1,21 @@
Line 2-1
-Line 2-2
Line 2-3
Line 2-4
Line 2-5
Line 2-6
Line 2-7
Line 2-8
Line 2-9
Line 2-10
Line 2-11
Line 2-12
+Line new
Line 2-13
Line 2-14
Line 2-15
-Line 2-16
+Line changed
Line 2-17
Line 2-18
Line 2-19
Line 2-20
Line 2-21

View File

@ -1,12 +0,0 @@
local tmp = 1
local keymap_rhs = function()
-- Comment
_G.been_here = true
end
--stylua: ignore
vim.api.nvim_set_keymap(
'n', 'ga', '',
{ callback = keymap_rhs, desc = 'Keymap with callback' }
)

View File

@ -1,96 +0,0 @@
local filename = vim.fn.fnamemodify('tests/dir-extra/real-files/a.lua', ':p')
_G.lsp_buf_calls = {}
local make_context = function(lsp_method)
return {
bufnr = vim.api.nvim_get_current_buf(),
method = lsp_method,
-- There are more fields, but none are relevant
}
end
vim.lsp.buf.declaration = function(opts)
table.insert(_G.lsp_buf_calls, 'declaration')
local data = {
context = make_context('textDocument/declaration'),
items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } },
title = 'Declaration',
}
opts.on_list(data)
end
vim.lsp.buf.definition = function(opts)
table.insert(_G.lsp_buf_calls, 'definition')
local data = {
context = make_context('textDocument/definition'),
items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } },
title = 'Definition',
}
opts.on_list(data)
end
vim.lsp.buf.document_symbol = function(opts)
table.insert(_G.lsp_buf_calls, 'document_symbol')
local data = {
context = make_context('textDocument/documentSymbol'),
items = {
{ col = 7, filename = filename, kind = 'Number', lnum = 1, text = '[Number] a' },
{ col = 7, filename = filename, kind = 'Object', lnum = 2, text = '[Object] t' },
{ col = 3, filename = filename, kind = 'Variable', lnum = 3, text = '[Variable] x' },
{ col = 3, filename = filename, kind = 'Variable', lnum = 4, text = '[Variable] y' },
},
title = 'Symbols in a.lua',
}
opts.on_list(data)
end
vim.lsp.buf.implementation = function(opts)
table.insert(_G.lsp_buf_calls, 'implementation')
local data = {
context = make_context('textDocument/implementation'),
items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } },
title = 'Implementation',
}
opts.on_list(data)
end
vim.lsp.buf.references = function(_, opts)
table.insert(_G.lsp_buf_calls, 'references')
local data = {
context = make_context('textDocument/references'),
items = {
{ col = 7, filename = filename, lnum = 1, text = 'local a = 1' },
{ col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' },
{ col = 16, filename = filename, lnum = 4, text = ' y = math.min(a, 2),' },
},
title = 'References',
}
opts.on_list(data)
end
vim.lsp.buf.type_definition = function(opts)
table.insert(_G.lsp_buf_calls, 'type_definition')
local data = {
context = make_context('textDocument/typeDefinition'),
items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } },
title = 'Type definition',
}
opts.on_list(data)
end
vim.lsp.buf.workspace_symbol = function(query, opts)
table.insert(_G.lsp_buf_calls, 'workspace_symbol')
_G.workspace_symbol_query = query
local data = {
context = make_context('textDocument/workspaceSymbol'),
items = {
{ col = 7, filename = filename, kind = 'Number', lnum = 1, text = '[Number] a' },
{ col = 7, filename = filename, kind = 'Object', lnum = 2, text = '[Object] t' },
{ col = 3, filename = filename, kind = 'Variable', lnum = 3, text = '[Variable] x' },
{ col = 3, filename = filename, kind = 'Variable', lnum = 4, text = '[Variable] y' },
},
title = "Symbols matching ''",
}
opts.on_list(data)
end

View File

@ -1,55 +0,0 @@
_G.process_log = {}
local n_pid, n_stream = 0, 0
local new_process = function(pid)
return {
pid = pid,
close = function(_) table.insert(_G.process_log, 'Process ' .. pid .. ' was closed.') end,
}
end
-- Mock streams by using global `_G.stdout_data_feed` and `_G.stderr_data_feed`
-- arrays as source. Each feed's element should be either string (for usable
-- data) or a table with `err` field (for error).
local stream_counts = {}
vim.loop.new_pipe = function()
-- NOTE: Use `_G.stream_type_queue` to determine which stream type to create
-- (for log purposes). This is to account for `vim.loop.spawn` creating
-- different sets of streams. Assume 'stdout' by default.
if _G.stream_type_queue == nil or #_G.stream_type_queue == 0 then _G.stream_type_queue = { 'stdout' } end
local stream_type = _G.stream_type_queue[1]
table.remove(_G.stream_type_queue, 1)
local new_count = (stream_counts[stream_type] or 0) + 1
stream_counts[stream_type] = new_count
local cur_stream_id = stream_type .. '_' .. new_count
return {
read_start = function(_, callback)
-- It is not possible in Neovim<=0.9 to execute `vim.fn` functions during
-- `pipe:read_start()`
local data_feed = stream_type == 'stdout' and _G.stdout_data_feed or _G.stderr_data_feed
for _, x in ipairs(data_feed or {}) do
if type(x) == 'table' then callback(x.err, nil) end
if type(x) == 'string' then callback(nil, x) end
end
callback(nil, nil)
end,
close = function() table.insert(_G.process_log, string.format('%s was closed.', cur_stream_id)) end,
}
end
_G.spawn_log = {}
vim.loop.spawn = function(path, options, on_exit)
local options_without_callables = vim.deepcopy(options)
options_without_callables.stdio = nil
table.insert(_G.spawn_log, { executable = path, options = options_without_callables })
vim.schedule(function() on_exit() end)
n_pid = n_pid + 1
local pid = 'Pid_' .. n_pid
return new_process(pid), pid
end
vim.loop.process_kill = function(process) table.insert(_G.process_log, 'Process ' .. process.pid .. ' was killed.') end

View File

@ -1,3 +0,0 @@
VAR ?= 1
all: test

View File

@ -1,5 +0,0 @@
local a = 1
local t = {
x = math.max(a, 2),
y = math.min(a, 2),
}

View File

@ -1,26 +0,0 @@
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
Line 21
Line 22
Line 23
Line 24
Line 25
Line 26

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

View File

@ -27,13 +27,29 @@ local function get_mb_active_client_root(file_name)
end
end
---Attempts to find the root for an existing active client. If no existing
---client root is found, returns the result of evaluating `config.root_dir`.
---@param config RustaceanLspClientConfig
---@param file_name string
---@return string | nil root_dir
function cargo.get_root_dir(file_name)
function cargo.get_config_root_dir(config, file_name)
local reuse_active = get_mb_active_client_root(file_name)
if reuse_active then
return reuse_active
end
local config_root_dir = config.root_dir
if type(config_root_dir) == 'function' then
return config_root_dir(file_name, cargo.get_root_dir)
else
return config_root_dir
end
end
---The default implementation used for `vim.g.rustaceanvim.server.root_dir`
---@param file_name string
---@return string | nil root_dir
function cargo.get_root_dir(file_name)
local path = file_name:find('%.rs$') and vim.fs.dirname(file_name) or file_name
if not path then
return nil

View File

@ -89,6 +89,7 @@ function M.validate(cfg)
cmd = { server.cmd, { 'function', 'table' } },
standalone = { server.standalone, 'boolean' },
settings = { server.settings, { 'function', 'table' }, true },
root_dir = { server.root_dir, { 'function', 'string' } },
})
if not ok then
return false, err

View File

@ -110,6 +110,7 @@ vim.g.rustaceanvim = vim.g.rustaceanvim
---@class RustaceanLspClientOpts
---@field auto_attach? boolean | fun(bufnr: integer):boolean Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found.
---@field cmd? string[] | fun():string[] Command and arguments for starting rust-analyzer
---@field root_dir? string | fun(filename: string, default: fun(filename: string):string|nil):string|nil The directory to use for the attached LSP. Can be a function, which may return nil if no server should attach. The second argument contains the default implementation, which can be used for fallback behavior.
---@field settings? table | fun(project_root:string|nil, default_settings: table):table Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration.
---@field standalone? boolean Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time.
---@field logfile? string The path to the rust-analyzer log file.

View File

@ -1,4 +1,5 @@
local types = require('rustaceanvim.types.internal')
local cargo = require('rustaceanvim.cargo')
local compat = require('rustaceanvim.compat')
local config = require('rustaceanvim.config')
local executors = require('rustaceanvim.executors')
@ -275,6 +276,10 @@ local RustaceanDefaultConfig = {
cmd = function()
return { 'rust-analyzer', '--log-file', RustaceanConfig.server.logfile }
end,
---@type string | fun(filename: string, default: fun(filename: string):string|nil):string|nil
root_dir = cargo.get_root_dir,
--- standalone file support
--- setting it to false may improve startup time
---@type boolean

View File

@ -95,7 +95,7 @@ M.start = function(bufnr)
local client_config = config.server
---@type LspStartConfig
local lsp_start_config = vim.tbl_deep_extend('force', {}, client_config)
local root_dir = cargo.get_root_dir(bufname)
local root_dir = cargo.get_config_root_dir(client_config, bufname)
if not root_dir then
--- No project root found. Start in detached/standalone mode.
root_dir = vim.fs.dirname(bufname)

View File

@ -27,12 +27,13 @@
---@diagnostic disable: duplicate-set-field
local cargo = require('rustaceanvim.cargo')
local compat = require('rustaceanvim.compat')
local config = require('rustaceanvim.config.internal')
local lib = require('neotest.lib')
local nio = require('nio')
local trans = require('rustaceanvim.neotest.trans')
local cargo = require('rustaceanvim.cargo')
local overrides = require('rustaceanvim.overrides')
local compat = require('rustaceanvim.compat')
local trans = require('rustaceanvim.neotest.trans')
---@package
---@type neotest.Adapter
@ -42,7 +43,7 @@ local NeotestAdapter = { name = 'rustaceanvim' }
---@param file_name string
---@return string | nil
NeotestAdapter.root = function(file_name)
return cargo.get_root_dir(file_name)
return cargo.get_config_root_dir(config.server, file_name)
end
---@package

View File

@ -1,17 +1,17 @@
rock_manifest = {
doc = {
["mason.txt"] = "858adffa88b1649b91187f49f191e376",
["rustaceanvim.txt"] = "0bb03192be9a68d7b6c73e8414b01625"
["rustaceanvim.txt"] = "a9fa5fd997f2e2c099d2bf715cf4d5e9"
},
ftplugin = {
["rust.lua"] = "40f5f67ffb8f441a636ff231b7878ff8",
["rust.lua"] = "b225026e3590a6741373922fbae423e5",
["rust.vim"] = "3121ffa3b7f1aa9c3efbfe32e438dbeb",
["toml.lua"] = "a8807dcfb5f6687ac543f4f8da3a9554"
},
lua = {
rustaceanvim = {
["cached_commands.lua"] = "6e23c8231f44a3edc76be54766fca334",
["cargo.lua"] = "39415eb623c1376d5f2d5c717b8c0eb0",
["cargo.lua"] = "43ba56ed4ba112dd22cac598e7b248df",
commands = {
["code_action_group.lua"] = "55bf0c83a007e5d64924eafe2e2a96eb",
["crate_graph.lua"] = "30d01abc92dff63ace83a5d1697d2073",
@ -36,9 +36,9 @@ rock_manifest = {
},
["compat.lua"] = "fedaef1aeaceaf086116ed62b423d0a3",
config = {
["check.lua"] = "8a68a6e78ea97ab59ea0be83bff7ffc7",
["init.lua"] = "f2ef97efc1f563c06932d51006e5b7cc",
["internal.lua"] = "319f08833432f1ec7b04d4432737a1f0",
["check.lua"] = "55ddc99999546e6951cd2641cc997af2",
["init.lua"] = "a583a64ac0023a551c16a92f61ff063d",
["internal.lua"] = "854115363fcfc13e65098150b873a8ff",
["json.lua"] = "a8c7caf443ad9ce1193726aec053cc8d",
["server.lua"] = "d642a65f31cb4f12b812840c1171821f"
},
@ -56,9 +56,9 @@ rock_manifest = {
["health.lua"] = "126952700269c9ab976f29f59604c5da",
["hover_actions.lua"] = "d0842822fa99c55b4cc5a65eae968ff2",
["init.lua"] = "a48de2e7e937208adc6781a5ea35ec88",
["lsp.lua"] = "f26e69489b384870c2774703599bf1bb",
["lsp.lua"] = "c36e5b79bb7fb41a9781d70421f7a55c",
neotest = {
["init.lua"] = "10bfd8f06b7ad2de8d706c2e26505ae7",
["init.lua"] = "ec54c5df5002742877ec6c925b273b2d",
["trans.lua"] = "1f79320bca0c81d91673543dd7ad4984"
},
["os.lua"] = "4c8caca1afb6a8e7862300b4dcc29f09",

View File

@ -234,12 +234,13 @@ RustcOpts *RustcOpts*
RustaceanLspClientOpts *RustaceanLspClientOpts*
Fields: ~
{auto_attach?} (boolean|fun(bufnr:integer):boolean) Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found.
{cmd?} (string[]|fun():string[]) Command and arguments for starting rust-analyzer
{settings?} (table|fun(project_root:string|nil,default_settings:table):table) Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration.
{standalone?} (boolean) Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time.
{logfile?} (string) The path to the rust-analyzer log file.
{load_vscode_settings?} (boolean) Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options. Default: false
{auto_attach?} (boolean|fun(bufnr:integer):boolean) Whether to automatically attach the LSP client. Defaults to `true` if the `rust-analyzer` executable is found.
{cmd?} (string[]|fun():string[]) Command and arguments for starting rust-analyzer
{root_dir?} (string|fun(filename:string,default:fun(filename:string):string|nil):string|nil) The directory to use for the attached LSP. Can be a function, which may return nil if no server should attach. The second argument contains the default implementation, which can be used for fallback behavior.
{settings?} (table|fun(project_root:string|nil,default_settings:table):table) Setting passed to rust-analyzer. Defaults to a function that looks for a `rust-analyzer.json` file or returns an empty table. See https://rust-analyzer.github.io/manual.html#configuration.
{standalone?} (boolean) Standalone file support (enabled by default). Disabling it may improve rust-analyzer's startup time.
{logfile?} (string) The path to the rust-analyzer log file.
{load_vscode_settings?} (boolean) Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options. Default: false
RustaceanDapOpts *RustaceanDapOpts*

View File

@ -46,19 +46,12 @@ end
vim.g.loaded_rustaceanvim = true
local bufnr = vim.api.nvim_get_current_buf()
local auto_attach = config.server.auto_attach
if type(auto_attach) == 'function' then
local bufnr = vim.api.nvim_get_current_buf()
auto_attach = auto_attach(bufnr)
end
if auto_attach then
-- Defer for a smoother experience on low-end devices
vim.api.nvim_create_autocmd('BufEnter', {
buffer = bufnr,
group = vim.api.nvim_create_augroup('RustaceanvimAttach', { clear = true }),
callback = function()
require('rustaceanvim.lsp').start()
end,
})
require('rustaceanvim.lsp').start()
end

View File

@ -1,17 +1,17 @@
rock_manifest = {
doc = {
["mason.txt"] = "858adffa88b1649b91187f49f191e376",
["rustaceanvim.txt"] = "0bb03192be9a68d7b6c73e8414b01625"
["rustaceanvim.txt"] = "a9fa5fd997f2e2c099d2bf715cf4d5e9"
},
ftplugin = {
["rust.lua"] = "40f5f67ffb8f441a636ff231b7878ff8",
["rust.lua"] = "b225026e3590a6741373922fbae423e5",
["rust.vim"] = "3121ffa3b7f1aa9c3efbfe32e438dbeb",
["toml.lua"] = "a8807dcfb5f6687ac543f4f8da3a9554"
},
lua = {
rustaceanvim = {
["cached_commands.lua"] = "6e23c8231f44a3edc76be54766fca334",
["cargo.lua"] = "39415eb623c1376d5f2d5c717b8c0eb0",
["cargo.lua"] = "43ba56ed4ba112dd22cac598e7b248df",
commands = {
["code_action_group.lua"] = "55bf0c83a007e5d64924eafe2e2a96eb",
["crate_graph.lua"] = "30d01abc92dff63ace83a5d1697d2073",
@ -36,9 +36,9 @@ rock_manifest = {
},
["compat.lua"] = "fedaef1aeaceaf086116ed62b423d0a3",
config = {
["check.lua"] = "8a68a6e78ea97ab59ea0be83bff7ffc7",
["init.lua"] = "f2ef97efc1f563c06932d51006e5b7cc",
["internal.lua"] = "319f08833432f1ec7b04d4432737a1f0",
["check.lua"] = "55ddc99999546e6951cd2641cc997af2",
["init.lua"] = "a583a64ac0023a551c16a92f61ff063d",
["internal.lua"] = "854115363fcfc13e65098150b873a8ff",
["json.lua"] = "a8c7caf443ad9ce1193726aec053cc8d",
["server.lua"] = "d642a65f31cb4f12b812840c1171821f"
},
@ -56,9 +56,9 @@ rock_manifest = {
["health.lua"] = "126952700269c9ab976f29f59604c5da",
["hover_actions.lua"] = "d0842822fa99c55b4cc5a65eae968ff2",
["init.lua"] = "a48de2e7e937208adc6781a5ea35ec88",
["lsp.lua"] = "f26e69489b384870c2774703599bf1bb",
["lsp.lua"] = "c36e5b79bb7fb41a9781d70421f7a55c",
neotest = {
["init.lua"] = "10bfd8f06b7ad2de8d706c2e26505ae7",
["init.lua"] = "ec54c5df5002742877ec6c925b273b2d",
["trans.lua"] = "1f79320bca0c81d91673543dd7ad4984"
},
["os.lua"] = "4c8caca1afb6a8e7862300b4dcc29f09",