Review Request 118435: Handle namespace imports, classes and wrappers in code-completion

Denis Steckelmacher steckdenis at yahoo.fr
Sat May 31 13:53:55 UTC 2014



> On May 31, 2014, 10:48 a.m., Sven Brauch wrote:
> > I never used the importIdentifier stuff, but what you do looks okay, and since it works it should be fine. The rest looks alright as well.
> > 
> > Re. items with equal names: The completion model (CodeCompletionModelControllerInterfaceV4 I think the class is called) has a flag to hide items with equal names, you could try that, but I'm not sure it's enough in all cases here (because of the prefix etc. stuff).

I'll try the flag, but the difficulty is that the names are not completely equals. The user is interested in QML components, but every QML component also has a C++ wrapper. So, I have to replace "wrapper Button" and "component Button" with "component Button". The wrapper must disappear in this case, but if a wrapper exists without a corresponding component, I would like to keep it.


> On May 31, 2014, 10:48 a.m., Sven Brauch wrote:
> > codecompletion/completionitem.cpp, line 65
> > <https://git.reviewboard.kde.org/r/118435/diff/1/?file=276548#file276548line65>
> >
> >     rather use kDebug(), it can be disabled

It wasn't meant to go into the diff, so I removed the qDebug() lines.


- Denis


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/118435/#review58848
-----------------------------------------------------------


On May 31, 2014, 10:35 a.m., Denis Steckelmacher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/118435/
> -----------------------------------------------------------
> 
> (Updated May 31, 2014, 10:35 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdev-qmljs
> 
> 
> Description
> -------
> 
> This adds support for import statements in the code-completion context (by enumerating the declarations of {...import...}), and adds a NormalDeclarationCompletionItem subclass that provides better type names for QML components, classes and instances. For instance, instead of displaying "QtQuick::Rectangle QtQuick::Rectangle", the item displays "component QtQuick::Rectangle". Instead of "<class> my_button", it displays "QtQuick.Controls::Button my_button".
> 
> These two changes required a near rewrite of context.cpp, because the old code did not handle the QML class hierarchy and used a mean of finding the globally visible symbols that was incompatible with namespaces.
> 
> 
> Diffs
> -----
> 
>   codecompletion/CMakeLists.txt de6f53c 
>   codecompletion/completionitem.h PRE-CREATION 
>   codecompletion/completionitem.cpp PRE-CREATION 
>   codecompletion/context.h 09b3d8f 
>   codecompletion/context.cpp 751dc8e 
> 
> Diff: https://git.reviewboard.kde.org/r/118435/diff/
> 
> 
> Testing
> -------
> 
> There are currently no unit tests for code-completion, but I've seen that other plugins have ones. I will add some of them in the coming days.
> 
> Manual testing has shown that everything behaves as expected. The code-completion is not yet perfect, though, and there are many duplicates (it's a QML-related problem: Button exists in a wrapper and in a component version because it is declared like that in its plugin.qmltypes file). A future patch will change that and ensure that only the most pertinent version of a symbol is displayed.
> 
> 
> Thanks,
> 
> Denis Steckelmacher
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140531/1673ed83/attachment.html>


More information about the KDevelop-devel mailing list