ionic-team / vscode-ionic

Visual Studio Code Ionic Extension
Other
10 stars 1 forks source link

Undesired Auto Importing ionicons. #189

Closed joelcoxokc closed 3 weeks ago

joelcoxokc commented 3 weeks ago

For some reason every time I save an html file... Ionic extension will auto import all the ionicons into the component's ts file. I have already registered the desired icons using addIcons() in the base of my app. I do not want them to be auto imported into that specific component.

Please help, as my team has to disable the entire extension because every time we save HTML we have to go remove imports from the ts file.

This atleast needs to be a setting

dtarnawsky commented 3 weeks ago

Thanks for the bug report Joel, it sounds like there are probably 2 camps of developers here. One that imports as needed in the component and ones that add their icons at the root of the app.

It sounds like the best compromise is to make this a per project setting and it asks the question (once) before performing the first import.

Would that work for you?

cacalo commented 3 weeks ago

I'm having the same problem, this issued ocurres on any angular project, even if it is not using ionic, as long as the ionic extension is installed on vsCode. I'd prefer that the plugin checks that the project is in fach an ionic project and not just Angular or Angular+capacitor, after that the behaviour should be opt-it with the question and not default on.

dtarnawsky commented 3 weeks ago

v1.93.4 asks you whether you want to auto import ion-icons for that project. This should allow you to have projects that addIcons at the root or on a component by component basis. The extension will only add when you add an ion-icon to the template and will only work when you have @ionic/angular in your project. This fixes Joel's issue and your issue Gonzalo. If you are on v1.93.4+ and have any issues let me know.

joelcoxokc commented 3 weeks ago

@dtarnawsky Thank you very much for the speedy reply, and the immediate action. I really do appreciate this :) We now have the extension enabled again and everything is working great!