vscode-iconify icon indicating copy to clipboard operation
vscode-iconify copied to clipboard

Support for aliases

Open RebeccaStevens opened this issue 1 year ago • 3 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

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

RebeccaStevens avatar Oct 02 '23 06:10 RebeccaStevens

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.

arthur-leclerc avatar Dec 06 '23 01:12 arthur-leclerc

Sure, PR welcome :)

antfu avatar Dec 06 '23 11:12 antfu

@arthur-leclerc There's already an option for that: https://github.com/antfu/vscode-iconify/blob/d295384d5f642791f52d36432b58369e4fac1603/package.json#L526-L530

RebeccaStevens avatar Mar 07 '24 01:03 RebeccaStevens

@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 avatar May 16 '24 15:05 lumosminima

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

RebeccaStevens avatar May 16 '24 22:05 RebeccaStevens

@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.

lumosminima avatar May 17 '24 08:05 lumosminima