kstenschke / shifter-plugin

Intelligent string/code manipulation plugin for Jetbrains IDEs: Detects shiftable type of word/line/selection and manipulates it on keyboard shortcut
http://plugins.jetbrains.com/plugin/6149
Apache License 2.0
105 stars 13 forks source link

Invalid shifting with JavaScript objects #48

Open patric-eberle opened 4 years ago

patric-eberle commented 4 years ago

Shifter: 1.9.6

When sorting a JavaScript object, the code gets messed up, unless only ES2015 shorthand definition or primitive key/value pairs are used.

Case 1:

const foo = {
  userRights,
  cWishLists: cWishLists.getAllWishLists,
  cVariantSelector,
};

This one works, as long as I only select the inner rows of the object.

Case 2:

const foo = {
  baa: {
    foo: 'baa',
  },
  userRights,
  cWishLists: cWishLists.getAllWishLists,
  cVariantSelector,
};

This one fails and produces the following result:

const foo = {
  foo: 'baa',
  baa: {
    cVariantSelector,
    cWishLists: cWishLists.getAllWishLists,
    userRights,
  },
};

Selecting the whole variable fails entirely (which I think may be OK...)

cVariantSelector,
  cWishLists;
:
cWishLists.getAllWishLists,
  userRights,
const foo = {};

Grüäss us Sanggallä 😃