Creating Language Plugin not used for new language

Roland Pluess roland at rptd.ch
Wed Jul 11 15:54:44 BST 2018


I'm trying to make a language plugin for my own language I used in projects but I'm wrestling left and right with creating a language plugin for KDevelop since the documentation is next to non-existent.

So far I managed to set up the plugin stub using the new plugin template from KDevelop. The plugin is correctly showing up in the "Language Support" category. The basic stub looks like this:

class kdev_lang_dscript : public KDevelop::IPlugin, public KDevelop::ILanguageSupport {
    Q_OBJECT
    Q_INTERFACES(KDevelop::ILanguageSupport)
public:
    kdev_lang_dscript(QObject* parent, const QVariantList& args);
    virtual ~kdev_lang_dscript();
    virtual QString name() const;
    virtual KDevelop::ParseJob *createParseJob(const KDevelop::IndexedString &url);
};

I've placed qDebug()<< calls in all methods to check what is called. I've adjusted the JSON file generated by the template to match up:

{
    "KPlugin": {
        "Category": "Language Support",
        "Id": "dragonscriptlanguagesupport",
        "License": "GPL",
        "Name": "DragonScript Language Support",
        "Name[x-test]": "xxDragonScript Language Supportxx",
        "Description": "DragonScript Language Plugin",
        "Description[x-test]": "xxDragonScript Language Pluginxx",
        "ServiceTypes": [
            "KDevelop/Plugin"
        ]
    },
    "X-KDevelop-Interfaces": [
        "ILanguageSupport"
    ],
    "X-KDevelop-Languages": [
        "DragonScript"
    ],
    "X-KDevelop-Category": "Global",
    "X-KDevelop-Mode": "NoGUI",
    "X-KDevelop-SupportedMimeTypes": [
        "text/x-dragonscript"
    ]
}

I'm installing the plugin into a separate directory running a test-session in another KDevelop instance using (-s plugintest) and QT_PLUGIN_PATH set to include the path. I see that the module is loaded. The constructor and destructor is called. When I load up a source file nothing happens. I do not see createParseJob() being ever called. Even if I add stubs for all other virtual methods in ILanguageSupport riddled with qDebug()<< I see none of these methods being called.

What else do I need to to to get my language plugin being used for source files with the right extension? There exists no mime-type for this language in the system obviously so can this be done by using file extensions?

- Regards

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


More information about the KDevelop-devel mailing list