Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better nvim error message if flix.jar is not found #208

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,17 @@ if not configs.flix then
default_config = {
cmd = start_cmd,
filetypes = { "flix" },
root_dir = vim.loop.cwd(),
root_dir = function(fname)
local root_dir = vim.fs.dirname(vim.fs.find("flix.toml", { path = fname, upward = true })[1])
or vim.loop.cwd()
-- Check if flix.jar exists
local flix_jar_path = root_dir .. "/flix.jar"
if vim.loop.fs_stat(flix_jar_path) == nil then
print("Failed to start the lsp server: flix.jar not found in project root (" .. root_dir .. ")!")
return nil -- Prevents LSP from starting
end
return root_dir
end,
settings = {},
},
}
Expand Down