Commit 969afc2b authored by Mark Nauwelaerts's avatar Mark Nauwelaerts
Browse files

lspclient: consider language semantics in function parentheses auto-completion

parent dd06221f
......@@ -339,13 +339,15 @@ public:
// This is a function
const auto &m = m_matches.at(index.row());
if (isFunctionKind(m.kind)) {
// add parentheses if function and guestimated meaningful for language in question
bool addParens = isFunctionKind(m.kind) && m_triggersSignature.contains(QLatin1Char('('));
if (addParens) {
matching += QStringLiteral("()");
}
view->document()->replaceText(word, matching);
if (isFunctionKind(m.kind)) {
if (addParens) {
// place the cursor in between (|)
view->setCursorPosition({view->cursorPosition().line(), view->cursorPosition().column() - 1});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment