antfu / vscode-iconify

🙂 Iconify IntelliSense for VS Code

Home Page:https://marketplace.visualstudio.com/items?itemName=antfu.iconify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for aliases

RebeccaStevens opened this issue · comments

Clear and concise description of the problem

Icons aren't shown for aliased icon names. It would be great if they could be.

Suggested solution

Ability to read a json file like this to get the aliases.

{
  aliases: {
    "chevron-left": "ri:arrow-left-s-line",
    "chevron-up": "ri:arrow-up-s-line",
    "chevron-right": "ri:arrow-right-s-line",
    "chevron-down": "ri:arrow-down-s-line",
    // ...
  }
}

Alternative

No response

Additional context

I'm using nuxt icon which allows for declaring aliases for icons. Config details

Validations

Hi, I would add that it would be nice to be able to also put an alias on an entire collection.

For example, simple-icons is defined with the alias si on a project I use.

Sure, PR welcome :)

@arthur-leclerc There's already an option for that:

vscode-iconify/package.json

Lines 526 to 530 in d295384

"iconify.customCollectionIdsMap": {
"type": "object",
"default": {},
"description": "Collection IDs Map for collection name alias, e.g. { 'mc': 'mingcute' }"
}

@RebeccaStevens How is this supposed to be used? I have:

// settings.json
...
 "iconify.customCollectionIdsMap": {
    "ms": "material-symbols",
    "logo": "logos",
    "spinners": "svg-spinners",
  },
  "iconify.customCollectionJsonPaths": [
    "./.vscode/iconsMap.json"
  ],
...

And:

// iconsMap.json

{
    "i-add": "i-ms-add",
    "i-check": "i-ms-check-small",
    "i-avatar": "i-ms-account-circle-outline",
    "i-delete": "i-ms-delete-outline",
    "i-signout": "i-ms-logout",
}

I have same mapping as above inside another iconShortcuts.ts to actually match the aliases but they don't display any icon also customCollectionIdsMap stops working whereas previously i-ms-check would display a ✔️. If I remove customCollectionJsonPaths then it starts working again. So docs on proper usage would be awesome!

@lumosminima You'll want to use customAliasesJsonPaths instead of customCollectionJsonPaths. customCollectionJsonPaths is for providing your own custom icon set.

@RebeccaStevens 🤦‍♂️ got it! though for some reason they only work if I don't have the i- prefix in both shortcuts and map so icon-check works but not i-check. Thanks for this eye candy 🤩

Update:
I have a monorepo and was duplicating the iconMap.json but only one is needed and also it looks like I have to use:

// presetIconShortcuts.ts
'i-overview': 'i-ms-table-chart-view-outline',

And

// iconMap.json
'i-overview': 'ms:table-chart-view-outline',

For i-overview to work.