summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/dafny/dafny.vim25
-rw-r--r--ale_linters/dart/language_server.vim30
-rw-r--r--ale_linters/python/pyls.vim21
-rw-r--r--ale_linters/typescript/tslint.vim4
4 files changed, 80 insertions, 0 deletions
diff --git a/ale_linters/dafny/dafny.vim b/ale_linters/dafny/dafny.vim
new file mode 100644
index 00000000..8bbf1b13
--- /dev/null
+++ b/ale_linters/dafny/dafny.vim
@@ -0,0 +1,25 @@
+" Author: Taylor Blau <me@ttaylorr.com>
+
+function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
+ let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'bufnr': a:buffer,
+ \ 'col': l:match[3] + 0,
+ \ 'lnum': l:match[2] + 0,
+ \ 'text': l:match[5],
+ \ 'type': l:match[4] =~# '^Error' ? 'E' : 'W'
+ \ })
+ endfor
+ return l:output
+endfunction
+
+call ale#linter#Define('dafny', {
+\ 'name': 'dafny',
+\ 'executable': 'dafny',
+\ 'command': 'dafny %s /compile:0',
+\ 'callback': 'ale_linters#dafny#dafny#Handle',
+\ 'lint_file': 1,
+\ })
diff --git a/ale_linters/dart/language_server.vim b/ale_linters/dart/language_server.vim
new file mode 100644
index 00000000..15c77017
--- /dev/null
+++ b/ale_linters/dart/language_server.vim
@@ -0,0 +1,30 @@
+" Author: aurieh <me@aurieh.me>
+" Description: A language server for dart
+
+call ale#Set('dart_language_server_executable', 'dart_language_server')
+
+function! ale_linters#dart#language_server#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'dart_language_server_executable')
+endfunction
+
+function! ale_linters#dart#language_server#GetLanguage(buffer) abort
+ return 'dart'
+endfunction
+
+function! ale_linters#dart#language_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
+
+call ale#linter#Define('dart', {
+\ 'name': 'language_server',
+\ 'lsp': 'stdio',
+\ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable',
+\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
+\ 'language_callback': 'ale_linters#dart#language_server#GetLanguage',
+\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
+\})
+
diff --git a/ale_linters/python/pyls.vim b/ale_linters/python/pyls.vim
new file mode 100644
index 00000000..1b91c2c7
--- /dev/null
+++ b/ale_linters/python/pyls.vim
@@ -0,0 +1,21 @@
+" Author: aurieh <me@aurieh.me>
+" Description: A language server for Python
+
+call ale#Set('python_pyls_executable', 'pyls')
+
+function! ale_linters#python#pyls#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'python_pyls_executable')
+endfunction
+
+function! ale_linters#python#pyls#GetLanguage(buffer) abort
+ return 'python'
+endfunction
+
+call ale#linter#Define('python', {
+\ 'name': 'pyls',
+\ 'lsp': 'stdio',
+\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
+\ 'command_callback': 'ale_linters#python#pyls#GetExecutable',
+\ 'language_callback': 'ale_linters#python#pyls#GetLanguage',
+\ 'project_root_callback': 'ale#python#FindProjectRoot',
+\})
diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim
index c3852b89..e366af8f 100644
--- a/ale_linters/typescript/tslint.vim
+++ b/ale_linters/typescript/tslint.vim
@@ -24,6 +24,10 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
let l:output = []
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
+ if get(l:error, 'ruleName', '') is# 'no-implicit-dependencies'
+ continue
+ endif
+
call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:error.name),
\ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),