Civet
Civet copied to clipboard
Support for neovim/vim
I recently discovery this project and I really like the syntax of the language. So I was thinking to give it a shot but unfortunately the language server only supports VSCode. It'd be really nice if the language server also supported neovim/vim.
Agreed! Someone needs to spend the time to separate the LSP process from the rest of the VSCode Plugin. I believe they are mostly separate already, and it's mostly a distribution/bundling issue. I don't think it should be hard (assuming LSP protocols are the same), but only trying will tell. 😺 Are you interested in giving it a try?
Yeah, sure I can give it a shot
Any news on this? It would really help with enjoyment of this language to not be editor-locked.
I looked into this briefly but ran into ran into some trouble because I have no experience configuring neovim.
It seems that something similar to this should work though:
vim.lsp.config('civet_lsp', {
cmd = { 'node', '~/Downloads/DanielX.civet-0.3.28/extension/dist/server.js', '--stdio' },
filetypes = { 'civet' },
root_dir = util.root_pattern('tsconfig.json', 'package.json', '.git'),
single_file_support = true,
})
This is assuming that the published VSCode extension is downloaded and extracted. https://marketplace.visualstudio.com/_apis/public/gallery/publishers/DanielX/vsextensions/civet/0.3.28/vspackage
I didn't quite get it working but maybe this will encourage someone who has more experience with neovim to give it a shot and eventually we can get over the finish line.
the config @STRd6 provided works fine (with a vim.lsp.enable('civet_ls', true) added after it) but needs an extra snippet since civet isn't recognised as a vim filetype & files with .civet extension are treated as plaintext
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
desc = 'Set filetype=civet for files with the civet extension',
pattern = '*.civet',
command = 'setf civet',
group = vim.api.nvim_create_augroup(
'my-set-civet-type',
{ clear = true }
),
})
this sets the filetype for any file with a .civet suffix to civet, and setting the filetype automatically attaches the lsp client. the lsp client itself is unusable because of https://github.com/DanielXMoore/Civet/issues/1762
the remaining requirements for nvim support are a filetype definition with at least commentstrings (definitions of what civet comments look like), and a tree sitter parser for syntax highlighting and AST queries / structured editing
I was wondering whether TextMate grammars could be used for syntax highlighting directly in vim, and found https://github.com/uga-rosa/scorpeon.vim which claims to do so, though it's archived. https://github.com/icedman/vim-textmate similarly. Worth exploring a bit.