diff options
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/balloon.vim | 9 | ||||
-rw-r--r-- | autoload/ale/engine.vim | 3 | ||||
-rw-r--r-- | autoload/ale/handlers/go.vim | 25 | ||||
-rw-r--r-- | autoload/ale/handlers/markdownlint.vim | 17 | ||||
-rw-r--r-- | autoload/ale/handlers/textlint.vim | 24 | ||||
-rw-r--r-- | autoload/ale/path.vim | 4 | ||||
-rw-r--r-- | autoload/ale/toggle.vim | 16 |
7 files changed, 82 insertions, 16 deletions
diff --git a/autoload/ale/balloon.vim b/autoload/ale/balloon.vim index 41fa95fa..552ced82 100644 --- a/autoload/ale/balloon.vim +++ b/autoload/ale/balloon.vim @@ -2,6 +2,13 @@ " Description: balloonexpr support for ALE. function! ale#balloon#MessageForPos(bufnr, lnum, col) abort + " Don't show balloons if they are disabled, or linting is disabled. + if !ale#Var(a:bufnr, 'set_balloons') + \|| !g:ale_enabled + \|| !getbufvar(a:bufnr, 'ale_enabled', 1) + return '' + endif + let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col) @@ -13,7 +20,7 @@ function! ale#balloon#Expr() abort endfunction function! ale#balloon#Disable() abort - set noballooneval + set noballooneval balloonexpr= endfunction function! ale#balloon#Enable() abort diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index 89169874..dd871c36 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -366,9 +366,6 @@ function! s:RemapItemTypes(type_map, loclist) abort endfor endfunction -" Save the temporary directory so we can figure out if files are in it. -let s:temp_dir = fnamemodify(tempname(), ':h') - function! ale#engine#FixLocList(buffer, linter_name, loclist) abort let l:bufnr_map = {} let l:new_loclist = [] diff --git a/autoload/ale/handlers/go.vim b/autoload/ale/handlers/go.vim new file mode 100644 index 00000000..224df664 --- /dev/null +++ b/autoload/ale/handlers/go.vim @@ -0,0 +1,25 @@ +" Author: neersighted <bjorn@neersighted.com> +" Description: go vet for Go files +" +" Author: John Eikenberry <jae@zhar.net> +" Description: updated to work with go1.10 +" +" Author: Ben Paxton <ben@gn32.uk> +" Description: moved to generic Golang file from govet + +function! ale#handlers#go#Handler(buffer, lines) abort + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$' + let l:output = [] + let l:dir = expand('#' . a:buffer . ':p:h') + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[4], + \ 'type': 'E', + \}) + endfor + return l:output +endfunction diff --git a/autoload/ale/handlers/markdownlint.vim b/autoload/ale/handlers/markdownlint.vim new file mode 100644 index 00000000..12fc501c --- /dev/null +++ b/autoload/ale/handlers/markdownlint.vim @@ -0,0 +1,17 @@ +" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com> +" Description: Adds support for markdownlint + +function! ale#handlers#markdownlint#Handle(buffer, lines) abort + let l:pattern=': \(\d*\): \(MD\d\{3}\)\(\/\)\([A-Za-z0-9-]\+\)\(.*\)$' + 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[2] . l:match[3] . l:match[4] . ')' . l:match[5], + \ 'type': 'W', + \ }) + endfor + + return l:output +endfunction diff --git a/autoload/ale/handlers/textlint.vim b/autoload/ale/handlers/textlint.vim index 0aae57ef..4e56e127 100644 --- a/autoload/ale/handlers/textlint.vim +++ b/autoload/ale/handlers/textlint.vim @@ -1,5 +1,25 @@ -" Author: tokida https://rouger.info -" Description: Redpen, a proofreading tool (http://redpen.cc) +" Author: tokida https://rouger.info, Yasuhiro Kiyota <yasuhiroki.duck@gmail.com> +" Description: textlint, a proofreading tool (https://textlint.github.io/) + +call ale#Set('textlint_executable', 'textlint') +call ale#Set('textlint_use_global', 0) +call ale#Set('textlint_options', '') + +function! ale#handlers#textlint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'textlint', [ + \ 'node_modules/.bin/textlint', + \ 'node_modules/textlint/bin/textlint.js', + \]) +endfunction + +function! ale#handlers#textlint#GetCommand(buffer) abort + let l:executable = ale#handlers#textlint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'textlint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -f json --stdin --stdin-filename %s' +endfunction function! ale#handlers#textlint#HandleTextlintOutput(buffer, lines) abort let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {'messages': []}) diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim index 16dabf21..91832b35 100644 --- a/autoload/ale/path.vim +++ b/autoload/ale/path.vim @@ -84,12 +84,12 @@ function! ale#path#IsAbsolute(filename) abort return a:filename[:0] is# '/' || a:filename[1:2] is# ':\' endfunction -let s:temp_dir = fnamemodify(tempname(), ':h') +let s:temp_dir = ale#path#Simplify(fnamemodify(tempname(), ':h')) " Given a filename, return 1 if the file represents some temporary file " created by Vim. function! ale#path#IsTempName(filename) abort - return a:filename[:len(s:temp_dir) - 1] is# s:temp_dir + return ale#path#Simplify(a:filename)[:len(s:temp_dir) - 1] is# s:temp_dir endfunction " Given a base directory, which must not have a trailing slash, and a diff --git a/autoload/ale/toggle.vim b/autoload/ale/toggle.vim index e9cc29b6..2fa98b4a 100644 --- a/autoload/ale/toggle.vim +++ b/autoload/ale/toggle.vim @@ -84,10 +84,6 @@ function! s:EnablePreamble() abort " Lint immediately, including running linters against the file. call ale#Queue(0, 'lint_file') - - if g:ale_set_balloons - call ale#balloon#Enable() - endif endfunction function! s:DisablePostamble() abort @@ -95,10 +91,6 @@ function! s:DisablePostamble() abort if g:ale_set_highlights call ale#highlight#UpdateHighlights() endif - - if g:ale_set_balloons - call ale#balloon#Disable() - endif endfunction function! s:CleanupEveryBuffer() abort @@ -121,9 +113,17 @@ function! ale#toggle#Toggle() abort if g:ale_enabled call s:EnablePreamble() + + if g:ale_set_balloons + call ale#balloon#Enable() + endif else call s:CleanupEveryBuffer() call s:DisablePostamble() + + if has('balloon_eval') + call ale#balloon#Disable() + endif endif call ale#toggle#InitAuGroups() |