clang.kak: rework clang-show-error-info

This commit is contained in:
Maxime Coste 2015-11-21 12:07:53 +00:00
parent 5e4f5cd2a0
commit bd2bf3a6a5

View File

@ -110,13 +110,10 @@ def clang-disable-autocomplete -docstring "Disable automatic clang completion" %
} }
def -hidden clang-show-error-info %{ %sh{ def -hidden clang-show-error-info %{ %sh{
echo "${kak_opt_clang_errors}" | while read line; do echo "${kak_opt_clang_errors}" | grep "^${kak_cursor_line},.*" | while read line; do
case "${line}" in desc=$(echo ${line} | sed -e "s/^[[:digit:]]\+,//g; s/'/\\\\'/g")
${kak_cursor_line},*)
desc=$(echo ${line#*,} | sed -e "s/'/\\\\'/g")
echo "info -anchor ${kak_cursor_line}.${kak_cursor_column} '${desc}'" echo "info -anchor ${kak_cursor_line}.${kak_cursor_column} '${desc}'"
;; break
esac
done done
} } } }
@ -149,3 +146,14 @@ def clang-diagnostics-next -docstring "Jump to the next line that contains an er
fi fi
) )
} } } }
def -allow-override -hidden clang-show-completion-info %[
eval -draft %[
exec '{(b'
%sh[
msg=$(echo "${kak_opt_clang_completions}" | sed -e 's/\([^\\]\):/\1\n/g' )
echo "echo -debug -- %{$msg}"
desc=$(echo "${kak_opt_clang_completions}" | sed -e 's/\([^\\]\):/\1\n/g' | grep "^${kak_selection}@" | head -n1 | sed -e 's/.*[^\\]@\(.*[^\\]\)@.*$/\1/' )
echo "eval -client $kak_client info -anchor ${kak_cursor_line}.${kak_cursor_column} ${desc}"
] ]
]