aboutsummaryrefslogtreecommitdiff
path: root/autoload/prettier/logging/error.vim
diff options
context:
space:
mode:
authorMitermayer Reis <mitermayer.reis@gmail.com>2020-02-05 11:08:03 +1100
committerGitHub <noreply@github.com>2020-02-05 11:08:03 +1100
commit49d91743b2df43f84edd199f877d494b4d8812f4 (patch)
treecf856d77c9960a09eb3156937aa1b896b855bed6 /autoload/prettier/logging/error.vim
parent9eb448e45ef88e90681335fda32bcae52a09d6dc (diff)
parentb064c6ab82a3c57ea64360d762d661ad7e8ee54c (diff)
downloadvim-prettier-49d91743b2df43f84edd199f877d494b4d8812f4.tar.xz
Merge pull request #175 from prettier/release/1.x
Release/1.x
Diffstat (limited to 'autoload/prettier/logging/error.vim')
-rw-r--r--autoload/prettier/logging/error.vim12
1 files changed, 12 insertions, 0 deletions
diff --git a/autoload/prettier/logging/error.vim b/autoload/prettier/logging/error.vim
new file mode 100644
index 0000000..48ad048
--- /dev/null
+++ b/autoload/prettier/logging/error.vim
@@ -0,0 +1,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