Civet icon indicating copy to clipboard operation
Civet copied to clipboard

Support for neovim/vim

Open Hamza12700 opened this issue 1 year ago • 7 comments
trafficstars

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.

Hamza12700 avatar Jul 12 '24 18:07 Hamza12700

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?

edemaine avatar Jul 12 '24 20:07 edemaine

Yeah, sure I can give it a shot

Hamza12700 avatar Jul 13 '24 09:07 Hamza12700

Any news on this? It would really help with enjoyment of this language to not be editor-locked.

miloslavnosek avatar Jul 11 '25 06:07 miloslavnosek

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.

STRd6 avatar Jul 12 '25 05:07 STRd6

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

kasimeka avatar Jul 19 '25 17:07 kasimeka

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

kasimeka avatar Jul 21 '25 06:07 kasimeka

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.

edemaine avatar Oct 02 '25 14:10 edemaine