Update
This commit is contained in:
parent
e8245dbf17
commit
aebef2c2e7
@ -9,22 +9,35 @@ function! s:error(text) abort
|
|||||||
echohl None
|
echohl None
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:cexpr(errorformat, joined_lines) abort
|
function! s:cexpr(errorformat, lines, reason) abort
|
||||||
let temp_errorfomat = &errorformat
|
call setqflist([], ' ', {
|
||||||
try
|
\ 'lines': a:lines,
|
||||||
let &errorformat = a:errorformat
|
\ 'efm': a:errorformat,
|
||||||
cexpr a:joined_lines
|
\ 'context': {'reason': a:reason},
|
||||||
copen
|
\})
|
||||||
finally
|
copen
|
||||||
let &errorformat = temp_errorfomat
|
endfunction
|
||||||
endtry
|
|
||||||
|
" If the quickfix list has a context matching [reason], clear and close it.
|
||||||
|
function! s:clearQfList(reason) abort
|
||||||
|
let context = get(getqflist({'context': 1}), 'context', {})
|
||||||
|
if type(context) == v:t_dict &&
|
||||||
|
\ has_key(context, 'reason') &&
|
||||||
|
\ context.reason == a:reason
|
||||||
|
call setqflist([], 'r')
|
||||||
|
cclose
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! dart#fmt(q_args) abort
|
function! dart#fmt(q_args) abort
|
||||||
if executable('dartfmt')
|
if executable('dartfmt')
|
||||||
let buffer_content = join(getline(1, '$'), "\n")
|
let buffer_content = join(getline(1, '$'), "\n")
|
||||||
let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content)
|
let args = '--stdin-name '.expand('%').' '.a:q_args
|
||||||
if buffer_content ==# joined_lines[:-2] | return | endif
|
let joined_lines = system(printf('dartfmt %s', args), buffer_content)
|
||||||
|
if buffer_content ==# joined_lines[:-2]
|
||||||
|
call s:clearQfList('dartfmt')
|
||||||
|
return
|
||||||
|
endif
|
||||||
if 0 == v:shell_error
|
if 0 == v:shell_error
|
||||||
let win_view = winsaveview()
|
let win_view = winsaveview()
|
||||||
let lines = split(joined_lines, "\n")
|
let lines = split(joined_lines, "\n")
|
||||||
@ -33,12 +46,11 @@ function! dart#fmt(q_args) abort
|
|||||||
silent keepjumps execute string(len(lines)+1).',$ delete'
|
silent keepjumps execute string(len(lines)+1).',$ delete'
|
||||||
endif
|
endif
|
||||||
call winrestview(win_view)
|
call winrestview(win_view)
|
||||||
|
call s:clearQfList('dartfmt')
|
||||||
else
|
else
|
||||||
let errors = split(joined_lines, "\n")[2:]
|
let errors = split(joined_lines, "\n")[2:]
|
||||||
let file_path = expand('%')
|
let error_format = '%Aline %l\, column %c of %f: %m,%C%.%#'
|
||||||
call map(errors, 'file_path.":".v:val')
|
call s:cexpr(error_format, errors, 'dartfmt')
|
||||||
let error_format = '%A%f:line %l\, column %c of stdin: %m,%C%.%#'
|
|
||||||
call s:cexpr(error_format, join(errors, "\n"))
|
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
call s:error('cannot execute binary file: dartfmt')
|
call s:error('cannot execute binary file: dartfmt')
|
||||||
@ -49,8 +61,9 @@ function! dart#analyzer(q_args) abort
|
|||||||
if executable('dartanalyzer')
|
if executable('dartanalyzer')
|
||||||
let path = expand('%:p:gs:\:/:')
|
let path = expand('%:p:gs:\:/:')
|
||||||
if filereadable(path)
|
if filereadable(path)
|
||||||
let joined_lines = system(printf('dartanalyzer %s %s', a:q_args, shellescape(path)))
|
let command = printf('dartanalyzer %s %s', a:q_args, shellescape(path))
|
||||||
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
|
let lines = systemlist(command)
|
||||||
|
call s:cexpr('%m (%f\, line %l\, col %c)', lines, 'dartanalyzer')
|
||||||
else
|
else
|
||||||
call s:error(printf('cannot read a file: "%s"', path))
|
call s:error(printf('cannot read a file: "%s"', path))
|
||||||
endif
|
endif
|
||||||
@ -63,8 +76,9 @@ function! dart#tojs(q_args) abort
|
|||||||
if executable('dart2js')
|
if executable('dart2js')
|
||||||
let path = expand('%:p:gs:\:/:')
|
let path = expand('%:p:gs:\:/:')
|
||||||
if filereadable(path)
|
if filereadable(path)
|
||||||
let joined_lines = system(printf('dart2js %s %s', a:q_args, shellescape(path)))
|
let command = printf('dart2js %s %s', a:q_args, shellescape(path))
|
||||||
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
|
let lines = systemlist(command)
|
||||||
|
call s:cexpr('%m (%f\, line %l\, col %c)', lines, 'dart2js')
|
||||||
else
|
else
|
||||||
call s:error(printf('cannot read a file: "%s"', path))
|
call s:error(printf('cannot read a file: "%s"', path))
|
||||||
endif
|
endif
|
||||||
|
@ -470,6 +470,10 @@ function! go#config#EchoGoInfo() abort
|
|||||||
return get(g:, "go_echo_go_info", 1)
|
return get(g:, "go_echo_go_info", 1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#CodeCompletionEnabled() abort
|
||||||
|
return get(g:, "go_code_completion_enabled", 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Set the default value. A value of "1" is a shortcut for this, for
|
" Set the default value. A value of "1" is a shortcut for this, for
|
||||||
" compatibility reasons.
|
" compatibility reasons.
|
||||||
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
|
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
|
||||||
|
@ -291,8 +291,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') ==
|
|||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" dockerfile, from Dockerfile.vim in ekalinin/Dockerfile.vim
|
" dockerfile, from Dockerfile.vim in ekalinin/Dockerfile.vim
|
||||||
" Dockerfile
|
" Dockerfile
|
||||||
autocmd BufRead,BufNewFile Dockerfile set ft=Dockerfile
|
autocmd BufRead,BufNewFile [Dd]ockerfile set ft=Dockerfile
|
||||||
autocmd BufRead,BufNewFile Dockerfile* set ft=Dockerfile
|
autocmd BufRead,BufNewFile Dockerfile* set ft=Dockerfile
|
||||||
|
autocmd BufRead,BufNewFile [Dd]ockerfile.vim set ft=vim
|
||||||
autocmd BufRead,BufNewFile *.dock set ft=Dockerfile
|
autocmd BufRead,BufNewFile *.dock set ft=Dockerfile
|
||||||
autocmd BufRead,BufNewFile *.[Dd]ockerfile set ft=Dockerfile
|
autocmd BufRead,BufNewFile *.[Dd]ockerfile set ft=Dockerfile
|
||||||
augroup end
|
augroup end
|
||||||
|
@ -122,7 +122,7 @@ function! GetNimIndent(lnum)
|
|||||||
return plindent + &sw
|
return plindent + &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if pline =~ '\(type\|import\|const\|var\)\s*$'
|
if pline =~ '\(type\|import\|const\|var\|let\)\s*$'
|
||||||
\ || pline =~ '=\s*\(object\|enum\|tuple\|concept\)'
|
\ || pline =~ '=\s*\(object\|enum\|tuple\|concept\)'
|
||||||
return plindent + &sw
|
return plindent + &sw
|
||||||
endif
|
endif
|
||||||
|
@ -43,12 +43,12 @@ syn match elixirOperator '\.\.\|\.'
|
|||||||
syn match elixirOperator "\^\^\^\|\^"
|
syn match elixirOperator "\^\^\^\|\^"
|
||||||
syn match elixirOperator '\\\\\|::\|\*\|/\|\~\~\~\|@'
|
syn match elixirOperator '\\\\\|::\|\*\|/\|\~\~\~\|@'
|
||||||
|
|
||||||
|
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*\%(\.[A-Z]\w*\)*'
|
||||||
|
|
||||||
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
|
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
|
||||||
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
|
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
|
||||||
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"
|
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"
|
||||||
|
|
||||||
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*'
|
|
||||||
|
|
||||||
syn keyword elixirBoolean true false nil
|
syn keyword elixirBoolean true false nil
|
||||||
|
|
||||||
syn match elixirVariable '@[a-z]\w*'
|
syn match elixirVariable '@[a-z]\w*'
|
||||||
|
@ -128,7 +128,7 @@ syntax keyword typescriptBranch break continue yield await
|
|||||||
syntax keyword typescriptLabel case default async readonly
|
syntax keyword typescriptLabel case default async readonly
|
||||||
syntax keyword typescriptStatement return with
|
syntax keyword typescriptStatement return with
|
||||||
|
|
||||||
syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity Math Number NaN Object Packages RegExp String Symbol netscape
|
syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity JSON Math Number NaN Object Packages RegExp String Symbol netscape
|
||||||
|
|
||||||
syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ syn match typescriptBraces "[{}\[\]]"
|
|||||||
syn match typescriptParens "[()]"
|
syn match typescriptParens "[()]"
|
||||||
syn match typescriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-="
|
syn match typescriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-="
|
||||||
syn match typescriptEndColons "[;,]"
|
syn match typescriptEndColons "[;,]"
|
||||||
syn match typescriptLogicSymbols "\(&&\)\|\(||\)"
|
syn match typescriptLogicSymbols "\(&&\)\|\(||\)\|\(!\)"
|
||||||
|
|
||||||
" typescriptFold Function {{{
|
" typescriptFold Function {{{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user