diff --git a/src/source_language_protocol.cc b/src/source_language_protocol.cc index 9bd0854..7c5438f 100644 --- a/src/source_language_protocol.cc +++ b/src/source_language_protocol.cc @@ -1170,7 +1170,22 @@ void Source::LanguageProtocolView::setup_autocomplete() { auto label=it->second.get("label", ""); auto detail=it->second.get("detail", ""); auto documentation=it->second.get("documentation", ""); - auto insert=it->second.get("insertText", label); + auto insert=it->second.get("insertText", ""); + if(insert.empty()) { + insert=label; + auto kind=it->second.get("kind", 0); + if(kind>=2 && kind<=3) { + bool found_bracket=false; + for(auto &chr: insert) { + if(chr=='(' || chr=='{') { + found_bracket=true; + break; + } + } + if(!found_bracket) + insert+="(${1:})"; + } + } if(!label.empty()) { autocomplete.rows.emplace_back(std::move(label)); autocomplete_comment.emplace_back(std::move(detail));