Repository navigation
fix: DevKit no longer warns about the capitalization of the nameKey and descriptionKey of a server or debugAdapterServer extension - #2209
Conversation
…nd descriptionKey of a server or debugAdapterServer extension The nameKey and descriptionKey of ServerExtensionPointBean and DebugAdapterServerExtensionPointBean were @nls(capitalization = Title) and @nls(capitalization = Sentence), so DevKit asked for the key itself, e.g. languageServer.presentableName, to have title capitalization. What DevKit reads: its "Plugin.xml capitalization" inspection (PluginXmlCapitalizationInspection) takes the capitalization of an extension attribute from the NlsInfo of the bean field it binds to. When the attribute's value has a reference to a property, it checks the text of that property; otherwise it checks the attribute's own text. DevKit gives that reference (I18nReferenceContributor) only to the key attributes of a fixed list of platform beans, such as ConfigurableEP.key, InspectionEP.key and InlayHintsProviderExtensionBean.nameKey, which are @nls(capitalization = ...) like ours were. For any other bean, LSP4IJ's included, it checks the key. NlsInfo reads @NonNls (and @propertykey, which needs a fixed bundle) as not localized, so the inspection skips the field; DevKit also stops spell-checking an attribute whose field is @NonNls. A key isn't a text shown to the user, so both fields are now @NonNls. Both annotations are kept in the class file, where DevKit reads them for a plugin that depends on LSP4IJ, so a test reads them from there. Fixes redhat-developer#450
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 23 minutes. View limit details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2209 +/- ##
==========================================
+ Coverage 54.59% 54.65% +0.05%
==========================================
Files 834 834
Lines 35385 35385
Branches 7300 5546 -1754
==========================================
+ Hits 19320 19340 +20
+ Misses 13223 13206 -17
+ Partials 2842 2839 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Combined, unchanged, with the other small fixes into #2219, one commit each, so that they take one review instead of six. |
Fixes #450
What
DevKit warned that the
nameKeyof aserverextension, such aslanguageServer.presentableName, "is not properly capitalized, should have title capitalization". The same goes for itsdescriptionKey, and for those of adebugAdapterServerextension. Those attributes carried@Nls(capitalization = …).DevKit's
PluginXmlCapitalizationInspectiontakes an attribute's capitalization from the@Nlsof the bean field it binds to. It checks a property's text only when the value references one, and DevKit gives that reference to the key attributes of a fixed list of platform beans (ConfigurableEP,InspectionEP, …). For any other bean, it checks the key itself. The platform's own key attributes carry the same@Nls, but only work because DevKit hard-codes those beans.Change
nameKeyanddescriptionKeyofServerExtensionPointBeanandDebugAdapterServerExtensionPointBeanare@NonNlsinstead of@Nls(capitalization = …). DevKit'sNlsInforeads@NonNlsas not localized, and the inspection skips such a field.Not in this PR:
nameanddescriptionnever had@Nls. Adding title capitalization there would warn about names such as "clangd".Tests
New
ExtensionPointBeanKeyAttributesTest(2 tests). It reads the four fields' annotations from the class files, with the platform's repackaged ASM, since DevKit reads the class-file annotations of a dependency, which reflection doesn't see.Behaviour change
nameKey="languageServer.presentableName"gets DevKit's capitalization warningnameKeyordescriptionKey, which DevKit no longer checks