<commit_before>function! lsp#ui#vim#diagnostics#echo#cursor_moved()
    if !g:lsp_diagnostics_echo_cursor
        return
    endif

    if mode() isnot# 'n'
        " dont' show echo only in normal mode
        return
    endif

    call s:stop_cursor_moved_timer()

    let l:current_pos = getcurpos()[0:2]

    " use timer to avoid recalculation
    if !exists('s:last_pos') || l:current_pos != s:last_pos
        let s:last_pos = l:current_pos
        let s:cursor_moved_timer = timer_start(g:lsp_diagnostics_echo_delay, function('s:echo_diagnostics_under_cursor'))
    endif
endfunction

function! s:echo_diagnostics_under_cursor(...) abort
    let l:diagnostic = lsp#ui#vim#diagnostics#get_diagnostics_under_cursor()
    if !empty(l:diagnostic) && has_key(l:diagnostic, 'message')
        echo 'LSP: '. substitute(l:diagnostic['message'], '\n\+', ' ', 'g')
    else
        echo ''
    endif
endfunction

function! s:stop_cursor_moved_timer() abort
    if exists('s:cursor_moved_timer')
        call timer_stop(s:cursor_moved_timer)
        unlet s:cursor_moved_timer
    endif
endfunction
<commit_msg>Fix erasing ALE (and other) diagnostic errors (#184)<commit_after>function! lsp#ui#vim#diagnostics#echo#cursor_moved()
    if !g:lsp_diagnostics_echo_cursor
        return
    endif

    if mode() isnot# 'n'
        " dont' show echo only in normal mode
        return
    endif

    call s:stop_cursor_moved_timer()

    let l:current_pos = getcurpos()[0:2]

    " use timer to avoid recalculation
    if !exists('s:last_pos') || l:current_pos != s:last_pos
        let s:last_pos = l:current_pos
        let s:cursor_moved_timer = timer_start(g:lsp_diagnostics_echo_delay, function('s:echo_diagnostics_under_cursor'))
    endif
endfunction

function! s:echo_diagnostics_under_cursor(...) abort
    let l:diagnostic = lsp#ui#vim#diagnostics#get_diagnostics_under_cursor()
    if !empty(l:diagnostic) && has_key(l:diagnostic, 'message')
        echo 'LSP: '. substitute(l:diagnostic['message'], '\n\+', ' ', 'g')
    endif
endfunction

function! s:stop_cursor_moved_timer() abort
    if exists('s:cursor_moved_timer')
        call timer_stop(s:cursor_moved_timer)
        unlet s:cursor_moved_timer
    endif
endfunction

{'fraction_non_alphanumeric': 0.11086175942549371, 'fraction_numerical': 0.0031418312387791743, 'mean_word_length': 3.942350332594235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3003237', 'n_tokens_mistral': 782, 'n_tokens_neox': 751, 'n_words': 149}