mirror of https://github.com/amix/vimrc.git
parent
83980d8f24
commit
92c794cc2b
@ -0,0 +1,51 @@ |
||||
" Author: Roeland Moors - https://github.com/roelandmoors |
||||
" based on the ale ruumba and robocop linters |
||||
" Description: ERB Lint, support for https://github.com/Shopify/erb-lint |
||||
|
||||
call ale#Set('eruby_erblint_executable', 'erblint') |
||||
call ale#Set('eruby_erblint_options', '') |
||||
|
||||
function! ale_linters#eruby#erblint#GetCommand(buffer) abort |
||||
let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable') |
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'erblint') |
||||
\ . ' --format json ' |
||||
\ . ale#Var(a:buffer, 'eruby_erblint_options') |
||||
\ . ' --stdin %s' |
||||
endfunction |
||||
|
||||
function! ale_linters#eruby#erblint#Handle(buffer, lines) abort |
||||
if empty(a:lines) |
||||
return [] |
||||
endif |
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], []) |
||||
|
||||
if !has_key(l:errors, 'summary') |
||||
\|| l:errors['summary']['offenses'] == 0 |
||||
\|| empty(l:errors['files']) |
||||
return [] |
||||
endif |
||||
|
||||
let l:output = [] |
||||
|
||||
for l:error in l:errors['files'][0]['offenses'] |
||||
call add(l:output, { |
||||
\ 'lnum': l:error['location']['start_line'] + 0, |
||||
\ 'col': l:error['location']['start_column'] + 0, |
||||
\ 'end_col': l:error['location']['last_column'] + 0, |
||||
\ 'code': l:error['linter'], |
||||
\ 'text': l:error['message'], |
||||
\ 'type': 'W', |
||||
\}) |
||||
endfor |
||||
|
||||
return l:output |
||||
endfunction |
||||
|
||||
call ale#linter#Define('eruby', { |
||||
\ 'name': 'erblint', |
||||
\ 'executable': {b -> ale#Var(b, 'eruby_erblint_executable')}, |
||||
\ 'command': function('ale_linters#eruby#erblint#GetCommand'), |
||||
\ 'callback': 'ale_linters#eruby#erblint#Handle', |
||||
\}) |
@ -0,0 +1,11 @@ |
||||
" Author: Arnold Chand <creativenull@outlook.com> |
||||
" Description: Deno lsp linter for JavaScript files. |
||||
|
||||
call ale#linter#Define('javascript', { |
||||
\ 'name': 'deno', |
||||
\ 'lsp': 'stdio', |
||||
\ 'executable': function('ale#handlers#deno#GetExecutable'), |
||||
\ 'command': '%e lsp', |
||||
\ 'project_root': function('ale#handlers#deno#GetProjectRoot'), |
||||
\ 'initialization_options': function('ale#handlers#deno#GetInitializationOptions'), |
||||
\}) |
@ -0,0 +1,16 @@ |
||||
" Author: Joรฃo Pesce <joao@pesce.cc> |
||||
" Description: eslint for JSON files. |
||||
" |
||||
" Requires eslint-plugin-jsonc or a similar plugin to work |
||||
" |
||||
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp |
||||
" <devw0rp@gmail.com> |
||||
|
||||
call ale#linter#Define('json', { |
||||
\ 'name': 'eslint', |
||||
\ 'output_stream': 'both', |
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'), |
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'), |
||||
\ 'command': function('ale#handlers#eslint#GetCommand'), |
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON', |
||||
\}) |
@ -0,0 +1,16 @@ |
||||
" Author: Joรฃo Pesce <joao@pesce.cc> |
||||
" Description: eslint for JSON5 files. |
||||
" |
||||
" Requires eslint-plugin-jsonc or a similar plugin to work |
||||
" |
||||
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp |
||||
" <devw0rp@gmail.com> |
||||
|
||||
call ale#linter#Define('json5', { |
||||
\ 'name': 'eslint', |
||||
\ 'output_stream': 'both', |
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'), |
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'), |
||||
\ 'command': function('ale#handlers#eslint#GetCommand'), |
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON', |
||||
\}) |
@ -0,0 +1,16 @@ |
||||
" Author: Joรฃo Pesce <joao@pesce.cc> |
||||
" Description: eslint for JSONC files. |
||||
" |
||||
" Requires eslint-plugin-jsonc or a similar plugin to work |
||||
" |
||||
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp |
||||
" <devw0rp@gmail.com> |
||||
|
||||
call ale#linter#Define('jsonc', { |
||||
\ 'name': 'eslint', |
||||
\ 'output_stream': 'both', |
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'), |
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'), |
||||
\ 'command': function('ale#handlers#eslint#GetCommand'), |
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON', |
||||
\}) |
@ -0,0 +1,59 @@ |
||||
" Author: Trevor Whitney <trevorjwhitney@gmail.com> |
||||
" Description: jsonnet-lint for jsonnet files |
||||
|
||||
call ale#Set('jsonnet_jsonnet_lint_executable', 'jsonnet-lint') |
||||
call ale#Set('jsonnet_jsonnet_lint_options', '') |
||||
|
||||
function! ale_linters#jsonnet#jsonnet_lint#GetCommand(buffer) abort |
||||
let l:options = ale#Var(a:buffer, 'jsonnet_jsonnet_lint_options') |
||||
|
||||
return '%e' |
||||
\ . ale#Pad(l:options) |
||||
\ . ' %t' |
||||
endfunction |
||||
|
||||
|
||||
function! ale_linters#jsonnet#jsonnet_lint#Handle(buffer, lines) abort |
||||
" Matches patterns line the following: |
||||
" |
||||
" ERROR: foo.jsonnet:22:3-12 expected token OPERATOR but got (IDENTIFIER, "bar") |
||||
" ERROR: hoge.jsonnet:20:3 unexpected: "}" while parsing terminal |
||||
" ERROR: main.jsonnet:212:1-14 Expected , or ; but got (IDENTIFIER, "older_cluster") |
||||
let l:pattern = '^ERROR: [^:]*:\(\d\+\):\(\d\+\)\(-\d\+\)* \(.*\)' |
||||
let l:output = [] |
||||
|
||||
for l:line in a:lines |
||||
let l:match = matchlist(l:line, l:pattern) |
||||
|
||||
if len(l:match) == 0 |
||||
continue |
||||
endif |
||||
|
||||
let line_number = l:match[1] + 0 |
||||
let column = l:match[2] + 0 |
||||
" l:match[3] has optional -14, when linter is showing a range |
||||
let text = l:match[4] |
||||
|
||||
|
||||
" vcol is Needed to indicate that the column is a character. |
||||
call add(l:output, { |
||||
\ 'bufnr': a:buffer, |
||||
\ 'lnum': line_number, |
||||
\ 'vcol': 0, |
||||
\ 'col': column, |
||||
\ 'text': text, |
||||
\ 'type': 'E', |
||||
\ 'nr': -1, |
||||
\}) |
||||
endfor |
||||
|
||||
return l:output |
||||
endfunction |
||||
|
||||
call ale#linter#Define('jsonnet', { |
||||
\ 'name': 'jsonnet_lint', |
||||
\ 'output_stream': 'stderr', |
||||
\ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnet_lint_executable')}, |
||||
\ 'command': function('ale_linters#jsonnet#jsonnet_lint#GetCommand'), |
||||
\ 'callback': 'ale_linters#jsonnet#jsonnet_lint#Handle', |
||||
\}) |
@ -0,0 +1,52 @@ |
||||
" Authors: Trevor Whitney <trevorjwhitney@gmail.com> and Takuya Kosugiyama <re@itkq.jp> |
||||
" Description: jsonnetfmt for jsonnet files |
||||
|
||||
call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt') |
||||
call ale#Set('jsonnet_jsonnetfmt_options', '') |
||||
|
||||
function! ale_linters#jsonnet#jsonnetfmt#GetCommand(buffer) abort |
||||
let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options') |
||||
|
||||
return '%e' |
||||
\ . ale#Pad(l:options) |
||||
\ . ' %t' |
||||
endfunction |
||||
|
||||
|
||||
function! ale_linters#jsonnet#jsonnetfmt#Handle(buffer, lines) abort |
||||
" Matches patterns line the following: |
||||
" |
||||
" STATIC ERROR: foo.jsonnet:22:3-12: expected token OPERATOR but got (IDENTIFIER, "bar") |
||||
" STATIC ERROR: hoge.jsonnet:20:3: unexpected: "}" while parsing terminal |
||||
let l:pattern = '^STATIC ERROR:[^:]*:\(\d\+\):\(\d\+\):*\(-\d\+\)* \(.*\)' |
||||
let l:output = [] |
||||
|
||||
for l:line in a:lines |
||||
let l:match = matchlist(l:line, l:pattern) |
||||
|
||||
if len(l:match) == 0 |
||||
continue |
||||
endif |
||||
|
||||
" vcol is Needed to indicate that the column is a character. |
||||
call add(l:output, { |
||||
\ 'bufnr': a:buffer, |
||||
\ 'lnum': l:match[1] + 0, |
||||
\ 'vcol': 0, |
||||
\ 'col': l:match[2] + 0, |
||||
\ 'text': l:match[4], |
||||
\ 'type': 'E', |
||||
\ 'nr': -1, |
||||
\}) |
||||
endfor |
||||
|
||||
return l:output |
||||
endfunction |
||||
|
||||
call ale#linter#Define('jsonnet', { |
||||
\ 'name': 'jsonnetfmt', |
||||
\ 'output_stream': 'stderr', |
||||
\ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnetfmt_executable')}, |
||||
\ 'command': function('ale_linters#jsonnet#jsonnetfmt#GetCommand'), |
||||
\ 'callback': 'ale_linters#jsonnet#jsonnetfmt#Handle', |
||||
\}) |
@ -0,0 +1,175 @@ |
||||
" Author: w0rp <devw0rp@gmail.com> |
||||
" Description: flakehell for python files |
||||
|
||||
call ale#Set('python_flakehell_executable', 'flakehell') |
||||
call ale#Set('python_flakehell_options', '') |
||||
call ale#Set('python_flakehell_use_global', get(g:, 'ale_use_global_executables', 0)) |
||||
call ale#Set('python_flakehell_change_directory', 'project') |
||||
call ale#Set('python_flakehell_auto_pipenv', 0) |
||||
call ale#Set('python_flakehell_auto_poetry', 0) |
||||
|
||||
function! s:UsingModule(buffer) abort |
||||
return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python' |
||||
endfunction |
||||
|
||||
function! ale_linters#python#flakehell#GetExecutable(buffer) abort |
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flakehell_auto_pipenv')) |
||||
\ && ale#python#PipenvPresent(a:buffer) |
||||
return 'pipenv' |
||||
endif |
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_flakehell_auto_poetry')) |
||||
\ && ale#python#PoetryPresent(a:buffer) |
||||
return 'poetry' |
||||
endif |
||||
|
||||
if !s:UsingModule(a:buffer) |
||||
return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell']) |
||||
endif |
||||
|
||||
return ale#Var(a:buffer, 'python_flakehell_executable') |
||||
endfunction |
||||
|
||||
function! ale_linters#python#flakehell#RunWithVersionCheck(buffer) abort |
||||
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer) |
||||
|
||||
let l:module_string = s:UsingModule(a:buffer) ? ' -m flakehell' : '' |
||||
let l:command = ale#Escape(l:executable) . l:module_string . ' --version' |
||||
|
||||
return ale#semver#RunWithVersionCheck( |
||||
\ a:buffer, |
||||
\ l:executable, |
||||
\ l:command, |
||||
\ function('ale_linters#python#flakehell#GetCommand'), |
||||
\) |
||||
endfunction |
||||
|
||||
function! ale_linters#python#flakehell#GetCwd(buffer) abort |
||||
let l:change_directory = ale#Var(a:buffer, 'python_flakehell_change_directory') |
||||
let l:cwd = '' |
||||
|
||||
if l:change_directory is# 'project' |
||||
let l:project_root = ale#python#FindProjectRootIni(a:buffer) |
||||
|
||||
if !empty(l:project_root) |
||||
let l:cwd = l:project_root |
||||
endif |
||||
endif |
||||
|
||||
if (l:change_directory is# 'project' && empty(l:cwd)) |
||||
\|| l:change_directory is# 1 |
||||
\|| l:change_directory is# 'file' |
||||
let l:cwd = '%s:h' |
||||
endif |
||||
|
||||
return l:cwd |
||||
endfunction |
||||
|
||||
function! ale_linters#python#flakehell#GetCommand(buffer, version) abort |
||||
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer) |
||||
|
||||
if (l:executable =~? 'pipenv\|poetry$') |
||||
let l:exec_args = ' run flakehell' |
||||
elseif (l:executable is? 'python') |
||||
let l:exec_args = ' -m flakehell' |
||||
else |
||||
let l:exec_args = '' |
||||
endif |
||||
|
||||
" Only include the --stdin-display-name argument if we can parse the |
||||
" flakehell version, and it is recent enough to support it. |
||||
let l:display_name_args = ale#semver#GTE(a:version, [0, 8, 0]) |
||||
\ ? ' --stdin-display-name %s' |
||||
\ : '' |
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_flakehell_options') |
||||
|
||||
return ale#Escape(l:executable) |
||||
\ . l:exec_args |
||||
\ . (!empty(l:options) ? ' lint ' . l:options : ' lint') |
||||
\ . ' --format=default' |
||||
\ . l:display_name_args . ' -' |
||||
endfunction |
||||
|
||||
let s:end_col_pattern_map = { |
||||
\ 'F405': '\(.\+\) may be undefined', |
||||
\ 'F821': 'undefined name ''\([^'']\+\)''', |
||||
\ 'F999': '^''\([^'']\+\)''', |
||||
\ 'F841': 'local variable ''\([^'']\+\)''', |
||||
\} |
||||
|
||||
function! ale_linters#python#flakehell#Handle(buffer, lines) abort |
||||
let l:output = ale#python#HandleTraceback(a:lines, 10) |
||||
|
||||
if !empty(l:output) |
||||
return l:output |
||||
endif |
||||
|
||||
" Matches patterns line the following: |
||||
" |
||||
" Matches patterns line the following: |
||||
" |
||||
" stdin:6:6: E111 indentation is not a multiple of four |
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+):? (.*)$' |
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern) |
||||
let l:code = l:match[3] |
||||
|
||||
if (l:code is# 'W291' || l:code is# 'W293') |
||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace') |
||||
" Skip warnings for trailing whitespace if the option is off. |
||||
continue |
||||
endif |
||||
|
||||
if l:code is# 'W391' |
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines') |
||||
" Skip warnings for trailing blank lines if the option is off |
||||
continue |
||||
endif |
||||
|
||||
let l:item = { |
||||
\ 'lnum': l:match[1] + 0, |
||||
\ 'col': l:match[2] + 0, |
||||
\ 'vcol': 1, |
||||
\ 'text': l:match[4], |
||||
\ 'code': l:code, |
||||
\ 'type': 'W', |
||||
\} |
||||
|
||||
if l:code[:0] is# 'F' |
||||
if l:code isnot# 'F401' |
||||
let l:item.type = 'E' |
||||
endif |
||||
elseif l:code[:0] is# 'E' |
||||
let l:item.type = 'E' |
||||
|
||||
if l:code isnot# 'E999' && l:code isnot# 'E112' |
||||
let l:item.sub_type = 'style' |
||||
endif |
||||
elseif l:code[:0] is# 'W' |
||||
let l:item.sub_type = 'style' |
||||
endif |
||||
|
||||
let l:end_col_pattern = get(s:end_col_pattern_map, l:code, '') |
||||
|
||||
if !empty(l:end_col_pattern) |
||||
let l:end_col_match = matchlist(l:match[4], l:end_col_pattern) |
||||
|
||||
if !empty(l:end_col_match) |
||||
let l:item.end_col = l:item.col + len(l:end_col_match[1]) - 1 |
||||
endif |
||||
endif |
||||
|
||||
call add(l:output, l:item) |
||||
endfor |
||||
|
||||
return l:output |
||||
endfunction |
||||
|
||||
call ale#linter#Define('python', { |
||||
\ 'name': 'flakehell', |
||||
\ 'executable': function('ale_linters#python#flakehell#GetExecutable'), |
||||
\ 'cwd': function('ale_linters#python#flakehell#GetCwd'), |
||||
\ 'command': function('ale_linters#python#flakehell#RunWithVersionCheck'), |
||||
\ 'callback': 'ale_linters#python#flakehell#Handle', |
||||
\}) |
@ -0,0 +1,46 @@ |
||||
" Author: Samuel Branisa <branisa.samuel@icloud.com> |
||||
" Description: rflint linting for robot framework files |
||||
|
||||
call ale#Set('robot_rflint_executable', 'rflint') |
||||
|
||||
function! ale_linters#robot#rflint#GetExecutable(buffer) abort |
||||
return ale#Var(a:buffer, 'robot_rflint_executable') |
||||
endfunction |
||||
|
||||
function! ale_linters#robot#rflint#GetCommand(buffer) abort |
||||
let l:executable = ale_linters#robot#rflint#GetExecutable(a:buffer) |
||||
let l:flags = '--format' |
||||
\ . ' "{filename}:{severity}:{linenumber}:{char}:{rulename}:{message}"' |
||||
|
||||
return l:executable |
||||
\ . ' ' |
||||
\ . l:flags |
||||
\ . ' %s' |
||||
endfunction |
||||
|
||||
function! ale_linters#robot#rflint#Handle(buffer, lines) abort |
||||
let l:pattern = '\v^([[:alnum:][:punct:]]+):(W|E):([[:digit:]]+):([[:digit:]]+):([[:alnum:]]+):(.*)$' |
||||
let l:output = [] |
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern) |
||||
call add(l:output, { |
||||
\ 'bufnr': a:buffer, |
||||
\ 'filename': l:match[1], |
||||
\ 'type': l:match[2], |
||||
\ 'lnum': str2nr(l:match[3]), |
||||
\ 'col': str2nr(l:match[4]), |
||||
\ 'text': l:match[5], |
||||
\ 'detail': l:match[6], |
||||
\}) |
||||
endfor |
||||
|
||||
return l:output |
||||
endfunction |
||||
|
||||
call ale#linter#Define('robot', { |
||||
\ 'name': 'rflint', |
||||
\ 'executable': function('ale_linters#robot#rflint#GetExecutable'), |
||||
\ 'command': function('ale_linters#robot#rflint#GetCommand'), |
||||
\ 'callback': 'ale_linters#robot#rflint#Handle', |
||||
\}) |
||||
|
@ -1,14 +1,11 @@ |
||||
" Author: toastal <toastal@protonmail.com> |
||||
" Author: toastal <toastal@posteo.net> |
||||
" Description: Dhallโs built-in formatter |
||||
" |
||||
function! ale#fixers#dhall_format#Fix(buffer) abort |
||||
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) |
||||
let l:command = l:executable |
||||
\ . ' format' |
||||
\ . ' --inplace %t' |
||||
|
||||
return { |
||||
\ 'command': l:command, |
||||
\ 'read_temporary_file': 1, |
||||
\ 'command': l:executable |
||||
\ . ' format' |
||||
\} |
||||
endfunction |
||||
|
@ -1,18 +1,14 @@ |
||||
" Author: toastal <toastal@protonmail.com> |
||||
" Author: toastal <toastal@posteo.net> |
||||
" Description: Dhallโs package freezing |
||||
|
||||
call ale#Set('dhall_freeze_options', '') |
||||
|
||||
function! ale#fixers#dhall_freeze#Freeze(buffer) abort |
||||
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) |
||||
let l:command = l:executable |
||||
\ . ' freeze' |
||||
\ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options')) |
||||
\ . ' --inplace %t' |
||||
|
||||
|
||||
return { |
||||
\ 'command': l:command, |
||||
\ 'read_temporary_file': 1, |
||||
\ 'command': l:executable |
||||
\ . ' freeze' |
||||
\ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options')) |
||||
\} |
||||
endfunction |
||||
|
@ -1,14 +1,11 @@ |
||||
" Author: toastal <toastal@protonmail.com> |
||||
" Author: toastal <toastal@posteo.net> |
||||
" Description: Dhallโs built-in linter/formatter |
||||
|
||||
function! ale#fixers#dhall_lint#Fix(buffer) abort |
||||
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) |
||||
let l:command = l:executable |
||||
\ . ' lint' |
||||
\ . ' --inplace %t' |
||||
|
||||
return { |
||||
\ 'command': l:command, |
||||
\ 'read_temporary_file': 1, |
||||
\ 'command': l:executable |
||||
\ . ' lint' |
||||
\} |
||||
endfunction |
||||
|
@ -0,0 +1,18 @@ |
||||
" Author: ghsang <gwonhyuksang@gmail.com> |
||||
" Description: Integration of dotnet format with ALE. |
||||
|
||||
call ale#Set('cs_dotnet_format_executable', 'dotnet') |
||||
call ale#Set('cs_dotnet_format_options', '') |
||||
|
||||
function! ale#fixers#dotnet_format#Fix(buffer) abort |
||||
let l:executable = ale#Var(a:buffer, 'cs_dotnet_format_executable') |
||||
let l:options = ale#Var(a:buffer, 'cs_dotnet_format_options') |
||||
|
||||
return { |
||||
\ 'command': ale#Escape(l:executable) |
||||
\ . ' format' |
||||
\ . (empty(l:options) ? '' : ' ' . l:options) |
||||
\ . ' --folder --include %t "$(dirname %t)"', |
||||
\ 'read_temporary_file': 1, |
||||
\} |
||||
endfunction |
@ -0,0 +1,21 @@ |
||||
" Author Pig Frown <pigfrown@protonmail.com> |
||||
" Description: Fix Go files long lines with golines" |
||||
|
||||
call ale#Set('go_golines_executable', 'golines') |
||||
|
||||
call ale#Set('go_golines_options', '') |
||||
|
||||
function! ale#fixers#golines#Fix(buffer) abort |
||||
let l:executable = ale#Var(a:buffer, 'go_golines_executable') |
||||
let l:options = ale#Var(a:buffer, 'go_golines_options') |
||||
let l:env = ale#go#EnvString(a:buffer) |
||||
|
||||
if !executable(l:executable) |
||||
return 0 |
||||
endif |
||||
|
||||
return { |
||||
\ 'command': l:env . ale#Escape(l:executable) |
||||
\ . (empty(l:options) ? '' : ' ' . l:options) |
||||
\} |
||||
endfunction |
@ -0,0 +1,18 @@ |
||||
" Authors: Trevor Whitney <trevorjwhitney@gmail.com> and Takuya Kosugiyama <re@itkq.jp> |
||||
" Description: Integration of jsonnetfmt with ALE. |
||||
|
||||
call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt') |
||||
call ale#Set('jsonnet_jsonnetfmt_options', '') |
||||
|
||||
function! ale#fixers#jsonnetfmt#Fix(buffer) abort |
||||
let l:executable = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_executable') |
||||
let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options') |
||||
|
||||
return { |
||||
\ 'command': ale#Escape(l:executable) |
||||
\ . ' -i' |
||||
\ . ale#Pad(l:options) |
||||
\ . ' %t', |
||||
\ 'read_temporary_file': 1, |
||||
\} |
||||
endfunction |
@ -0,0 +1,24 @@ |
||||
" Author: toastal <toastal@posteo.net> |
||||
" Description: Integration of purs-tidy with ALE. |
||||
|
||||
call ale#Set('purescript_tidy_executable', 'purs-tidy') |
||||
call ale#Set('purescript_tidy_use_global', get(g:, 'ale_use_global_executables', 0)) |
||||
call ale#Set('purescript_tidy_options', '') |
||||
|
||||
function! ale#fixers#purs_tidy#GetExecutable(buffer) abort |
||||
return ale#path#FindExecutable(a:buffer, 'purescript_tidy', [ |
||||
\ 'node_modules/purescript-tidy/bin/index.js', |
||||
\ 'node_modules/.bin/purs-tidy', |
||||
\]) |
||||
endfunction |
||||
|
||||
function! ale#fixers#purs_tidy#Fix(buffer) abort |
||||
let l:executable = ale#fixers#purs_tidy#GetExecutable(a:buffer) |
||||
let l:options = ale#Var(a:buffer, 'purescript_tidy_options') |
||||
|
||||
return { |
||||
\ 'command': ale#Escape(l:executable) |
||||
\ . ' format' |
||||
\ . ale#Pad(l:options) |
||||
\} |
||||
endfunction |