components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/js/source-editor/completion-engine.js
/**
             * Handle the aggregation definition selection 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 selection 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 selection 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 handleAggregationDefinitionSelectionSuggestions(regexResults, fullEditorText) {
                var aggregationSelectionClause = regexResults[6];
                var extensionFunctionSuggestionsRegex = new RegExp(regex.aggregation.selection.outputAttributesList +
                    regex.comma + regex.namespace + "[a-zA-Z_0-9]*$", "i");
                var afterAggregationSelectionClauseSuggestionsRegex = new RegExp(
                    regex.aggregation.selection.outputAttributesList + "\\s+[a-zA-Z_0-9]*$", "i");
                var attributeAndInBuiltFunctionSuggestionsRegex = new RegExp(
                    "(?:" + regex.aggregation.selection.outputAttribute + regex.comma + ")*" +
                    "[a-zA-Z_0-9]*(?:\\s*\\((?:(?:.(?!\\)))*.)?\\s*)?$", "i");
                if (extensionFunctionSuggestionsRegex.test(aggregationSelectionClause)) {
                    var namespace = extensionFunctionSuggestionsRegex.exec(aggregationSelectionClause)[1];
                    addSnippets(getExtensionFunctionNames(namespace));
                } else if (afterAggregationSelectionClauseSuggestionsRegex.test(aggregationSelectionClause)) {
                    addCompletions(["as", "group by", "aggregate"]
                        .map(function (completion) {
                                return {value: completion + " "};
                            }
                        ));
                } else if (attributeAndInBuiltFunctionSuggestionsRegex.test(aggregationSelectionClause)) {
                    addAttributesOfSourcesAsCompletionsFromAggregationInput(
                        regexResults, fullEditorText, 3, 2,
                        [constants.STREAMS]
                    );
                    addAttributesOfStreamReferencesAsCompletionsFromAggregationDefinition(
                        regexResults, fullEditorText, 3, 2
                    );
                    addCompletions(Object.keys(self.evalScriptsList).map(function (evalScript) {
                        return {
                            value: evalScript,
                            description: self.evalScriptsList[evalScript].description,
                            priority: 2
                        }
                    }));
                    addSnippets(getInBuiltFunctionNames().map(function (completion) {
                        return Object.assign({}, completion, {
                            priority: 2
                        });
                    }));
                    addCompletions(getExtensionNamesSpaces([constants.FUNCTIONS]).map(function (functionName) {
                        return {
                            value: functionName,
                            priority: 2
                        }
                    }));
                }
            }
function handleAggregationDefinitionSelectionSuggestions ( regexResults , fullEditorText ) { var aggregationSelectionClause = regexResults [ 6 ] ; var extensionFunctionSuggestionsRegex = new RegExp ( regex . aggregation . selection . outputAttributesList + regex . comma + regex . namespace + "[a-zA-Z_0-9]*$" , "i" ) ; var afterAggregationSelectionClauseSuggestionsRegex = new RegExp ( regex . aggregation . selection . outputAttributesList + "\\s+[a-zA-Z_0-9]*$" , "i" ) ; var attributeAndInBuiltFunctionSuggestionsRegex = new RegExp ( "(?:" + regex . aggregation . selection . outputAttribute + regex . comma + ")*" + "[a-zA-Z_0-9]*(?:\\s*\\((?:(?:.(?!\\)))*.)?\\s*)?$" , "i" ) ; if ( extensionFunctionSuggestionsRegex . test ( aggregationSelectionClause ) ) { var namespace = extensionFunctionSuggestionsRegex . exec ( aggregationSelectionClause ) [ 1 ] ; addSnippets ( getExtensionFunctionNames ( namespace ) ) ; } else if ( afterAggregationSelectionClauseSuggestionsRegex . test ( aggregationSelectionClause ) ) { addCompletions ( [ "as" , "group by" , "aggregate" ] . map ( function ( completion ) { return { value : completion + " " } ; } ) ) ; } else if ( attributeAndInBuiltFunctionSuggestionsRegex . test ( aggregationSelectionClause ) ) { addAttributesOfSourcesAsCompletionsFromAggregationInput ( regexResults , fullEditorText , 3 , 2 , [ constants . STREAMS ] ) ; addAttributesOfStreamReferencesAsCompletionsFromAggregationDefinition ( regexResults , fullEditorText , 3 , 2 ) ; addCompletions ( Object . keys ( self . evalScriptsList ) . map ( function ( evalScript ) { return { value : evalScript , description : self . evalScriptsList [ evalScript ] . description , priority : 2 } } ) ) ; addSnippets ( getInBuiltFunctionNames ( ) . map ( function ( completion ) { return Object . assign ( { } , completion , { priority : 2 } ) ; } ) ) ; addCompletions ( getExtensionNamesSpaces ( [ constants . FUNCTIONS ] ) . map ( function ( functionName ) { return { value : functionName , priority : 2 } } ) ) ; } }
Handle the aggregation definition selection 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 selection 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 function extension suggestions after namespace + colon // Add keyword suggestions after a list attributes without a comma at the end // Add attributes list suggestions : attributes, eval scripts, inbuilt and extension functions /*
                    addSnippets(getExtensionNamesSpaces([constants.FUNCTIONS]).map(function (suggestion) {
                        return Object.assign({}, suggestion, {
                            value: suggestion.value + ":",
                            priority: 2
                        });
                    }));
                    */