Problem
When working with Unreal Engine projects, there are source files under the engine where Rider doesn't provide syntax highlighting and doesn't highlight code issues.
Sample files:
-
Engine/Source/Developer/Apple/MetalShaderFormat/Private/MetalShaderCompiler.cpp(while being on Windows or Linux); -
Engine/Source/Developer/Linux/LinuxTargetPlatform/Private/LinuxTargetPlatformModule.cpp(while being on Windows or MacOS); -
Engine/Source/Developer/Windows/LiveCoding/Private/LiveCodingSettings.cpp(while being on Linux or MacOS);
Opening such a file on a non-matching platform will look like this:
Explanation
This is expected, by design behavior. Currently Rider excludes files from analysis that doesn't belong to current platform. The reasons for that are following:
- These files might be not used on current platform at all.
- These files might miss compilation properties;
- When UnrealBuildTool generates project files, it provides project properties only for default platform;
- Rider integration with UnrealBuildTool doesn't support fetching project properties for other platforms as well;
- Such files might depend on operating system-specific STL (system library) and use specific paths which are not present on current operating system (or not configured a machine);
Because of that code indexing and IntelliSense won't work correctly for other platforms even if cross-compilation is configured on the machine. To avoid a lot of false positives in incorrectly parsed code, code from other platforms is excluded from code analysis.
Workaround (only for Windows)
If you do wish this code to be analyzed and highlighted, you can apply the following workaround. Note, upon opening such a file, it is expected to see random number of non-resolved symbols and false-positive errors/warnings:
- Download the EmptyUProject.sln.DotSettings.user file attached;
- Place it next to your solution file.
- Rename it, so it would be called YourGameProjectName.sln.DotSettings.user;
- Reopen game project in Rider;
Note that in that case, you might face a red non-resolved code. It is supposed to happen since because what described above.
Feel free to upvote the following related issues should you wish Rider to handle OS-dependent sources better: Cross platform files is not analyzed, the file is not analysis by default, Migrate option for ignoring third-party code to Rider's UI
Comments
0 comments
Please sign in to leave a comment.