Skip to content
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

VSC hint popped up saying: extension 'Standard- Javascript standard style' is configured as formatter but it cannot format javascript files. #331

Open
kamaslau opened this issue Nov 24, 2021 · 13 comments

Comments

@kamaslau
Copy link

What version of this package are you using? v2.0.1

What operating system, Node.js, and npm version? macos Monterey 12.0.1 with Node v17.1.0 and [email protected], [email protected] is installed globaly.

What happened? Popup showed when trigger formatter via hotkey combo option+shift+f

What did you expect to happen? No popup should be showed and code should be formatted by standard.

Are you willing to submit a pull request to fix this bug? If I could, I would ^_^.

@kamaslau
Copy link
Author

VSC settings.json contents are:

{
"standard.autoFixOnSave": true,
"standard.enableGlobally": true,
"standard.engine": "ts-standard",
"standard.run": "onSave",
"standard.treatErrorsAsWarnings": true,
}

@brunoprietog
Copy link

Hi, I have the same issue

@theoludwig
Copy link
Contributor

Hey!

Thanks for your report but I can't reproduce the issue, the formatter works fine for me with the same .vscode/settings.json.
image

Also it is strongly encouraged to install ts-standard locally in your project inside your devDependencies , basically follow the "How to use" section from the README and everything should be fine.

https://github.com/standard/vscode-standard#how-to-use

@loh-aivy
Copy link

loh-aivy commented Jan 6, 2022

same here

{
  "standard.enable": true,
  "standard.engine": "standard",
  "standard.autoFixOnSave": true,
  "standard.run": "onSave",
  "standard.validate": [
    "javascript"
  ],
  "editor.defaultFormatter": "standard.vscode-standard",
  "editor.formatOnSave": true
}

extension 'StandardJS - Javascript standard style' is configured as formatter but it cannot format 'JavaScript' files

@mikemitchel
Copy link

mikemitchel commented Mar 10, 2022

also receiving this error in VS Code. Have tried remove all other formatters and resetting VS Code settings to defaults. Have tried uninstall and re-install in the latest plugin, as well as updating to latest standard in dev dependencies

"standard": "^16.0.4",

options in package.json

  "standard": {
    "globals": [
      "$",
      "jQuery",
      "can",
      "mocha"
    ],
    "ignore": [
      "src/calculator/",
      "models/fixtures/**",
      "mobile/util/**",
      "build.production.html.js",
      "styles/documentjs-theme/**",
      "models/tests/fixtures/**"
    ],
    "env": [
      "mocha"
    ]
  },

If I run standard --fix from the command line it will fix the file in question, but as soon as I save that file it fails again (standard is set as the default formatter in VS Code and set to format on save)

@mpcsh
Copy link

mpcsh commented Mar 18, 2022

I'm hitting this same issue as well. it's a bit frustrating to that this extension deviates from the vscode convention in this way

@falco467
Copy link

I have the same problem. "Fix all auto-fixable-problems" works but using standardjs as formatter throws this error on the same file.

@Kiailandi
Copy link

I know that going with "same here" does not really help, but this issue is 2 years old and I don't see any further feedback from members besides the initial "can't reproduce".

I'd like to understand if this is an issue afflicting only a few of us and won't be addressed or if it is something widespread.

Given that the main function of the formatter itself is hindered by this issue it does not make much sense to use the extension at all if the issue persists.

@briandonahue
Copy link

I've got to add a "me too" here. VS Code auto-completes this setting that looks like it would work

    "[javascript]": {
        "editor.defaultFormatter": "standard.vscode-standard"
    },

but running it in a CJS file (.eslintrc.cjs) throws this error

image

@zisis912
Copy link

happens to me too

@billiegoose
Copy link

same here

1 similar comment
@git-push-origin
Copy link

same here

@SaberLS
Copy link

SaberLS commented Aug 4, 2024

following settings fixed the issue for me

  "standard.enable": true,
  "standard.enableGlobally": true,
  "standard.run": "onType", // in my case "onType" fixes on save, "onSave" seems to fix only on auto save, doesn't do anything on ctrl+s
  "standard.autoFixOnSave": true, // needs to be true with false both "onType" and "onSave" doesn't work
  "standard.treatErrorsAsWarnings": true,
  "standard.engine": "standard",
  "standard.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],
  "[javascript]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "standard.vscode-standard"
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests