plugins.rustaceanvim.settings.server.auto_attach

Whether to automatically attach the LSP client. Defaults to true if the rust-analyzer executable is found.

This can also be the definition of a function (fun():boolean).

Plugin default:

  function(bufnr)
    if #vim.bo[bufnr].buftype > 0 then
      return false
    end
    local path = vim.api.nvim_buf_get_name(bufnr)
    if not os.is_valid_file_path(path) then
      return false
    end
    local cmd = types.evaluate(RustaceanConfig.server.cmd)
    ---@cast cmd string[]
    local rs_bin = cmd[1]
    return vim.fn.executable(rs_bin) == 1
  end

Type: null or lua function string or boolean

Default: null

Declared by:

plugins.rustaceanvim.settings.server.cmd

Command and arguments for starting rust-analyzer.

This can also be the definition of a function: fun(project_root:string|nil,default_settings:table):table

Plugin default:

  function()
    return { 'rust-analyzer', '--log-file', RustaceanConfig.server.logfile }
  end

Type: null or lua function string or list of string

Default: null

Declared by:

plugins.rustaceanvim.settings.server.load_vscode_settings

Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json. If found, loaded settings will override configured options.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

plugins.rustaceanvim.settings.server.logfile

The path to the rust-analyzer log file.

Type: null or string or raw lua code

Default: null

Plugin default: "{__raw = \"vim.fn.tempname() .. '-rust-analyzer.log'\";}"

Declared by:

plugins.rustaceanvim.settings.server.on_attach

Function to call on attach. If plugins.lsp is enabled, it defaults to the Nixvim global __lspOnAttach function. Otherwise it defaults to null.

Type: null or lua code string

Default: null

Declared by:

plugins.rustaceanvim.settings.server.settings

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.

This can also be the definition of a function: fun(project_root:string|nil, default_settings: table|nil):table

Plugin default:

  function(project_root, default_settings)
    return require('rustaceanvim.config.server').load_rust_analyzer_settings(project_root, { default_settings = default_settings })
  end

Type: null or lua function string or (attribute set of anything)

Default: null

Declared by:

plugins.rustaceanvim.settings.server.standalone

Standalone file support (enabled by default). Disabling it may improve rust-analyzer’s startup time.

Type: null or boolean or raw lua code

Default: null

Plugin default: true

Declared by: