standard / vscode-standard

VS Code extension for JavaScript Standard Style (`standard`) with automatic fixing
https://marketplace.visualstudio.com/items?itemName=standard.vscode-standard
MIT License
122 stars 24 forks source link

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

Open kamaslau opened 2 years ago

kamaslau commented 2 years ago

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 npm@8.1.4, ts-standard@11.0.0 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 commented 2 years ago

VSC settings.json contents are:

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

brunoprietog commented 2 years ago

Hi, I have the same issue

theoludwig commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

Kiailandi commented 12 months ago

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 commented 11 months ago

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 commented 7 months ago

happens to me too

billiegoose commented 2 months ago

same here

git-push-origin commented 2 months ago

same here

SaberLS commented 1 month ago

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