Lowercase Keywords Revisited (not an April Fools' Day joke this time, I promise)
I hope you enjoyed yesterday’s April Fools’ Day post. I thought it was a fun way to kick off an experiment I’d like to conduct and in this post I’ll tell you how you can actually try out lowercase keywords for VB on your machine right now no matter what version of VS you’re using (no joke).
You see, a few years back Architect-emeritus Paul Vick asked a question, “Do PascalCased keywords make VB look more verbose than it really is?” At the time I didn’t really give the question enough thought but a lot of commenters responded positively about the look (both then and yesterday) and recently I got to thinking about it again. It is true both that VB uses capitalized words far more often than in natural English text and also that programmers exposed to lots of other programming languages probably also aren’t used to so many uppercase characters. I can imagine how this could magnify the perception of VB’s verbosity so I set out to figure a way to actually test the hypothesis. What I came up with was a special proof-of-concept font: Glamour. How it works it pretty simple: Visual Studio can make keywords appear any color you want. But it can also make keywords appear bold. I made a font where the bold version is the same as the regular version but with all of the uppercase letters using the lowercase glyphs. So when this font is installed and selected as the text editor font and keywords are configured to be bold Visual Studio renders them in all lowercase instead (An elegant hack, huh?).
There are several advantages to this approach:
- Anyone using any version of Visual Studio can try it out.
- It’s just a presentation thing (a glamour); it won’t cause the pretty-lister to modify an existing file nor will it affect the way the text is actually saved, so…
- It won’t affect anyone else on your team if they don’t want to try it or don’t like it,
- You won’t have to undo any changes if you don’t like it,
- If a lot of people like it they can use it without half the VB code in the world using PascalCased keywords and the other half using lowercase keywords.
Of course, if you look at your code outside of VS or copy/paste it into another program or do anything to make the code not parse as keywords (like commenting out a block of code) it’ll revert to its normal PascalCased look. But for playing around with an idea I still think this is a good enough approach to get a feel for whether you like it or not. Like I said yesterday, when I started programming in QBasic all of the keywords were in SCREAMING CAPS so it’s not like the current style is etched in stone. Who knows, maybe this is popular enough that we add an option to Visual Studio for this kind of thing (no promises!).
I named the font Glamour (like a magical illusion spell) in recognition to its appearance-only effects. It’s entirely based off of the popular open source font Inconsolata by Raph Levien (itself influenced by the popular Microsoft font Consolas) and you can try it out right now:
- Download Glamour from my GitHub repo.
- Install it by drag/dropping the truetype font (.ttf) files in your %SystemDrive%WindowsFonts folder.
- Change your text editor font in the Tools > Options > Fonts & Colors dialog to Glamour.
- Select “Keyword” in the “Display Items” list and check the “Bold” checkbox.
- You’re all set. Happy coding!
If you’re a longtime VB user like myself who’s interested in trying something a little different, or someone used to other languages who wants to give VB a more familiar look and feel go ahead and try it out and let us know what you think.
Anthony D. Green, Program Manager, Visual Basic, C#, and F# Languages Team
It is an interesting thiught! We are creatures.of habit and each time I have to write code in c– or some such language, I find it disconcerting that my code is lower case…but why not? The glamour font looks cool
This does not work for me. I followed your steps exactly. Do you know what could be the problem?
This actually also works if you just turn the IntelliSense to sugesstion mode by pressing CTRL + ALT + SPACE and turn off pretty listing in Tools -> Options -> Text Editor -> Basic -> Advanced. However, words that Visual Studio add on its own will be capitalized.