diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-21 19:51:34 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-21 19:51:34 +0100 |
commit | 3a289dab6b6581586d42204e5e8d56a1489aa75c (patch) | |
tree | a29f573e0f9afe9e36fabfa702776f2d6227c039 | |
parent | 23ee0d0992c876c605555a3a667cc84c52382ed4 (diff) | |
download | ale-3a289dab6b6581586d42204e5e8d56a1489aa75c.zip |
#318 Do not capitalize the first character for cursor messages
-rw-r--r-- | autoload/ale/cursor.vim | 4 | ||||
-rw-r--r-- | test/test_cursor_warnings.vader | 19 |
2 files changed, 19 insertions, 4 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim index ad580b98..e5ce7fde 100644 --- a/autoload/ale/cursor.vim +++ b/autoload/ale/cursor.vim @@ -7,15 +7,13 @@ function! s:GetMessage(linter, type, text) abort let l:type = a:type ==# 'E' \ ? g:ale_echo_msg_error_str \ : g:ale_echo_msg_warning_str - " Capitalize the 1st character - let l:text = toupper(a:text[0]) . a:text[1:-1] " Replace handlers if they exist for [l:k, l:v] in items({'linter': a:linter, 'severity': l:type}) let l:msg = substitute(l:msg, '\V%' . l:k . '%', l:v, '') endfor - return printf(l:msg, l:text) + return printf(l:msg, a:text) endfunction function! s:EchoWithShortMess(setting, message) abort diff --git a/test/test_cursor_warnings.vader b/test/test_cursor_warnings.vader index 6018dabd..586cc13c 100644 --- a/test/test_cursor_warnings.vader +++ b/test/test_cursor_warnings.vader @@ -32,7 +32,17 @@ Before: \ 'nr': -1, \ 'type': 'E', \ 'text': 'Missing radix parameter (radix)' - \ } + \ }, + \ { + \ 'lnum': 3, + \ 'col': 1, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'eslint', + \ 'nr': -1, + \ 'type': 'E', + \ 'text': 'lowercase error' + \ }, \ ], \ }, \} @@ -73,6 +83,7 @@ After: Given javascript(A Javscript file with warnings/errors): var x = 3 var x = 5*2 + parseInt("10"); + // comment Execute(Messages should be shown for the correct lines): call cursor(1, 1) @@ -124,3 +135,9 @@ Execute(ALEDetail should print regular 'text' attributes): redir END AssertEqual "\nInfix operators must be spaced. (space-infix-ops)", g:output + +Execute(ALEDetail should not capitlise cursor messages): + call cursor(3, 1) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'lowercase error', GetLastMessage() |