antfu / vscode-iconify

πŸ™‚ Iconify IntelliSense for VS Code
https://marketplace.visualstudio.com/items?itemName=antfu.iconify
MIT License
474 stars 36 forks source link

feat: Reload `customCollections` when `iconifyJSON` updated. #90

Closed s3xysteak closed 2 weeks ago

s3xysteak commented 4 weeks ago

Description

Before the PR, I have to restart vscode or use command Developer: Reload Window to make new icons work. After the PR, the configuration should takes effect immediately.

The changes only involve useCustomCollections function in src/config.ts and add deleteTask function to delete task in _tasks in src/loader.ts, and the only two side-effect is customCollections in src/config.ts and _tasks in src/loader.ts. It updates customCollections when needed, to achieve the feature.

Linked Issues

Closes #89

Additional context

The PR is not ready to be merged now. Here is a TODO list:

There is one problem that has not been solved yet. useFsWatcher is based on workspace.createFileSystemWatcher, which cannot watch a file that not exists. Because config.customCollectionJsonPaths using a path instead of a glob, so I have no idea how to deal with the files created or deleted.

s3xysteak commented 3 weeks ago

https://github.com/antfu/vscode-iconify/blob/main/src/loader.ts#L13 _tasks was not updated in time, which caused the issue.

s3xysteak commented 2 weeks ago

@antfu Notice that the PR required reactive-vscode version to be at least v0.2.5 which fixed some bugs about useFsWatcher compared to version @0.2.3 in current main commit. I didn't bump the dependence in the PR. Please update it before release. πŸ˜‡

antfu commented 2 weeks ago

Next time you could include the version bump if it's required, to make the PR complete and functional. As long as you don't bump unrelated deps I think it's ok (not limited to my repos just saying). And no worries, I always bump deps before releasing :)