Improve error messages

This commit is contained in:
Shougo Matsushita 2015-08-15 09:24:17 +09:00
parent e619d43571
commit 58ac259dc5
2 changed files with 6 additions and 6 deletions

View File

@ -141,7 +141,7 @@ function! s:parse_snippet_name(snippet_file, line, linenr, dup_check) "{{{
if has_key(a:dup_check, snippet_dict.name) if has_key(a:dup_check, snippet_dict.name)
let dup = a:dup_check[snippet_dict.name] let dup = a:dup_check[snippet_dict.name]
call neosnippet#util#print_error(printf( call neosnippet#util#print_error(printf(
\ 'Warning: %s:%d is overriding `%s` from %s:%d', \ '%s:%d is overriding `%s` from %s:%d',
\ a:snippet_file, a:linenr, snippet_dict.name, \ a:snippet_file, a:linenr, snippet_dict.name,
\ dup.action__path, dup.action__line)) \ dup.action__path, dup.action__line))
call neosnippet#util#print_error(printf( call neosnippet#util#print_error(printf(
@ -178,18 +178,18 @@ function! s:add_snippet_attribute(snippet_file, line, linenr, snippet_dict) "{{{
\ '^options\s\+\zs.*$'), '[,[:space:]]\+') \ '^options\s\+\zs.*$'), '[,[:space:]]\+')
if !has_key(a:snippet_dict.options, option) if !has_key(a:snippet_dict.options, option)
call neosnippet#util#print_error( call neosnippet#util#print_error(
\ printf('[neosnippet] %s:%d', a:snippet_file, a:linenr)) \ printf('%s:%d', a:snippet_file, a:linenr))
call neosnippet#util#print_error( call neosnippet#util#print_error(
\ printf('[neosnippet] Invalid option name : "%s"', option)) \ printf('Invalid option name : "%s"', option))
else else
let a:snippet_dict.options[option] = 1 let a:snippet_dict.options[option] = 1
endif endif
endfor endfor
else else
call neosnippet#util#print_error( call neosnippet#util#print_error(
\ printf('[neosnippet] %s:%d', a:snippet_file, a:linenr)) \ printf('%s:%d', a:snippet_file, a:linenr))
call neosnippet#util#print_error( call neosnippet#util#print_error(
\ printf('[neosnippet] Invalid syntax : "%s"', a:line)) \ printf('Invalid syntax : "%s"', a:line))
endif endif
endfunction"}}} endfunction"}}}

View File

@ -107,7 +107,7 @@ function! neosnippet#util#get_cur_text() "{{{
\ '^.*\%' . col('.') . 'c' . (mode() ==# 'i' ? '' : '.')) \ '^.*\%' . col('.') . 'c' . (mode() ==# 'i' ? '' : '.'))
endfunction"}}} endfunction"}}}
function! neosnippet#util#print_error(string) "{{{ function! neosnippet#util#print_error(string) "{{{
echohl Error | echomsg a:string | echohl None echohl Error | echomsg '[neosnippet] ' . a:string | echohl None
endfunction"}}} endfunction"}}}
function! neosnippet#util#parse_options(args, options_list) "{{{ function! neosnippet#util#parse_options(args, options_list) "{{{