aki77 / atom-expand-region

expanding selection
https://atom.io/packages/expand-region
MIT License
89 stars 9 forks source link

"expand-region:expand" unfolds entire document #17

Open a-laughlin opened 7 years ago

a-laughlin commented 7 years ago

Version : 0.2.5 Atom Version: 1.10.2

Keybinding resolver shows expand-region is the only command activating. Glanced quickly over the code. Don't see why it's happening.

Folding the second method and expanding anything in the first will unfold the second. Example code:

{
  addLoggingToReducers(allReducers){
    return _.transform(allReducers, (agg, rawReducer, combineReducersKey)=>{
      agg[combineReducersKey] = function(state, action){
        // console.group(combineReducersKey);
        // console.log(`%c prev state`, `color:lightgreen`, store.getState());
        // if (action.type.startsWith('@@redux')){
        //   return rawReducer.apply(this, arguments);
        // }
        // console.groupCollapsed(`%c ${combineReducersKey}.${action.type} reducer`, 'color:darkblue');
        console.log(`%c ${combineReducersKey}.${action.type} reducer`, 'color:darkblue');
        // console.log(`%c action`, 'color:darkblue', action);
        const returnValue = rawReducer.apply(this, arguments);
        // console.groupEnd(`%c ${combineReducersKey}.${action.type} reducer`, 'color:darkblue');
        // console.log(`%c next state`, `color:darkgreen`, store.getState());
        // console.groupEnd(combineReducersKey);
        return returnValue;
      };
    });
  },

  addLoggingToDispatch(storeShadow){
    const dispatchRaw = storeShadow.dispatch;
    storeShadow.dispatch = (action)=>{
      // console.groupCollapsed(action.type);
      // console.log(`%c prev state`, `color:lightgreen`, storeShadow.getState());
      console.log(`%c dispatching ${action.type}`, 'color:blue', action);
      // console.log(`%c action`, 'color:lightblue', action);
      const returnValue = dispatchRaw(action);
      // console.log(`%c next state`, `color:darkgreen`, storeShadow.getState());
      // console.groupEnd(action.type);
      return returnValue;
    };
    return storeShadow;
  },
}

Probably a separate issue, but placing the cursor on the word "returnValue" in the first method, and expanding twice, results in a selection that starts in the comment and goes to the end of the enclosing method. Only happens when the comment is there.

rafaelbdb commented 7 years ago

Same issue here. I recommend developer to change the name "expand-region" to "expand-selection" (or similar) if possible. That will probably solve it.

camjackson commented 7 years ago

I've had the same issue, it's very annoying!