mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
Fix highlighting name
This commit is contained in:
@@ -181,7 +181,7 @@ public class Plugin : IViewer
|
||||
Debug.WriteLine(resourceName);
|
||||
|
||||
var hlm = resourceName.Contains(".Syntax.Dark.") ? _hlmDark : _hlmLight;
|
||||
var ext = Path.GetFileNameWithoutExtension(resourceName);
|
||||
var ext = Path.GetFileNameWithoutExtension(resourceName.ToResourceDummyName());
|
||||
using var reader = new XmlTextReader(s);
|
||||
var xshd = HighlightingLoader.LoadXshd(reader);
|
||||
var highlightingDefinition = HighlightingLoader.Load(xshd, hlm);
|
||||
@@ -216,3 +216,35 @@ public class Plugin : IViewer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
file static class ResourceNameHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a resource name (using '.' as separators) into a dummy file path
|
||||
/// by replacing inner dots with backslashes, while preserving the file extension.
|
||||
///
|
||||
/// Example:
|
||||
/// Input: "Resources.Images.icon.png"
|
||||
/// Output: "Resources\Images\icon.png"
|
||||
///
|
||||
/// Input: "Assets.Sounds.music.background.mp3"
|
||||
/// Output: "Assets\Sounds\music\background.mp3"
|
||||
/// </summary>
|
||||
/// <param name="resourceName">The embedded resource name (excluding the default namespace).</param>
|
||||
/// <returns>A string representing the resource as a dummy file path.</returns>
|
||||
public static string ToResourceDummyName(this string resourceName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(resourceName))
|
||||
return resourceName;
|
||||
|
||||
int lastDotIndex = resourceName.LastIndexOf('.');
|
||||
if (lastDotIndex <= 0) // Either no dot or dot is at the beginning
|
||||
return resourceName;
|
||||
|
||||
// Replace dots before the extension with backslashes
|
||||
string pathWithoutExtension = resourceName.Substring(0, lastDotIndex).Replace('.', '\\');
|
||||
string extension = resourceName.Substring(lastDotIndex);
|
||||
|
||||
return pathWithoutExtension + extension;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<SyntaxDefinition name="HLSL" extensions=".hlsl">
|
||||
|
||||
<Environment>
|
||||
<Default color="Black" bgcolor="#FFFFFF"/>
|
||||
<Selection color="Black" bgcolor="#C3C3FF"/>
|
||||
<LineNumbers color="Gray" bgcolor="#FFFFFF"/>
|
||||
<CaretMarker color="#F0F0F1"/>
|
||||
<VRuler color="#E0E0E5"/>
|
||||
<FoldLine color="#A0A0A0" bgcolor="#FFFFFF"/>
|
||||
<FoldMarker color="Black" bgcolor="#FFFFFF"/>
|
||||
<SelectedFoldLine color="Black" bgcolor="#FFFFFF"/>
|
||||
<EOLMarkers color="#CACAD2"/>
|
||||
<SpaceMarkers color="#B6B6C0"/>
|
||||
<TabMarkers color="#B6B6C0"/>
|
||||
<InvalidLines color="#B6B6C0"/>
|
||||
</Environment>
|
||||
|
||||
<Properties>
|
||||
<Property name="LineComment" value="//"/>
|
||||
<Property name="BlockCommentBegin" value="/*"/>
|
||||
<Property name="BlockCommentEnd" value="*/"/>
|
||||
</Properties>
|
||||
|
||||
<Digits name="Number" color="Purple"/>
|
||||
|
||||
<RuleSets>
|
||||
<RuleSet ignorecase="false">
|
||||
<Delimiters>&<>~%^*()-+=!|\/{}[]:;"' , ?</Delimiters>
|
||||
|
||||
<!-- Comments -->
|
||||
<Span name="LineComment" stopateol="true" color="Green">
|
||||
<Begin>//</Begin>
|
||||
</Span>
|
||||
<Span name="BlockComment" stopateol="false" color="Green">
|
||||
<Begin>/*</Begin>
|
||||
<End>*/</End>
|
||||
</Span>
|
||||
|
||||
<!-- Strings -->
|
||||
<Span name="String" stopateol="false" color="Maroon">
|
||||
<Begin>"</Begin>
|
||||
<End>"</End>
|
||||
</Span>
|
||||
|
||||
<!-- Keywords -->
|
||||
<KeyWords name="Keywords" color="Blue" bold="true">
|
||||
<Key word="if"/>
|
||||
<Key word="else"/>
|
||||
<Key word="for"/>
|
||||
<Key word="while"/>
|
||||
<Key word="do"/>
|
||||
<Key word="break"/>
|
||||
<Key word="continue"/>
|
||||
<Key word="return"/>
|
||||
<Key word="discard"/>
|
||||
<Key word="struct"/>
|
||||
<Key word="cbuffer"/>
|
||||
<Key word="register"/>
|
||||
<Key word="sampler"/>
|
||||
<Key word="Texture2D"/>
|
||||
<Key word="Texture3D"/>
|
||||
<Key word="TextureCube"/>
|
||||
<Key word="SamplerState"/>
|
||||
<Key word="RWTexture2D"/>
|
||||
</KeyWords>
|
||||
|
||||
<!-- Types -->
|
||||
<KeyWords name="Types" color="Teal">
|
||||
<Key word="float"/>
|
||||
<Key word="float2"/>
|
||||
<Key word="float3"/>
|
||||
<Key word="float4"/>
|
||||
<Key word="float4x4"/>
|
||||
<Key word="int"/>
|
||||
<Key word="int2"/>
|
||||
<Key word="int3"/>
|
||||
<Key word="int4"/>
|
||||
<Key word="bool"/>
|
||||
<Key word="bool2"/>
|
||||
<Key word="bool3"/>
|
||||
<Key word="bool4"/>
|
||||
<Key word="uint"/>
|
||||
<Key word="half"/>
|
||||
<Key word="min16float"/>
|
||||
</KeyWords>
|
||||
|
||||
</RuleSet>
|
||||
</RuleSets>
|
||||
</SyntaxDefinition>
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<SyntaxDefinition name="JavaScript" extensions=".js;.jsx;.mjs;.cjs">
|
||||
<SyntaxDefinition name="JavaScript" extensions=".js;.jsx;.mjs;.cjs;">
|
||||
|
||||
<Environment>
|
||||
<Default color="Black" bgcolor="#FFFFFF"/>
|
||||
|
@@ -1,15 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
HTML syntax highlighting
|
||||
Written by Ezra Altahan
|
||||
25/10/2016
|
||||
Version 1.0
|
||||
|
||||
hello@exr.be
|
||||
https://github.com/ei
|
||||
-->
|
||||
|
||||
<SyntaxDefinition name="HTML" extensions=".html;.htm;.xhtml;.shtml;.shtm;.xht;.hta">
|
||||
|
||||
<Environment>
|
||||
|
Reference in New Issue
Block a user