use of org.ballerinalang.model.tree.TopLevelNode in project ballerina by ballerina-lang.
the class CommandUtil method getEnumDocumentationByPosition.
/**
* Get the Documentation attachment for the enum.
* @param bLangPackage BLangPackage built
* @param line Start line of the enum in the source
* @return {@link String} Documentation attachment for the enum
*/
static DocAttachmentInfo getEnumDocumentationByPosition(BLangPackage bLangPackage, int line) {
for (TopLevelNode topLevelNode : bLangPackage.topLevelNodes) {
if (topLevelNode instanceof BLangEnum) {
BLangEnum enumNode = (BLangEnum) topLevelNode;
DiagnosticPos enumPos = CommonUtil.toZeroBasedPosition(enumNode.getPosition());
int enumStart = enumPos.getStartLine();
if (enumStart == line) {
return getEnumNodeDocumentation(enumNode, line);
}
}
}
return null;
}
Aggregations