Closed pauladam94 closed 2 months ago
I actually managed to make it work.
Actually in neovim. Instead of changing the tynimyst parameter rootPath
, it is the lspconfig parameter root_dir
that should be changed.
This fix my issue :
require("lspconfig")["tinymist"].setup {
capabilities = lsp_capabilities,
root_dir = function(filename, bufnr)
return "/home/pauladam/PaulJR/" -- this is fixed, but other function can take the parent directory in neovim
end,
}
Once you know that, any thing can be given to root_dir
parameter.
Sorry I'm late, I was busy when I first checked your issue. I think of it is a bit unfortunate that there are some unintentional similar keys that are confusing people. But root_dir
is a neovim specific configuration. But we could document it to avoid future pitfall.
Just to be sure, it this way that should work to put settings for the tinymist ?
{
"neovim/nvim-lspconfig",
dependencies = {
"kevinhwang91/nvim-ufo",
{ "j-hui/fidget.nvim", opts = {} },
{ "folke/neodev.nvim", opts = {} },
},
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
require("lspconfig")["tinymist"].setup {
capabilities = lsp_capabilities,
root_dir = function(filename, bufnr)
return "the right root_dire depending on filename..."
end
settings = {
tinymist = {
settings = {
formatterMode = "typstfmt",
},
},
},
}
}
I don't see obvious errors in your posted code.
root_dir = function(filename, bufnr)
return vim.fn.getcwd()
end,
This is much more dynamic. But this may change the workspace every time :(
Here is my config for the LSP in neovim in init.lua.
In the tinymist docs, for the root path it is indicated to put - for getting the parent directory. Is it the string
"-"
right ? Just to be sure because I also have tried that but it didn't work.Here is the result of LspInfo :
Maybe I am doing something obviously wrong, that's why I post this issue. Thank in advance.