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 709
  • Linux 324
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 Mar 11 Mar 10 Mar 9
Windows 3 3 3 6 3 8 7 7 3 2 5 8 6 5 5 5 2 5 2 4 5 4 1 2 7 10 11 4 6 4 4 3 7 8 9 8 5 6 8 2 13 6 6 3 7 5
OS X 0 0 0 2 2 3 1 0 0 1 0 4 1 1 1 0 0 0 0 3 0 0 2 0 1 2 1 0 0 0 0 1 2 2 0 1 0 1 1 1 2 1 1 0 0 0
Linux 0 0 0 1 1 1 1 0 0 2 0 1 2 0 0 1 0 2 0 0 0 0 0 0 0 1 0 2 0 0 0 0 2 0 0 1 0 0 0 1 1 0 0 0 0 0

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>