Making "this" less annoying

 Now that I have a job where I’m writing web components full time, I see the this keyword more than I ever have in my whole life. It’s not a problem, per se, but you can see how it’s a little repetitive. I started wondering what my options were to fix this minor annoyance and the ShopTalk Discord helped me find a simple way and an over-the-top way to fix my issue.

Simple way: Overriding VS Code theme color tokens

By default my Github Light theme makes this a bold dark blue color. I didn’t want to roll my own theme though to scratch this niche itch, so I dug in and found out you can override single tokens in VS Code. Handy. The documentation is a bit opaque but here’s what you need to do:

// settings.json
"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": "variable.language.this",
      "settings": {
        "foreground": "#b0b0b0"
      }
    }
  ]
},

Now my this looks like this…

the keyword this in code set in a light gray, almost illegible font color

It’s a calming sensation for me to have repetitive noise dimmed. I liked it so much I dimmed comments to match as well. I may even dim TypeScript because sometimes I wish I could hide the syntax, but keep the squiggles.

Over the top way: Replace this with a custom glyph

Changing colors is cool… but what if you could go one step further and replace this with an icon? What would an icon for this even look like?

I asked the ShopTalk Discord and got some interesting ideas like the “☝️” emoji, which I think is funny in an “I’m with stupid” t-shirt sort of way. Andrew Walpole took it to the next level and designed a custom glyph:

the letter of the word this arranged in a diamond pattern

Alan Smith then figured out how to use Glyphs Mini to add a custom ligature to an open source coding font. Andrew riffed on Alan’s work and exported a custom version of Fira Code with his custom glyph as a ligature. The last step was to install the font update my VS Code settings:

  "editor.fontFamily": "'Fira Code Ligged', monospace",
  "editor.fontLigatures": true

Now my code looks incredibly futuristic…

the this glyph replacing instances of the glyph keyword in code

Abusing typefaces to remove the repetitiveness of programming languages is fun. After seeing the icon in situ, the idea might be a smidge too wild for me due to reduced legibility. While I don’t use the custom glyph on the daily, this experiment does spark a deep desire in me to create a bunch of custom glyphs for common keywords so I can make JavaScript an entirely rune-based programming language.

Custom ligatures with CSS?

A wild idea, but it would be neat if you could create your own custom ligatures in CSS to avoid the need to re-bake custom fonts each time you have a niche typographic need. Here’s a pseudo-syntax of how that might work:

@font-face "Dave Hijinks" {
  match: "this.";
  replace: "☝️.";
}

@font-face "Cloud2Butts" {
  match: "cloud", "AI";
  replace: "butt", url(fart.svg);
}

body {
  font-face: "Dave Hijinks", "Cloud2Butt", sans-serif;
}

Anyways, it’s a thought. Not a serious proposal. This was a fun rabbit hole to travel down with some friends.

daverupert.com

15 Jan 2025 at 01:41



Refresh complete

ReloadX
Home
(263) All feeds

Last 24 hours
Download OPML
A Very Good Blog by Keenan
*
A Working Library
Alastair Johnston
*
Andy Sylvester's Web
Anna Havron
*
Annie
*
Annie Mueller
Apple Annie's Weblog
Articles – Dan Q
*
Austin Kleon
*
Baty.net posts
bgfay
*
Bix Dot Blog
*
Brandon's Journal
*
Chris Coyier
Chris Lovie-Tyler
Chris McLeod's blog
CJ Chilvers
*
Colin Devroe
Colin Walker – Daily Feed
Content on Kwon.nyc
*
Crazy Stupid Tech
*
Dave's famous linkblog
*
daverupert.com
Dino's Journal 📖
dispatches
dominikhofer dot me
Excursions
*
Flashing Palely in the Margins
Floating Flinders
For You
*
Frank Meeuwsen
frittiert.es
Hello! on Alan Ralph
*
Human Stuff from Lisa Olivera
inessential.com
*
Interconnected
*
jabel
Jake LaCaze
*
James Van Dyne
*
Jan-Lukas Else
*
Jim Nielsen's Blog
*
Jo's Blog
*
Kev Quirk
lili's musings
*
Live & Learn
Lucy Bellwood
*
Maggie Appleton
*
Manton Reece
*
Manu's Feed
*
maya.land
Meadow 🌱
*
Minutes to Midnight RSS feed
*
Nicky's Blog
Notes – Dan Q
*
On my Om
Own Your Web
Paul's Dev Notes
QC RSS
rebeccatoh.co
reverie v. reality
*
Rhoneisms
ribbonfarm
Robert Birming
*
Robin Rendle
Robin Rendle
Sara Joy
*
Scripting News
*
Scripting News for email
Sentiers – Blog
Simon Collison | Articles & Stream
strandlines
Tangible Life
the dream machine
*
The Marginalian
*
The Torment Nexus
*
thejaymo
theunderground.blog
Thoughtless Ramblings
tomcritchlow.com
*
Tracy Durnell
*
Winnie Lim
*
yours, tiramisu
Žan Černe's Blog

About Reader


Reader is a public/private RSS & Atom feed reader.


The page is publicly available but all admin and post actions are gated behind login checks. Anyone is welcome to come and have a look at what feeds are listed — the posts visible will be everything within the last week and be unaffected by my read/unread status.


Reader currently updates every six hours.


Close

Search




x
Colin Walker Colin Walker colin@colinwalker.blog