brunnerh / insert-unicode

A Visual Studio Code extension which adds commands for inserting unicode characters/codes.
MIT License
31 stars 0 forks source link

[Feature request] Support private area codepoints #42

Open edhebi opened 1 year ago

edhebi commented 1 year ago

Hi!

With vscode not having a direct way to insert a codepoint from its hex, I tend to use this extensions a lot, but it frustratingly

  1. doesn't allow unmapped codepoints
  2. doesn't consider the private area planes to be mapped.

The combination of those two makes it impossible to insert codepoints from the private area, which is fairly annoying when working with say, icon fonts.

Disclaimer: This might already possible and I'm just missing it

Suggestion

I think (1) is reasonable and (2) is reasonable most of the time. I think the right call would be to add a insert-unicode.include-private-area options to make those insertable. If there's interest I'm willing to dedicate time to implement it.

brunnerh commented 1 year ago

I also sometimes work with icon fonts but have never written a code point for them manually.

Usually one would generate classes to give proper names that can be used to reference them. And if reuse within CSS is required, one can use pre-processor variables or custom CSS properties.

.icon-base.icon-a::before { content: "\f101"; }
.icon-base.icon-b::before { content: "\f102"; }
.icon-base.icon-b::before { content: "\f103"; }
html {
  --icon-a: "\f101";
  /* ... */
}

.some-element::before { content: var(--icon-a); }

Adding unmapped or private code points would add a great number of entries which may hurt selection performance. It would be acceptable behind a flag but I currently do not see much of a use case here.

edhebi commented 1 year ago

Sorry for the late reply, somehow github didn't send my any notification whatsoever. I'm working with icon fonts but not with web, and I actually need to write those in-line ^^'. This is not a super common usecase I realize, and honestly considering there's no name to look for or anything, this should absolutely be a vscode builtin feature. I can live without it ultimately, do you want me to close the issue ?

brunnerh commented 1 year ago

Just realized, have you tried the "Insert from Hex Code" command?