Skip to content

Commit

Permalink
Updated the plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
amix committed Sep 30, 2018
1 parent a6b6493 commit 44dca49
Show file tree
Hide file tree
Showing 27 changed files with 492 additions and 186 deletions.
14 changes: 14 additions & 0 deletions sources_non_forked/ale/ale_linters/c/ccls.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
" Author: Ye Jingchen <[email protected]>, Ben Falconer <[email protected]>, jtalowell <[email protected]>
" Description: A language server for C

call ale#Set('c_ccls_executable', 'ccls')
call ale#Set('c_ccls_init_options', {})

call ale#linter#Define('c', {
\ 'name': 'ccls',
\ 'lsp': 'stdio',
\ 'executable_callback': ale#VarFunc('c_ccls_executable'),
\ 'command': '%e',
\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
\ 'initialization_options_callback':ale#VarFunc('c_ccls_init_options'),
\})
14 changes: 14 additions & 0 deletions sources_non_forked/ale/ale_linters/cpp/ccls.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
" Author: Ye Jingchen <[email protected]>, Ben Falconer <[email protected]>, jtalowell <[email protected]>
" Description: A language server for C++

call ale#Set('cpp_ccls_executable', 'ccls')
call ale#Set('cpp_ccls_init_options', {})

call ale#linter#Define('cpp', {
\ 'name': 'ccls',
\ 'lsp': 'stdio',
\ 'executable_callback': ale#VarFunc('cpp_ccls_executable'),
\ 'command': '%e',
\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
\ 'initialization_options_callback': ale#VarFunc('cpp_ccls_init_options'),
\})
18 changes: 0 additions & 18 deletions sources_non_forked/ale/ale_linters/haskell/ghc-mod.vim

This file was deleted.

19 changes: 19 additions & 0 deletions sources_non_forked/ale/ale_linters/haskell/ghc_mod.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
" Author: wizzup <[email protected]>
" Description: ghc-mod for Haskell files

call ale#Set('haskell_ghc_mod_executable', 'ghc-mod')

function! ale_linters#haskell#ghc_mod#GetCommand (buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_ghc_mod_executable')

return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'ghc-mod')
\ . ' --map-file %s=%t check %s'
endfunction

call ale#linter#Define('haskell', {
\ 'name': 'ghc_mod',
\ 'aliases': ['ghc-mod'],
\ 'executable_callback': ale#VarFunc('haskell_ghc_mod_executable'),
\ 'command_callback': 'ale_linters#haskell#ghc_mod#GetCommand',
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\})
5 changes: 4 additions & 1 deletion sources_non_forked/ale/ale_linters/haskell/hdevtools.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ call ale#Set('haskell_hdevtools_executable', 'hdevtools')
call ale#Set('haskell_hdevtools_options', get(g:, 'hdevtools_options', '-g -Wall'))

function! ale_linters#haskell#hdevtools#GetCommand(buffer) abort
return '%e check' . ale#Pad(ale#Var(a:buffer, 'haskell_hdevtools_options'))
let l:executable = ale#Var(a:buffer, 'haskell_hdevtools_executable')

return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hdevtools')
\ . ' check' . ale#Pad(ale#Var(a:buffer, 'haskell_hdevtools_options'))
\ . ' -p %s %t'
endfunction

Expand Down
15 changes: 9 additions & 6 deletions sources_non_forked/ale/ale_linters/haskell/hie.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

call ale#Set('haskell_hie_executable', 'hie')

function! ale_linters#haskell#hie#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'haskell_hie_executable')
endfunction

function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
" Search for the stack file first
let l:project_file = ale#path#FindNearestFile(a:buffer, 'stack.yaml')
Expand Down Expand Up @@ -35,10 +31,17 @@ function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
return l:project_file
endfunction

function! ale_linters#haskell#hie#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_hie_executable')

return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hie')
\ . ' --lsp'
endfunction

call ale#linter#Define('haskell', {
\ 'name': 'hie',
\ 'lsp': 'stdio',
\ 'command': '%e --lsp',
\ 'executable_callback': 'ale_linters#haskell#hie#GetExecutable',
\ 'command_callback': 'ale_linters#haskell#hie#GetCommand',
\ 'executable_callback': ale#VarFunc('haskell_hie_executable'),
\ 'project_root_callback': 'ale_linters#haskell#hie#GetProjectRoot',
\})
16 changes: 14 additions & 2 deletions sources_non_forked/ale/ale_linters/haskell/hlint.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Author: jparoz <[email protected]>
" Description: hlint for Haskell files

