mirror of https://github.com/amix/vimrc.git
parent
8e54cbc92e
commit
a7a471a207
@ -0,0 +1,26 @@ |
||||
" Author: Bartek Jasicki http://github.com/thindil |
||||
" Description: Support for Ada Language Server |
||||
|
||||
call ale#Set('ada_adals_executable', 'ada_language_server') |
||||
call ale#Set('ada_adals_project', 'default.gpr') |
||||
call ale#Set('ada_adals_encoding', 'utf-8') |
||||
|
||||
function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort |
||||
return { |
||||
\ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'), |
||||
\ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding') |
||||
\} |
||||
endfunction |
||||
|
||||
function! ale_linters#ada#adals#GetRootDirectory(buffer) abort |
||||
return fnamemodify(bufname(a:buffer), ':p:h') |
||||
endfunction |
||||
|
||||
call ale#linter#Define('ada', { |
||||
\ 'name': 'adals', |
||||
\ 'lsp': 'stdio', |
||||
\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')}, |
||||
\ 'command': '%e', |
||||
\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'), |
||||
\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig') |
||||
\}) |
@ -0,0 +1,12 @@ |
||||
" Author: Leo <thinkabit.ukim@gmail.com> |
||||
" Description: apkbuild-lint from atools linter for APKBUILDs |
||||
|
||||
call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint') |
||||
|
||||
call ale#linter#Define('apkbuild', { |
||||
\ 'name': 'apkbuild_lint', |
||||
\ 'output_stream': 'stdout', |
||||
\ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')}, |
||||
\ 'command': '%e %t', |
||||
\ 'callback': 'ale#handlers#atools#Handle', |
||||
\}) |
@ -0,0 +1,12 @@ |
||||
" Author: Leo <thinkabit.ukim@gmail.com> |
||||
" Description: secfixes-check from atools linter for APKBUILDs |
||||
|
||||
call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check') |
||||
|
||||
call ale#linter#Define('apkbuild', { |
||||
\ 'name': 'secfixes_check', |
||||
\ 'output_stream': 'stdout', |
||||
\ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')}, |
||||
\ 'command': '%e %t', |
||||
\ 'callback': 'ale#handlers#atools#Handle', |
||||
\}) |
@ -0,0 +1,23 @@ |
||||
" Author: Tommy Chiang <ty1208chiang@gmail.com> |
||||
" Description: Clangd language server for CUDA (modified from Andrey |
||||
" Melentyev's implementation for C++) |
||||
|
||||
call ale#Set('cuda_clangd_executable', 'clangd') |
||||
call ale#Set('cuda_clangd_options', '') |
||||
call ale#Set('c_build_dir', '') |
||||
|
||||
function! ale_linters#cuda#clangd#GetCommand(buffer) abort |
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer) |
||||
|
||||
return '%e' |
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options')) |
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '') |
||||
endfunction |
||||
|
||||
call ale#linter#Define('cuda', { |
||||
\ 'name': 'clangd', |
||||
\ 'lsp': 'stdio', |
||||
\ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')}, |
||||
\ 'command': function('ale_linters#cuda#clangd#GetCommand'), |
||||
\ 'project_root': function('ale#c#FindProjectRoot'), |
||||
\}) |
@ -0,0 +1,29 @@ |
||||
" Author: Nelson Yeung <nelsyeung@gmail.com> |
||||
" Description: Check Dart files with dart analysis server LSP |
||||
|
||||
call ale#Set('dart_analysis_server_executable', 'dart') |
||||
|
||||
function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort |
||||
" Note: pub only looks for pubspec.yaml, there's no point in adding |
||||
" support for pubspec.yml |
||||
let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml') |
||||
|
||||
return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : '.' |
||||
endfunction |
||||
|
||||
function! ale_linters#dart#analysis_server#GetCommand(buffer) abort |
||||
let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable') |
||||
let l:dart = resolve(exepath(l:executable)) |
||||
|
||||
return '%e ' |
||||
\ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot' |
||||
\ . ' --lsp' |
||||
endfunction |
||||
|
||||
call ale#linter#Define('dart', { |
||||
\ 'name': 'analysis_server', |
||||
\ 'lsp': 'stdio', |
||||
\ 'executable': {b -> ale#Var(b, 'dart_analysis_server_executable')}, |
||||
\ 'command': function('ale_linters#dart#analysis_server#GetCommand'), |
||||
\ 'project_root': function('ale_linters#dart#analysis_server#GetProjectRoot'), |
||||
\}) |
@ -0,0 +1,31 @@ |
||||
call ale#Set('desktop_desktop_file_validate_options', '') |
||||
|
||||
" Example matches for pattern: |
||||
" |
||||
" foo.desktop: warning: key "TerminalOptions" in group ... |
||||
" foo.desktop: error: action "new-private-window" is defined, ... |
||||
let s:pattern = '\v^(.+): ([a-z]+): (.+)$' |
||||
|
||||
function! ale_linters#desktop#desktop_file_validate#Handle(buffer, lines) abort |
||||
" The error format doesn't specify lines, so we can just put all of the |
||||
" errors on line 1. |
||||
return ale#util#MapMatches(a:lines, s:pattern, {match -> { |
||||
\ 'lnum': 1, |
||||
\ 'col': 1, |
||||
\ 'type': match[2] is? 'error' ? 'E' : 'W', |
||||
\ 'text': match[3], |
||||
\}}) |
||||
endfunction |
||||
|
||||
call ale#linter#Define('desktop', { |
||||
\ 'name': 'desktop_file_validate', |
||||
\ 'aliases': ['desktop-file-validate'], |
||||
\ 'executable': 'desktop-file-validate', |
||||
\ 'command': {b -> |
||||
\ '%e' |
||||
\ . ale#Pad(ale#Var(b, 'desktop_desktop_file_validate_options')) |
||||
\ . ' %t' |
||||
\ }, |
||||
\ 'callback': 'ale_linters#desktop#desktop_file_validate#Handle', |
||||
\ 'output_stream': 'both', |
||||
\}) |
@ -1,15 +1,10 @@ |
||||
" Author: Michiel Westerbeek <happylinks@gmail.com> |
||||
" Description: Linter for GraphQL Schemas |
||||
|
||||
function! ale_linters#graphql#gqlint#GetCommand(buffer) abort |
||||
return ale#path#BufferCdString(a:buffer) |
||||
\ . 'gqlint' |
||||
\ . ' --reporter=simple %t' |
||||
endfunction |
||||
|
||||
call ale#linter#Define('graphql', { |
||||
\ 'name': 'gqlint', |
||||
\ 'executable': 'gqlint', |
||||
\ 'command': function('ale_linters#graphql#gqlint#GetCommand'), |
||||
\ 'cwd': '%s:h', |
||||
\ 'command': 'gqlint --reporter=simple %t', |
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning', |
||||
\}) |
||||
|
@ -0,0 +1,63 @@ |
||||
" Author: Yen3 <yen3rc@gmail.com> |
||||
" Description: A language server for haskell |
||||
" The file is based on hie.vim (author: Luxed |
||||
" <devildead13@gmail.com>). It search more project root files. |
||||
" |
||||
call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper') |
||||
|
||||
function! ale_linters#haskell#hls#FindRootFile(buffer) abort |
||||
let l:serach_root_files = [ |
||||
\ 'stack.yaml', |
||||
\ 'cabal.project', |
||||
\ 'package.yaml', |
||||
\ 'hie.yaml' |
||||
\ ] |
||||
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) |
||||
for l:root_file in l:serach_root_files |
||||
if filereadable(l:path . l:root_file) |
||||
return l:path |
||||
endif |
||||
endfor |
||||
endfor |
||||
|
||||
return '' |
||||
endfunction |
||||
|
||||
function! ale_linters#haskell#hls#GetProjectRoot(buffer) abort |
||||
" Search for the project file first |
||||
let l:project_file = ale_linters#haskell#hls#FindRootFile(a:buffer) |
||||
|
||||
" If it's empty, search for the cabal file |
||||
if empty(l:project_file) |
||||
" Search all of the paths except for the root filesystem path. |
||||
let l:paths = join( |
||||
\ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2], |
||||
\ ',' |
||||
\) |
||||
let l:project_file = globpath(l:paths, '*.cabal') |
||||
endif |
||||
|
||||
" If we still can't find one, use the current file. |
||||
if empty(l:project_file) |
||||
let l:project_file = expand('#' . a:buffer . ':p') |
||||
endif |
||||
|
||||
return fnamemodify(l:project_file, ':h') |
||||
endfunction |
||||
|
||||
function! ale_linters#haskell#hls#GetCommand(buffer) abort |
||||
let l:executable = ale#Var(a:buffer, 'haskell_hls_executable') |
||||
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, |
||||
\ 'haskell-language-server-wrapper') |
||||
\ . ' --lsp' |
||||