mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -1,6 +1,15 @@
|
||||
" Author: Baabelfish
|
||||
" Description: Typechecking for nim files
|
||||
|
||||
let s:end_col_patterns = [
|
||||
\ '\v''([^'']+)'' is declared but not used.*',
|
||||
\ '\videntifier expected, but found ''([^'']+)''',
|
||||
\ '\vimported and not used: ''([^'']+)''.*',
|
||||
\ '\vundeclared identifier: ''([^'']+)''',
|
||||
\ '\v''([^'']+)'' cannot be assigned to',
|
||||
\ '\vredefinition of ''([^'']+)'';',
|
||||
\]
|
||||
|
||||
function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t')
|
||||
let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)'
|
||||
@ -43,6 +52,11 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
let l:item.code = l:code_match[2]
|
||||
endif
|
||||
|
||||
" Find position end_col.
|
||||
for l:col_match in ale#util#GetMatches(l:item.text, s:end_col_patterns)
|
||||
let l:item.end_col = l:item.col + len(l:col_match[1]) - 1
|
||||
endfor
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
|
33
sources_non_forked/ale/ale_linters/nim/nimlsp.vim
Normal file
33
sources_non_forked/ale/ale_linters/nim/nimlsp.vim
Normal file
@ -0,0 +1,33 @@
|
||||
" Author: jeremija <https://github.com/jeremija>
|
||||
" Description: Support for nimlsp (language server for nim)
|
||||
|
||||
call ale#Set('nim_nimlsp_nim_sources', '')
|
||||
|
||||
function! ale_linters#nim#nimlsp#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(l:project_root, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#nim#nimlsp#GetCommand(buffer) abort
|
||||
let l:nim_sources = ale#Var(a:buffer, 'nim_nimlsp_nim_sources')
|
||||
|
||||
if !empty(l:nim_sources)
|
||||
let l:nim_sources = ale#Escape(l:nim_sources)
|
||||
endif
|
||||
|
||||
return '%e' . ale#Pad(l:nim_sources)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('nim', {
|
||||
\ 'name': 'nimlsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'nimlsp',
|
||||
\ 'command': function('ale_linters#nim#nimlsp#GetCommand'),
|
||||
\ 'language': 'nim',
|
||||
\ 'project_root': function('ale_linters#nim#nimlsp#GetProjectRoot'),
|
||||
\})
|
Reference in New Issue
Block a user