call ale#Set('haskell_hlint_executable', 'hlint')
call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', ''))

function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
let l:output = []

Expand All @@ -26,9 +29,18 @@ function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
return l:output
endfunction

function! ale_linters#haskell#hlint#GetCommand(buffer) abort
let l:hlintopts = '--color=never --json'

return ale#handlers#hlint#GetExecutable(a:buffer)
\ . ' ' . ale#Var(a:buffer, 'haskell_hlint_options')
\ . ' ' . l:hlintopts
\ . ' -'
endfunction

call ale#linter#Define('haskell', {
\ 'name': 'hlint',
\ 'executable': 'hlint',
\ 'command': 'hlint --color=never --json -',
\ 'executable_callback': ale#VarFunc('haskell_hlint_executable'),
\ 'command_callback': 'ale_linters#haskell#hlint#GetCommand' ,
\ 'callback': 'ale_linters#haskell#hlint#Handle',
\})
14 changes: 14 additions & 0 deletions sources_non_forked/ale/ale_linters/objc/ccls.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
" Author: Ye Jingchen <[email protected]>, Ben Falconer <[email protected]>, jtalowell <[email protected]>
" Description: A language server for Objective-C

call ale#Set('objc_ccls_executable', 'ccls')
call ale#Set('objc_ccls_init_options', {})

call ale#linter#Define('objc', {
\ 'name': 'ccls',
\ 'lsp': 'stdio',
\ 'executable_callback': ale#VarFunc('objc_ccls_executable'),
\ 'command': '%e',
\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
\ 'initialization_options_callback': ale#VarFunc('objc_ccls_init_options'),
\})
28 changes: 28 additions & 0 deletions sources_non_forked/ale/ale_linters/php/psalm.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
" Author: richard marmorstein <https://github.com/twitchard>
" Description: plugin for Psalm, static analyzer for PHP

call ale#Set('php_psalm_executable', 'psalm')

function! ale_linters#php#psalm#Handle(buffer, lines) abort
" Matches patterns like the following:
let l:pattern = '^.*:\(\d\+\):\(\d\+\):\(\w\+\) - \(.*\)$'
let l:output = []

for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'text': l:match[4],
\ 'type': l:match[3][:0] is# 'e' ? 'E' : 'W',
\})
endfor

return l:output
endfunction

call ale#linter#Define('php', {
\ 'name': 'psalm',
\ 'command': '%e --diff --output-format=emacs %s',
\ 'executable_callback': ale#VarFunc('php_psalm_executable'),
\ 'callback': 'ale_linters#php#psalm#Handle',
\ 'lint_file': 1,
\})
8 changes: 7 additions & 1 deletion sources_non_forked/ale/ale_linters/scss/stylelint.vim
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
" Author: diartyz <[email protected]>

call ale#Set('scss_stylelint_executable', 'stylelint')
call ale#Set('scss_stylelint_options', '')
call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))

function! ale_linters#scss#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
\ . ' --stdin-filename %s'
endfunction

call ale#linter#Define('scss', {
\ 'name': 'stylelint',
\ 'executable_callback': ale#node#FindExecutableFunc('scss_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ]),
\ 'command': '%e --stdin-filename %s',
\ 'command_callback': 'ale_linters#scss#stylelint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
\})
10 changes: 8 additions & 2 deletions sources_non_forked/ale/autoload/ale/fixers/brittany.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@

call ale#Set('haskell_brittany_executable', 'brittany')

function! ale#fixers#brittany#Fix(buffer) abort
function! ale#fixers#brittany#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable')

return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'brittany')
endfunction

function! ale#fixers#brittany#Fix(buffer) abort
let l:executable = ale#fixers#brittany#GetExecutable(a:buffer)

