bmatcuk / stylelint-lsp

A stylelint Language Server
MIT License
48 stars 4 forks source link

Support for yarn pnp #42

Open GabeDuarteM opened 1 year ago

GabeDuarteM commented 1 year ago

I have a project using yarn pnp + workspaces (yarn monorepo), and because of the way yarn deals with packages in this mode, we end up having no node_modules folder. Is there already support for yarn PnP with stylelint-lsp?

I'm using the native lsp with neovim, when I open up a project that doesn't use PnP stylelint-lsp seems to work without a problem, but when opening up one that uses it, I get this error on the logs:

[ERROR][2023-04-05 18:46:26] .../vim/lsp/rpc.lua:733    "rpc"   "stylelint-lsp" "stderr"    'Error when trying to validate file:///[[filepath-censored]] Error: Could not find "stylelint-config-standard". Do you need a `configBasedir`?\n    at module.exports (/home/gabe/.local/share/nvim/mason/packages/stylelint-lsp/node_modules/stylelint-lsp/node_modules/stylelint/lib/utils/configurationError.js:10:14)\n    at getModulePath (/home/gabe/.local/share/nvim/mason/packages/stylelint-lsp/node_modules/stylelint-lsp/node_modules/stylelint/lib/utils/getModulePath.js:27:9)\n    at loadExtendedConfig (/home/gabe/.local/share/nvim/mason/packages/stylelint-lsp/node_modules/stylelint-lsp/node_modules/stylelint/lib/augmentConfig.js:190:21)\n    at /home/gabe/.local/share/nvim/mason/packages/stylelint-lsp/node_modules/stylelint-lsp/node_modules/stylelint/lib/augmentConfig.js:167:11 {\n  code: 78\n}\n'

So it seems that the LSP cannot find the installed packages (its probably looking inside node_modules). When I open VSCode with the vscode-styling extension everything seems to work fine. When looking for pnp on their repo, seems like they added support for it on https://github.com/stylelint/vscode-stylelint/issues/272. Do you think it would be possible to add support to it on stylelint-lsp (assuming it doesn't already have it)?