components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/js/source-editor/completion-engine.js
/**
             * Handle the aggregation definition group by suggestions
             *
             * @private
             * @param {string[]} regexResults Array of groups from the regex execution of the aggregation definition
             * @param {string} fullEditorText Complete editor text before the cursor
             */
Handle the aggregation definition group by suggestions
@private
@param {string[]} regexResults Array of groups from the regex execution of the aggregation definition
@param {string} fullEditorText Complete editor text before the cursor
Handle the aggregation definition group by suggestions @private @param { string [] } regexResults Array of groups from the regex execution of the aggregation definition @param { string } fullEditorText Complete editor text before the cursor
function handleAggregationDefinitionGroupBySuggestions(regexResults, fullEditorText) {
                var groupByClause = regexResults[8];
                var afterGroupByClauseRegex = new RegExp(regex.identifier + "\\s*" +
                    "(?:" + regex.comma + regex.identifier + "\\s*)*" + "\\s+[a-zA-Z_0-9]*$", "i");
                var generalSuggestionsRegex = new RegExp("(?:" + regex.identifier + "\\s*" +
                    regex.comma + ")*", "i");
                if (afterGroupByClauseRegex.test(groupByClause)) {
                    addCompletions(["aggregate"]
                        .map(function (completion) {
                                return {value: completion + " ", priority: 2};
                            }
                        ));
                } else if (generalSuggestionsRegex.test(groupByClause)) {
                    addAttributesOfSourcesAsCompletionsFromAggregationInput(
                        regexResults, fullEditorText, 3, 2,
                        [constants.STREAMS]
                    );
                    addAttributesOfStreamReferencesAsCompletionsFromAggregationDefinition(
                        regexResults, fullEditorText, 3, 2
                    );
                }
            }
function handleAggregationDefinitionGroupBySuggestions ( regexResults , fullEditorText ) { var groupByClause = regexResults [ 8 ] ; var afterGroupByClauseRegex = new RegExp ( regex . identifier + "\\s*" + "(?:" + regex . comma + regex . identifier + "\\s*)*" + "\\s+[a-zA-Z_0-9]*$" , "i" ) ; var generalSuggestionsRegex = new RegExp ( "(?:" + regex . identifier + "\\s*" + regex . comma + ")*" , "i" ) ; if ( afterGroupByClauseRegex . test ( groupByClause ) ) { addCompletions ( [ "aggregate" ] . map ( function ( completion ) { return { value : completion + " " , priority : 2 } ; } ) ) ; } else if ( generalSuggestionsRegex . test ( groupByClause ) ) { addAttributesOfSourcesAsCompletionsFromAggregationInput ( regexResults , fullEditorText , 3 , 2 , [ constants . STREAMS ] ) ; addAttributesOfStreamReferencesAsCompletionsFromAggregationDefinition ( regexResults , fullEditorText , 3 , 2 ) ; } }
Handle the aggregation definition group by suggestions
 @private
 @param {string[]} regexResults Array of groups from the regex execution of the aggregation definition
 @param {string} fullEditorText Complete editor text before the cursor
Handle the aggregation definition group by suggestions @private @param { string [] } regexResults Array of groups from the regex execution of the aggregation definition @param { string } fullEditorText Complete editor text before the cursor
// Regexps used for identifying the suggestions // Testing to find the relevant suggestion // Add keyword suggestions after the group by attribute list without a comma at the end // Add attributes of the sources for the group by clause