- The CLI is found where the plugin finds it (require("llembas").cli(): PATH, then
~/.local/bin); the installer and the launcher keep the same find_cli in shell, and
scripts/test-ide.sh fails when the two shell copies differ or disagree with the plugin. A CLI
in ~/.local/bin that is not on PATH (right after a first install) is no longer "not installed".
- The CLI's get.sh is taken from a CLI release (the newest of the channel, or
LLEMBAS_IDE_CLI_VERSION) and run only after that release's SHA256SUMS is verified with the
release key and get.sh matches it; LEMBAS_REF names that release.
- curl … | bash -s -- --help prints the help (it is a here-document now); it names ssh-keygen.
- The start screen says a sign-in is needed only when there is none.
- doctor and an update see files added to a plugin, not only changed ones; doctor accepts the
start as the installer does, says when plugins.lock is missing, checks ssh-keygen, and counts
"1 check failed" / "N checks failed".
- A release archive that holds a link is refused; newest_tag keeps redirects on https.
- The README key table says where a chord also works.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
92 lines
3.9 KiB
Lua
92 lines
3.9 KiB
Lua
-- Language servers through Neovim's own client. A server is a program of yours: the IDE starts
|
|
-- the ones it finds on PATH and never downloads one. :LLeMbasIdeLsp says which are found and how
|
|
-- each is installed.
|
|
local M = {}
|
|
|
|
-- name (nvim-lspconfig's), the program looked for, what it is for, one way to install it.
|
|
M.servers = {
|
|
{ "lua_ls", "lua-language-server", "Lua", "your package manager, or github.com/LuaLS/lua-language-server releases" },
|
|
{ "pyright", "pyright-langserver", "Python", "npm install -g pyright (or: pipx install pyright)" },
|
|
{ "ruff", "ruff", "Python lint and format", "pipx install ruff" },
|
|
{ "ts_ls", "typescript-language-server", "TypeScript, JavaScript", "npm install -g typescript typescript-language-server" },
|
|
{ "rust_analyzer", "rust-analyzer", "Rust", "rustup component add rust-analyzer" },
|
|
{ "gopls", "gopls", "Go", "go install golang.org/x/tools/gopls@latest" },
|
|
{ "clangd", "clangd", "C, C++", "your package manager: clangd" },
|
|
{ "bashls", "bash-language-server", "Shell", "npm install -g bash-language-server" },
|
|
{ "jsonls", "vscode-json-language-server", "JSON", "npm install -g vscode-langservers-extracted" },
|
|
{ "html", "vscode-html-language-server", "HTML", "npm install -g vscode-langservers-extracted" },
|
|
{ "cssls", "vscode-css-language-server", "CSS", "npm install -g vscode-langservers-extracted" },
|
|
{ "yamlls", "yaml-language-server", "YAML", "npm install -g yaml-language-server" },
|
|
{ "marksman", "marksman", "Markdown", "your package manager, or github.com/artempyanykh/marksman releases" },
|
|
}
|
|
|
|
M.enabled = {}
|
|
|
|
function M.setup()
|
|
local modern = vim.fn.has("nvim-0.11") == 1 and vim.lsp.enable ~= nil
|
|
-- Below 0.11 nvim-lspconfig's start-up file only announces that old Neovim is deprecated.
|
|
if not modern then vim.g.lspconfig = 1 end
|
|
|
|
local capabilities
|
|
local ok, blink = pcall(require, "blink.cmp")
|
|
if ok then capabilities = blink.get_lsp_capabilities() end
|
|
|
|
for _, s in ipairs(M.servers) do
|
|
local name, bin = s[1], s[2]
|
|
if vim.fn.executable(bin) == 1 then
|
|
if modern then
|
|
vim.lsp.enable(name)
|
|
table.insert(M.enabled, name)
|
|
else
|
|
local has, lspconfig = pcall(require, "lspconfig")
|
|
if has and lspconfig[name] then
|
|
lspconfig[name].setup({ capabilities = capabilities })
|
|
table.insert(M.enabled, name)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
group = vim.api.nvim_create_augroup("llembas_ide_lsp", { clear = true }),
|
|
callback = function(ev)
|
|
for _, k in ipairs(require("llembas_ide.keys").lsp) do
|
|
vim.keymap.set(k[1], k[2], k[3], { buffer = ev.buf, desc = k[4] })
|
|
end
|
|
end,
|
|
})
|
|
end
|
|
|
|
--- The guide: every server the IDE knows, whether it is found, and how to get it.
|
|
function M.guide()
|
|
local lines = {
|
|
"Language servers",
|
|
"",
|
|
"The IDE starts a server it finds on PATH when you open a file of its language.",
|
|
"It never downloads one: install the ones you want yourself, then restart the IDE.",
|
|
"",
|
|
}
|
|
local marks = {}
|
|
for _, s in ipairs(M.servers) do
|
|
local found = vim.fn.executable(s[2]) == 1
|
|
table.insert(lines, (" %s %-14s %-24s %s"):format(found and "found " or "missing", s[1], s[3], s[2]))
|
|
table.insert(marks, { #lines - 1, found and "LLeMbasIdeGood" or "LLeMbasIdeWarn" })
|
|
if not found then
|
|
table.insert(lines, " " .. s[4])
|
|
table.insert(marks, { #lines - 1, "LLeMbasIdeMuted" })
|
|
end
|
|
end
|
|
vim.list_extend(lines, {
|
|
"",
|
|
"Running in this buffer's window: :checkhealth vim.lsp",
|
|
"Another server: vim.lsp.enable(\"name\") in lua/user/init.lua (Neovim 0.11 or newer).",
|
|
})
|
|
local buf = require("llembas_ide.ui").page("LLeMbas IDE: language servers", lines)
|
|
for _, m in ipairs(marks) do
|
|
vim.api.nvim_buf_add_highlight(buf, -1, m[2], m[1], 2, 9)
|
|
end
|
|
vim.api.nvim_buf_add_highlight(buf, -1, "Title", 0, 0, -1)
|
|
end
|
|
|
|
return M
|