You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
462 B
Lua
16 lines
462 B
Lua
local etc = require("etc")
|
|
|
|
local buf = vim.api.nvim_get_current_buf()
|
|
local rustup_dir = os.getenv('RUSTUP_HOME') or vim.env.HOME .. '.rustup'
|
|
|
|
if etc.has_executable("rust-analyzer") then
|
|
local rust_analyzer = vim.lsp.start({
|
|
name = 'rust-analyzer',
|
|
cmd = { 'rust-analyzer' },
|
|
filetypes = { 'rust' },
|
|
single_file_support = true,
|
|
root_dir = vim.fs.root(buf, {'Cargo.toml', '.git'}),
|
|
})
|
|
vim.lsp.buf_attach_client(buf, rust_analyzer)
|
|
end
|