Janne252 / vscode-fontawesome-auto-complete

Auto-complete & preview Font Awesome icons in any language.
https://marketplace.visualstudio.com/items?itemName=Janne252.fontawesome-autocomplete
GNU General Public License v3.0
15 stars 2 forks source link

Support for Vue FontAwesome #8

Closed makingDigital closed 4 years ago

makingDigital commented 5 years ago

The markup for Vue Fontawesome is a little different, it would be great to have automcomplete for it:

https://github.com/FortAwesome/vue-fontawesome

Janne252 commented 5 years ago

It appears that the main difference between vue-fontawesome's syntax and standard Font Awesome is the missing fa- prefix on icon names:

<font-awesome-icon icon="address-book" /> (fas is the default assumed prefix)

vs.

<i class="fas fa-address-book"></i>

Meaning that a configuration option for this extension that enables/disables the inclusion of the fa- prefix should be enough to provide a compatible experience?

Unfortunately it also appears that prefixes are provided in an array:

<font-awesome-icon :icon="['fas', 'spinner']" />

@makingDigital Do you know if this is the only way of providing the prefix? i.e. if vue-font-awesome-icon supports icon="fas spinner"?

makingDigital commented 5 years ago

Apologies for the late reply, at the moment no it has to be provided in an array to specify the library you want I believe, but if you just have one type included you can just say icon="coffee" and it'll default to the first one. The config part for autocompleting the icon attribute would probably do the job, would be cool to have autocomplete on the tag itself, typing out is tiresome haha!

Janne252 commented 5 years ago

I think this can be solved by supporting an insertion template per file type:

{
    "insertionTemplate": {
        "**/*.vue": "<font-awesome-icon :icon=\"['{style}', '{name}']\" />"
    }
}

Where

Default template for any file type would be {style} fa-{name}.

This woud allow maximum support for customizing the output.

50l3r commented 4 years ago

I think this can be solved by supporting an insertion template per file type:

{
    "insertionTemplate": {
        "**/*.vue": "<font-awesome-icon :icon=\"['{style}', '{name}']\" />"
    }
}

Where

  • {style} is replaced with the icon style prefix, e.g. far
  • {name} is replaced with the icon's name without fa- prefix, e.g. user.

Default template for any file type would be {style} fa-{name}.

This woud allow maximum support for customizing the output.

I think this can be solved by supporting an insertion template per file type:

{
    "insertionTemplate": {
        "**/*.vue": "<font-awesome-icon :icon=\"['{style}', '{name}']\" />"
    }
}

Where

  • {style} is replaced with the icon style prefix, e.g. far
  • {name} is replaced with the icon's name without fa- prefix, e.g. user.

Default template for any file type would be {style} fa-{name}.

This woud allow maximum support for customizing the output.

Where i need to put the insertionTemplate config? It says that is config unavailable as insertionTemplate and fontAwesomeAutocomplete.insertionTemplate too

Janne252 commented 4 years ago

@50l3r The insertion template proposed in this issue was a sugguestion. It is not implemented yet but as it appears to have some demand I'll implement it for the next release.

50l3r commented 4 years ago

Great. I use vue as one of my main languages and font awesome with the vue-font-awesome library. This plugin matches so great

Janne252 commented 4 years ago

Version 1.0.0 is now available on the marketplace, with the new setting insertionTemplate implemented. In addition to supporting the insertion format, the mouse-over documentation popup also supports the custom insertionTemplate configurations.