display icon for type kinds
This commit is contained in:
@@ -443,6 +443,10 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
{
|
||||
var symbolKindString = CollectionExtensions.GetValueOrDefault(completionItem.Properties, "SymbolKind");
|
||||
var symbolKind = symbolKindString is null ? null : (SymbolKind?)int.Parse(symbolKindString);
|
||||
var typeKindString = completionItem.Tags[0];
|
||||
var accessibilityModifierString = completionItem.Tags.Skip(1).FirstOrDefault(); // accessibility is not always supplied
|
||||
TypeKind? typeKind = Enum.TryParse<TypeKind>(typeKindString, out var tk) ? tk : null;
|
||||
Accessibility? accessibilityModifier = Enum.TryParse<Accessibility>(accessibilityModifierString, out var am) ? am : null;
|
||||
var godotCompletionType = symbolKind switch
|
||||
{
|
||||
SymbolKind.Method => CodeCompletionKind.Function,
|
||||
@@ -452,7 +456,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
SymbolKind.Field => CodeCompletionKind.Member,
|
||||
_ => CodeCompletionKind.PlainText
|
||||
};
|
||||
var icon = GetIconForSymbolKind(symbolKind);
|
||||
var icon = GetIconForCompletion(symbolKind, typeKind, accessibilityModifier);
|
||||
AddCodeCompletionOption(godotCompletionType, completionItem.DisplayText, completionItem.DisplayText, icon: icon, value: new RefCountedContainer<CompletionItem>(completionItem));
|
||||
}
|
||||
// partially working - displays menu only when caret is what CodeEdit determines as valid
|
||||
|
||||
@@ -7,13 +7,15 @@ public partial class SharpIdeCodeEdit
|
||||
{
|
||||
private readonly Texture2D _csharpMethodIcon = ResourceLoader.Load<Texture2D>("uid://b17p18ijhvsep");
|
||||
private readonly Texture2D _csharpClassIcon = ResourceLoader.Load<Texture2D>("uid://b027uufaewitj");
|
||||
private readonly Texture2D _csharpInterfaceIcon = ResourceLoader.Load<Texture2D>("uid://bdwmkdweqvowt");
|
||||
|
||||
private Texture2D? GetIconForSymbolKind(SymbolKind? symbolKind)
|
||||
private Texture2D? GetIconForCompletion(SymbolKind? symbolKind, TypeKind? typeKind, Accessibility? accessibility)
|
||||
{
|
||||
var texture = symbolKind switch
|
||||
var texture = (symbolKind, typeKind, accessibility) switch
|
||||
{
|
||||
SymbolKind.Method => _csharpMethodIcon,
|
||||
SymbolKind.NamedType => _csharpClassIcon,
|
||||
(SymbolKind.Method, _, _) => _csharpMethodIcon,
|
||||
(SymbolKind.NamedType, TypeKind.Interface, _) => _csharpInterfaceIcon,
|
||||
(SymbolKind.NamedType, _, _) => _csharpClassIcon,
|
||||
//SymbolKind.Local => ,
|
||||
//SymbolKind.Property => ,
|
||||
//SymbolKind.Field => ,
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
|
||||
<svg
|
||||
height="800px"
|
||||
width="800px"
|
||||
version="1.1"
|
||||
id="Capa_1"
|
||||
viewBox="0 0 525.325 525.325"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="interface-icon.svg"
|
||||
inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs1" /><sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:zoom="1.031492"
|
||||
inkscape:cx="59.137637"
|
||||
inkscape:cy="460.01326"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1369"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g1" />
|
||||
<g
|
||||
id="g1"
|
||||
transform="matrix(1.0007541,0,0,0.96334492,-0.19807395,9.6729914)">
|
||||
|
||||
<path
|
||||
style="fill:none;stroke:#55aef1;stroke-width:26.7512;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
|
||||
d="M 125.57295,262.61572 H 270.53639"
|
||||
id="path3" /><ellipse
|
||||
style="fill:#25324d;stroke:#55aef1;stroke-width:23.5209;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1"
|
||||
id="path1"
|
||||
cx="71.390305"
|
||||
cy="262.61572"
|
||||
rx="54.182652"
|
||||
ry="56.286709" /><ellipse
|
||||
style="fill:#25324d;stroke:#55aef1;stroke-width:26.7512;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1"
|
||||
id="path2"
|
||||
cx="386.81247"
|
||||
cy="262.61572"
|
||||
rx="116.27608"
|
||||
ry="120.79138" /></g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bdwmkdweqvowt"
|
||||
path="res://.godot/imported/interface-icon.svg-1e415258a2c18b1738f926a403e84537.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Features/Completions/Resources/interface-icon.svg"
|
||||
dest_files=["res://.godot/imported/interface-icon.svg-1e415258a2c18b1738f926a403e84537.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=0.1
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
Reference in New Issue
Block a user