bmatcuk / coc-stylelintplus

stylelint extension for coc.nvim supporting additional features
MIT License
48 stars 7 forks source link

Autofix on safe and format does not work #4

Open nexusstar opened 4 years ago

nexusstar commented 4 years ago

I have set in my cocConfig file

    "stylelintplus.autoFixOnSave": true,
    "stylelintplus.autoFixOnFormat": true,

But neither of them autofixes anything. Can I debug this somehow?

bmatcuk commented 4 years ago

Hi @nexusstar, sorry for the slow reply. I just tested locally and both options seem to be working for me. If you run :CocInfo, do you see that stylelintplus has started? Are there any errors?

caifara commented 3 years ago

I have the same problem, but do encounter an error while trying to save:


2021-01-14T09:48:54.258 ERROR (pid:60698) [language-client-client] - _h [Error]: Request textDocument/willSaveWaitUntil failed with message: No configuration provided for /Users/xxxx/Documents/projecten/brightbook/app/javascript/styles/tailwind.pcss
    at Ey (/Users/xxxx/.vim/plugged/coc.nvim/build/index.js:22:224)
    at In (/Users/xxxx/.vim/plugged/coc.nvim/build/index.js:21:12525)
    at Immediate.<anonymous> (/Users/xxxx/.vim/plugged/coc.nvim/build/index.js:21:12376)
    at processImmediate (internal/timers.js:456:21) {
  code: -32603,
  data: undefined
}
bmatcuk commented 3 years ago

Hi @caifara - that error is coming from stylelint itself. Sounds like you either haven't created a configuration file, or stylelint can't find it. See this issue: https://github.com/stylelint/stylelint/issues/3625

timtyrrell commented 3 years ago

Seems like I have the same issue. If I run CocCommand stylelintplus.applyAutoFixes it works but not if I save or format.

Oh, I just found out why. Looks I had to remove scss from this array: "coc.preferences.formatOnSaveFiletypes". Might be a good README item 🤔

bmatcuk commented 3 years ago

Oh, interesting... do you have coc-css installed? If so, do you have "scss.validate": false in your coc-settings.json?

timtyrrell commented 3 years ago

Assuming you mean me, I do. I also have the following which are related to styles or formatting, in case it helps:

  "css.validate": false,
  "less.validate": false,
  "scss.validate": false,
  "wxss.validate": false,
  "stylelintplus.filetypes": [
    "scss"
  ],
  "stylelintplus.autoFixOnSave": true,
  "cssmodules.camelCase": true,
  "cssmodules.hintName": "cssmodule",
  "eslint.autoFixOnSave": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],
  "eslint.probe": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],
  "coc.preferences.formatOnSaveFiletypes": [
    "json",
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vimwiki",
    "markdown",
    "sass"
  ],
  "prettier.requireConfig": true,
  "prettier.onlyUseLocalVersion": true,