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

feat(vscode): resolve config by file path #1101

Merged
merged 8 commits into from Jun 18, 2022
Merged

Conversation

QiroNT
Copy link
Member

@QiroNT QiroNT commented Jun 13, 2022

What have changed

  • The VSCode extension now can load multiple config files according to file's path.
    • Config files will be searched from file's directory to the workspace directory or what's being specified in unocss.root.
    • Every config file will only be loaded once, every file will be searched against loaded configs first.
    • The config file living in CWD will be loaded upon extension start.

Unsolved problems

  • Files meeting code.includes(INCLUDE_COMMENT_IDE) || isCssId(id) will now be resolved to default config. Should it use the "closest" config or the default one?
  • Should the config file search all the way to the root of the drive? Should it be CWD instead?
  • Should there be a command to unload all loaded contexts(aka. reload)? It definitely helps with potential loading issues (eg. when a new config file is added), but I'm not sure if it's necessary.
  • Reduce the number of createContext calls. Currently it's being called every time a resolve from cache fails, and it does lot's of disk reads which is slow. I think it could be reduced by a better cache algorithm, haven't came up with one yet.

@netlify
Copy link

netlify bot commented Jun 13, 2022

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit 34bfd80
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/62a8b4932f3b8b00093c539c
😎 Deploy Preview https://deploy-preview-1101--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@QiroNT QiroNT marked this pull request as ready for review June 14, 2022 12:40
@QiroNT QiroNT requested a review from antfu as a code owner June 14, 2022 12:40
packages/core/src/types.ts Outdated Show resolved Hide resolved
@antfu
Copy link
Member

antfu commented Jun 14, 2022

For sure we could have a Reload UnoCSS command.

@QiroNT QiroNT requested a review from antfu June 14, 2022 16:17
@antfu antfu merged commit 08a173f into main Jun 18, 2022
@antfu antfu deleted the feat/vscode-multi-config branch June 18, 2022 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants