<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi <span style="background-color: rgb(255, 255, 255);" class="">Cristina,</span><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class="">There is no inherit filtering in clang code-completion, what you need to do on the client side is:</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class="">- When cursor is immediately after an identifier, invoke clang code-completion at the column location where the identifier begins</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class="">- Get all the results, then filter them using the identifier as filtering hint.</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class="">Let me know if you have any other questions.</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class=""></span><div><blockquote type="cite" class=""><div class="">On Feb 1, 2016, at 9:20 AM, Bianca-Cristina Cristescu via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><font face="Tahoma" size="2" class=""><span style="font-size:10pt" dir="ltr" class=""><font face="Times New Roman" size="2" class=""><span style="font-size:16px" class=""><div class="">
<div class=""><font face="Tahoma" size="2" class=""><span style="font-size:10pt" class=""><font face="Helvetica" class="">Hello, </font>
<div class=""><font face="Helvetica" class=""><br class="">
</font></div>
<font face="Helvetica" class="">I am working on autocompletion in the context of cling (</font><a href="https://mmm.cern.ch/owa/redir.aspx?C=uJ-aTnQK4Uuu63K_-62ZB9lhrt-KMNMISzgTuVv6J_9YwDFhO3ofuTkvJrVPSJOIGwZuUCspl3I.&URL=https%3a%2f%2froot.cern.ch%2fcling" target="_blank" class=""><font face="Helvetica" class="">https://root.cern.ch/cling</font></a><font face="Helvetica" class="">). </font><font face="Helvetica" class="">
</font>
<div class=""><font face="Helvetica" class="">I am trying to use clang’s autocompletion on identifiers. </font><font face="Helvetica" class=""><br class="">
</font></div>
<div class="">
<pre style="margin-top:14pt;margin-bottom:14pt" class=""><font face="Helvetica" class="">The file that I am using as a test case is the following:
testTabComp.cxx
class MyClass {
private:
//data members
int anInteger;
double aDouble;
//function members
public:
MyClass(int i, double d) {
anInteger = i;
aDouble = d;
}
int getInt() { return anInteger; }
double getDouble() { return aDouble; }
void setInt(int value) { anInteger = value; }
void setDouble(double value) { aDouble = value; }
};
int main() {
MyClass* objectMyClass = new MyClass(5, 1.0);
objectMyClass->set\r
return 0;
}
I am invoing clang with:
../Debug+Asserts/bin/clang -cc1 -code-completion-at=testTabComp.cxx:32:23 testTabComp.cxx
If I omit the "set" token then it autocompletes correctly:</font><font face="Helvetica" class="">
COMPLETION: aDouble : [#double#]aDouble</font><font face="Helvetica" class="">
COMPLETION: anInteger : [#int#]anInteger</font><font face="Helvetica" class="">
COMPLETION: getDouble : [#double#]getDouble()</font><font face="Helvetica" class="">
COMPLETION: getInt : [#int#]getInt()</font><font face="Helvetica" class="">
COMPLETION: MyClass : MyClass::</font><font face="Helvetica" class="">
COMPLETION: operator= : [#MyClass &#]operator=(<#const MyClass &#>)</font><font face="Helvetica" class="">
COMPLETION: setDouble : [#void#]setDouble(<#double value#>)</font><font face="Helvetica" class="">
COMPLETION: setInt : [#void#]setInt(<#int value#>)</font><font face="Helvetica" class="">
COMPLETION: ~MyClass : [#void#]~MyClass()</font><font face="Helvetica" class="">
</font><font face="Helvetica" class="">
But if I don't then I get the whole world:
testTabComp.cxx:32:17: error: no member named 'set' in 'MyClass'
objectMyClass->set
~~~~~~~~~~~~~ ^
COMPLETION: __FUNCTION__
COMPLETION: __PRETTY_FUNCTION__
COMPLETION: bool
COMPLETION: char
COMPLETION: class
COMPLETION: int
COMPLETION: long
COMPLETION: main : [#int#]main()
COMPLETION: MyClass : MyClass
COMPLETION: MyClass : MyClass(<#int i#>, <#double d#>)
COMPLETION: MyClass : MyClass(<#const MyClass &#>)
....
Is that the intended behaviour for code completion of member functions when the completion point is not immediatly after the "->"?
If there is another way to do this I would appreciate any help!
PS: I tried libclang as well, but I got the same behaviour.
Thank you! </font></pre>
</div>
<div class=""> </div>
<font face="Helvetica" class="">Cheers,</font><font face="Helvetica" class=""><br class="">
Cristina Cristescu</font></span></font></div>
</div></span></font></span></font></div>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></div></body></html>