From a9326e2596c56b7717562b9dc7f749c7c5faf7b4 Mon Sep 17 00:00:00 2001 From: mitermayer Date: Wed, 2 May 2018 16:55:44 -0700 Subject: Starting refactoring methods out to components - This is the first commit on refactoring methods outs on self contained components, this will help on unit testing and maintainability --- autoload/prettier/logging/error.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 autoload/prettier/logging/error.vim (limited to 'autoload/prettier/logging/error.vim') 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 -- cgit v1.3