1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 17:02:06 +03:00

Small fixes in clang.kak completion handling

This commit is contained in:
Maxime Coste 2016-04-04 13:37:28 +01:00
parent 989d64abd4
commit 675a68abb8

View File

@ -44,16 +44,19 @@ def clang-parse -params 0..1 -docstring "Parse the contents of the current buffe
-Xclang -code-completion-brief-comments -Xclang -code-completion-at=${pos} - < ${dir}/buf 2> ${dir}/stderr | -Xclang -code-completion-brief-comments -Xclang -code-completion-at=${pos} - < ${dir}/buf 2> ${dir}/stderr |
awk -F ': ' -e ' awk -F ': ' -e '
/^COMPLETION:/ && ! /\(Hidden\)/ { /^COMPLETION:/ && ! /\(Hidden\)/ {
id=$2
gsub(/ +$/, "", id)
gsub(/:/, "\\:", id)
gsub(/\|/, "\\|", id)
gsub(/[[{<]#|#[}>]/, "", $3) gsub(/[[{<]#|#[}>]/, "", $3)
gsub(/#]/, " ", $3) gsub(/#]/, " ", $3)
gsub(/:: /, "::", $3) gsub(/:: /, "::", $3)
gsub(/ +$/, "", $3) gsub(/ +$/, "", $3)
id=substr($2, 1, length($2)-1)
gsub(/:/, "\\:", id)
gsub(/\|/, "\\\|", id)
desc=$4 ? $3 "\\n" $4 : $3 desc=$4 ? $3 "\\n" $4 : $3
gsub(/:/, "\\:", desc) gsub(/:/, "\\:", desc)
gsub(/\|/, "\\\|", desc) gsub(/\|/, "\\|", desc)
if (id in docstrings) if (id in docstrings)
docstrings[id]=docstrings[id] "\\n" desc docstrings[id]=docstrings[id] "\\n" desc
else else
@ -68,7 +71,7 @@ def clang-parse -params 0..1 -docstring "Parse the contents of the current buffe
gsub(/[^[:alnum:]{}_]+/, "{operator}&{}", menu) gsub(/[^[:alnum:]{}_]+/, "{operator}&{}", menu)
print id "|" docstrings[id] "|" menu print id "|" docstrings[id] "|" menu
} }
}' | sort | paste -s -d ':' | sed -e "s/\\\\n/\\n/g; s/'/\\\\'/g") }' | paste -s -d ':' | sed -e "s/\\\\n/\\n/g; s/'/\\\\'/g")
echo "eval -client ${kak_client} echo 'clang completion done' echo "eval -client ${kak_client} echo 'clang completion done'
set 'buffer=${kak_buffile}' clang_completions '${header}:${compl}'" | kak -p ${kak_session} set 'buffer=${kak_buffile}' clang_completions '${header}:${compl}'" | kak -p ${kak_session}
else else