mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
22
sources_non_forked/ale/ale_linters/d/dls.vim
Normal file
22
sources_non_forked/ale/ale_linters/d/dls.vim
Normal file
@ -0,0 +1,22 @@
|
||||
" Author: aurieh <me@aurieh.me>
|
||||
" Description: A Language Server implementation for D
|
||||
|
||||
call ale#Set('d_dls_executable', 'dls')
|
||||
|
||||
function! ale_linters#d#dls#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'd_dls_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dls#FindProjectRoot(buffer) abort
|
||||
" Note: this will return . if dub config is empty
|
||||
" dls can run outside DUB projects just fine
|
||||
return fnamemodify(ale#d#FindDUBConfig(a:buffer), ':h')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('d', {
|
||||
\ 'name': 'dls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#d#dls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#d#dls#GetExecutable',
|
||||
\ 'project_root_callback': 'ale_linters#d#dls#FindProjectRoot',
|
||||
\})
|
@ -1,20 +1,6 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: "dmd for D files"
|
||||
|
||||
function! s:FindDUBConfig(buffer) abort
|
||||
" Find a DUB configuration file in ancestor paths.
|
||||
" The most DUB-specific names will be tried first.
|
||||
for l:possible_filename in ['dub.sdl', 'dub.json', 'package.json']
|
||||
let l:dub_file = ale#path#FindNearestFile(a:buffer, l:possible_filename)
|
||||
|
||||
if !empty(l:dub_file)
|
||||
return l:dub_file
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#DUBCommand(buffer) abort
|
||||
" If we can't run dub, then skip this command.
|
||||
if !executable('dub')
|
||||
@ -22,7 +8,7 @@ function! ale_linters#d#dmd#DUBCommand(buffer) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:dub_file = s:FindDUBConfig(a:buffer)
|
||||
let l:dub_file = ale#d#FindDUBConfig(a:buffer)
|
||||
|
||||
if empty(l:dub_file)
|
||||
return ''
|
||||
|
Reference in New Issue
Block a user