jdtsmith / kind-icon

Completion kind text/icon prefix labelling for emacs in-region completion
GNU Affero General Public License v3.0
174 stars 4 forks source link

FR: Add a function for manually install all the preset svg icons #15

Closed Eason0210 closed 2 years ago

Eason0210 commented 2 years ago

Hi @jdtsmith ,

Thanks for make this excellent package.

Recently, after I installed the svg-lib to enable the svg-icons, every time I input a new keyword, I have to wait for downloading an icon, especially sometimes the network is not good and it takes a long time to wait. It's kind of annoying.

It would be nice to add a function that the user can trigger manually to download all the preset icons to the cache directory. Or we can provide a repository which include only the preset icons, then user can download from it manually.

jdtsmith commented 2 years ago

Sounds like you have svg-lib misconfigured. It does download and cache icons in the directory specified by svg-lib-icons-dir, so that simply showing them once will result in never downloading again. Do you have such a directory and is it populated with SVG icons?

jdtsmith commented 2 years ago

Also, it's easy to double-check if this is working using M-x customize-group kind-icon, open the mapping and Preview each icon.

Eason0210 commented 2 years ago

Sounds like you have svg-lib misconfigured. It does download and cache icons in the directory specified by svg-lib-icons-dir, so that simply showing them once will result in never downloading again. Do you have such a directory and is it populated with SVG icons?

Yes, It will download only one icons in the~/.emacs.d/.cache/svg-lib directory. For example, when I input (mes first time in emacs-lisp-mode, only get one icon downloaded, is this behavior correct? I expect it to download all the icons( Actually 32 icons in total).

image

Also, it's easy to double-check if this is working using M-x customize-group kind-icon, open the mapping and Preview each icon.

Click the preview button will trigger the icon to download, but user need to click 32 times. Any way, it works 😄 Thank you.

(use-package kind-icon
  :after corfu
  :custom
  (kind-icon-default-face 'corfu-default)
  :config
  (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
jdtsmith commented 2 years ago

It only downloads on demand, i.e. when an icon is missing from the cache. This could be because you just started using kind-icon, or configured a new icon. Here you only have one type of completion, so only one will have been downloaded. But eventually all would have been retrieved as you use it. And forever after that, no need to download again.

I'll consider an icon-preview that will have the effect of downloading them all; will leave this open for a bit to see whether that materializes.

Eason0210 commented 2 years ago

It only downloads on demand.

Ok, now I understand.

I'll consider an icon-preview that will have the effect of downloading them all

It would be great 👍

jdtsmith commented 2 years ago

Please see latest commit ee51d05 and give a try.

Eason0210 commented 2 years ago

Great, It works well.

After I run M-x kind-icon-preview-all and got this nice preview result:

image