diff options
| author | mitermayer <mitermayer.reis@gmail.com> | 2018-05-02 16:55:44 -0700 |
|---|---|---|
| committer | mitermayer <mitermayer.reis@gmail.com> | 2019-08-25 21:11:49 -0700 |
| commit | dafe05bbed12f0b75ecefa93818c595df1c64dc2 (patch) | |
| tree | 726392db5c5b5f3911499e2924229bfca50a04c7 /autoload/prettier/logging | |
| parent | fc25ce1a3c1ca0b8128c5c745c87932aba9fc32a (diff) | |
| download | vim-prettier-dafe05bbed12f0b75ecefa93818c595df1c64dc2.tar.xz | |
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
Diffstat (limited to 'autoload/prettier/logging')
| -rw-r--r-- | autoload/prettier/logging/error.vim | 12 |
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 |
