Creating Language Plugin not used for new language

Friedrich W. H. Kossebau kossebau at kde.org
Wed Jul 11 16:12:44 BST 2018


Hi Roland,

Am Mittwoch, 11. Juli 2018, 16:54:44 CEST schrieb Roland Pluess:
> I'm trying to make a language plugin for my own language I used in projects

I applaud such efforts :)

> 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?

IIRC no, the related code relies on QMimeDatabase having the related MIME type 
definition (which at least on Linux/*BSD uses xdg's sharedmimeinfo).

But compare the things done for initial CUDA/OpenCL support by installing 
matching custom MIME type definitions at the end of
https://cgit.kde.org/kdevelop.git/tree/plugins/clang/CMakeLists.txt
--- 8< ---
install(FILES kdevclang.xml DESTINATION ${KDE_INSTALL_MIMEDIR})
update_xdg_mimetypes(${KDE_INSTALL_MIMEDIR})
--- 8< ---

with the MIME type definitions being
https://cgit.kde.org/kdevelop.git/tree/plugins/clang/kdevclang.xml

See 
https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html for more info about how to write your own MIME type 
definitions as usable with xdg's sharedmimeinfo.

For that custom type definition installation to work, you will need 
SharedMimeInfo macros included, so have this in the toplevel CMakeLists.txt:
--- 8< ---
find_package(SharedMimeInfo REQUIRED)
--- 8< ---

That should get you started hopefully. Such definition should also allow 
having proper things elsewhere, like matching icons in the file manager/dialog 
(once added) :)

Cheers
Friedrich




More information about the KDevelop-devel mailing list