ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

HTML (C#)

by michaelblyons ST3

Sublime Text syntax highlighting for HTML with embedded C#: WebForms/ASP.Net and Razor

Details

Installs

  • Total 12K
  • Win 10K
  • Mac 2K
  • Linux 846
Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12
Windows 0 0 0 1 1 0 0 0 2 1 0 0 1 1 1 0 2 2 2 1 0 0 1 1 1 1 0 0 1 1 1 0 0 1 0 1 1 0 2 1 0 0 0 2 1 1
Mac 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

HTML (C#)

Sublime Text syntax highlighting for .cshtml, .aspx, and similar files.

Current support

Highlighting

  • Embedded C# (<script runat="server">)
    • The runat="server" must immediately follow the tag opening.
  • <% expressions (including <%=, <%#, <%:, <%$, <%--)

Functionality

  • Hotkey comment/uncomment server-side comments (Ctrl+/ or Cmd+/)

  • Snippets for <%-ish expressions

  • Snippets for some directives (Try page or import)

    • Default attributes are subject to change.
  • Snippets may require Ctrl+space, depending on your environment.

  • Some autocomplete within directives.

Razor syntax

A huge thank-you to @keith-hall for this!

Future support (maybe)

  • Identify more attributes of directives
  • Autocomplete ASP builtins

Known issues:

  • “Goto Anything” support is poor.

  • No recognition of excluded scopes to return to HTML. In the snippet below, the C# scope ends immediately after "bar.

    <%
      var foo = "bar%>";
    %>
    
  • Javascript does not always recognize that Response.Write output is coming. The ) is marked as invalid and the conditional scopes are never terminated.

    <script type="text/javascript">
    if (true && <%= list.Any() %>) {
       doStuff();
    }
    </script>