No syntax highlighting in just one specific .cs file

Since yesterday one of my Unity project .cs files (MeshFace.cs) shows no syntax highlighting at all anymore but code completion still works. Other .cs files in the same namespace & assembly (asmdef) work fine.

Here's what I tried / observed:

  • refactor rename the class + file to "MeshF***Face.cs" => now I get syntax highlighting
  • refactor rename class back to MeshFace.cs => a warning appears that the rename conflicts with an existing MeshFace class (I searched the solution, there is no other MeshFace class). I ignore the warning and MeshFace.cs again has no highlighting.
  • refactor/rename, then create a new MeshFace.cs => the new MeshFace.cs file has no syntax highlighting to begin with
  • checked File Types in settings (all of them!) to see if somehow ".cs" or "MeshFace.cs" appears under a different file type, or any other possible pattern match => found nothing
  • added MeshFace.cs explicitly to C# File Type pattern and "auto-detected by file content" => no effect
  • closed Rider, inspected workspace.xml, changed the MeshFace.cs file's entry from SKIP_HIGHLIGHTING to FORCE_HIGHLIGHTING => no effect, Rider just changes it back when I close it again
  • in workspace.xml deleted the entire HighlightingSettingsPerFile contents (with Rider closed) => no effect
  • checked file Properties => looks like any other .cs file
  • checked menu commands and looked around under settings ...
  • came here, found nothing
  • created this post :)

I'm bummed. I can't find what's wrong with the syntax highlighting with this file.

Using Rider 2022.1.2


Got it! Just finished writing, then I noticed this in the upper right corner:


Got the same problem yesterday. Think I accidentally hit a hotkey that disabled the file's syntax highlighting. Thanks for the solution!


Please sign in to leave a comment.