diff options
Diffstat (limited to 'lua/lspconfig/rust_analyzer.lua')
| -rw-r--r-- | lua/lspconfig/rust_analyzer.lua | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lua/lspconfig/rust_analyzer.lua b/lua/lspconfig/rust_analyzer.lua index 34c6420f..b5f151c8 100644 --- a/lua/lspconfig/rust_analyzer.lua +++ b/lua/lspconfig/rust_analyzer.lua @@ -1,39 +1,39 @@ -local configs = require "lspconfig/configs" -local util = require "lspconfig/util" +local configs = require 'lspconfig/configs' +local util = require 'lspconfig/util' local lsp = vim.lsp local function reload_workspace(bufnr) bufnr = util.validate_bufnr(bufnr) - lsp.buf_request(bufnr, "rust-analyzer/reloadWorkspace", nil, function(err, _, result, _) + lsp.buf_request(bufnr, 'rust-analyzer/reloadWorkspace', nil, function(err, _, result, _) if err then error(tostring(err)) end - vim.notify "Cargo workspace reloaded" + vim.notify 'Cargo workspace reloaded' end) end configs.rust_analyzer = { default_config = { - cmd = { "rust-analyzer" }, - filetypes = { "rust" }, + cmd = { 'rust-analyzer' }, + filetypes = { 'rust' }, root_dir = function(fname) - local cargo_crate_dir = util.root_pattern "Cargo.toml"(fname) - local cmd = "cargo metadata --no-deps --format-version 1" + local cargo_crate_dir = util.root_pattern 'Cargo.toml'(fname) + local cmd = 'cargo metadata --no-deps --format-version 1' if cargo_crate_dir ~= nil then - cmd = cmd .. " --manifest-path " .. util.path.join(cargo_crate_dir, "Cargo.toml") + cmd = cmd .. ' --manifest-path ' .. util.path.join(cargo_crate_dir, 'Cargo.toml') end local cargo_metadata = vim.fn.system(cmd) local cargo_workspace_dir = nil if vim.v.shell_error == 0 then - cargo_workspace_dir = vim.fn.json_decode(cargo_metadata)["workspace_root"] + cargo_workspace_dir = vim.fn.json_decode(cargo_metadata)['workspace_root'] end return cargo_workspace_dir or cargo_crate_dir - or util.root_pattern "rust-project.json"(fname) + or util.root_pattern 'rust-project.json'(fname) or util.find_git_ancestor(fname) end, settings = { - ["rust-analyzer"] = {}, + ['rust-analyzer'] = {}, }, }, commands = { @@ -41,11 +41,11 @@ configs.rust_analyzer = { function() reload_workspace(0) end, - description = "Reload current cargo workspace", + description = 'Reload current cargo workspace', }, }, docs = { - package_json = "https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/master/editors/code/package.json", + package_json = 'https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/master/editors/code/package.json', description = [[ https://github.com/rust-analyzer/rust-analyzer |