return {
\ 'command': ale#Escape(l:executable)
\ 'command': l:executable
\ . ' --write-mode inplace'
\ . ' %t',
\ 'read_temporary_file': 1,
Expand Down
17 changes: 16 additions & 1 deletion sources_non_forked/ale/autoload/ale/fixers/generic_python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, line
let l:new_lines = []
let l:last_indent_size = 0
let l:last_line_is_blank = 0
let l:in_docstring = 0

for l:line in a:lines
let l:indent_size = len(matchstr(l:line, '^ *'))

if !l:in_docstring
" Make sure it is not just a single line docstring and then verify
" it's starting a new docstring
if match(l:line, '\v^ *("""|'''''').*("""|'''''')') == -1
\&& match(l:line, '\v^ *("""|'''''')') >= 0
let l:in_docstring = 1
endif
else
if match(l:line, '\v^ *.*("""|'''''')') >= 0
let l:in_docstring = 0
endif
endif

if !l:last_line_is_blank
\&& !l:in_docstring
\&& l:indent_size <= l:last_indent_size
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)') >= 0
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)(\(| |$)') >= 0
call add(l:new_lines, '')
endif

Expand Down
2 changes: 1 addition & 1 deletion sources_non_forked/ale/autoload/ale/fixers/hfmt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function! ale#fixers#hfmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable')

return {
\ 'command': ale#Escape(l:executable)
\ 'command': ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hfmt')
\ . ' -w'
\ . ' %t',
\ 'read_temporary_file': 1,
Expand Down
5 changes: 1 addition & 4 deletions sources_non_forked/ale/autoload/ale/fixers/hlint.vim
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
" Author: eborden <[email protected]>
" Description: Integration of hlint refactor with ALE.
"
call ale#Set('haskell_hlint_executable', 'hlint')

function! ale#fixers#hlint#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')

return {
\ 'command': ale#Escape(l:executable)
\ 'command': ale#handlers#hlint#GetExecutable(a:buffer)
\ . ' --refactor'
\ . ' --refactor-options="--inplace"'
\ . ' %t',
Expand Down
10 changes: 8 additions & 2 deletions sources_non_forked/ale/autoload/ale/fixers/stylish_haskell.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
"
call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')

function! ale#fixers#stylish_haskell#Fix(buffer) abort
function! ale#fixers#stylish_haskell#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')

return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'stylish-haskell')
endfunction

function! ale#fixers#stylish_haskell#Fix(buffer) abort
let l:executable = ale#fixers#stylish_haskell#GetExecutable(a:buffer)

return {
\ 'command': ale#Escape(l:executable)
\ 'command': l:executable
\ . ' --inplace'
\ . ' %t',
\ 'read_temporary_file': 1,
Expand Down
17 changes: 17 additions & 0 deletions sources_non_forked/ale/autoload/ale/handlers/ccls.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
scriptencoding utf-8
" Author: Ye Jingchen <[email protected]>
" Description: Utilities for ccls

function! ale#handlers#ccls#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls-root')

if empty(l:project_root)
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
endif

if empty(l:project_root)
let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls')
endif

return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function! ale#handlers#haskell_stack#EscapeExecutable(executable, stack_exec) abort
let l:exec_args = a:executable =~? 'stack$'
\ ? ' exec ' . ale#Escape(a:stack_exec) . ' --'
\ : ''

return ale#Escape(a:executable) . l:exec_args
endfunction
8 changes: 8 additions & 0 deletions sources_non_forked/ale/autoload/ale/handlers/hlint.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
call ale#Set('haskell_hlint_executable', 'hlint')
call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', ''))

function! ale#handlers#hlint#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')

return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hlint')
endfunction
31 changes: 31 additions & 0 deletions sources_non_forked/ale/doc/ale-c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,36 @@ g:ale_c_uncrustify_options *g:ale_c_uncrustify_options*
This variable can be change to modify flags given to uncrustify.


===============================================================================
ccls *ale-c-ccls*

g:ale_c_ccls_executable *g:ale_c_ccls_executable*
*b:ale_c_ccls_executable*
Type: |String|
Default: `'ccls'`

This variable can be changed to use a different executable for ccls.


g:ale_c_ccls_init_options *g:ale_c_ccls_init_options*
*b:ale_c_ccls_init_options*
Type: |Dictionary|
Default: `{}`

This variable can be changed to customize ccls initialization options.
Example: >
{
\ 'cacheDirectory': '/tmp/ccls',
\ 'cacheFormat': 'binary',
\ 'diagnostics': {
\ 'onOpen': 0,
\ 'opChange': 1000,
\ },
\ }
<
Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all
available options and explanations.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
Loading

0 comments on commit 44dca49

Please sign in to comment.