mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Vend the localization key found in documentation comments
If a documentation comment has a - LocalizationKey: field, strip it out of the documentation body and report it in cursor/doc info with the key "key.localization_key". rdar://problem/30383329
This commit is contained in:
@@ -443,6 +443,20 @@ bool ide::getDocumentationCommentAsXML(const Decl *D, raw_ostream &OS) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ide::getLocalizationKey(const Decl *D, raw_ostream &OS) {
|
||||
swift::markup::MarkupContext MC;
|
||||
auto DC = getCascadingDocComment(MC, D);
|
||||
if (!DC.hasValue())
|
||||
return false;
|
||||
|
||||
if (const auto LKF = DC.getValue()->getLocalizationKeyField()) {
|
||||
printInlinesUnder(LKF.getValue(), OS);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Conversion to Doxygen.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user