Sam's Blog

17 Oct

ManagedMyC: Code folding for functions

This is part 2 of [many?] posts about creating an ANTLR-based language service for Visual Studio.

Since this is a near-trivial feature to add based on the code in my previous post, I’ll go ahead and get it in tonight. We want to fold from the opening { to the closing } of a function, so the first thing to do is find that in the grammar.

declaration_
    :   class1? type? IDENTIFIER paren_params block
    |   simple_declaration
    ;

Continue Reading »

16 Oct

Custom Visual Studio language services: ManagedMyC meets ANTLR

As some of you know (ok probably not many of you), I’m the author behind Pixel Mine nFringe, a custom language service framework that we used to provide UnrealScript editing & debugging features in Visual Studio 2005 and 2008. To date, I’ve written 2 full language services with it (UnrealScript and Antlr v3) and toyed with several others (INI files, C/C++, StringTemplate, and a scripting language used in another game). Several people have asked how to get started on a language service using ANTLR grammars for the backend features.

Just to get started, I’ve made a near direct port of the ManagedMyC sample from the Visual Studio SDK, which uses MPLEX/MPPG, to one that uses ANTLR. The most important thing to note at this point: many parts of this sample are inefficient, clumsy, and/or just done the wrong way. None of the features from earlier posts here are implemented in this sample [yet]. Over the next several weeks, I plan to make blog entries covering individual tasks required to make ManagedMyC a solid example of how someone could make a custom language service.

Continue Reading »

07 Oct

Custom Visual Studio language services: Tracking recently used items in autocompletion lists

The C# language service has the great feature of remembering recently used items in the completion lists (auto-complete, complete word, member select, etc.). You can add a similar ability to your language service by deriving your Declarations-derived class from MruDeclarations instead of Declarations. Continue Reading »

07 Oct

Custom Visual Studio language services: Advanced commenting features

The default line/block commenting/uncommenting implementation in the Managed Package Framework is … well, lacking. When line comments are available, it always uses them, and it always inserts the comments at the beginning of the line. I came up with a better (IMO of course) set of rules to determine whether block comments or line comments should be used. Continue Reading »

02 Nov

Root folders revisited

When I know I’m going to be working in a particular folder for a long time, I find it really convenient to open that folder in a rooted explorer window while I work. I added a command to the explorer context menu to open a subfolder in a rooted window. It’s nothing spectacular but very convenient at times. Here’s the registry tweak and a screenshot:

Root Folder Here

11 Oct

Multi-processor building in Visual Studio 2005

Today I learned about a very interesting (undocumented) compiler flag in Visual Studio 2005. With the simple addition of /MP to the C++ Additional Options for your project, the compiler will take advantage of multiple processors. Obviously you need a multi-processor machine for this to work.

So how much difference are we talking? The project I’m currently working on took 5:00 to build on my FX-70 machine at work. Adding this flag dropped the number to 1:53. Continue Reading »

30 Mar

Building a simple Launchy clone in WPF (Part 3/3: Tying things together)

This part is all about some finishing touches. At this point I’ll assume you’ve finished Part 1 and Part 2, so we’ll go ahead and dive right in! :) Continue Reading »

30 Mar

Building a simple Launchy clone in WPF (Part 2/3: Visual Studio)

This is the second part of my tutorial on making a minimalistic clone of Launchy. I’ll assume you’ve finished Part 1. If you haven’t you might want to check it out since this part builds on it. :) Continue Reading »

30 Mar

Building a simple Launchy clone in WPF (Part 1/3: Blend)

As I mentioned in my previous post, I’m quite a fan of Launchy. For fun, I set out to create a simple clone of Launchy in C#/.NET 3.0. In this article, I’ll show what it takes to create a minimal but functional Launchy clone in about 2 hours. After working through this lab, it wouldn’t be too difficult to make the resulting program as functional as Launchy. But that’s outside of what I’m trying to accomplish here, so I’ll leave that to the tinkerers. :)

You will need several tools to build this application according to the tutorial. I will also assume you are familiar with the basic concepts of using them. Among the tools are:

  • Microsoft Visual Studio 2005
  • Microsoft Expression Blend Release Candidate 1

For more information about this software and others needed to get started developing WPF applications today, visit http://www.netfx3.com/.

If you just want to see the result in action, you can download the whole 18.6kb archive here. The file is compressed with 7-zip, one of the greatest FOSS projects of all time IMO. :) Remember this program runs without a window by design. To use it after you run it, press WinKey+Space. To exit, press WinKey+Space, then right click the dialog. Here is a screenshot:

Launchy Clone in action

Continue Reading »

15 Mar

Your Start menu is too slow

Every once in a while I run across a new piece of software and think to myself “Why have I never seen this before??” Today was one of those days.

This is by far the most efficient program launching method for Windows I’ve ever used (spare the alternate OS comments kthx)!

After you install it, press Alt+Spacebar to bring up the launcher, and all of your start menu items/IE favorites/Firefox bookmarks are just a few keystrokes away.

Launchy Homepage

Launchy screenshot

© 2010 Sam's Blog | Entries (RSS) and Comments (RSS)

Your Index Web Directorywordpress logo