mirror of
https://github.com/amix/vimrc
synced 2025-07-09 10:45:00 +08:00
gitignore sources_non_forked_cache
This commit is contained in:
5
sources_non_forked/ale/ale_linters/scala/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/scala/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Scala files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('scala')
|
14
sources_non_forked/ale/ale_linters/scala/fsc.vim
Normal file
14
sources_non_forked/ale/ale_linters/scala/fsc.vim
Normal file
@ -0,0 +1,14 @@
|
||||
" Author: Nils Leuzinger - https://github.com/PawkyPenguin
|
||||
" Description: Basic scala support using fsc
|
||||
|
||||
function! s:IsSbt(buffer) abort
|
||||
return index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
\ 'name': 'fsc',
|
||||
\ 'executable': {buf -> s:IsSbt(buf) ? '' : 'fsc'},
|
||||
\ 'command': '%e -Ystop-after:parser %t',
|
||||
\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
50
sources_non_forked/ale/ale_linters/scala/metals.vim
Normal file
50
sources_non_forked/ale/ale_linters/scala/metals.vim
Normal file
@ -0,0 +1,50 @@
|
||||
" Author: Jeffrey Lau - https://github.com/zoonfafer
|
||||
" Description: Metals Language Server for Scala https://scalameta.org/metals/
|
||||
|
||||
call ale#Set('scala_metals_executable', 'metals-vim')
|
||||
call ale#Set('scala_metals_project_root', '')
|
||||
|
||||
function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#Var(a:buffer, 'scala_metals_project_root')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return l:project_root
|
||||
endif
|
||||
|
||||
let l:potential_roots = [
|
||||
\ 'build.sc',
|
||||
\ 'build.sbt',
|
||||
\ '.bloop',
|
||||
\ '.metals',
|
||||
\]
|
||||
|
||||
for l:root in l:potential_roots
|
||||
let l:project_root = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ l:root,
|
||||
\ ''
|
||||
\)
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(
|
||||
\ l:project_root,
|
||||
\ ':h',
|
||||
\)
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#scala#metals#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad('stdio')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
\ 'name': 'metals',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': 'scala',
|
||||
\ 'executable': {b -> ale#Var(b, 'scala_metals_executable')},
|
||||
\ 'command': function('ale_linters#scala#metals#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#scala#metals#GetProjectRoot'),
|
||||
\})
|
31
sources_non_forked/ale/ale_linters/scala/sbtserver.vim
Normal file
31
sources_non_forked/ale/ale_linters/scala/sbtserver.vim
Normal file
@ -0,0 +1,31 @@
|
||||
" Author: ophirr33 <coghlan.ty@gmail.com>
|
||||
" Description: TCP lsp client for sbt Server
|
||||
|
||||
call ale#Set('scala_sbtserver_address', '127.0.0.1:4273')
|
||||
call ale#Set('scala_sbtserver_project_root', '')
|
||||
|
||||
function! ale_linters#scala#sbtserver#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#Var(a:buffer, 'scala_sbtserver_project_root')
|
||||
|
||||
if l:project_root is? ''
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'build.sbt')
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endif
|
||||
|
||||
return l:project_root
|
||||
endfunction
|
||||
|
||||
function! ale_linters#scala#sbtserver#GetAddress(buffer) abort
|
||||
let l:address = ale#Var(a:buffer, 'scala_sbtserver_address')
|
||||
|
||||
return l:address
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
\ 'name': 'sbtserver',
|
||||
\ 'lsp': 'socket',
|
||||
\ 'address': function('ale_linters#scala#sbtserver#GetAddress'),
|
||||
\ 'language': 'scala',
|
||||
\ 'project_root': function('ale_linters#scala#sbtserver#GetProjectRoot'),
|
||||
\})
|
15
sources_non_forked/ale/ale_linters/scala/scalac.vim
Normal file
15
sources_non_forked/ale/ale_linters/scala/scalac.vim
Normal file
@ -0,0 +1,15 @@
|
||||
" Author: Zoltan Kalmar - https://github.com/kalmiz,
|
||||
" w0rp <devw0rp@gmail.com>
|
||||
" Description: Basic scala support using scalac
|
||||
|
||||
function! s:IsSbt(buffer) abort
|
||||
return index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
\ 'name': 'scalac',
|
||||
\ 'executable': {buf -> s:IsSbt(buf) ? '' : 'scalac'},
|
||||
\ 'command': '%e -Ystop-after:parser %t',
|
||||
\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
86
sources_non_forked/ale/ale_linters/scala/scalastyle.vim
Normal file
86
sources_non_forked/ale/ale_linters/scala/scalastyle.vim
Normal file
@ -0,0 +1,86 @@
|
||||
" Author: Kevin Kays - https://github.com/okkays
|
||||
" Description: Support for the scalastyle checker.
|
||||
|
||||
call ale#Set('scala_scalastyle_options', '')
|
||||
" TODO: Remove support for the old option name in ALE 3.0.
|
||||
call ale#Set('scala_scalastyle_config',
|
||||
\ get(g:, 'ale_scalastyle_config_loc', '')
|
||||
\)
|
||||
|
||||
function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort
|
||||
" Look for help output from scalastyle first, which indicates that no
|
||||
" configuration file was found.
|
||||
for l:line in a:lines[:10]
|
||||
if l:line =~# '-c, --config'
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'text': '(See :help ale-scala-scalastyle)'
|
||||
\ . ' No scalastyle configuration file was found.',
|
||||
\}]
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" warning file=/home/blurble/Doop.scala message=Missing or badly formed ScalaDoc: Extra @param foobles line=190
|
||||
let l:patterns = [
|
||||
\ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\)$',
|
||||
\ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\) column=\(\d\+\)$',
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
let l:args = {
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'type': l:match[1] =~? 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[2]
|
||||
\}
|
||||
|
||||
if !empty(l:match[4])
|
||||
let l:args['col'] = l:match[4] + 1
|
||||
endif
|
||||
|
||||
call add(l:output, l:args)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#scala#scalastyle#GetCommand(buffer) abort
|
||||
" Search for scalastyle config in parent directories.
|
||||
let l:scalastyle_config = ''
|
||||
let l:potential_configs = [
|
||||
\ 'scalastyle_config.xml',
|
||||
\ 'scalastyle-config.xml'
|
||||
\]
|
||||
|
||||
for l:config in l:potential_configs
|
||||
let l:scalastyle_config = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ l:config,
|
||||
\ ''
|
||||
\)
|
||||
|
||||
if !empty(l:scalastyle_config)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
" If all else fails, try the global config.
|
||||
if empty(l:scalastyle_config)
|
||||
let l:scalastyle_config = ale#Var(a:buffer, 'scala_scalastyle_config')
|
||||
endif
|
||||
|
||||
return 'scalastyle'
|
||||
\ . (!empty(l:scalastyle_config) ? ' --config ' . ale#Escape(l:scalastyle_config) : '')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'scala_scalastyle_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
\ 'name': 'scalastyle',
|
||||
\ 'executable': 'scalastyle',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'command': function('ale_linters#scala#scalastyle#GetCommand'),
|
||||
\ 'callback': 'ale_linters#scala#scalastyle#Handle',
|
||||
\})
|
Reference in New Issue
Block a user