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

HTML (C#)

by michaelblyons ST3

Sublime Text 3 syntax highlighting for HTML with embedded C#

Details

Installs

  • Total 5K
  • Win 4K
  • OS X 730
  • Linux 335
May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 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
Windows 9 7 7 0 3 4 10 8 7 9 5 1 6 6 7 10 7 7 1 6 7 3 4 6 1 3 4 5 10 5 5 3 3 6 3 8 7 7 3 2 5 8 6 5 5 5
OS X 1 1 1 0 1 0 2 2 0 0 1 0 0 4 1 1 0 1 0 2 0 0 1 1 0 0 0 2 0 1 0 0 0 2 2 3 1 0 0 1 0 4 1 1 1 0
Linux 0 0 1 0 0 1 0 0 1 0 1 0 3 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0 2 0 1 2 0 0 1

Readme

Source
raw.​githubusercontent.​com

HTML (C#)

Sublime Text 3 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 <% expressions (Try typing exp)
    • These are subject to change.
  • Snippets for some directives (Try page or import)
    • Default attributes are subject to change.
  • Snippets may require Ctrl+space, depending on your environment.

Future support (maybe)

  • Razor syntax
  • Identify all relevant attributes of directives

Known issues:

  • “Goto Anything” support is poor.

  • Control structures in code blocks separated by HTML are not scoped correctly. For example, the else below does not know that it is matched to the if above.

    <% if(condition){ %>
      <p>show me</p>
    <% } else { %>
      <p>me instead</p>
    <% } %>
    
  • 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>