Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wyhinton opened this issue Oct 23, 2021 · 1 comment

Comments

@wyhinton
Copy link

wyhinton commented Oct 23, 2021

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?

@kkudose
Copy link

kkudose commented Mar 16, 2022

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",
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants