Allow language plugin metadata JSON to declare support for >1 language
ClosedPublic

Authored by kossebau on Feb 3 2017, 1:06 AM.

Details

Summary

A plugin implementing ILanguageSupport can specify the language supported
by the plugin JSON metadata key "X-KDevelop-Language", which is specified
to only take one string item.
The only known effective user of this metadata is the filetemplates plugin,
which takes the "Language" property of a to-be-applied template file to ask
the language controller for a matching language plugin, to get a proper
class helper object for the code generation.

KDevCLang currently has its "X-KDevelop-Language" metadata set to "C",
while it can support C, C++ & Objective-C. As a result the language
controller currently will not deliver KDevCLang to the filetemplate plugin
when asked for "C++", which then flaws the generation of C++ classes.

This patch introduces a new key "X-KDevelop-Languages" (for semantic correctness)
to fix this, and emits a temporary warning to help anyone to port their
language plugins as needed.

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau updated this revision to Diff 10888.Feb 3 2017, 1:06 AM
kossebau retitled this revision from to Allow language plugin metadata JSON to declare support for >1 language.
kossebau updated this object.
kossebau added a reviewer: KDevelop.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptFeb 3 2017, 1:06 AM
mwolff accepted this revision.Feb 3 2017, 7:41 AM
mwolff added a reviewer: mwolff.
mwolff added a subscriber: mwolff.

lgtm in principle

shell/languagecontroller.cpp
227

this needs to be emitted for every plugin that has this, no?

This revision is now accepted and ready to land.Feb 3 2017, 7:41 AM
kossebau added inline comments.Feb 3 2017, 1:28 PM
shell/languagecontroller.cpp
227

Effectively there is only one plugin per language currently (both in known world, but also as the current code has no other means to control which one of multiples would be returned as "the" languagesupport plugin.
But does not hurt to just loop over the complete list returned, okay.

kossebau updated this revision to Diff 10897.Feb 3 2017, 1:28 PM
kossebau edited edge metadata.

do deprecated-key warning for all plugins returned

This revision was automatically updated to reflect the committed changes.
kossebau marked an inline comment as done.