SQL language server not starting #4210
-
So I'm trying to get sqlls to work on I did: And confirmed it is installed. Any idea how to debug? Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
see :LspInfo |
Beta Was this translation helpful? Give feedback.
-
TL;DR: To enable sqlls (after installing it) in LunarVim and set the current working directory as the root directory, add these configurations to your config.lua: lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
return server ~= "sqlls"
end, lvim.lsp.automatic_configuration.skipped_servers)
require("lvim.lsp.manager").setup("sqlls", {
cmd = {"sql-language-server", "up", "--method", "stdio"};
filetypes = {"sql", "mysql"};
root_dir = function() return vim.loop.cwd() end;
}) After making changes to your config.lua, don't forget to run Explanation: The sqlls language server may fail to start if it can't determine a root directory for your project. SQL files don't have an inherent concept of a "project root", which can lead to this issue. In the code above, we are: Enabling sqlls: We remove sqlls from the skipped_servers list in LunarVim, effectively enabling the server for use. lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
return server ~= "sqlls"
end, lvim.lsp.automatic_configuration.skipped_servers) Setting up sqlls: We configure sqlls using LunarVim's LSP manager, specifying the command to start the server, the file types it should be used with, and setting the root directory to the current working directory. require("lvim.lsp.manager").setup("sqlls", {
cmd = {"sql-language-server", "up", "--method", "stdio"};
filetypes = {"sql", "mysql"};
root_dir = function() return vim.loop.cwd() end;
}) Using LunarVim's LSP manager to setup the language server ensures that the server is not configured twice, which could happen if we used lspconfig directly after removing the server from skipped_servers. |
Beta Was this translation helpful? Give feedback.
sqlls is disabled by default, remove it from skipped_list, there's an example here