src/extensions/default/JavaScriptRefactoring/RenameIdentifier.js
function handleFindRefs (refsResp) {
            if (!refsResp || !refsResp.references || !refsResp.references.refs) {
                return;
            }

            var inlineWidget = EditorManager.getFocusedInlineWidget(),
                editor = EditorManager.getActiveEditor(),
                refs = refsResp.references.refs,
                type = refsResp.references.type;

            //In case of inline widget if some references are outside widget's text range then don't allow for rename
            if (inlineWidget) {
                var isInTextRange  = !refs.find(function(item) {
                    return (item.start.line < inlineWidget._startLine || item.end.line > inlineWidget._endLine);
                });
                
                if (!isInTextRange) {
                    editor.displayErrorMessageAtCursor(Strings.ERROR_RENAME_QUICKEDIT);
                    return;
                }
            }

            var currentPosition = editor.posFromIndex(refsResp.offset),
                refsArray = refs;
            if (type !== "local") {
                refsArray = refs.filter(function (element) {
                    return isInSameFile(element, refsResp);
                });
            }

            // Finding the Primary Reference in Array
            var primaryRef = refsArray.find(function (element) {
                return ((element.start.line === currentPosition.line || element.end.line === currentPosition.line)
                        && currentPosition.ch <= element.end.ch && currentPosition.ch >= element.start.ch);
            });
            // Setting the primary flag of Primary Refence to true
            primaryRef.primary = true;

            editor.setSelections(refsArray);
        }
function handleFindRefs (refsResp) {
            if (!refsResp || !refsResp.references || !refsResp.references.refs) {
                return;
            }

            var inlineWidget = EditorManager.getFocusedInlineWidget(),
                editor = EditorManager.getActiveEditor(),
                refs = refsResp.references.refs,
                type = refsResp.references.type;

            //In case of inline widget if some references are outside widget's text range then don't allow for rename
            if (inlineWidget) {
                var isInTextRange  = !refs.find(function(item) {
                    return (item.start.line < inlineWidget._startLine || item.end.line > inlineWidget._endLine);
                });
                
                if (!isInTextRange) {
                    editor.displayErrorMessageAtCursor(Strings.ERROR_RENAME_QUICKEDIT);
                    return;
                }
            }

            var currentPosition = editor.posFromIndex(refsResp.offset),
                refsArray = refs;
            if (type !== "local") {
                refsArray = refs.filter(function (element) {
                    return isInSameFile(element, refsResp);
                });
            }

            // Finding the Primary Reference in Array
            var primaryRef = refsArray.find(function (element) {
                return ((element.start.line === currentPosition.line || element.end.line === currentPosition.line)
                        && currentPosition.ch <= element.end.ch && currentPosition.ch >= element.start.ch);
            });
            // Setting the primary flag of Primary Refence to true
            primaryRef.primary = true;

            editor.setSelections(refsArray);
        }
function handleFindRefs ( refsResp ) { if ( ! refsResp || ! refsResp . references || ! refsResp . references . refs ) { return ; } var inlineWidget = EditorManager . getFocusedInlineWidget ( ) , editor = EditorManager . getActiveEditor ( ) , refs = refsResp . references . refs , type = refsResp . references . type ; //In case of inline widget if some references are outside widget's text range then don't allow for rename if ( inlineWidget ) { var isInTextRange = ! refs . find ( function ( item ) { return ( item . start . line < inlineWidget . _startLine || item . end . line > inlineWidget . _endLine ) ; } ) ; if ( ! isInTextRange ) { editor . displayErrorMessageAtCursor ( Strings . ERROR_RENAME_QUICKEDIT ) ; return ; } } var currentPosition = editor . posFromIndex ( refsResp . offset ) , refsArray = refs ; if ( type !== "local" ) { refsArray = refs . filter ( function ( element ) { return isInSameFile ( element , refsResp ) ; } ) ; } // Finding the Primary Reference in Array var primaryRef = refsArray . find ( function ( element ) { return ( ( element . start . line === currentPosition . line || element . end . line === currentPosition . line ) && currentPosition . ch <= element . end . ch && currentPosition . ch >= element . start . ch ) ; } ) ; // Setting the primary flag of Primary Refence to true primaryRef . primary = true ; editor . setSelections ( refsArray ) ; }
Check if references are in this file only
If yes then select all references
Check if references are in this file only If yes then select all references