summaryrefslogtreecommitdiff
path: root/ale_linters/scala/fsc.vim
diff options
context:
space:
mode:
authorNils Leuzinger <nilsl@student.ethz.ch>2018-04-05 21:04:11 +0200
committerw0rp <w0rp@users.noreply.github.com>2018-04-05 21:04:11 +0200
commit912f632bf591377a69bf688f6a85668d93be8841 (patch)
tree2a970b78998ca400551c7ef7d025826f9207db76 /ale_linters/scala/fsc.vim
parenta2acdecbc2d03fbf03e74835086532b62e60665c (diff)
downloadale-912f632bf591377a69bf688f6a85668d93be8841.zip
Add fsc linter for Scala (#1452)
* Add fsc as a Scala linter * Pull reused code into `autoload/ale/` directory * Include fsc into the README * Add unit test for testing the scala handler * Add unit test for scala's fsc linter * Rename scala unit tests for clarity * Fix typo in README * Fix typos in doc/ale.txt * Fix author headline * Put methods for fsc commands back into fsc.vim * Move command_callback tests to correct location * Rewrite handler test so it actually tests handler * Clarify description of test in test_scala_handler
Diffstat (limited to 'ale_linters/scala/fsc.vim')
-rw-r--r--ale_linters/scala/fsc.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/ale_linters/scala/fsc.vim b/ale_linters/scala/fsc.vim
new file mode 100644
index 00000000..17b26f0b
--- /dev/null
+++ b/ale_linters/scala/fsc.vim
@@ -0,0 +1,29 @@
+" Author: Nils Leuzinger - https://github.com/PawkyPenguin
+" Description: Basic scala support using fsc
+"
+function! ale_linters#scala#fsc#GetExecutable(buffer) abort
+ if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
+ " Don't check sbt files
+ return ''
+ endif
+
+ return 'fsc'
+endfunction
+
+function! ale_linters#scala#fsc#GetCommand(buffer) abort
+ let l:executable = ale_linters#scala#fsc#GetExecutable(a:buffer)
+
+ if empty(l:executable)
+ return ''
+ endif
+
+ return ale#Escape(l:executable) . ' -Ystop-after:parser %t'
+endfunction
+
+call ale#linter#Define('scala', {
+\ 'name': 'fsc',
+\ 'executable_callback': 'ale_linters#scala#fsc#GetExecutable',
+\ 'command_callback': 'ale_linters#scala#fsc#GetCommand',
+\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
+\ 'output_stream': 'stderr',
+\})