From 2a6517453feb6f00e3d64bcb4fde61934897f4bd Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 4 May 2025 14:11:18 -0700 Subject: fix(configs): eliminate some usages of root_pattern #3820 Problem: `root_pattern` is not necessary for non-glob patterns. Solution: Replace non-glob cases with `vim.fs.root()`.. --- lsp/rust_analyzer.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lsp/rust_analyzer.lua') diff --git a/lsp/rust_analyzer.lua b/lsp/rust_analyzer.lua index 0540aca2..23771bac 100644 --- a/lsp/rust_analyzer.lua +++ b/lsp/rust_analyzer.lua @@ -21,8 +21,6 @@ --- Note: do not set `init_options` for this LS config, it will be automatically populated by the contents of settings["rust-analyzer"] per --- https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26. -local util = require 'lspconfig.util' - local function reload_workspace(bufnr) local clients = vim.lsp.get_clients { bufnr = bufnr, name = 'rust_analyzer' } for _, client in ipairs(clients) do @@ -64,12 +62,12 @@ return { return end - local cargo_crate_dir = util.root_pattern 'Cargo.toml'(fname) + local cargo_crate_dir = vim.fs.root(fname, { 'Cargo.toml' }) local cargo_workspace_root if cargo_crate_dir == nil then on_dir( - util.root_pattern 'rust-project.json'(fname) + vim.fs.root(fname, { 'rust-project.json' }) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) ) return -- cgit v1.2.3-70-g09d2