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

Denis Steckelmacher steckdenis at yahoo.fr
Wed Apr 30 17:39:50 UTC 2014



> On April 29, 2014, 8:18 p.m., Sven Brauch wrote:
> > duchain/declarationbuilder.h, line 77
> > <https://git.reviewboard.kde.org/r/117886/diff/1/?file=269271#file269271line77>
> >
> >     What's the difference between those two, I guess one gets an integral type and one gets a type for a builtin class? Can you document it please?

typeFromName supports built-in types (int, void, bool, float), and calls typeFromClassName when the type passed as argument is not a built-in one. typeFromClassName exists in order to keep typeFromName short and focused, and also because there are cases where the type will always be a class (QML components cannot inherit "int" for instance).


> On April 29, 2014, 8:18 p.m., Sven Brauch wrote:
> > duchain/declarationbuilder.cpp, line 505
> > <https://git.reviewboard.kde.org/r/117886/diff/1/?file=269272#file269272line505>
> >
> >     I never used DelayedType, are you sure it does what you think it does?
> >     It is intended to be used for C++ templates, which is quite different from "this type was not yet parsed". Maybe it can be used for this purpose, I don't know, but it sounds a bit adventurous ;)
> >     Maybe just return mixed here?

One other solution would be to create a new StructureType for unknown class names. I don't know if DelayedType can be used here, and a grep on kdevplatform's source code didn't give me much more information. DelayedType seems to be usable whenever a type name without any extra information has to be stored somewhere. KDevelop behaves well with delayed types, but I don't know if this use is really supported by it.


- Denis


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


On April 30, 2014, 5:33 p.m., Denis Steckelmacher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/117886/
> -----------------------------------------------------------
> 
> (Updated April 30, 2014, 5:33 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.cpp 9fc2e6c 
>   duchain/declarationbuilder.cpp.orig PRE-CREATION 
>   duchain/declarationbuilder.h 2f7affc 
>   duchain/declarationbuilder.h.orig PRE-CREATION 
>   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/20140430/6485e6e5/attachment.html>


More information about the KDevelop-devel mailing list