aboutsummaryrefslogtreecommitdiff
path: root/autoload/prettier/logging/error.vim
blob: 48ad048f9601b8bc9ef492c4d53017b611ff0359 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
let s:PREFIX_MSG = 'Prettier: '
let s:ERRORS = {
  \ 'EXECUTABLE_NOT_FOUND_ERROR': 'no prettier executable installation found',
  \ 'PARSING_ERROR': 'failed to parse buffer',
  \ }
let s:DEFAULT_ERROR = get(s:, 'PARSING_ERROR')

function! prettier#logging#error#log(...) abort
  let l:error = a:0 > 0 ? a:1 : s:DEFAULT_ERROR
  let l:msg = a:0 > 1 ? ': ' . a:2 : ''
  echohl WarningMsg | echom s:PREFIX_MSG . get(s:ERRORS, l:error, s:DEFAULT_ERROR) . l:msg | echohl NONE
endfunction