[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:
David Farler
2017-02-17 11:54:06 -08:00
parent 7fa116039d
commit 677e03df85
13 changed files with 94 additions and 1 deletions

View File

@@ -29,6 +29,10 @@ namespace ide {
/// \returns true if the declaration has a documentation comment.
bool getDocumentationCommentAsXML(const Decl *D, raw_ostream &OS);
/// If the declaration has a documentation comment and a localization key,
/// print it into the given output stream and return true. Else, return false.
bool getLocalizationKey(const Decl *D, raw_ostream &OS);
/// Converts the given comment to Doxygen.
void getDocumentationCommentAsDoxygen(const DocComment *DC, raw_ostream &OS);

View File

@@ -28,6 +28,7 @@ class ParamField;
class ReturnsField;
class TagField;
class ThrowsField;
class LocalizationKeyField;
/// The basic structure of a doc comment attached to a Swift
/// declaration.

View File

@@ -61,7 +61,7 @@ MARKUP_AST_NODE(PrivateExtension, MarkupASTNode)
MARKUP_AST_NODE(ExperimentField, PrivateExtension)
MARKUP_AST_NODE(ImportantField, PrivateExtension)
MARKUP_AST_NODE(InvariantField, PrivateExtension)
MARKUP_AST_NODE(LocalizationKey, PrivateExtension)
MARKUP_AST_NODE(LocalizationKeyField, PrivateExtension)
MARKUP_AST_NODE(MutatingvariantField, PrivateExtension)
MARKUP_AST_NODE(NonmutatingvariantField, PrivateExtension)
MARKUP_AST_NODE(NoteField, PrivateExtension)