mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-29 01:24:52 +03:00
Tweak the bash code on the racer support
This commit is contained in:
parent
67ce6946d2
commit
2f41fdb683
@ -105,11 +105,11 @@ define-command racer-go-definition -docstring "Jump to where the rust identifier
|
|||||||
(
|
(
|
||||||
cursor="${kak_cursor_line} $((${kak_cursor_column} - 1))"
|
cursor="${kak_cursor_line} $((${kak_cursor_column} - 1))"
|
||||||
racer_data=$(racer --interface tab-text find-definition ${cursor} ${kak_buffile} ${dir}/buf | head -n 1)
|
racer_data=$(racer --interface tab-text find-definition ${cursor} ${kak_buffile} ${dir}/buf | head -n 1)
|
||||||
racer_match=$(echo "$racer_data" | cut -f1 )
|
racer_match=$(printf %s\\n "$racer_data" | cut -f1 )
|
||||||
if [[ "$racer_match" == "MATCH" ]]; then
|
if [[ "$racer_match" == "MATCH" ]]; then
|
||||||
racer_line=$(echo "$racer_data" | cut -f3 )
|
racer_line=$(printf %s\\n "$racer_data" | cut -f3 )
|
||||||
racer_column=$(echo "$racer_data" | cut -f4 )
|
racer_column=$(printf %s\\n "$racer_data" | cut -f4 )
|
||||||
racer_file=$(echo "$racer_data" | cut -f5 )
|
racer_file=$(printf %s\\n "$racer_data" | cut -f5 )
|
||||||
printf %s\\n "edit -existing '$racer_file' $racer_line $racer_column"
|
printf %s\\n "edit -existing '$racer_file' $racer_line $racer_column"
|
||||||
printf %s\\n "set-option buffer readonly true"
|
printf %s\\n "set-option buffer readonly true"
|
||||||
else
|
else
|
||||||
@ -128,15 +128,16 @@ define-command racer-show-doc -docstring "Show the documentation about the rust
|
|||||||
%sh{
|
%sh{
|
||||||
dir=${kak_opt_racer_tmp_dir}
|
dir=${kak_opt_racer_tmp_dir}
|
||||||
(
|
(
|
||||||
cursor="${kak_cursor_line} $((${kak_cursor_column} - 1))"
|
printf -v NEWLINE '\n'
|
||||||
|
cursor="${kak_cursor_line} ${kak_cursor_column}"
|
||||||
racer_data=$(racer --interface tab-text complete-with-snippet ${cursor} ${kak_buffile} ${dir}/buf | head -n 2 | tail -n 1)
|
racer_data=$(racer --interface tab-text complete-with-snippet ${cursor} ${kak_buffile} ${dir}/buf | head -n 2 | tail -n 1)
|
||||||
racer_match=$(echo "$racer_data" | cut -f1 )
|
racer_match=$(printf %s\\n "$racer_data" | cut -f1)
|
||||||
printf %s\\n "info '$racer_data'"
|
printf %s\\n "info %@.$racer_match.@"
|
||||||
if [[ "$racer_match" == "MATCH" ]]; then
|
if [[ "$racer_match" == "MATCH" ]]; then
|
||||||
racer_doc=$(echo "$racer_data" | cut -f9 | xargs )
|
racer_doc=$(printf %s\\n "$racer_data" | cut -f9 | xargs )
|
||||||
racer_doc=$(echo "${racer_doc//\\n/
|
racer_doc=$(printf %s\\n "$racer_doc" | sed -e "s/\\\n/\\$NEWLINE/g")
|
||||||
}") # This is a bit ugly and probably should be replaced with something better than a new line in the code itself, but I couldn't work how
|
racer_doc=$(printf %s\\n "$racer_doc" | sed -e "s/@/\\@/g")
|
||||||
printf %s\\n "info '$racer_doc'"
|
printf %s\\n "info %@$racer_doc@"
|
||||||
else
|
else
|
||||||
printf %s\\n "echo -debug 'racer could not find a definition'"
|
printf %s\\n "echo -debug 'racer could not find a definition'"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user