Review Request 117886: Recognize components, properties, signals, slots and methods in plugin.qmltypes files

Denis Steckelmacher steckdenis at yahoo.fr
Thu May 1 17:30:24 UTC 2014



> On April 30, 2014, 8:41 p.m., Sven Brauch wrote:
> > From what I understand the idea of DelayedType is that you can put a type and then later replace it by various other types dynamically, like in C++ templates. I don't see how this matches the use case here. I'd prefer not to introduce the complexity of the DelayedType stuff, and instead just return mixed. Consider for example that with the removal of the oldcpp plugin soon-ish you will be the only user of several hundred lines of code if you use DelayedType, for no real reason (which makes removing or rethinking that code more difficult).

I have replaced DelayedType with StructureType. I don't use a mixed type because typeFromClassName is mainly used to find the base class type of a class, and "mixed" does not have much sense here. For instance, if I type "Component { name: foo; prototype: QObject }", I want to declare "class foo : public QObject", not "class foo : public mixed".

I agree that it is not yet the perfect solution. The right solution would be to have a list of built-in base classes (QObject, QDeclarativeItem, etc), but building such a list may be a bit too much for this patch. Now, many StructureType instances are created, but the information shown to the user is what is expected.


- Denis


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


On May 1, 2014, 5:25 p.m., Denis Steckelmacher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/117886/
> -----------------------------------------------------------
> 
> (Updated May 1, 2014, 5:25 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdev-qmljs
> 
> 
> Description
> -------
> 
> Sorry for the size of this patch, but most of the things added in this patch are needed in order for it to be unit-testable. This patch adds the following:
> 
> * A method that takes a QML type name ("int", "float", "bool" or any class name like "QObject") and returns the corresponding IntegralType, StructureType or DelayedType
> * Support for plugin.qmltypes files that declare QML components and their properties, methods, signals and slots (methods, signals and slots have their argument types recognized)
> * A new test file
> 
> This screenshot (http://steckdenis.be/static/images/kdev-js-qml-types.png) shows what KDevelop displays when I put my cursor on "Component". The component is correctly declared (using its name and its prototype), and its use is correctly detected (though this detection will come in a future patch). "Component" is highlighted instead of "name: "QAbstractItemModel"" because highlighting string literals was not pretty at all.
> 
> A future patch will add support for enumerations, then I will need to figure out how to correctly put all these declarations in the correct namespaces (each component comes with the domain name of the package in which it has to be registered).
> 
> 
> Diffs
> -----
> 
>   duchain/declarationbuilder.h 2f7affc 
>   duchain/declarationbuilder.cpp 9fc2e6c 
>   tests/files/plugins.qml PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/117886/diff/
> 
> 
> Testing
> -------
> 
> I've added a testsuite for this patch, and it passes, even though it is quite minimal because there are still many things to do :-) .
> 
> 
> Thanks,
> 
> Denis Steckelmacher
> 
>

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


More information about the KDevelop-devel mailing list