lsp based prolog neovim support
- Vim Script 79.4%
- Lua 20.6%
| docs | ||
| ftdetect | ||
| ftplugin | ||
| indent | ||
| lua/plgl | ||
| syntax | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
patch-prolog.nvim
Neovim support for ISO Prolog as implemented by patch-prolog (the plg* toolchain and plgl language server).
Features
- Filetype detection —
.pl,.plg,.proare detected asprolog(overrides Neovim's built-in Perl mapping for.pl; see patch-prolog/docs/OPERATORS.md for the upstream rationale). - Syntax highlighting — comments (
%line,/* */block), strings, quoted atoms, numbers, variables, the full ISO operator table, common built-ins, and stdlib predicates. - Auto-indentation — bodies indent after
:-, parens/brackets indent on open and dedent on close. - LSP integration — drives
plglover stdio for real-time diagnostics (parse errors, plus warnings for calls to undefined predicates with did-you-mean suggestions), completion (built-ins + stdlib + buffer-defined predicates), hover (one-line docs for built-ins, clause heads for user-defined predicates), and goto-definition.
Requirements
- Neovim 0.10+ (for
vim.lsp.startandvim.filetype.add). plglbinary on yourPATH.
Installing plgl
Build from source — the toolchain isn't on crates.io yet. The LSP server links only the parser (no clang needed); install just it with:
git clone https://git.navicore.tech/navicore/patch-prolog
cd patch-prolog
cargo install --path crates/lsp
Or install the whole toolchain (the plgc compiler + the plgl server)
in one step with the repo's justfile:
just install
Verify with plgl --version.
Installation
lazy.nvim
{
"navicore/patch-prolog.nvim",
ft = "prolog",
opts = {},
}
Manual
require("plgl").setup({})
With options
require("plgl").setup({
-- Override the binary path/args (default: { "plgl" }).
cmd = { "plgl" },
-- Standard LSP hooks — same shape as any other lspconfig client.
on_attach = function(client, bufnr)
-- e.g. local map = vim.keymap.set
-- map("n", "gd", vim.lsp.buf.definition, { buffer = bufnr })
-- map("n", "K", vim.lsp.buf.hover, { buffer = bufnr })
end,
capabilities = vim.lsp.protocol.make_client_capabilities(),
})
Reporting issues
- Plugin issues (filetype, syntax, indentation, LSP wiring): https://git.navicore.tech/navicore/patch-prolog.nvim/issues
- Engine / LSP server bugs (diagnostics, completion items, hover content): https://git.navicore.tech/navicore/patch-prolog/issues
License
MIT.