components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/js/source-editor/completion-engine.js
/**
             * add attributes in the source in the reference to stream map
             * References will be used rather than stream names to refer to attributes (reference.attribute)
             * A reference can be an event in a pattern (event=pattern) or a stream reference in query
             * in (stream as reference)
             *
             * @private
             * @param {string[]} regexResults Array of groups from the regex execution of the query
             * @param {string} fullEditorText Complete editor text before the cursor
             * @param {string[]} sourceToStreamMap Array of streams of which attributes will be added
             * @param {int} attributePriority priority to be set as attribute priority
             * @param {int} sourcePriority priority to be set as source priority
             * @param {string[]} sourceTypes Source types to search for. Should be a subset of
             * [constants.STREAMS, constants.EVENT_TABLES, constants.WINDOWS, constants.EVAL_SCRIPTS,
             * constants.TRIGGERS]
             */
add attributes in the source in the reference to stream map
References will be used rather than stream names to refer to attributes (reference.attribute)
A reference can be an event in a pattern (event=pattern) or a stream reference in query
in (stream as reference)


add attributes in the source in the reference to stream map References will be used rather than stream names to refer to attributes ( reference . attribute ) A reference can be an event in a pattern ( event = pattern ) or a stream reference in query in ( stream as reference )
function addAttributesOfSourceReferencesAsCompletions(regexResults, fullEditorText,
                                                                  sourceToStreamMap, attributePriority,
                                                                  sourcePriority, sourceTypes) {
                var afterSourceAndDotSuggestionsRegex = new RegExp("(" + regex.identifier + ")\\s*" +
                    "(?:\\[\\s*[0-9]*\\s*\\])?\\s*\\.\\s*[a-zA-Z_0-9]*$", "i");
                var sourceBeforeDotMatch;
                if (sourceBeforeDotMatch = afterSourceAndDotSuggestionsRegex.exec(regexResults.input)) {
                    if (sourceToStreamMap[sourceBeforeDotMatch[1]]) {
                        addCompletions(getAttributesFromSourcesWithPrefixedDuplicates(
                            regexResults, fullEditorText,
                            {
                                name: sourceToStreamMap[sourceBeforeDotMatch[1]],
                                reference: sourceBeforeDotMatch[1]
                            },
                            sourceTypes
                        ).map(function (attribute) {
                            return Object.assign({}, attribute, {
                                priority: attributePriority
                            });
                        }));
                    }
                } else {
                    for (var reference in sourceToStreamMap) {
                        if (sourceToStreamMap.hasOwnProperty(reference)) {
                            addCompletions(getAttributesFromSourcesWithPrefixedDuplicates(
                                regexResults, fullEditorText,
                                {name: sourceToStreamMap[reference], reference: reference},
                                sourceTypes
                            ).map(function (attribute) {
                                return Object.assign({}, attribute, {
                                    value: reference + "." + attribute.value,
                                    priority: attributePriority
                                });
                            }));
                        }
                    }
                    addCompletions(Object.keys(sourceToStreamMap).map(function (reference) {
                        var source = getSource(
                            regexResults, fullEditorText, sourceToStreamMap[reference],
                            [constants.STREAMS, constants.EVENT_TABLES]
                        );
                        return {
                            value: reference + ".",
                            description: source.description,
                            type: source.type,
                            priority: sourcePriority
                        };
                    }));
                }
            }
function addAttributesOfSourceReferencesAsCompletions ( regexResults , fullEditorText , sourceToStreamMap , attributePriority , sourcePriority , sourceTypes ) { var afterSourceAndDotSuggestionsRegex = new RegExp ( "(" + regex . identifier + ")\\s*" + "(?:\\[\\s*[0-9]*\\s*\\])?\\s*\\.\\s*[a-zA-Z_0-9]*$" , "i" ) ; var sourceBeforeDotMatch ; if ( sourceBeforeDotMatch = afterSourceAndDotSuggestionsRegex . exec ( regexResults . input ) ) { if ( sourceToStreamMap [ sourceBeforeDotMatch [ 1 ] ] ) { addCompletions ( getAttributesFromSourcesWithPrefixedDuplicates ( regexResults , fullEditorText , { name : sourceToStreamMap [ sourceBeforeDotMatch [ 1 ] ] , reference : sourceBeforeDotMatch [ 1 ] } , sourceTypes ) . map ( function ( attribute ) { return Object . assign ( { } , attribute , { priority : attributePriority } ) ; } ) ) ; } } else { for ( var reference in sourceToStreamMap ) { if ( sourceToStreamMap . hasOwnProperty ( reference ) ) { addCompletions ( getAttributesFromSourcesWithPrefixedDuplicates ( regexResults , fullEditorText , { name : sourceToStreamMap [ reference ] , reference : reference } , sourceTypes ) . map ( function ( attribute ) { return Object . assign ( { } , attribute , { value : reference + "." + attribute . value , priority : attributePriority } ) ; } ) ) ; } } addCompletions ( Object . keys ( sourceToStreamMap ) . map ( function ( reference ) { var source = getSource ( regexResults , fullEditorText , sourceToStreamMap [ reference ] , [ constants . STREAMS , constants . EVENT_TABLES ] ) ; return { value : reference + "." , description : source . description , type : source . type , priority : sourcePriority } ; } ) ) ; } }
add attributes in the source in the reference to stream map
 References will be used rather than stream names to refer to attributes (reference.attribute)
 A reference can be an event in a pattern (event=pattern) or a stream reference in query
 in (stream as reference)
add attributes in the source in the reference to stream map References will be used rather than stream names to refer to attributes ( reference . attribute ) A reference can be an event in a pattern ( event = pattern ) or a stream reference in query in ( stream as reference )
// Add suggestions after the source name + dot // Add the attributes names (duplicate attributes are prefixed with the stream + dot) // Add the stream names + dot