clang-complete: do the compilation in the buffer directory
This commit is contained in:
parent
ee800ad778
commit
f0baf35117
|
@ -10,14 +10,13 @@ def clang-complete %{
|
||||||
# end the previous %sh{} so that its output gets interpreted by kakoune
|
# end the previous %sh{} so that its output gets interpreted by kakoune
|
||||||
# before launching the following as a background task.
|
# before launching the following as a background task.
|
||||||
%sh{
|
%sh{
|
||||||
# this runs in a detached shell, asynchronously, so that kakoune does not hang while clang is running
|
# this runs in a detached shell, asynchronously, so that kakoune does not hang while clang is running.
|
||||||
# as completions references a cursor position and a buffer timestamp, only valid completions should be
|
# As completions references a cursor position and a buffer timestamp, only valid completions should be
|
||||||
# displayed.
|
# displayed.
|
||||||
(
|
(
|
||||||
pos=${kak_opt_clang_filename}:${kak_cursor_line}:${kak_cursor_column}
|
pos=-:${kak_cursor_line}:${kak_cursor_column}
|
||||||
cp ${kak_opt_clang_filename} /tmp/kak_clang_file.cpp
|
cd $(dirname ${kak_bufname})
|
||||||
echo $pos > /tmp/kak_clang_pos
|
output=$(clang++ -x c++ -fsyntax-only ${kak_opt_clang_options} -Xclang -code-completion-at=${pos} - < ${kak_opt_clang_filename} |
|
||||||
output=$(clang++ -fsyntax-only -I${PWD} ${kak_opt_clang_options} -Xclang -code-completion-at=${pos} ${kak_opt_clang_filename} |
|
|
||||||
grep -E "^COMPLETION:[^:]+:" | perl -pe 's/^COMPLETION:[^:]+: +//; s/\[#.*?#\]|<#.*?#>(, *|\))?|\{#.*?#\}\)?//g')
|
grep -E "^COMPLETION:[^:]+:" | perl -pe 's/^COMPLETION:[^:]+: +//; s/\[#.*?#\]|<#.*?#>(, *|\))?|\{#.*?#\}\)?//g')
|
||||||
rm -r $(dirname ${kak_opt_clang_filename})
|
rm -r $(dirname ${kak_opt_clang_filename})
|
||||||
completions="${kak_cursor_line}:${kak_cursor_column}@${kak_timestamp}"
|
completions="${kak_cursor_line}:${kak_cursor_column}@${kak_timestamp}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user