--- RinneScript Neovim plugin — native LSP integration. --- --- Usage: --- require('rinne').setup({ bin = '/path/to/rinne' }) --- -- or just require('rinne') — resolves bin from g:rinne_path or PATH. local M = {} local function find_bin(opts) local bin = opts.bin or vim.g.rinne_path or 'rinne' -- Resolve to absolute path; if it contains a slash, treat as explicit path. if bin:find('/') then if vim.fn.executable(bin) == 1 then return bin end error(('rinne LSP binary not found or not executable: %s'):format(bin)) end -- Bare name: search PATH. local resolved = vim.fn.executable(bin) if resolved == 1 then return bin end error( ('rinne LSP binary %q not found on PATH. ' .. 'Set g:rinne_path or pass opts.bin to require("rinne").setup().'):format(bin) ) end --- Configure and enable the RinneScript LSP client. --- Never throws for a missing binary: warns once and leaves startup intact --- (the editor must not break when the server isn't installed yet). --- @param opts? {bin?: string} function M.setup(opts) opts = opts or {} local ok, bin = pcall(find_bin, opts) if not ok then vim.notify(tostring(bin), vim.log.levels.WARN, { title = 'rinne.nvim' }) return M end vim.lsp.config('rinne', { cmd = { bin, 'lsp' }, filetypes = { 'rinne' }, root_markers = { 'build.zig.zon', '.git' }, }) vim.lsp.enable('rinne') return M end return M