sort-js-object-keys icon indicating copy to clipboard operation
sort-js-object-keys copied to clipboard

Can't seem to get to work, error Please make sure your selected text is a JS object!

Open wyhinton opened this issue 4 years ago • 1 comments

I can't seem to get this plugin to work. At first, I thought it was because my js object was a rather complex one (lots of functions, comments, etc.). So I tried a very simple object and still no luck. Then I though it might be because I'm using it in a .ts file, not a .js file. But the simple example doesn't work in that either.

Running >Sort JS Object Keys with the following selected:

const test = {
  two: "no",
  one: "yes",
};

Results in:

Please make sure your selected text is a JS object!

Is anyone able to get this to plugin to work? Or get it to work with typescript?

wyhinton avatar Oct 23 '21 06:10 wyhinton

This is probably not useful to OP since it's old, but hopefully other people who come across this issue will find this useful.

You have to select only the object. Do NOT select the name of the object or let or const. For the example above:

{
  two: "no",
  one: "yes",
};

kkudose avatar Mar 16 '22 04:03 kkudose