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

VSCode extension does not respect folder settings! #484

Open
mctrafik opened this issue Nov 18, 2023 · 2 comments
Open

VSCode extension does not respect folder settings! #484

mctrafik opened this issue Nov 18, 2023 · 2 comments
Labels
status: needs investigation triage needs further investigation

Comments

@mctrafik
Copy link

What minimal example or steps are needed to reproduce the bug?

I have the following repositories in my VSCode workspace:

workspace/
- marketing-web/
--- .stylelintrc.js
- web-platform/
--- .vscode/
----- settings.json (specifies  `"stylelint.configFile": "js/config/.stylelintrc.js"` )
--- js/
---- config/
------ .stylelintrc.js

Both are loaded in vs-code in the same workspace because they share packages and I need to compile both and link them together when coding. As you can see the location of stylelintrc is in different folders.

I have no stylelint extension config in my user or in my workspace settings. But I do have settings in the web-platform
folder.

Screenshot 2023-11-18 at 11 38 35 AM

The issue is that stylelint extension crashes when I work in web-platform folder with:

no such file or directory, open `Users/../marketing-web/js/config/.stylelintrc.js`

Which is true.. that file doesn't exit, but the extension shouldn't be looking for it.

Screenshot 2023-11-18 at 11 39 11 AM

My guess is that your extension doesn't determine what the current workspace folder the user is in, and uses the first one, always (which is wrong).

What minimal configuration is needed to reproduce the bug?

N/A

How did you run Stylelint?

Through vs-code extension.

Which Stylelint-related dependencies are you using?

vscode extension 1.3.0

"stylelint": "^15.11.0",
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-styled-components": "^0.1.1",

What did you expect to happen?

I expect it to search in the correct workspace folder for the stylelint rc path.

What actually happened?

It searched for the config in the wrong workspace folder.

Do you have a proposal to fix the bug?

N/A

@mctrafik
Copy link
Author

Screenshot 2023-11-18 at 11 43 45 AM

I filed a similar bug with another extension and just in case it's not obvious, I have 3 folders in my workspace. I'm working in web-platform and the setting is for that folder, but it's being applied to marketing-web, which is a different folder and it doesn't have the override! So the root stylelintrc.js should be found.

@jeddy3 jeddy3 transferred this issue from stylelint/stylelint Nov 19, 2023
@pogz
Copy link

pogz commented Nov 24, 2023

I ran into a similar issue with a multi-root workspace. It looks like this extension may not have been updated to support the multi-root workspace APIs:

https://code.visualstudio.com/docs/editor/multi-root-workspaces

Here is the specific documentation on the changes required for language servers:

https://github.com/microsoft/vscode/wiki/Adopting-Multi-Root-Workspace-APIs#language-client--language-server

The fallback logic appears to be that it will treat the first folder/package in the workspace as the "root", which breaks relative paths used in other packages within the workspace. The package in my workspace using this extension is not the first, so the relative paths in the .vscode/settings.json file and my .stylelintrc.json attempt to resolve against the first package folder and throw an exception, breaking all style linting.

@ybiquitous ybiquitous added the status: needs investigation triage needs further investigation label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs investigation triage needs further investigation
Projects
None yet
Development

No branches or pull requests

3 participants