Problem
Upon opening a specific file, it appears that Rider doesn't provide syntax highlighting and doesn't highlight any code issue.
Explanation
Rider does suppress code analysis for files exceeding predefined file size threshold:
- C# files: 300KB;
- C++ files: 1.5MB;
Solution
Per-file workaround
To enable syntax highlighting and code analysis on a per-file basis, it is possible to force Rider to start analyzing the exact file via the "OFF" widget in the top-right corner. Hover over it → hover over "Highlighting: None" → select "All Problems". Once it is done, Rider enables IntelliSense for the current file.
Permanent solution
It is possible to increase the predefined file size limit. It is helpful when there are many large files, and it is necessary to have code analysis to work by default for all of them.
Note that this change may affect general IDE performance.
To increase the file size limit, it is required to redefine the idea.properties and .DotSettings parameters in the IDE properties files. To do this, add the following properties to the corresponding settings files.
For example, one might want to increase the limit to 3MB (the default is 300KB). You can follow these steps to apply this change:
-
idea.properties:
Paste a line
idea.max.intellisense.filesize=3000there. The value in this property is in KB, so 3000KB ~= 3MB; -
.DotSettings:
Add an entry
<s:Int64 x:Key="/Default/PerformanceThreshold/AnalysisFileSizeThreshold/=CSHARP/@EntryIndexedValue">3000000</s:Int64>. Note instead ofCSHARP, one can also useCPPto change the threshold for C++ source files. The value in this property is in bytes, to 3MB~=3000000 bytes.-
General rule is to put that entry in between root entry:
<wpf:ResourceDictionary ... a lot of chars ...>{here}</wpf:ResourceDictionary> -
For example, a valid
SampleSolution.sln.DotSettings.userfile might look like:<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <s:Int64 x:Key="/Default/PerformanceThreshold/AnalysisFileSizeThreshold/=CSHARP/@EntryIndexedValue">3000000</s:Int64></wpf:ResourceDictionary>
-
Where to find settings files
idea.properties
- From the Rider Welcome screen, select Configure (bottom-left corner) | Edit Custom Properties;
- Or, If a project is already opened in IDE, select Help | Edit Custom Properties;
- Edit and save the file. Restart Rider to apply changes;
.DotSettings
This file can be edited on a machine-wide or per-project layer (see Layer-based settings documentation for details). You can find an instruction on how to apply this setting on different settings layers below:
- To apply it machine-wide, find and open the
GlobalSettingsStorage.DotSettingsfile.- From the Welcome screen select Help | Special Files and Folders, or with the project opened, select Help | Diagnostic Tools | Special Files and Folders;
- Double-click the "Config Directory", so it opens in the system file explorer;
- open
./resharper-host/GlobalSettingsStorage.DotSettings;
- To apply it per project, open
{SolutionRootDir}/SolutionName.sln.DotSettings(team-shared) or{SolutionRootDir}/SolutionName.sln.DotSettings.user(personal) file. If no such file exists, create it;
We recommend using the team-shared layer if you want to share these settings with a team and commit them to VCS.
Comments
0 comments
Please sign in to leave a comment.