[PATCH] D50835: [clangd] Add parantheses while auto-completing functions.
Eric Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 17 08:25:20 PDT 2018
ioeric added inline comments.
================
Comment at: clangd/CodeComplete.cpp:1379
+ Kind == CompletionItemKind::Method) &&
+ SnippetSuffix.front() == '(' && SnippetSuffix.back() == ')') {
+ // Check whether function has any parameters or not.
----------------
nit: add parentheses around `(... == ...)`
================
Comment at: clangd/CodeComplete.cpp:1380
+ SnippetSuffix.front() == '(' && SnippetSuffix.back() == ')') {
+ // Check whether function has any parameters or not.
+ LSP.textEdit->newText += SnippetSuffix.size() > 2 ? "(${0})" : "()";
----------------
nit: no braces around one liner.
================
Comment at: clangd/CodeComplete.cpp:1381
+ // Check whether function has any parameters or not.
+ LSP.textEdit->newText += SnippetSuffix.size() > 2 ? "(${0})" : "()";
+ }
----------------
I think we are missing one case here: `!EnableFunctionArgSnippets && (<not function or method>)`?
I think we could do something like:
```
if (!EnableFunctionArgSnippets && (<function or metrhod>))
// Truncate parameter template
else
// append snippet like before
```
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D50835
More information about the cfe-commits
mailing list