Setup Module
Module Settings
This functionality is available in InelliJ IDEA product. In all other products the plugin is enabled by default.
It’s possible that you already have a project or create/import project, but Q code was not loaded correctly. In this case you can change your project structure and do module setup manually.
Just open project structure dialog and select modules tab there:
Create Module
If you need a new module for Q code, there is nothing more simple rather than press + (plus) button at the modules’ toolbar and choose ‘KDB+ Q’ module type:
Like in project creation, you can select KDB SDK, if required, and provide new module name and path at the next step:
If you already have a KDB Module, you can import it the same way. Just choose ‘Import Module’ and go through the same steps.
Add Framework
If you already have a module of another (java or mixed), you can just add ‘KDB+ Q Language’ framework to it. Just right-click on the module, select ‘Add’ and ‘KDB+ Q Language’ at the end:
Please note, to be able to run any Q file in local KDB instance, the module must
have KDB SDK set as the module SDK:
Module Content
One of the most important thing about modules - how to define its structure and content as it has a direct impact on the ability to run and scan Q files.
Even the IDEA has many content types, like ‘source’, ‘tests’, ‘resources’ and so on, for now only ‘source’ makes sense for KDB module and everything under ‘source’ is treated as the module root.
All file loads and like
\l code/log.q
\l code/config.q
\l code/tables.q
will be resolved to the module’s source directories.
If module has no ‘source’ folders, its ‘Content root’ will be used instead.
External Dependencies
Another ability to manage a module content is to add an internal or external dependency. For example, if you have multy-modules project or your project depends on external code.
In project structure dialog you can see separate tab for Libraries and here you can define a new KDB+ Q library as well:
You can select a folder with Q files or a zip archive with KDB source code:
At the final step, just choose which module new library should be attached to and that’s it:
Your library will be scanned and attached to your project:
any usage of a function from external files will be resolved to the library as it would be in your project.