diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-05-04 14:11:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-04 14:11:18 -0700 |
| commit | 2a6517453feb6f00e3d64bcb4fde61934897f4bd (patch) | |
| tree | dc681744b655f6eb40478ef6d7ae5495686f2b71 /lsp/rust_analyzer.lua | |
| parent | feat: support :LspStart/LspRestart in Nvim 0.11.2+ #3734 (diff) | |
| download | nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.gz nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.bz2 nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.lz nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.xz nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.zst nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.zip | |
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()`..
Diffstat (limited to 'lsp/rust_analyzer.lua')
| -rw-r--r-- | lsp/rust_analyzer.lua | 6 |
1 files changed, 2 insertions, 4 deletions
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 |
