Open collinarnett opened 1 year ago
Maybe you could check out the configuration of rust-analyzer
for reference.
I think this is the final straw in moving to neovim. This and the latest advancements with tree-sitter and scala.
I think this is the final straw in moving to neovim. This and the latest advancements with tree-sitter and scala.
Note that coc.nvim
also works fluently on Vim and supports inlay hints only on Vim 9. (Neovim havn't implemented in-line decorations yet) tree-sitter
should be strictly worse and slower than LSP semantic highlighting, since it serves as a light-but-general-LSP. Usually you need to turn it off when editing all-packages.nix
.
Managed to get this working, thanks to @oxalica for pointing me in the right direction. in ale/ale_linters/nix/nil.vim I have created this file:
call ale#Set('nix_nil_exec', 'nil')
call ale#Set('nix_nil_config', {})
function! ale_linters#nix#nil#GetCommand(buffer) abort
return '%e'
endfunction
function! ale_linters#nix#nil#GetProjectRoot(buffer) abort
let l:flake_file = ale#path#FindNearestFile(a:buffer, 'flake.nix')
return !empty(l:flake_file) ? fnamemodify(l:flake_file, ':h') : ''
endfunction
call ale#linter#Define('nix', {
\ 'name': 'nil',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'nix_nil_config')},
\ 'executable': {b -> ale#Var(b, 'nix_nil_exec')},
\ 'command': function('ale_linters#nix#nil#GetCommand'),
\ 'project_root': function('ale_linters#nix#nil#GetProjectRoot'),
\})
and I've just added nil to my list of nix linters. I've made the root directory point to the closest flake atm but that may not work for all peoples setups. I'm going to have a look at some other linters and see how they handle it.
Edit: had a look at some of the go lsp's, they use .git location as their backup, but i think that would be perfect for the primary here. I'll use this for like a week and if nobody has any comments I'll make a PR to get this into ale.
call ale#Set('nix_nil_exec', 'nil')
call ale#Set('nix_nil_config', {})
function! ale_linters#nix#nil#GetCommand(buffer) abort
return '%e'
endfunction
function! ale_linters#nix#nil#GetProjectRoot(buffer) abort
let l:git_root = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_root) ? fnamemodify(l:git_root, ':h') : ''
endfunction
call ale#linter#Define('nix', {
\ 'name': 'nil',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'nix_nil_config')},
\ 'executable': {b -> ale#Var(b, 'nix_nil_exec')},
\ 'command': function('ale_linters#nix#nil#GetCommand'),
\ 'project_root': function('ale_linters#nix#nil#GetProjectRoot'),
\})
Hi @SamuelKurtzer -- I don't see any PR for nil over there https://github.com/dense-analysis/ale/pulls?is%3Apr+nil , have you had a chance to find time to do it?
(just looking at nix linters landscape and was wondering what to use at this point and wondered about this. I'm not above manually adding this file, but it'll benefit everyone if it were merged upstream)
I tried my best to get this working with A.L.E in vim and I'm having trouble. I can't seem to get past a simple errors in ALE.
I also tried using
nil
as the command but that didn't work either. I feel like I'm missing something extremely basic.