diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2017-04-28 17:46:40 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2017-05-11 11:54:09 +0000 |
commit | 64ec695566ff1479744e4467e053cfa6cf3bfb8c (patch) | |
tree | 148c7cb42afe33b47ce7be855d324e290027240c /src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp | |
parent | f127cb3c597dcb53acf40640757bc97efc8f059a (diff) | |
download | qt-creator-64ec695566ff1479744e4467e053cfa6cf3bfb8c.tar.gz |
Clang: Show function signature hint for constructors and functors
For "foo(|" [1] we requested a completion from libclang with the cursor
position just before "foo" and then filtered the function declarations
for functions matching the name "foo". This worked fine for ordinary
functions, but obviously not for constructors and functors.
Recent versions of libclang support proper function call completion with
XCursor_OverloadCandidate, so make use of that.
[1] '|' represents the cursor position
Task-number: QTCREATORBUG-14882
Task-number: QTCREATORBUG-14884
Change-Id: I9d31b3960ccff6a8b9440dbcb7ff9f5ca9f61266
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp')
-rw-r--r-- | src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp index 77eccac70d..2852be4697 100644 --- a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp +++ b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp @@ -167,7 +167,11 @@ void CompletionChunksToTextConverter::parse( switch (codeCompletionChunk.kind()) { case CodeCompletionChunk::ResultType: parseResultType(codeCompletionChunk.text()); break; - case CodeCompletionChunk::Placeholder: parsePlaceHolder(codeCompletionChunk); break; + // Do not rely on CurrentParameter because it might be wrong for + // invalid code. Instead, handle it as PlaceHolder. + case CodeCompletionChunk::CurrentParameter: + case CodeCompletionChunk::Placeholder: + parsePlaceHolder(codeCompletionChunk); break; case CodeCompletionChunk::LeftParen: parseLeftParen(codeCompletionChunk); break; case CodeCompletionChunk::LeftBrace: parseLeftBrace(codeCompletionChunk); break; default: parseText(codeCompletionChunk.text()); break; |