Updated the plugins
This commit is contained in:
parent
a6b64938eb
commit
44dca49794
27 changed files with 491 additions and 185 deletions
14
sources_non_forked/ale/ale_linters/c/ccls.vim
Normal file
14
sources_non_forked/ale/ale_linters/c/ccls.vim
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||||
|
" Description: A language server for C
|
||||||
|
|
||||||
|
call ale#Set('c_ccls_executable', 'ccls')
|
||||||
|
call ale#Set('c_ccls_init_options', {})
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'ccls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable_callback': ale#VarFunc('c_ccls_executable'),
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
|
||||||
|
\ 'initialization_options_callback':ale#VarFunc('c_ccls_init_options'),
|
||||||
|
\})
|
14
sources_non_forked/ale/ale_linters/cpp/ccls.vim
Normal file
14
sources_non_forked/ale/ale_linters/cpp/ccls.vim
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||||
|
" Description: A language server for C++
|
||||||
|
|
||||||
|
call ale#Set('cpp_ccls_executable', 'ccls')
|
||||||
|
call ale#Set('cpp_ccls_init_options', {})
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'ccls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable_callback': ale#VarFunc('cpp_ccls_executable'),
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
|
||||||
|
\ 'initialization_options_callback': ale#VarFunc('cpp_ccls_init_options'),
|
||||||
|
\})
|
|
@ -1,18 +0,0 @@
|
||||||
" Author: wizzup <wizzup@gmail.com>
|
|
||||||
" Description: ghc-mod for Haskell files
|
|
||||||
|
|
||||||
call ale#linter#Define('haskell', {
|
|
||||||
\ 'name': 'ghc_mod',
|
|
||||||
\ 'aliases': ['ghc-mod'],
|
|
||||||
\ 'executable': 'ghc-mod',
|
|
||||||
\ 'command': 'ghc-mod --map-file %s=%t check %s',
|
|
||||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
|
||||||
\})
|
|
||||||
|
|
||||||
call ale#linter#Define('haskell', {
|
|
||||||
\ 'name': 'stack_ghc_mod',
|
|
||||||
\ 'aliases': ['stack-ghc-mod'],
|
|
||||||
\ 'executable': 'stack',
|
|
||||||
\ 'command': 'stack exec ghc-mod -- --map-file %s=%t check %s',
|
|
||||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
|
||||||
\})
|
|
19
sources_non_forked/ale/ale_linters/haskell/ghc_mod.vim
Normal file
19
sources_non_forked/ale/ale_linters/haskell/ghc_mod.vim
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
" Author: wizzup <wizzup@gmail.com>
|
||||||
|
" Description: ghc-mod for Haskell files
|
||||||
|
|
||||||
|
call ale#Set('haskell_ghc_mod_executable', 'ghc-mod')
|
||||||
|
|
||||||
|
function! ale_linters#haskell#ghc_mod#GetCommand (buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'haskell_ghc_mod_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'ghc-mod')
|
||||||
|
\ . ' --map-file %s=%t check %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('haskell', {
|
||||||
|
\ 'name': 'ghc_mod',
|
||||||
|
\ 'aliases': ['ghc-mod'],
|
||||||
|
\ 'executable_callback': ale#VarFunc('haskell_ghc_mod_executable'),
|
||||||
|
\ 'command_callback': 'ale_linters#haskell#ghc_mod#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||||
|
\})
|
|
@ -5,7 +5,10 @@ call ale#Set('haskell_hdevtools_executable', 'hdevtools')
|
||||||
call ale#Set('haskell_hdevtools_options', get(g:, 'hdevtools_options', '-g -Wall'))
|
call ale#Set('haskell_hdevtools_options', get(g:, 'hdevtools_options', '-g -Wall'))
|
||||||
|
|
||||||
function! ale_linters#haskell#hdevtools#GetCommand(buffer) abort
|
function! ale_linters#haskell#hdevtools#GetCommand(buffer) abort
|
||||||
return '%e check' . ale#Pad(ale#Var(a:buffer, 'haskell_hdevtools_options'))
|
let l:executable = ale#Var(a:buffer, 'haskell_hdevtools_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hdevtools')
|
||||||
|
\ . ' check' . ale#Pad(ale#Var(a:buffer, 'haskell_hdevtools_options'))
|
||||||
\ . ' -p %s %t'
|
\ . ' -p %s %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
|
|
||||||
call ale#Set('haskell_hie_executable', 'hie')
|
call ale#Set('haskell_hie_executable', 'hie')
|
||||||
|
|
||||||
function! ale_linters#haskell#hie#GetExecutable(buffer) abort
|
|
||||||
return ale#Var(a:buffer, 'haskell_hie_executable')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
|
function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
|
||||||
" Search for the stack file first
|
" Search for the stack file first
|
||||||
let l:project_file = ale#path#FindNearestFile(a:buffer, 'stack.yaml')
|
let l:project_file = ale#path#FindNearestFile(a:buffer, 'stack.yaml')
|
||||||
|
@ -35,10 +31,17 @@ function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
|
||||||
return l:project_file
|
return l:project_file
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#haskell#hie#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'haskell_hie_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hie')
|
||||||
|
\ . ' --lsp'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('haskell', {
|
call ale#linter#Define('haskell', {
|
||||||
\ 'name': 'hie',
|
\ 'name': 'hie',
|
||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'command': '%e --lsp',
|
\ 'command_callback': 'ale_linters#haskell#hie#GetCommand',
|
||||||
\ 'executable_callback': 'ale_linters#haskell#hie#GetExecutable',
|
\ 'executable_callback': ale#VarFunc('haskell_hie_executable'),
|
||||||
\ 'project_root_callback': 'ale_linters#haskell#hie#GetProjectRoot',
|
\ 'project_root_callback': 'ale_linters#haskell#hie#GetProjectRoot',
|
||||||
\})
|
\})
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
" Author: jparoz <jesse.paroz@gmail.com>
|
" Author: jparoz <jesse.paroz@gmail.com>
|
||||||
" Description: hlint for Haskell files
|
" Description: hlint for Haskell files
|
||||||
|
|
||||||
|
call ale#Set('haskell_hlint_executable', 'hlint')
|
||||||
|
call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', ''))
|
||||||
|
|
||||||
function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
|
function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
|
@ -26,9 +29,18 @@ function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
|
||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#haskell#hlint#GetCommand(buffer) abort
|
||||||
|
let l:hlintopts = '--color=never --json'
|
||||||
|
|
||||||
|
return ale#handlers#hlint#GetExecutable(a:buffer)
|
||||||
|
\ . ' ' . ale#Var(a:buffer, 'haskell_hlint_options')
|
||||||
|
\ . ' ' . l:hlintopts
|
||||||
|
\ . ' -'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('haskell', {
|
call ale#linter#Define('haskell', {
|
||||||
\ 'name': 'hlint',
|
\ 'name': 'hlint',
|
||||||
\ 'executable': 'hlint',
|
\ 'executable_callback': ale#VarFunc('haskell_hlint_executable'),
|
||||||
\ 'command': 'hlint --color=never --json -',
|
\ 'command_callback': 'ale_linters#haskell#hlint#GetCommand' ,
|
||||||
\ 'callback': 'ale_linters#haskell#hlint#Handle',
|
\ 'callback': 'ale_linters#haskell#hlint#Handle',
|
||||||
\})
|
\})
|
||||||
|
|
14
sources_non_forked/ale/ale_linters/objc/ccls.vim
Normal file
14
sources_non_forked/ale/ale_linters/objc/ccls.vim
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||||
|
" Description: A language server for Objective-C
|
||||||
|
|
||||||
|
call ale#Set('objc_ccls_executable', 'ccls')
|
||||||
|
call ale#Set('objc_ccls_init_options', {})
|
||||||
|
|
||||||
|
call ale#linter#Define('objc', {
|
||||||
|
\ 'name': 'ccls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable_callback': ale#VarFunc('objc_ccls_executable'),
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
|
||||||
|
\ 'initialization_options_callback': ale#VarFunc('objc_ccls_init_options'),
|
||||||
|
\})
|
28
sources_non_forked/ale/ale_linters/php/psalm.vim
Normal file
28
sources_non_forked/ale/ale_linters/php/psalm.vim
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
" Author: richard marmorstein <https://github.com/twitchard>
|
||||||
|
" Description: plugin for Psalm, static analyzer for PHP
|
||||||
|
|
||||||
|
call ale#Set('php_psalm_executable', 'psalm')
|
||||||
|
|
||||||
|
function! ale_linters#php#psalm#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns like the following:
|
||||||
|
let l:pattern = '^.*:\(\d\+\):\(\d\+\):\(\w\+\) - \(.*\)$'
|
||||||
|
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[4],
|
||||||
|
\ 'type': l:match[3][:0] is# 'e' ? 'E' : 'W',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('php', {
|
||||||
|
\ 'name': 'psalm',
|
||||||
|
\ 'command': '%e --diff --output-format=emacs %s',
|
||||||
|
\ 'executable_callback': ale#VarFunc('php_psalm_executable'),
|
||||||
|
\ 'callback': 'ale_linters#php#psalm#Handle',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
|
@ -1,13 +1,19 @@
|
||||||
" Author: diartyz <diartyz@gmail.com>
|
" Author: diartyz <diartyz@gmail.com>
|
||||||
|
|
||||||
call ale#Set('scss_stylelint_executable', 'stylelint')
|
call ale#Set('scss_stylelint_executable', 'stylelint')
|
||||||
|
call ale#Set('scss_stylelint_options', '')
|
||||||
call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
function! ale_linters#scss#stylelint#GetCommand(buffer) abort
|
||||||
|
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
|
||||||
|
\ . ' --stdin-filename %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('scss', {
|
call ale#linter#Define('scss', {
|
||||||
\ 'name': 'stylelint',
|
\ 'name': 'stylelint',
|
||||||
\ 'executable_callback': ale#node#FindExecutableFunc('scss_stylelint', [
|
\ 'executable_callback': ale#node#FindExecutableFunc('scss_stylelint', [
|
||||||
\ 'node_modules/.bin/stylelint',
|
\ 'node_modules/.bin/stylelint',
|
||||||
\ ]),
|
\ ]),
|
||||||
\ 'command': '%e --stdin-filename %s',
|
\ 'command_callback': 'ale_linters#scss#stylelint#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||||
\})
|
\})
|
||||||
|
|
|
@ -3,11 +3,17 @@
|
||||||
|
|
||||||
call ale#Set('haskell_brittany_executable', 'brittany')
|
call ale#Set('haskell_brittany_executable', 'brittany')
|
||||||
|
|
||||||
function! ale#fixers#brittany#Fix(buffer) abort
|
function! ale#fixers#brittany#GetExecutable(buffer) abort
|
||||||
let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable')
|
let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'brittany')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#fixers#brittany#Fix(buffer) abort
|
||||||
|
let l:executable = ale#fixers#brittany#GetExecutable(a:buffer)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': l:executable
|
||||||
\ . ' --write-mode inplace'
|
\ . ' --write-mode inplace'
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
|
|
|
@ -6,13 +6,28 @@ function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, line
|
||||||
let l:new_lines = []
|
let l:new_lines = []
|
||||||
let l:last_indent_size = 0
|
let l:last_indent_size = 0
|
||||||
let l:last_line_is_blank = 0
|
let l:last_line_is_blank = 0
|
||||||
|
let l:in_docstring = 0
|
||||||
|
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
let l:indent_size = len(matchstr(l:line, '^ *'))
|
let l:indent_size = len(matchstr(l:line, '^ *'))
|
||||||
|
|
||||||
|
if !l:in_docstring
|
||||||
|
" Make sure it is not just a single line docstring and then verify
|
||||||
|
" it's starting a new docstring
|
||||||
|
if match(l:line, '\v^ *("""|'''''').*("""|'''''')') == -1
|
||||||
|
\&& match(l:line, '\v^ *("""|'''''')') >= 0
|
||||||
|
let l:in_docstring = 1
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if match(l:line, '\v^ *.*("""|'''''')') >= 0
|
||||||
|
let l:in_docstring = 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if !l:last_line_is_blank
|
if !l:last_line_is_blank
|
||||||
|
\&& !l:in_docstring
|
||||||
\&& l:indent_size <= l:last_indent_size
|
\&& l:indent_size <= l:last_indent_size
|
||||||
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)') >= 0
|
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)(\(| |$)') >= 0
|
||||||
call add(l:new_lines, '')
|
call add(l:new_lines, '')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ function! ale#fixers#hfmt#Fix(buffer) abort
|
||||||
let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable')
|
let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hfmt')
|
||||||
\ . ' -w'
|
\ . ' -w'
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
" Author: eborden <evan@evan-borden.com>
|
" Author: eborden <evan@evan-borden.com>
|
||||||
" Description: Integration of hlint refactor with ALE.
|
" Description: Integration of hlint refactor with ALE.
|
||||||
"
|
"
|
||||||
call ale#Set('haskell_hlint_executable', 'hlint')
|
|
||||||
|
|
||||||
function! ale#fixers#hlint#Fix(buffer) abort
|
function! ale#fixers#hlint#Fix(buffer) abort
|
||||||
let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#handlers#hlint#GetExecutable(a:buffer)
|
||||||
\ . ' --refactor'
|
\ . ' --refactor'
|
||||||
\ . ' --refactor-options="--inplace"'
|
\ . ' --refactor-options="--inplace"'
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
|
|
|
@ -3,11 +3,17 @@
|
||||||
"
|
"
|
||||||
call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')
|
call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')
|
||||||
|
|
||||||
function! ale#fixers#stylish_haskell#Fix(buffer) abort
|
function! ale#fixers#stylish_haskell#GetExecutable(buffer) abort
|
||||||
let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')
|
let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'stylish-haskell')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#fixers#stylish_haskell#Fix(buffer) abort
|
||||||
|
let l:executable = ale#fixers#stylish_haskell#GetExecutable(a:buffer)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': l:executable
|
||||||
\ . ' --inplace'
|
\ . ' --inplace'
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
|
|
17
sources_non_forked/ale/autoload/ale/handlers/ccls.vim
Normal file
17
sources_non_forked/ale/autoload/ale/handlers/ccls.vim
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
scriptencoding utf-8
|
||||||
|
" Author: Ye Jingchen <ye.jingchen@gmail.com>
|
||||||
|
" Description: Utilities for ccls
|
||||||
|
|
||||||
|
function! ale#handlers#ccls#GetProjectRoot(buffer) abort
|
||||||
|
let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls-root')
|
||||||
|
|
||||||
|
if empty(l:project_root)
|
||||||
|
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if empty(l:project_root)
|
||||||
|
let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||||
|
endfunction
|
|
@ -0,0 +1,7 @@
|
||||||
|
function! ale#handlers#haskell_stack#EscapeExecutable(executable, stack_exec) abort
|
||||||
|
let l:exec_args = a:executable =~? 'stack$'
|
||||||
|
\ ? ' exec ' . ale#Escape(a:stack_exec) . ' --'
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
return ale#Escape(a:executable) . l:exec_args
|
||||||
|
endfunction
|
8
sources_non_forked/ale/autoload/ale/handlers/hlint.vim
Normal file
8
sources_non_forked/ale/autoload/ale/handlers/hlint.vim
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
call ale#Set('haskell_hlint_executable', 'hlint')
|
||||||
|
call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', ''))
|
||||||
|
|
||||||
|
function! ale#handlers#hlint#GetExecutable(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hlint')
|
||||||
|
endfunction
|
|
@ -281,5 +281,36 @@ g:ale_c_uncrustify_options *g:ale_c_uncrustify_options*
|
||||||
This variable can be change to modify flags given to uncrustify.
|
This variable can be change to modify flags given to uncrustify.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
ccls *ale-c-ccls*
|
||||||
|
|
||||||
|
g:ale_c_ccls_executable *g:ale_c_ccls_executable*
|
||||||
|
*b:ale_c_ccls_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'ccls'`
|
||||||
|
|
||||||
|
This variable can be changed to use a different executable for ccls.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_c_ccls_init_options *g:ale_c_ccls_init_options*
|
||||||
|
*b:ale_c_ccls_init_options*
|
||||||
|
Type: |Dictionary|
|
||||||
|
Default: `{}`
|
||||||
|
|
||||||
|
This variable can be changed to customize ccls initialization options.
|
||||||
|
Example: >
|
||||||
|
{
|
||||||
|
\ 'cacheDirectory': '/tmp/ccls',
|
||||||
|
\ 'cacheFormat': 'binary',
|
||||||
|
\ 'diagnostics': {
|
||||||
|
\ 'onOpen': 0,
|
||||||
|
\ 'opChange': 1000,
|
||||||
|
\ },
|
||||||
|
\ }
|
||||||
|
<
|
||||||
|
Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all
|
||||||
|
available options and explanations.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
|
|
@ -279,5 +279,36 @@ uncrustify *ale-cpp-uncrustify*
|
||||||
See |ale-c-uncrustify| for information about the available options.
|
See |ale-c-uncrustify| for information about the available options.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
ccls *ale-cpp-ccls*
|
||||||
|
|
||||||
|
g:ale_cpp_ccls_executable *g:ale_cpp_ccls_executable*
|
||||||
|
*b:ale_cpp_ccls_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'ccls'`
|
||||||
|
|
||||||
|
This variable can be changed to use a different executable for ccls.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_cpp_ccls_init_options *g:ale_cpp_ccls_init_options*
|
||||||
|
*b:ale_cpp_ccls_init_options*
|
||||||
|
Type: |Dictionary|
|
||||||
|
Default: `{}`
|
||||||
|
|
||||||
|
This variable can be changed to customize ccls initialization options.
|
||||||
|
Example: >
|
||||||
|
{
|
||||||
|
\ 'cacheDirectory': '/tmp/ccls',
|
||||||
|
\ 'cacheFormat': 'binary',
|
||||||
|
\ 'diagnostics': {
|
||||||
|
\ 'onOpen': 0,
|
||||||
|
\ 'opChange': 1000,
|
||||||
|
\ },
|
||||||
|
\ }
|
||||||
|
<
|
||||||
|
Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all
|
||||||
|
available options and explanations.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
|
|
@ -22,6 +22,16 @@ g:ale_haskell_ghc_options *g:ale_haskell_ghc_options*
|
||||||
|
|
||||||
This variable can be changed to modify flags given to ghc.
|
This variable can be changed to modify flags given to ghc.
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
ghc-mod *ale-haskell-ghc-mod*
|
||||||
|
|
||||||
|
g:ale_haskell_ghc_mod_executable *g:ale_haskell_ghc_mod_executable*
|
||||||
|
*b:ale_haskell_ghc_mod_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'ghc-mod'`
|
||||||
|
|
||||||
|
This variable can be changed to use a different executable for ghc-mod.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
cabal-ghc *ale-haskell-cabal-ghc*
|
cabal-ghc *ale-haskell-cabal-ghc*
|
||||||
|
|
||||||
|
@ -77,6 +87,15 @@ g:ale_haskell_hlint_executable *g:ale_haskell_hlint_executable*
|
||||||
|
|
||||||
This variable can be changed to use a different executable for hlint.
|
This variable can be changed to use a different executable for hlint.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_haskell_hlint_options g:ale_haskell_hlint_options
|
||||||
|
b:ale_haskell_hlint_options
|
||||||
|
Type: String
|
||||||
|
Default: ''
|
||||||
|
|
||||||
|
This variable can be used to pass extra options to the underlying hlint
|
||||||
|
executable.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
stack-build *ale-haskell-stack-build*
|
stack-build *ale-haskell-stack-build*
|
||||||
|
|
||||||
|
|
|
@ -38,5 +38,36 @@ uncrustify *ale-objc-uncrustify*
|
||||||
See |ale-c-uncrustify| for information about the available options.
|
See |ale-c-uncrustify| for information about the available options.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
ccls *ale-objc-ccls*
|
||||||
|
|
||||||
|
g:ale_objc_ccls_executable *g:ale_objc_ccls_executable*
|
||||||
|
*b:ale_objc_ccls_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'ccls'`
|
||||||
|
|
||||||
|
This variable can be changed to use a different executable for ccls.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_objc_ccls_init_options *g:ale_objc_ccls_init_options*
|
||||||
|
*b:ale_objc_ccls_init_options*
|
||||||
|
Type: |Dictionary|
|
||||||
|
Default: `{}`
|
||||||
|
|
||||||
|
This variable can be changed to customize ccls initialization options.
|
||||||
|
Example: >
|
||||||
|
{
|
||||||
|
\ 'cacheDirectory': '/tmp/ccls',
|
||||||
|
\ 'cacheFormat': 'binary',
|
||||||
|
\ 'diagnostics': {
|
||||||
|
\ 'onOpen': 0,
|
||||||
|
\ 'opChange': 1000,
|
||||||
|
\ },
|
||||||
|
\ }
|
||||||
|
<
|
||||||
|
Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all
|
||||||
|
available options and explanations.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
|
|
@ -169,6 +169,16 @@ g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration*
|
||||||
This variable sets path to phpstan configuration file.
|
This variable sets path to phpstan configuration file.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
psalm *ale-php-psalm*
|
||||||
|
|
||||||
|
g:ale_php_psalm_executable *g:ale_php_psalm_executable*
|
||||||
|
*b:ale_php_psalm_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'psalm'`
|
||||||
|
|
||||||
|
This variable sets the executable used for psalm.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
php-cs-fixer *ale-php-php-cs-fixer*
|
php-cs-fixer *ale-php-php-cs-fixer*
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,12 @@ g:ale_scss_stylelint_executable *g:ale_scss_stylelint_executable*
|
||||||
|
|
||||||
See |ale-integrations-local-executables|
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
g:ale_scss_stylelint_options *g:ale_scss_stylelint_options*
|
||||||
|
*b:ale_scss_stylelint_options*
|
||||||
|
Type: |String|
|
||||||
|
Default: `''`
|
||||||
|
|
||||||
|
This variable can be set to pass additional options to stylelint.
|
||||||
|
|
||||||
g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global*
|
g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global*
|
||||||
*b:ale_scss_stylelint_use_global*
|
*b:ale_scss_stylelint_use_global*
|
||||||
|
|
|
@ -34,6 +34,7 @@ CONTENTS *ale-contents*
|
||||||
flawfinder..........................|ale-c-flawfinder|
|
flawfinder..........................|ale-c-flawfinder|
|
||||||
gcc.................................|ale-c-gcc|
|
gcc.................................|ale-c-gcc|
|
||||||
uncrustify..........................|ale-c-uncrustify|
|
uncrustify..........................|ale-c-uncrustify|
|
||||||
|
ccls................................|ale-c-ccls|
|
||||||
chef..................................|ale-chef-options|
|
chef..................................|ale-chef-options|
|
||||||
foodcritic..........................|ale-chef-foodcritic|
|
foodcritic..........................|ale-chef-foodcritic|
|
||||||
clojure...............................|ale-clojure-options|
|
clojure...............................|ale-clojure-options|
|
||||||
|
@ -55,6 +56,7 @@ CONTENTS *ale-contents*
|
||||||
flawfinder..........................|ale-cpp-flawfinder|
|
flawfinder..........................|ale-cpp-flawfinder|
|
||||||
gcc.................................|ale-cpp-gcc|
|
gcc.................................|ale-cpp-gcc|
|
||||||
uncrustify..........................|ale-cpp-uncrustify|
|
uncrustify..........................|ale-cpp-uncrustify|
|
||||||
|
ccls................................|ale-cpp-ccls|
|
||||||
c#....................................|ale-cs-options|
|
c#....................................|ale-cs-options|
|
||||||
mcs.................................|ale-cs-mcs|
|
mcs.................................|ale-cs-mcs|
|
||||||
mcsc................................|ale-cs-mcsc|
|
mcsc................................|ale-cs-mcsc|
|
||||||
|
@ -115,6 +117,7 @@ CONTENTS *ale-contents*
|
||||||
haskell...............................|ale-haskell-options|
|
haskell...............................|ale-haskell-options|
|
||||||
brittany............................|ale-haskell-brittany|
|
brittany............................|ale-haskell-brittany|
|
||||||
ghc.................................|ale-haskell-ghc|
|
ghc.................................|ale-haskell-ghc|
|
||||||
|
ghc-mod.............................|ale-haskell-ghc-mod|
|
||||||
cabal-ghc...........................|ale-haskell-cabal-ghc|
|
cabal-ghc...........................|ale-haskell-cabal-ghc|
|
||||||
hdevtools...........................|ale-haskell-hdevtools|
|
hdevtools...........................|ale-haskell-hdevtools|
|
||||||
hfmt................................|ale-haskell-hfmt|
|
hfmt................................|ale-haskell-hfmt|
|
||||||
|
@ -185,6 +188,7 @@ CONTENTS *ale-contents*
|
||||||
clang...............................|ale-objc-clang|
|
clang...............................|ale-objc-clang|
|
||||||
clangd..............................|ale-objc-clangd|
|
clangd..............................|ale-objc-clangd|
|
||||||
uncrustify..........................|ale-objc-uncrustify|
|
uncrustify..........................|ale-objc-uncrustify|
|
||||||
|
ccls................................|ale-objc-ccls|
|
||||||
objcpp................................|ale-objcpp-options|
|
objcpp................................|ale-objcpp-options|
|
||||||
clang...............................|ale-objcpp-clang|
|
clang...............................|ale-objcpp-clang|
|
||||||
clangd..............................|ale-objcpp-clangd|
|
clangd..............................|ale-objcpp-clangd|
|
||||||
|
@ -206,6 +210,7 @@ CONTENTS *ale-contents*
|
||||||
phpcs...............................|ale-php-phpcs|
|
phpcs...............................|ale-php-phpcs|
|
||||||
phpmd...............................|ale-php-phpmd|
|
phpmd...............................|ale-php-phpmd|
|
||||||
phpstan.............................|ale-php-phpstan|
|
phpstan.............................|ale-php-phpstan|
|
||||||
|
psalm...............................|ale-php-psalm|
|
||||||
php-cs-fixer........................|ale-php-php-cs-fixer|
|
php-cs-fixer........................|ale-php-php-cs-fixer|
|
||||||
po....................................|ale-po-options|
|
po....................................|ale-po-options|
|
||||||
write-good..........................|ale-po-write-good|
|
write-good..........................|ale-po-write-good|
|
||||||
|
@ -375,8 +380,8 @@ Notes:
|
||||||
* Awk: `gawk`
|
* Awk: `gawk`
|
||||||
* Bash: `language-server`, `shell` (-n flag), `shellcheck`, `shfmt`
|
* Bash: `language-server`, `shell` (-n flag), `shellcheck`, `shfmt`
|
||||||
* Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt`
|
* Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt`
|
||||||
* C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `cquery`, `flawfinder`, `gcc`, `uncrustify`
|
* C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `cquery`, `flawfinder`, `gcc`, `uncrustify`, `ccls`
|
||||||
* C++ (filetype cpp): `clang`, `clangd`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `clazy`!!, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc`, `uncrustify`
|
* C++ (filetype cpp): `clang`, `clangd`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `clazy`!!, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc`, `uncrustify`, `ccls`
|
||||||
* CUDA: `nvcc`!!
|
* CUDA: `nvcc`!!
|
||||||
* C#: `mcs`, `mcsc`!!, `uncrustify`
|
* C#: `mcs`, `mcsc`!!, `uncrustify`
|
||||||
* Chef: `foodcritic`
|
* Chef: `foodcritic`
|
||||||
|
@ -407,7 +412,7 @@ Notes:
|
||||||
* Hack: `hack`, `hackfmt`, `hhast`
|
* Hack: `hack`, `hackfmt`, `hhast`
|
||||||
* Haml: `haml-lint`
|
* Haml: `haml-lint`
|
||||||
* Handlebars: `ember-template-lint`
|
* Handlebars: `ember-template-lint`
|
||||||
* Haskell: `brittany`, `ghc`, `cabal-ghc`, `stylish-haskell`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`, `hie`
|
* Haskell: `brittany`, `ghc`, `cabal-ghc`, `stylish-haskell`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `hlint`, `hdevtools`, `hfmt`, `hie`
|
||||||
* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good`
|
* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good`
|
||||||
* Idris: `idris`
|
* Idris: `idris`
|
||||||
* Java: `checkstyle`, `javac`, `google-java-format`, `PMD`, `javalsp`, `uncrustify`
|
* Java: `checkstyle`, `javac`, `google-java-format`, `PMD`, `javalsp`, `uncrustify`
|
||||||
|
@ -428,12 +433,12 @@ Notes:
|
||||||
* Nim: `nim check`!!
|
* Nim: `nim check`!!
|
||||||
* nix: `nix-instantiate`
|
* nix: `nix-instantiate`
|
||||||
* nroff: `alex`!!, `proselint`, `write-good`
|
* nroff: `alex`!!, `proselint`, `write-good`
|
||||||
* Objective-C: `clang`, `clangd`, `uncrustify`
|
* Objective-C: `clang`, `clangd`, `uncrustify`, `ccls`
|
||||||
* Objective-C++: `clang`, `clangd`, `uncrustify`
|
* Objective-C++: `clang`, `clangd`, `uncrustify`
|
||||||
* OCaml: `merlin` (see |ale-ocaml-merlin|), `ols`, `ocamlformat`
|
* OCaml: `merlin` (see |ale-ocaml-merlin|), `ols`, `ocamlformat`
|
||||||
* Pawn: `uncrustify`
|
* Pawn: `uncrustify`
|
||||||
* Perl: `perl -c`, `perl-critic`, `perltidy`
|
* Perl: `perl -c`, `perl-critic`, `perltidy`
|
||||||
* PHP: `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`, `php-cs-fixer`
|
* PHP: `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`, `php-cs-fixer`, `psalm`!!
|
||||||
* PO: `alex`!!, `msgfmt`, `proselint`, `write-good`
|
* PO: `alex`!!, `msgfmt`, `proselint`, `write-good`
|
||||||
* Pod: `alex`!!, `proselint`, `write-good`
|
* Pod: `alex`!!, `proselint`, `write-good`
|
||||||
* Pony: `ponyc`
|
* Pony: `ponyc`
|
||||||
|
@ -1202,6 +1207,12 @@ g:ale_lint_on_text_changed *g:ale_lint_on_text_changed*
|
||||||
ALE will check buffers after a short delay, with a timer which resets on
|
ALE will check buffers after a short delay, with a timer which resets on
|
||||||
each change. The delay can be configured by adjusting the |g:ale_lint_delay|
|
each change. The delay can be configured by adjusting the |g:ale_lint_delay|
|
||||||
variable.
|
variable.
|
||||||
|
*ale-linting-interrupts-mapping*
|
||||||
|
|
||||||
|
Due to a bug in Vim, ALE can interrupt mappings with pending key presses,
|
||||||
|
per |timeoutlen|. If this happens, follow the advice for enabling
|
||||||
|
|g:ale_lint_on_insert_leave| below, and set this option to `'normal'`, or
|
||||||
|
disable it entirely.
|
||||||
|
|
||||||
You should set this setting once before ALE is loaded, and restart Vim if
|
You should set this setting once before ALE is loaded, and restart Vim if
|
||||||
you want to change your preferences. See |ale-lint-settings-on-startup|.
|
you want to change your preferences. See |ale-lint-settings-on-startup|.
|
||||||
|
@ -1217,7 +1228,7 @@ g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave*
|
||||||
|
|
||||||
ALE will not lint files when you escape insert mode with |CTRL-C| by
|
ALE will not lint files when you escape insert mode with |CTRL-C| by
|
||||||
default. You can make ALE lint files with this option when you use |CTRL-C|
|
default. You can make ALE lint files with this option when you use |CTRL-C|
|
||||||
with the following keybind. >
|
with the following mapping. >
|
||||||
|
|
||||||
" Make using Ctrl+C do the same as Escape, to trigger autocmd commands
|
" Make using Ctrl+C do the same as Escape, to trigger autocmd commands
|
||||||
inoremap <C-c> <Esc>
|
inoremap <C-c> <Esc>
|
||||||
|
|
|
@ -4,29 +4,40 @@ if exists("g:go_loaded_install")
|
||||||
endif
|
endif
|
||||||
let g:go_loaded_install = 1
|
let g:go_loaded_install = 1
|
||||||
|
|
||||||
" Not using the has('patch-7.4.2009') syntax because that wasn't added until
|
function! s:checkVersion() abort
|
||||||
" 7.4.237, and we want to be sure this works for everyone (this is also why
|
" Not using the has('patch-7.4.2009') syntax because that wasn't added until
|
||||||
" we're not using utils#EchoError()).
|
" 7.4.237, and we want to be sure this works for everyone (this is also why
|
||||||
"
|
" we're not using utils#EchoError()).
|
||||||
" Version 7.4.2009 was chosen because that's greater than what the most recent Ubuntu LTS
|
"
|
||||||
" release (16.04) uses and has a couple of features we need (e.g. execute()
|
" Version 7.4.2009 was chosen because that's greater than what the most recent Ubuntu LTS
|
||||||
" and :message clear).
|
" release (16.04) uses and has a couple of features we need (e.g. execute()
|
||||||
if
|
" and :message clear).
|
||||||
\ go#config#VersionWarning() != 0 &&
|
|
||||||
\ (v:version < 704 || (v:version == 704 && !has('patch2009')))
|
let l:unsupported = 0
|
||||||
\ && !has('nvim')
|
if go#config#VersionWarning() != 0
|
||||||
|
if has('nvim')
|
||||||
|
let l:unsupported = !has('nvim-0.3.1')
|
||||||
|
else
|
||||||
|
let l:unsupported = (v:version < 704 || (v:version == 704 && !has('patch2009')))
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:unsupported == 1
|
||||||
echohl Error
|
echohl Error
|
||||||
echom "vim-go requires Vim 7.4.2009 or Neovim, but you're using an older version."
|
echom "vim-go requires Vim 7.4.2009 or Neovim 0.3.1, but you're using an older version."
|
||||||
echom "Please update your Vim for the best vim-go experience."
|
echom "Please update your Vim for the best vim-go experience."
|
||||||
echom "If you really want to continue you can set this to make the error go away:"
|
echom "If you really want to continue you can set this to make the error go away:"
|
||||||
echom " let g:go_version_warning = 0"
|
echom " let g:go_version_warning = 0"
|
||||||
echom "Note that some features may error out or behave incorrectly."
|
echom "Note that some features may error out or behave incorrectly."
|
||||||
echom "Please do not report bugs unless you're using Vim 7.4.2009 or newer."
|
echom "Please do not report bugs unless you're using Vim 7.4.2009 or newer or Neovim 0.3.1."
|
||||||
echohl None
|
echohl None
|
||||||
|
|
||||||
" Make sure people see this.
|
" Make sure people see this.
|
||||||
sleep 2
|
sleep 2
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call s:checkVersion()
|
||||||
|
|
||||||
" these packages are used by vim-go and can be automatically installed if
|
" these packages are used by vim-go and can be automatically installed if
|
||||||
" needed by the user with GoInstallBinaries.
|
" needed by the user with GoInstallBinaries.
|
||||||
|
|
|
@ -1,204 +1,205 @@
|
||||||
# shorthand variable declaration
|
snippet v "shorthand variable declaration"
|
||||||
snippet v
|
|
||||||
${1} := ${2}
|
${1} := ${2}
|
||||||
# variable initialization
|
|
||||||
snippet vr
|
snippet vr "variable initialization"
|
||||||
var ${1:t} ${0:string}
|
var ${1:t} ${0:string}
|
||||||
# variable declaration
|
|
||||||
snippet var
|
snippet var "variable declaration"
|
||||||
var ${1} ${2} = ${3}
|
var ${1} ${2} = ${3}
|
||||||
# variables declaration
|
|
||||||
snippet vars
|
snippet vars "variables declaration"
|
||||||
var (
|
var (
|
||||||
${1} ${2} = ${3}
|
${1} ${2} = ${3}
|
||||||
)
|
)
|
||||||
# append
|
|
||||||
snippet ap
|
snippet ap "append"
|
||||||
append(${1:slice}, ${0:value})
|
append(${1:slice}, ${0:value})
|
||||||
# bool
|
|
||||||
snippet bl
|
snippet bl "bool"
|
||||||
bool
|
bool
|
||||||
# byte
|
|
||||||
snippet bt
|
snippet bt "byte"
|
||||||
byte
|
byte
|
||||||
# break
|
|
||||||
snippet br
|
snippet br "break"
|
||||||
break
|
break
|
||||||
# channel
|
|
||||||
snippet ch
|
snippet ch "channel"
|
||||||
chan ${0:int}
|
chan ${0:int}
|
||||||
# case
|
|
||||||
snippet cs
|
snippet cs "case"
|
||||||
case ${1:value}:
|
case ${1:value}:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
# const
|
|
||||||
snippet c
|
snippet c "const"
|
||||||
const ${1:NAME} = ${0:0}
|
const ${1:NAME} = ${0:0}
|
||||||
# constants with iota
|
|
||||||
snippet co
|
snippet co "constants with iota"
|
||||||
const (
|
const (
|
||||||
${1:NAME1} = iota
|
${1:NAME1} = iota
|
||||||
${0:NAME2}
|
${0:NAME2}
|
||||||
)
|
)
|
||||||
# continue
|
|
||||||
snippet cn
|
snippet cn "continue"
|
||||||
continue
|
continue
|
||||||
# defer
|
|
||||||
snippet df
|
snippet df "defer"
|
||||||
defer ${0:func}()
|
defer ${0:func}()
|
||||||
# defer recover
|
|
||||||
snippet dfr
|
snippet dfr "defer recover"
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
# int
|
|
||||||
snippet i
|
snippet i "int"
|
||||||
int
|
int
|
||||||
# import
|
|
||||||
snippet im
|
snippet im "import"
|
||||||
import (
|
import (
|
||||||
"${1:package}"
|
"${1:package}"
|
||||||
)
|
)
|
||||||
# interface
|
|
||||||
snippet in
|
snippet in "interface"
|
||||||
interface{}
|
interface{}
|
||||||
# full interface snippet
|
|
||||||
snippet inf
|
snippet inf "full interface "
|
||||||
interface ${1:name} {
|
interface ${1:name} {
|
||||||
${2:/* methods */}
|
${2:/* methods */}
|
||||||
}
|
}
|
||||||
# if condition
|
|
||||||
snippet if
|
snippet if "if condition"
|
||||||
if ${1:/* condition */} {
|
if ${1:/* condition */} {
|
||||||
${2:${VISUAL}}
|
${2:${VISUAL}}
|
||||||
}
|
}
|
||||||
snippet ife
|
|
||||||
|
|
||||||
|
snippet ife "if else condition"
|
||||||
if ${1:/* condition */} {
|
if ${1:/* condition */} {
|
||||||
${2:${VISUAL}}
|
${2:${VISUAL}}
|
||||||
} else {
|
} else {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
# else snippet
|
|
||||||
snippet el
|
snippet el "else"
|
||||||
else {
|
else {
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
# error snippet
|
|
||||||
snippet ir
|
snippet ir "if error not nil, return err"
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
${0}
|
${0}
|
||||||
# false
|
|
||||||
snippet f
|
snippet f "false"
|
||||||
false
|
false
|
||||||
# fallthrough
|
|
||||||
snippet ft
|
snippet ft "fallthrough"
|
||||||
fallthrough
|
fallthrough
|
||||||
# float
|
|
||||||
snippet fl
|
snippet fl "float"
|
||||||
float32
|
float32
|
||||||
# float32
|
|
||||||
snippet f3
|
snippet f3 "float32"
|
||||||
float32
|
float32
|
||||||
# float64
|
|
||||||
snippet f6
|
snippet f6 "float64"
|
||||||
float64
|
float64
|
||||||
# for int loop
|
|
||||||
snippet for
|
snippet for "for loop"
|
||||||
for ${1}{
|
for ${1}{
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
# for int loop
|
|
||||||
snippet fori
|
snippet fori "for int loop"
|
||||||
for ${2:i} := 0; $2 < ${1:count}; $2${3:++} {
|
for ${2:i} := 0; $2 < ${1:count}; $2${3:++} {
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
# for range loop
|
|
||||||
snippet forr
|
snippet forr "for range loop"
|
||||||
for ${1:e} := range ${2:collection} {
|
for ${1:e} := range ${2:collection} {
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
# function simple
|
|
||||||
snippet fun
|
snippet fun "function"
|
||||||
func ${1:funcName}(${2}) ${3:error} {
|
func ${1:funcName}(${2}) ${3:error} {
|
||||||
${4}
|
${4}
|
||||||
}
|
}
|
||||||
${0}
|
${0}
|
||||||
# function on receiver
|
|
||||||
snippet fum
|
snippet fum "method"
|
||||||
func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} {
|
func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} {
|
||||||
${6}
|
${6}
|
||||||
}
|
}
|
||||||
${0}
|
${0}
|
||||||
# http handler function on reciever
|
|
||||||
snippet fumh
|
snippet fumh "http handler function on reciever"
|
||||||
func (${1:receiver} ${2:type}) ${3:funcName}(${4:w} http.ResponseWriter, ${5:r} *http.Request) {
|
func (${1:receiver} ${2:type}) ${3:funcName}(${4:w} http.ResponseWriter, ${5:r} *http.Request) {
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
# log printf
|
|
||||||
snippet lf
|
snippet lf "log printf"
|
||||||
log.Printf("%${1:s}", ${2:var})
|
log.Printf("%${1:s}", ${2:var})
|
||||||
# log printf
|
|
||||||
snippet lp
|
snippet lp "log println"
|
||||||
log.Println("${1}")
|
log.Println("${1}")
|
||||||
# make
|
|
||||||
snippet mk
|
snippet mk "make"
|
||||||
make(${1:[]string}, ${0:0})
|
make(${1:[]string}, ${0:0})
|
||||||
# map
|
|
||||||
snippet mp
|
snippet mp "map"
|
||||||
map[${1:string}]${0:int}
|
map[${1:string}]${0:int}
|
||||||
# main()
|
|
||||||
snippet main
|
snippet main "func main()"
|
||||||
func main() {
|
func main() {
|
||||||
${1}
|
${1}
|
||||||
}
|
}
|
||||||
${0}
|
${0}
|
||||||
# new
|
|
||||||
snippet nw
|
snippet nw "new"
|
||||||
new(${0:type})
|
new(${0:type})
|
||||||
# package
|
|
||||||
snippet pa
|
snippet pa "package"
|
||||||
package ${1:main}
|
package ${1:main}
|
||||||
# panic
|
|
||||||
snippet pn
|
snippet pn "panic"
|
||||||
panic("${0:msg}")
|
panic("${0:msg}")
|
||||||
# print
|
|
||||||
snippet pr
|
snippet pf "fmt.Printf()"
|
||||||
fmt.Printf("%${1:s}\n", ${2:var})
|
fmt.Printf("%${1:s}\n", ${2:var})
|
||||||
# println
|
|
||||||
snippet pl
|
snippet pl "fmt.Println()"
|
||||||
fmt.Println("${1:s}")
|
fmt.Println("${1:s}")
|
||||||
# range
|
|
||||||
snippet rn
|
snippet rn "range"
|
||||||
range ${0}
|
range ${0}
|
||||||
# return
|
|
||||||
snippet rt
|
snippet rt "return"
|
||||||
return ${0}
|
return ${0}
|
||||||
# result
|
|
||||||
snippet rs
|
snippet rs "result"
|
||||||
result
|
result
|
||||||
# select
|
|
||||||
snippet sl
|
snippet sl "select"
|
||||||
select {
|
select {
|
||||||
case ${1:v1} := <-${2:chan1}
|
case ${1:v1} := <-${2:chan1}
|
||||||
${3}
|
${3}
|
||||||
default:
|
default:
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
# string
|
|
||||||
snippet sr
|
snippet sr "string"
|
||||||
string
|
string
|
||||||
# struct
|
|
||||||
snippet st
|
snippet st "struct"
|
||||||
struct ${1:name} {
|
struct ${1:name} {
|
||||||
${2:/* data */}
|
${2:/* data */}
|
||||||
}
|
}
|
||||||
${0}
|
${0}
|
||||||
# switch
|
|
||||||
snippet sw
|
snippet sw "switch"
|
||||||
switch ${1:var} {
|
switch ${1:var} {
|
||||||
case ${2:value1}:
|
case ${2:value1}:
|
||||||
${3}
|
${3}
|
||||||
|
@ -207,58 +208,62 @@ snippet sw
|
||||||
default:
|
default:
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
snippet sp
|
|
||||||
|
snippet ps "fmt.Sprintf"
|
||||||
fmt.Sprintf("%${1:s}", ${2:var})
|
fmt.Sprintf("%${1:s}", ${2:var})
|
||||||
# true
|
|
||||||
snippet t
|
snippet t "true"
|
||||||
true
|
true
|
||||||
# goroutine named function
|
|
||||||
snippet g
|
snippet g "goroutine named function"
|
||||||
go ${1:funcName}(${0})
|
go ${1:funcName}(${0})
|
||||||
# goroutine anonymous function
|
|
||||||
snippet ga
|
snippet ga "goroutine anonymous function"
|
||||||
go func(${1} ${2:type}) {
|
go func(${1} ${2:type}) {
|
||||||
${3:/* code */}
|
${3:/* code */}
|
||||||
}(${0})
|
}(${0})
|
||||||
snippet test test function
|
|
||||||
|
snippet test "test function"
|
||||||
func Test${1:name}(t *testing.T) {
|
func Test${1:name}(t *testing.T) {
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
snippet bench benchmark function
|
|
||||||
|
snippet bench "benchmark function"
|
||||||
func Benchmark${1:name}(b *testing.B) {
|
func Benchmark${1:name}(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
${2}
|
${2}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${0}
|
${0}
|
||||||
# composite literals
|
|
||||||
snippet cl
|
snippet cl "composite literals"
|
||||||
type ${1:name} struct {
|
type ${1:name} struct {
|
||||||
${2:attrName} ${3:attrType}
|
${2:attrName} ${3:attrType}
|
||||||
}
|
}
|
||||||
# if key in a map
|
|
||||||
snippet om
|
snippet om "if key in a map"
|
||||||
if ${1:value}, ok := ${2:map}[${3:key}]; ok == true {
|
if ${1:value}, ok := ${2:map}[${3:key}]; ok == true {
|
||||||
${4:/* code */}
|
${4:/* code */}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Grouped globals with anonymous struct
|
|
||||||
snippet gg
|
snippet gg "Grouped globals with anonymous struct"
|
||||||
var ${1:var} = struct{
|
var ${1:var} = struct{
|
||||||
${2:name} ${3:type}
|
${2:name} ${3:type}
|
||||||
}{
|
}{
|
||||||
$2: ${4:value},
|
$2: ${4:value},
|
||||||
}
|
}
|
||||||
|
|
||||||
# Marshalable json alias
|
|
||||||
snippet ja
|
snippet ja "Marshalable json alias"
|
||||||
type ${1:parentType}Alias $1
|
type ${1:parentType}Alias $1
|
||||||
|
|
||||||
func (p *$1) MarshalJSON() ([]byte, error) {
|
func (p *$1) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(&struct{ *$1Alias }{(*$1Alias)(p)})
|
return json.Marshal(&struct{ *$1Alias }{(*$1Alias)(p)})
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet errwr # Error handling with errors.Wrap
|
|
||||||
|
snippet errwr "Error handling with errors.Wrap"
|
||||||
if ${1}err != nil {
|
if ${1}err != nil {
|
||||||
return errors.Wrap(err, "${2}")
|
return errors.Wrap(err, "${2}")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue