Infovark Underground

  • news
    • infoblog
    • underground
  • product
  • download
  • buy
  • support
  • about
    • ← Introducing the SparkServer Project
    • Support the JQuery Project →

    3 Useful Visual Studio Tricks for Spark Templates

    05 Jan 2010 by Dean in .NET / 5 Comments

    This issue on the Spark discussion board inspired several tweaks to my Visual Studio setup. Gordon and I have found these quite useful, so we’d thought we’d share them here.

    Spark template file icons

    First, I made a couple registry files to give Spark templates a spiffy icon.

    Visual Studio gets its icons from the same registry setting used in Windows Explorer. So all we need to do is register the file extension and associate it with a default icon.

    I found a free-for-noncommercial-use “S”-shaped lightning bolt icon and used the instructions in this StackOverflow question to create the necessary registry entries.

    Add an icon for Spark templates in Visual Studio 2008

    Add an icon for Spark templates in Visual Studio 2008

    You can download the SparkFile.zip package I created from Codeplex. Place the .ico file in C:\Program Files\Spark, and run the two .reg files, and you’ll have a nifty spark icon inside Visual Studio.

    (All the usual caveats apply regarding modifying your registry.)

    Visual Studio template

    Next, I created an item template to use in the Visual Studio Add New Item menu, using this guide to creating item templates.

    You can download my SparkVSTemplate.zip package from Codeplex as well. Place the SparkVSTemplate.zip file in My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#\Web and you’ll be able to create a basic template from the VS menu. You don’t need to unzip it.

    HTML syntax highlighting

    Finally, I wanted to apply the standard syntax highlighting used for HTML pages.

    In Visual Studio 2008, go to Tools | Options, then choose Text Editor, then associate files ending in .spark with the HTML editor.

    Set up Spark View Engine templates to use the HTML Editor in Visual Studio 2008

    Set up Spark View Engine templates to use the HTML Editor in Visual Studio 2008

    This will set all the colors properly. Unfortunately, it will also flag any Spark-specific attributes or elements as HTML validation errors. I figure this is a small price to pay for proper syntax highlighting.

    What’s missing?

    I’d really like to get intellisense working for Spark. Though I tried the Visual Studio Integration Package, it won’t work right outside of VS Web projects. Syntax highlighting seems like the best I can do for the moment.

    If you’ve got other tips and tricks for using Spark inside Visual Studio, I’d love to hear them.

    Related posts

    1. Using Spark View Engine with C# WebServer
    2. Visual Studio 2008 and the CopyLocal setting
    3. Visual Studio 2008 and its CopyLocal setting
    4. How to avoid Visual Studio Help
    5. WCF, WebHttp Binding, and Authentication
    • Tweet
    • Tags:
    • Spark View Engine
    • Visual Studio

    5 Comments

    • Jon

      Thanks, works in 2010 too

      24 Mar 2010 07:03 am
      Reply
      • Danny Douglass

        Thanks – worked like a charm in VS 2008 and 2010!

        09 Jun 2010 11:06 am
        Reply
        • Jared

          Maybe I missed it… what is the URL to download the zip files from codeplex?

          24 Aug 2010 11:08 pm
          Reply
          • Jared

            Yep, missed it. Thanks!

            24 Aug 2010 11:08 pm
            Reply
            • OJ

              Nice post. Rob G is building intellisense for VS2010, it’s called SparkSense. It’s available via the extensions gallery.

              Just thought I’d mention it!
              OJ

              06 Feb 2011 05:02 pm
              Reply

              Leave a Comment

              Posting your comment...

              Subscribe to these comments via email

              • Categories

                • .NET (41)
                • AJAX (3)
                • Books (7)
                • HTML (9)
                • Infovark (8)
                • Programming (48)
                • REST (11)
                • SQL (3)
                • Testing (3)
                • Tools (13)
                • UI (3)
                • WCF (11)
                • Web Services (8)
                • WPF (4)
                • XML (4)
              • Archives

              • Get future articles


                 

              • Blogroll

                • Ajaxian
                • Anne Van Kesteren
                • Brain.Save()
                • Coding Horror
                • Eric Sink
                • Joel Spolsky
                • John Resig
                • Mark Pilgrim
                • Raymond Chen
                • Scott Hansleman
                • Secret Geek
                • Steve Yegge
                • The Daily WTF
                • The Database Programmer
              • Meta

                • Log in
                • Entries RSS
                • Comments RSS
                • WordPress.org
            • Site map

              • News
              • Product
              • Download
              • Buy
              • Support
              • About
            • Recent Posts

              • Review: Brownfield Application Development in .NET
              • Using Modal Dialogs with a Splash Screen in WPF
              • Highlighting query terms in a WPF TextBlock
              • Getting XAML Hyperlink text to wrap
              • How to format the XAML Hyperlink NavigateUri
            • Twitter

              Copyright 2011 Infovark, Inc. All rights reserved.