Skip to content

Instantly share code, notes, and snippets.

@Borod4r
Last active October 25, 2021 13:26
Show Gist options
  • Save Borod4r/fe73256b8c5c78a1b236e8c919e3d08d to your computer and use it in GitHub Desktop.
Save Borod4r/fe73256b8c5c78a1b236e8c919e3d08d to your computer and use it in GitHub Desktop.
Basic syntax highlight for Unity ShaderLab code in Project Rider
<!--
Basic syntax highlight for Unity ShaderLab code in Project Rider.
v1.0
Download this file and put it into your "filetypes" folder.
Windows Vista, 7, 8, 10:
<SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.Rider10\config\filetypes
Mac OS X:
~/Library/Preferences/Rider10/config/filetypes
Linux:
~/.Rider10/config/filetypes
-->
<filetype binary="false" description="Unity shaders" name="Unity shaders">
<highlighting>
<options>
<option name="LINE_COMMENT" value="//" />
<option name="COMMENT_START" value="/*" />
<option name="COMMENT_END" value="*/" />
<option name="HEX_PREFIX" value="" />
<option name="NUM_POSTFIXES" value="" />
<option name="HAS_BRACES" value="true" />
<option name="HAS_BRACKETS" value="true" />
<option name="HAS_PARENS" value="true" />
<option name="HAS_STRING_ESCAPES" value="true" />
</options>
<keywords keywords="2D;3D;Color;Cube;Float;Int;Range;Vector;appdata_base;appdata_full;appdata_img;appdata_tan;bool;fixed;fixed1x1;fixed1x2;fixed1x3;fixed1x4;fixed2;fixed2x1;fixed2x2;fixed2x3;fixed2x4;fixed3;fixed3x1;fixed3x2;fixed3x3;fixed3x4;fixed4;fixed4x1;fixed4x2;fixed4x3;fixed4x4;float;float1x1;float1x2;float1x3;float1x4;float2;float2x1;float2x2;float2x3;float2x4;float3;float3x1;float3x2;float3x3;float3x4;float4;float4x1;float4x2;float4x3;float4x4;half;half1x1;half1x2;half1x3;half1x4;half2;half2x1;half2x2;half2x3;half2x4;half3;half3x1;half3x2;half3x3;half3x4;half4;half4x1;half4x2;half4x3;half4x4;int;int1x1;int1x2;int1x3;int1x4;int2;int2x1;int2x2;int2x3;int2x4;int3;int3x1;int3x2;int3x3;int3x4;int4;int4x1;int4x2;int4x3;int4x4;sampler1D;sampler2D;sampler3D;samplerCUBE;samplerRECT" ignore_case="false" />
<keywords2 keywords="Category;Fallback;GrabPass;Pass;Properties;Shader;SubShader;UsePass;break;case;catch;const;continue;default;do;else;extern;for;goto;if;in;inline;inout;out;return;static;struct;switch;throw;try;uniform;varying;while" />
<keywords3 keywords="#include;#pragma;Blend;COLOR;COLOR0;COLOR1;COLOR2;COLOR3;COLOR4;COLOR5;COLOR6;COLOR7;ColorMask;CommonState;Cull;CustomEditor;Gamma;HDR;Header;HideInInspector;NORMAL;NoScaleOffset;Normal;Offset;POSITION;Passdef;PerRendererData;SV_Depth;SV_POSITION;SV_Target;SV_Target1;SV_Target2;SV_Target3;SV_Target4;SV_Target5;SV_Target6;SV_Target7;SV_VertexID;Space;TANGENT;TEXCOORD0;TEXCOORD1;TEXCOORD2;TEXCOORD3;TEXCOORD4;TEXCOORD5;TEXCOORD6;TEXCOORD7;Tags;UNITY_LIGHTMODEL_AMBIENT;UNITY_MATRIX_IT_MV;UNITY_MATRIX_MV;UNITY_MATRIX_MVP;UNITY_MATRIX_P;UNITY_MATRIX_T_MV;UNITY_MATRIX_V;UNITY_MATRIX_VP;UNITY_PI;VFACE;VPOS;ZTest;ZWrite;_CosTime;_LightColor;_LightColor0;_LightMatrix0;_Object2World;_ProjectionParams;_ScreenParams;_SinTime;_Time;_World2Object;_WorldSpaceCameraPos;_WorldSpaceLightPos0;_ZBufferParams;unity_4LightAtten0;unity_4LightPosX0;unity_4LightPosY0;unity_4LightPosZ0;unity_AmbientEquator;unity_AmbientGround;unity_AmbientSky;unity_CameraInvProjection;unity_CameraProjection;unity_CameraWorldClipPlanes;unity_DeltaTime;unity_FogColor;unity_FogParams;unity_LODFade;unity_LightAtten;unity_LightColor;unity_LightPosition;unity_OrthoParams;unity_SpotDirection" />
<keywords4 keywords="#elif;#else;#elseif;#endif;#if;#ifdef;CBUFFER_END;CBUFFER_START;CGPROGRAM;ENDCG;SHADER_API_D3D11;SHADER_API_D3D11_9X;SHADER_API_D3D9;SHADER_API_GLCORE;SHADER_API_GLES;SHADER_API_GLES3;SHADER_API_METAL;SHADER_API_MOBILE;SHADER_API_OPENGL;SHADER_API_PSP2;SHADER_API_PSSL;SHADER_API_WIIU;SHADER_API_XBOX360;SHADER_API_XBOXONE;SHADER_TARGET;SHADER_TARGET_GLSL;UNITY_ATTEN_CHANNEL;UNITY_BRANCH;UNITY_CAN_COMPILE_TESSELLATION;UNITY_COMPILER_CG;UNITY_COMPILER_HLSL;UNITY_COMPILER_HLSL2GLSL;UNITY_DECLARE_SHADOWMAP;UNITY_DECLARE_TEX2D;UNITY_DECLARE_TEX2DARRAY;UNITY_DECLARE_TEX2D_NOSAMPLER;UNITY_FLATTEN;UNITY_FRAMEBUFFER_FETCH_AVAILABLE;UNITY_HALF_TEXEL_OFFSET;UNITY_INITIALIZE_OUTPUT;UNITY_MIGHT_NOT_HAVE_DEPTH_Texture;UNITY_NEAR_CLIP_VALUE;UNITY_NO_DXT5nm;UNITY_NO_LINEAR_COLORSPACE;UNITY_NO_RGBM;UNITY_NO_SCREENSPACE_SHADOWS;UNITY_PASS_DEFERRED;UNITY_PASS_FORWARDADD;UNITY_PASS_FORWARDBASE;UNITY_PASS_PREPASSBASE;UNITY_PASS_PREPASSFINAL;UNITY_PASS_SHADOWCASTER;UNITY_PROJ_COORD;UNITY_SAMPLE_SHADOW;UNITY_SAMPLE_SHADOW_PROJ;UNITY_SAMPLE_TEX2D;UNITY_SAMPLE_TEX2DARRAY;UNITY_SAMPLE_TEX2DARRAY_LOD;UNITY_SAMPLE_TEX2D_SAMPLER;UNITY_USE_RGBA_FOR_POINT_SHADOWS;UNITY_UV_STARTS_AT_TOP;UNITY_VERSION;UNITY_VPOS_TYPE" />
</highlighting>
<extensionMap>
<mapping ext="cginc" />
<mapping ext="shader" />
</extensionMap>
</filetype>
@Borod4r
Copy link
Author

Borod4r commented Oct 24, 2016

To enable syntax highlight for unity shaders in Project Rider, download this file and put it into your "filetypes" folder.

Windows Vista, 7, 8, 10:
<SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.Rider10\config\filetypes

Mac OS X:
~/Library/Preferences/Rider10/config/filetypes

Linux:
~/.Rider10/config/filetypes

croppercapture 20

@GeneralD
Copy link

GeneralD commented Nov 7, 2016

On Mac, works well with following path.
~/Library/Preferences/Rider10/filetypes

@bbeaumont
Copy link

bbeaumont commented Nov 17, 2016

I've added cginc as an extension type:

<extensionMap>
    <mapping ext="shader" />
    <mapping ext="cginc" />
  </extensionMap>

@Borod4r
Copy link
Author

Borod4r commented Apr 29, 2017

@bbeaumont, thanks for catching this! Added cginc to the exetension map.

@telamonian
Copy link

For the latest version of rider on Mac, the path for the syntax highlighting .xml has changed to:

~/Library/Preferences/Rider2017.1/filetypes

@dimmduh
Copy link

dimmduh commented Aug 17, 2018

Thx!
Now rider support shaderlab highlighting out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment