JetBrains Rider not highlighting syntax for a file with a certain name
Asked Answered
L

5

8

I am trying to create a class with the name "SlotContent" but the file content is not highlighting shown in the picture

For every other file the syntax highlighting works totaly fine.

I Tried:

  • Restarting the IDE
  • Updating the IDE
  • Restarting my PC
  • Clearing the caches
using UnityEngine;

namespace Inventory.UI
{
    public class SlotContent : MonoBehaviour
    {
        
    }
}

Larose answered 1/9, 2022 at 17:13 Comment(0)
B
23

I had the same issue, and Tobias Lösch's answer helped, but only for a single file, I had issues with multiple files.

What I found is that the rider (for an unknown reason) had some files excluded from inspection (you can find it in Settings > Editor > Inspection Settings (see last part of the page with the title "Elements To Skip") - check the screenshot).

When I removed all the files - the highlighting returned.

enter image description here

Borderland answered 13/12, 2023 at 11:42 Comment(2)
This solved the issue for me. I added a project from another source location to the SLN for debugging, for whatever reason, just one file (out of 8) was added to this exclusion list...Pifer
To this day it can randomly add files there, still don't know the reason why.Borderland
U
7

I had the same issue with one file in my solution. You can manually turn on code analysis for that file in the upper right corner of the editor (Select OFF -> Highlight: all problems). However, I have no idea why it was deactivated in the first place. Here's a link that should help you:

https://youtrack.jetbrains.com/issue/RIDER-64564/Syntax-highlighting-mostly-stopped-working-for-single-file-and-no-errors-are-shown-despite-compilation-preventing-errors

Unconcern answered 25/11, 2022 at 9:45 Comment(1)
since i don't have this project anymore i cannot ensure that this works but if i get the chance i will try it out.Larose
P
1

Looks like this file does not belong to any .NET project. Could you ensure it is located near some .csproj file? Try to regenerate project in Unity, it can help also.

If all of that does not work, contact Rider support (right from IDE Help menu). Or create an issue in JetBrains public issue tracker: https://youtrack.jetbrains.com/newIssue?project=RIDER

Pocketknife answered 1/9, 2022 at 19:30 Comment(2)
what do you mean by "located near some csporj file"?Larose
in the file system. Rider analysis only files which are included in a .NET project.Pocketknife
B
1

You look on the top right and select "All Problems"

Baum answered 30/7 at 14:55 Comment(0)
U
0

I had to delete the .csproj file associated with the unhighlighted code file, and let unity regenerate it:

  1. Exit Unity Project
  2. Delete csproj
  3. Open Unity
  4. Double click on code file in unity
  5. Highlighting works now
Upsilon answered 17/9 at 20:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.