aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-04-22 02:08:25 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-04-22 02:08:25 +0300
commit499e0a03bb41e2330a47ccca83e6e6dfe7c5a634 (patch)
tree5d5d7866e33c1ae8a55cfa67be65848a25be7ab4 /Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense
parent97a784b6ce43960bdb92465b08f26d3562a4f202 (diff)
downloadTango-499e0a03bb41e2330a47ccca83e6e6dfe7c5a634.tar.gz
Tango-499e0a03bb41e2330a47ccca83e6e6dfe7c5a634.zip
Scripting.
Diffstat (limited to 'Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense')
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/EventCompletionItem.cs22
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownType.cs24
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownTypeEvent.cs21
3 files changed, 65 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/EventCompletionItem.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/EventCompletionItem.cs
new file mode 100644
index 000000000..5c510c39f
--- /dev/null
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/EventCompletionItem.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
+
+namespace Tango.Scripting.Editors.Intellisense
+{
+ public class EventCompletionItem : CompletionItem
+ {
+ private static BitmapSource image = GetImage("event.png");
+
+ public override string Text => Name;
+ public override CompletionItemPopupControl PopupControl => new FieldCompletionItemPopup();
+ public override BitmapSource Image => image;
+
+ public String Name { get; set; }
+ public String Class { get; set; }
+ public String Type { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownType.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownType.cs
index 6675eb582..3dc465541 100644
--- a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownType.cs
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownType.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Forms;
using System.Xml;
using Tango.Core;
@@ -15,15 +16,17 @@ namespace Tango.Scripting.Editors.Intellisense
{
private bool _initialized;
+ public String Alias { get; set; }
public bool DocumentationLoaded { get; set; }
public Type Type { get; private set; }
- public String Name { get; private set; }
+ public String Name { get; set; }
public String TypeDefinition { get; private set; }
public String FriendlyName { get; private set; }
public String Summary { get; set; }
public List<KnownTypeConstructor> Constructors { get; set; }
public List<KnownTypeMethod> Methods { get; set; }
public List<KnownTypeProperty> Properties { get; set; }
+ public List<KnownTypeEvent> Events { get; set; }
public List<KnownTypeMember> Members
{
get
@@ -32,6 +35,7 @@ namespace Tango.Scripting.Editors.Intellisense
members.AddRange(Properties);
members.AddRange(Methods);
+ members.AddRange(Events);
return members.OrderBy(x => x.Name).ToList();
}
@@ -45,6 +49,7 @@ namespace Tango.Scripting.Editors.Intellisense
Methods = new List<KnownTypeMethod>();
Properties = new List<KnownTypeProperty>();
Fields = new List<KnownTypeField>();
+ Events = new List<KnownTypeEvent>();
Type = type;
Name = type.Name;
@@ -177,7 +182,7 @@ namespace Tango.Scripting.Editors.Intellisense
//Load Properties
{
- var properties = Type.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPublic).ToList();
+ var properties = Type.GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance).ToList();
for (int i = 0; i < properties.Count; i++)
{
@@ -192,6 +197,21 @@ namespace Tango.Scripting.Editors.Intellisense
}
}
+ //Load Events
+ {
+ var events = Type.GetRuntimeEvents().ToList();
+
+ for (int i = 0; i < events.Count; i++)
+ {
+ var ev = events[i];
+
+ KnownTypeEvent p = new KnownTypeEvent(this);
+ p.Name = ev.Name;
+
+ Events.Add(p);
+ }
+ }
+
//Load Enum Values
{
if (Type.IsEnum)
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownTypeEvent.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownTypeEvent.cs
new file mode 100644
index 000000000..7403d2cbd
--- /dev/null
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/KnownTypeEvent.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Scripting.Editors.Intellisense
+{
+ public class KnownTypeEvent : KnownTypeMember
+ {
+ public KnownTypeEvent()
+ {
+ Summary = "Loading documentation...";
+ }
+
+ public KnownTypeEvent(KnownType knownType) : this()
+ {
+ Type = knownType;
+ }
+ }
+}