| 321 | } |
| 322 | |
| 323 | void adjustPluginPageAdapter(const KPluginMetaData& pluginInfo, KTextEditorConfigPageAdapter& adapter) |
| 324 | { |
| 325 | if (pluginInfo.pluginId() == LspPlugin::pluginId) { |
| 326 | const auto allowAll = LspPlugin::allowAllLanguages(); |
| 327 | const auto noteText = i18nc( |
| 328 | "%1 - the plugin name; %2 - the list of disabled languages; %3 - the environment variable name; " |
| 329 | "%5 - whether the environment variable is currently set", |
| 330 | "The following languages are supported much better by dedicated KDevelop plugins, " |
| 331 | "and so are disabled in the %1 plugin to prevent conflicts: <var>%2</var>. " |
| 332 | "In order to compare the levels of support or work around severe bugs, " |
| 333 | "disable the dedicated KDevelop plugin(s) and set the environment variable " |
| 334 | "<var>%3</var> (<span style='color:%4'>%5</span>).", |
| 335 | // wrap in <var> to italicise the programming language names, but not the commas that separate them |
| 336 | pluginInfo.name(), LspPlugin::disabledLanguages().join(QLatin1String{"</var>, <var>"}), |
| 337 | LspPlugin::allowAllEnvironmentVariableName, allowAll ? QLatin1String{"red"} : QLatin1String{"green"}, |
| 338 | allowAll ? i18nc("a certain environment variable is ...", "currently set") |
| 339 | : i18nc("a certain environment variable is ...", "currently unset")); |
| 340 | |
| 341 | auto* const noteLabel = new QLabel(noteText, &adapter); |
| 342 | // the Configure KDevelop dialog becomes much wider if the word wrap is not enabled |
| 343 | noteLabel->setWordWrap(true); |
| 344 | // separate the note visually from the base LSP Client page |
| 345 | noteLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); |
| 346 | |
| 347 | adapter.layout()->addWidget(noteLabel); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | } // unnamed namespace |
| 352 |
no test coverage detected