This repo is docs only. The server itself (core-lsp) is hosted on
the Core VPS; here is how to install and use it with your editor.
The server speaks LSP over stdio and gives you, for .cr files:
- diagnostics from
core checkon every edit - hover for keywords, primitive types,
say/alloc/free/assert - completion for keywords, types, stdlib modules, local
funcnames - document symbols (
func/struct/class/enum/interface/trait)
- Python 3 (3.8+; the server is stdlib-only, no pip packages)
- the
corecompiler on yourPATH(for diagnostics) — install it
mkdir -p ~/.local/bin
curl -fsSL http://94.24.39.227/dl/core-lsp.py -o ~/.local/bin/core-lsp
chmod +x ~/.local/bin/core-lspCheck it starts:
~/.local/bin/core-lsp --help 2>/dev/null || echo "core-lsp installed"To use a different compiler binary: export CORE_BIN=/path/to/core.
Install the core-lang extension (syntax + client; source in the main
repo under editors/vscode), then set:
{
"core-lang.serverPath": "/home/YOU/.local/bin/core-lsp",
"core-lang.coreBin": "core"
}Note:
.cris also Crystal's extension. The snippet below only attaches inside Core projects (acore.tomlfound upward), so the two never clash.
-- ~/.config/nvim/lua/core-lsp.lua (require it from your init.lua)
vim.filetype.add({ extension = { cr = 'core' } })
vim.api.nvim_create_autocmd('FileType', {
pattern = 'core',
callback = function(args)
local root = vim.fs.dirname(vim.fs.find({ 'core.toml' },
{ upward = true, path = args.file })[1] or args.file)
vim.lsp.start({
name = 'core-lsp',
cmd = { 'python3', vim.fn.expand('~/.local/bin/core-lsp') },
root_dir = root,
})
end,
})~/.config/helix/languages.toml (use an absolute path — Helix does not
expand ~):
[[language]]
name = "core"
scope = "source.core"
file-types = ["cr"]
comment-token = "//"
language-servers = ["core-lsp"]
[language-server.core-lsp]
command = "python3"
args = ["/home/YOU/.local/bin/core-lsp"]| Symptom | Fix |
|---|---|
| no diagnostics | core not on PATH, or set CORE_BIN to it; run core check file.cr by hand to see the error |
| server won't start | python3 --version (need 3.8+); re-download — the file must be exactly core-lsp.py, 7723 bytes |
wrong language attaches to .cr |
scope the filetype to Core projects (see Neovim note above) |
Re-run the install curl line — the VPS always serves the latest
server. The full server source and protocol details live in the main
repo at tools/lsp/core_lsp.py.