windicss / windicss-intellisense

Intelligent WindiCSS tooling for VS Code
https://marketplace.visualstudio.com/items?itemName=voorjaar.windicss-intellisense
MIT License
194 stars 16 forks source link

Multi Folder Workspace Config Issue #236

Open aphex opened 3 years ago

aphex commented 3 years ago

Most of the time my VSCode workspaces contain 2-6 folders and luckily only 1 has been a front-end project. So to deal with Windi I have just made the first folder in my workspace the one using Windi, and all is well. As it looks to only support the first workspace folder. https://github.com/windicss/windicss-intellisense/blob/main/src/extension.ts#L15

However when I go to add two projects using Windi to a workspace, its a mess as its picking up the first projects config, and doesn't pick up any custom properties or info from its own config. I am guessing in order to make this work we would need some information about the currently opened file, and trace it back to a root folder in the workspace, then search for the windi config from there? Or Maybe VSCode already provides information on the root folder for the current working file?

I am guessing there is no workaround for this currently?

alexanderniebuhr commented 3 years ago

/cc @IgnisDa

IgnisDa commented 3 years ago

I wonder how to approach the case when two or more windiconfigs are present in the same workspace. Do we use the first one or do we combine them both? For example, if we have a custom color defined in windi config of project 1, do we want it to be available in windi project 2 too?

@aphex and @alexanderniebuhr what do you think?

alexanderniebuhr commented 3 years ago

I would say not necessarily. Monorepos are mostly just separated projects in subfolders. But getting the nearest windi.config seems to be not good for performance.

/cc @antfu tagging you to see if you have any idea how multiple windi.config files in one workspace could be handled.

antfu commented 3 years ago

I think get the nearest config sound like the correct way to do that (just like tsconfig.json). We could cache those configs so the performance shouldn't be affected too much.

aphex commented 3 years ago

Our use case is not a monorepo but a vscode workspace that is pulling together multiple repos. Difference is there is no top level folder open in VSCode.

For example we will have a project-back-end folder and a project-front-end. These are both separate repos and sibling folders. We then have a folder of workspace files that orchestrate various projects together. In this simple case its just 2. However as they get more complex and we collect more vue applications in a single "project" we would like to use windi across all of them.

So from our standpoint, to answer your question, it would be best if simply the nearest windi config was loaded. Merging the files is not on our radar, and if we wanted to share assets we would like just create a package that both projects could install and reference.

IgnisDa commented 3 years ago

Wouldn't presets be the way to go here?

char-ptr commented 2 years ago

Any update for this issue?