bmatcuk/coc-stylelintplus

Do I need to install stylelint-lsp independently? Plugin not working

Closed this issue · 4 comments

It's a little unclear to me if I need to install styelint-lsp independently of doc-stylelintplus? In the Readme.md it says:

coc-stylelintplus uses stylelint-lsp as the language server.

I'm trying to figure out why my plugin isn't working; it appears to not be running at all. There is no highlighting of errors, warnings, etc and certainly no auto fixing. The plugins for eslint, prettier, and tsserver all seem to be working.

I have my coc config set to:

{
  "eslint.autoFixOnSave": true,
  "eslint.run": "onSave",
  "stylelintplus.autoFixOnFormat": true,
  "stylelintplus.autoFixOnSave": true,
  "stylelintplus.validateOnSave": true,
  "stylelintplus.cssInJs": true,
  "tsserver.formatOnType": true,
  "coc.preferences.formatOnType": true,
  "coc.preferences.jumpCommand": "vsplit",
  "prettier.disableSuccessMessage": true
}

I'm using VIM 8.2

Opening a [file].scss in a directory that has stylelint installed as a devDependency and a .stylelintrc at the root of the git repository, I see no feedback. If I run ./node_modules/.bin/stylelint [PATH] I get expected stylelint output.

When I run :CocList extensions I get:

  * coc-stylelintplus 1.4.1 ~/.config/coc/extensions/node_modules/coc-stylelintplus
  * coc-prettier 1.1.24 ~/.config/coc/extensions/node_modules/coc-prettier
  * coc-eslint 1.4.5 ~/.config/coc/extensions/node_modules/coc-eslint
  + coc-tsserver 1.8.1 ~/.config/coc/extensions/node_modules/coc-tsserver
  + coc-markdownlint 1.11.1 ~/.config/coc/extensions/node_modules/coc-markdownlint
  + coc-json 1.3.6 ~/.config/coc/extensions/node_modules/coc-json

Which to me seems like coc-stylelintplus seems to be running? What are my next steps to debug?

Interesting... you do not need to install stylelint-lsp - it's included. If you run a ps ax | grep stylelint while vim is open and editing a css file, do you see stylelint-lsp running? Another thing you can try inside vim is: :CocCommand workspace.showOutput and then select stylelintplus from the menu that appears - anything helpful in there?

If you run a ps ax | grep stylelint while vim is open and editing a css file, do you see stylelint-lsp running?

yes I see it running from ~/.config/coc/extensions/node_modules/coc-stylelintplus/node_modules/stylelint-lsp/dist/index.js

Another thing you can try inside vim is: :CocCommand workspace.showOutput and then select stylelintplus from the menu that appears

I do not get a menu that appears, instead I get a new vertical split with the title output:///prettier and no content...

Aha! I figured it out! In my ~/.vimrc I set both .scss and .sass files as filetype=sass

au bufread,bufnewfile *.sass,*.scss set filetype=sass

Once I set stylelintplus.filetypes=["css", "sass"] it worked! Perhaps you could add "sass" to the default filetypes?

Glad you figured it out!