From 7fa49801a69f881539d70049b1eb047b79db641b Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Tue, 8 Oct 2024 21:02:59 +0200 Subject: [PATCH] fix(mesonlsp): use correct root dir --- lua/lsp/config/mesonlsp.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/lsp/config/mesonlsp.lua b/lua/lsp/config/mesonlsp.lua index 48a283a..5699f7d 100644 --- a/lua/lsp/config/mesonlsp.lua +++ b/lua/lsp/config/mesonlsp.lua @@ -3,6 +3,15 @@ return { enable = true, mason = { "mesonlsp" }, lspconfig = { + ---@type fun(filename: string, bufnr: number): string? + root_dir = function(filename, bufnr) + local parent = require("lspconfig").util.find_git_ancestor(filename) + if not parent then + local win = vim.fn.bufwinid(bufnr) + parent = vim.fn.getcwd(win) + end + return parent + end, settings = { others = { disableInlayHints = true,