bcomnes / sublime-standard-format

:sparkles: Runs standard --fix against the javascript in your ST3 window on save or manually.
https://packagecontrol.io/packages/StandardFormat
MIT License
60 stars 21 forks source link

"Error Formatting Selection(s)" #42

Closed mattdesl closed 4 years ago

mattdesl commented 8 years ago

Lately I've been getting this error in console when using semistandard-format

standard-format: error formatting selection(s)

Settings:

{
    "PATH":
    [
        "/Users/matt/npm/bin"
    ],
    "format_on_save": false,
    "loud_error": false,
  "command": ["semistandard-format", "--stdin"]
}

Works fine with standard-format. Not sure if I should open an issue in semistandard-format. Strangely it used to work fine, so I'm not sure how things have changed.

bcomnes commented 8 years ago

Usually that occures when there is a syntax error but maybe something changed. @Flet any ideas?

JamieMason commented 8 years ago

I've been getting similar the last few days, I'm on standard-format@2.1.1 and get the error even when the only contents of the file are basic and valid eg.

var foo = 1;

Please let me know if I can give more information to help debug. Sublime's console just writes "standard-format: error formatting selection(s)"

JamieMason commented 8 years ago

Downgrading to npm i -g standard-format@2.0.0 fixed it for me.

/cc @bcomnes @mattdesl

denizdogan commented 8 years ago

I'm getting this even with standard-format@2.0.0.

xmakina commented 7 years ago

If you're having this problem, you can get a more informative error message by opening the console in Sublime (View --> Show Console) and setting "log_errors": true in the personal Standard.sublime_settings

In case it helps someone else, on Windows 10, I was getting an error about node not being a recognised executable and needed to add the node path (C:\Program Files\nodejs) to my users path variable, just being on the global path was not enough

dusty commented 7 years ago

Here is what I'm getting with this problem.

StandardFormat: error formatting selection(s)
b"standard: Use JavaScript Standard Style (http://standardjs.com)\nstandard:   <text>:2:3: 'angular' is not defined.\nstandard:   <text>:18:14: '_' is not defined.\nstandard:   <text>:18:24: '_' is not defined.\nstandard:   <text>:23:11: '_' is not defined.\nstandard:   <text>:51:11: '_' is not defined.\nstandard:   <text>:63:7: '_' is not defined.\nstandard:   <text>:64:9: '_' is not defined.\nstandard:   <text>:71:11: '_' is not defined.\nstandard:   <text>:81:14: '_' is not defined.\nstandard:   <text>:90:9: '_' is not defined.\nstandard:   <text>:96:14: '_' is not defined.\nstandard:   <text>:115:14: '_' is not defined.\n"
error: StandardFormat: error formatting selection(s)
Using node.js path on 'osx': /usr/local/bin/node

I have those in my package.json file under standard/globals.

I switched my user config file to

{
  "log_errors" : true,
  "commands": [
    ["standard-format", "--stdin"]
  ]
}

Disabling the standard --fix

And its working again.

jeffbyrnes commented 7 years ago

I think this is related to #38; I’m seeing the same issue using standard --fix --stdin.

jeffbyrnes commented 7 years ago

FYI, for those using semistandard, this works:

  "commands": [
    ["semistandard-format", "--stdin"]
  ],
bcomnes commented 4 years ago

Stale. Please reopen a new issue with specifics on reproduction if you are still having issue.