aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/Tango.Scripting.Editors
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
parent97a784b6ce43960bdb92465b08f26d3562a4f202 (diff)
downloadTango-499e0a03bb41e2330a47ccca83e6e6dfe7c5a634.tar.gz
Tango-499e0a03bb41e2330a47ccca83e6e6dfe7c5a634.zip
Scripting.
Diffstat (limited to 'Software/Visual_Studio/Scripting/Tango.Scripting.Editors')
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Editors/CachedUsing.cs20
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Images/event.pngbin0 -> 210 bytes
-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
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs330
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj8
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Themes/Generic.xaml3
8 files changed, 354 insertions, 74 deletions
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/CachedUsing.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/CachedUsing.cs
new file mode 100644
index 000000000..4a663bee9
--- /dev/null
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/CachedUsing.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Scripting.Editors.Intellisense;
+
+namespace Tango.Scripting.Editors
+{
+ public class CachedUsing
+ {
+ public String Namespace { get; set; }
+ public List<KnownType> KnownTypes { get; set; }
+
+ public CachedUsing()
+ {
+ KnownTypes = new List<KnownType>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Images/event.png b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Images/event.png
new file mode 100644
index 000000000..4566835c0
--- /dev/null
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Images/event.png
Binary files differ
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;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs
index a4493d2c4..29af14ddc 100644
--- a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs
@@ -59,10 +59,14 @@ namespace Tango.Scripting.Editors
private static Dictionary<Type, KnownType> _knownTypesCache;
private static String KNOWN_TYPES_CACHE_FOLDER;
private static List<CachedAssembly> _cachedAssemblies;
+ private static List<CachedUsing> _cachedUsings;
private static bool _isLoadingCachedAssemblies;
private static bool _isCacheAssembliesLoaded;
+ private static object _loadUsingsLock = new object();
- public static event EventHandler<TangoProgressChangedEventArgs<int>> AssemblyCacheProgress;
+ public static event EventHandler<TangoProgressChangedEventArgs<int>> LoadingSymbolsProgress;
+ public static event EventHandler LoadingSymbolsStarted;
+ public static event EventHandler LoadingSymbolsCompleted;
#region Mini Classes
@@ -96,6 +100,8 @@ namespace Tango.Scripting.Editors
#region Properties
+ public static List<String> BlockedUsingsCache { get; set; }
+
/// <summary>
/// Gets or sets a value indicating whether to enable folding.
/// </summary>
@@ -164,6 +170,8 @@ namespace Tango.Scripting.Editors
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ScriptEditor), new FrameworkPropertyMetadata(typeof(ScriptEditor)));
+ BlockedUsingsCache = new List<string>();
+
if (KNOWN_TYPES_CACHE_FOLDER == null)
{
KNOWN_TYPES_CACHE_FOLDER = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Scripting", "Cache");
@@ -178,6 +186,7 @@ namespace Tango.Scripting.Editors
_knownTypesCache = new Dictionary<Type, KnownType>();
_cachedAssemblies = new List<CachedAssembly>();
+ _cachedUsings = new List<CachedUsing>();
}
/// <summary>
@@ -458,7 +467,17 @@ namespace Tango.Scripting.Editors
});
}
- foreach (var methodGroup in typeMembers.Where(x => x.GetType() != typeof(KnownTypeMethod)).GroupBy(x => x.Name))
+ foreach (var ev in typeMembers.OfType<KnownTypeEvent>())
+ {
+ data.Add(new EventCompletionItem()
+ {
+ Class = knownType.FriendlyName,
+ Name = ev.Name,
+ Description = ev.Summary,
+ });
+ }
+
+ foreach (var methodGroup in typeMembers.Where(x => x.GetType() != typeof(KnownTypeMethod) && x.GetType() != typeof(KnownTypeEvent)).GroupBy(x => x.Name))
{
var member = methodGroup.First();
@@ -469,7 +488,6 @@ namespace Tango.Scripting.Editors
Type = member.ReturnTypeFriendlyName,
Description = member.Summary,
});
-
}
}
else
@@ -558,7 +576,7 @@ namespace Tango.Scripting.Editors
{
//Maybe static ...
var typeText = GetPreviousWord();
- knownType = _knownTypes.FirstOrDefault(x => x.FriendlyName == typeText);
+ knownType = _knownTypes.FirstOrDefault(x => x.FriendlyName == typeText || x.Alias == typeText);
if (knownType != null)
{
@@ -902,7 +920,7 @@ namespace Tango.Scripting.Editors
IList<ICompletionData> data = completionWindow.CompletionList.CompletionData;
data.Clear();
- foreach (var item in suggestions)
+ foreach (var item in suggestions.DistinctBy(x => x.Text))
{
data.Add(item);
}
@@ -984,6 +1002,13 @@ namespace Tango.Scripting.Editors
{
if (expression != null)
{
+ var insideMethodExp = expression.Split('(').LastOrDefault();
+
+ if (insideMethodExp != null)
+ {
+ expression = insideMethodExp;
+ }
+
var tree = expression.Split('.').Select(x => x.Remove(@"\n|\t|\r|\(.*\)|\[.*\]|\s")).ToList();
var variableName = tree.FirstOrDefault();
@@ -1003,7 +1028,8 @@ namespace Tango.Scripting.Editors
if (variable != null)
{
- var knownType = _knownTypes.FirstOrDefault(x => x.FriendlyName == Regex.Replace(variable.Type, "<.+>", "<T>"));
+ var name = Regex.Replace(variable.Type, "<.+>", "<T>");
+ var knownType = _knownTypes.FirstOrDefault(x => name == x.FriendlyName || name == x.Alias);
if (knownType != null)
{
@@ -1036,6 +1062,13 @@ namespace Tango.Scripting.Editors
if (expression != null)
{
+ var insideMethodExp = expression.Split('(').LastOrDefault();
+
+ if (insideMethodExp != null)
+ {
+ expression = insideMethodExp;
+ }
+
var tree = expression.Split('.').Select(x => x.Remove(@"\n|\t|\r|\(.*\)|\[.*\]|\s")).ToList();
var variableName = tree.FirstOrDefault();
@@ -1250,83 +1283,223 @@ namespace Tango.Scripting.Editors
return popup;
}
- public static void LoadCachedAssemblies(List<Assembly> assemblies)
+ public static void LoadUsingsSymbols(List<Assembly> assemblies, List<String> usings)
{
- if (_isLoadingCachedAssemblies) return;
+ lock (_loadUsingsLock)
+ {
+ LoadingSymbolsStarted?.Invoke(null, new EventArgs());
- _isLoadingCachedAssemblies = true;
+ var allTypes = assemblies.SelectMany(x => x.GetTypes());
- if (!_isCacheAssembliesLoaded)
- {
- foreach (var file in System.IO.Directory.GetFiles(KNOWN_TYPES_CACHE_FOLDER))
+ foreach (var use in usings)
{
- try
+ if (!_cachedUsings.Exists(x => x.Namespace == use))
{
- AssemblyCacheProgress?.Invoke(null, new TangoProgressChangedEventArgs<int>()
+ var useFileName = System.IO.Path.Combine(KNOWN_TYPES_CACHE_FOLDER, use + ".json");
+
+ if (File.Exists(useFileName))
{
- Progress = new TangoProgress<int>()
+ LoadingSymbolsProgress?.Invoke(null, new TangoProgressChangedEventArgs<int>()
+ {
+ Progress = new TangoProgress<int>()
+ {
+ IsIndeterminate = true,
+ Maximum = 100,
+ Message = $"Loading symbols for '{use}'..."
+ }
+ });
+
+ CachedUsing cached = JsonConvert.DeserializeObject<CachedUsing>(File.ReadAllText(useFileName), _jsonSettings);
+ _cachedUsings.Add(cached);
+ foreach (var knownType in cached.KnownTypes)
{
- IsIndeterminate = true,
- Maximum = 100,
- Message = $"Loading metadata cache for '{System.IO.Path.GetFileName(file)}'..."
+ _knownTypesCache.Add(knownType.Type, knownType);
}
- });
- var cachedAssembly = JsonConvert.DeserializeObject<CachedAssembly>(System.IO.File.ReadAllText(file), _jsonSettings);
+ continue;
+ }
+
+ var useTypes = allTypes.Where(x => x.IsVisible && x.IsPublic && x.Namespace == use).ToList();
- foreach (var knownType in cachedAssembly.KnownTypes)
+ CachedUsing cachedUsing = new CachedUsing();
+ cachedUsing.Namespace = use;
+ _cachedUsings.Add(cachedUsing);
+
+ int i = 1;
+
+ foreach (var type in useTypes)
{
- _knownTypesCache.Add(knownType.Type, knownType);
+ LoadingSymbolsProgress?.Invoke(null, new TangoProgressChangedEventArgs<int>()
+ {
+ Progress = new TangoProgress<int>()
+ {
+ IsIndeterminate = false,
+ Maximum = useTypes.Count,
+ Value = i++,
+ Message = $"Loading symbols for '{use}'..."
+ }
+ });
+
+ KnownType knownType = new KnownType(type);
+
+ if (type.IsPrimitive)
+ {
+ if (type == typeof(Int32))
+ {
+ knownType.Alias = "int";
+ }
+ else if (type == typeof(float))
+ {
+ knownType.Alias = "float";
+ }
+ else if (type == typeof(Double))
+ {
+ knownType.Alias = "double";
+ }
+ else if (type == typeof(long))
+ {
+ knownType.Alias = "long";
+ }
+ else if (type == typeof(bool))
+ {
+ knownType.Alias = "bool";
+ }
+ else if (type == typeof(uint))
+ {
+ knownType.Alias = "uint";
+ }
+ }
+
+ _knownTypesCache.Add(type, knownType);
+ cachedUsing.KnownTypes.Add(knownType);
+ knownType.LoadDocumentation();
}
- _cachedAssemblies.Add(cachedAssembly);
+ if (!BlockedUsingsCache.Exists(x => x == use))
+ {
+ Task.Factory.StartNew(() =>
+ {
+ var json = JsonConvert.SerializeObject(cachedUsing, _jsonSettings);
+ File.WriteAllText(useFileName, json);
+ });
+ }
}
- catch { }
}
- _isCacheAssembliesLoaded = true;
+ LoadingSymbolsCompleted?.Invoke(null, new EventArgs());
}
+ }
- foreach (var asm in assemblies)
- {
- if (!_cachedAssemblies.Exists(x => x.Name == asm.FullName))
- {
- String asmFileName = System.IO.Path.GetFileName(asm.Location);
+ //public static void LoadCachedAssemblies(List<Assembly> assemblies, List<String> usings = null)
+ //{
+ // if (_isLoadingCachedAssemblies) return;
- CachedAssembly cachedAssembly = new CachedAssembly();
- cachedAssembly.Name = asm.FullName;
- _cachedAssemblies.Add(cachedAssembly);
+ // _isLoadingCachedAssemblies = true;
- var types = asm.GetTypes().Where(x => x.IsVisible && x.IsPublic && !x.IsPrimitive).ToList();
+ // LoadingSymbolsStarted?.Invoke(null, new EventArgs());
- int i = 0;
+ // if (!_isCacheAssembliesLoaded)
+ // {
+ // foreach (var file in System.IO.Directory.GetFiles(KNOWN_TYPES_CACHE_FOLDER))
+ // {
+ // try
+ // {
+ // LoadingSymbolsProgress?.Invoke(null, new TangoProgressChangedEventArgs<int>()
+ // {
+ // Progress = new TangoProgress<int>()
+ // {
+ // IsIndeterminate = true,
+ // Maximum = 100,
+ // Message = $"Loading metadata cache for '{System.IO.Path.GetFileName(file)}'..."
+ // }
+ // });
- foreach (var type in types)
- {
- AssemblyCacheProgress?.Invoke(null, new TangoProgressChangedEventArgs<int>()
- {
- Progress = new TangoProgress<int>()
- {
- IsIndeterminate = false,
- Maximum = types.Count,
- Value = i++,
- Message = $"Caching metadata for '{asmFileName}'..."
- }
- });
+ // var cachedAssembly = JsonConvert.DeserializeObject<CachedAssembly>(System.IO.File.ReadAllText(file), _jsonSettings);
- KnownType knownType = new KnownType(type);
- _knownTypesCache.Add(type, knownType);
- cachedAssembly.KnownTypes.Add(knownType);
- knownType.LoadDocumentation();
- }
+ // foreach (var knownType in cachedAssembly.KnownTypes)
+ // {
+ // _knownTypesCache.Add(knownType.Type, knownType);
+ // }
- String cachedAssemblyFile = System.IO.Path.Combine(KNOWN_TYPES_CACHE_FOLDER, asmFileName);
- File.WriteAllText(cachedAssemblyFile, JsonConvert.SerializeObject(cachedAssembly, _jsonSettings));
- }
- }
+ // _cachedAssemblies.Add(cachedAssembly);
+ // }
+ // catch { }
+ // }
- _isLoadingCachedAssemblies = false;
- }
+ // _isCacheAssembliesLoaded = true;
+ // }
+
+ // foreach (var asm in assemblies)
+ // {
+ // if (!_cachedAssemblies.Exists(x => x.Name == asm.FullName))
+ // {
+ // String asmFileName = System.IO.Path.GetFileName(asm.Location);
+
+ // CachedAssembly cachedAssembly = new CachedAssembly();
+ // cachedAssembly.Name = asm.FullName;
+ // _cachedAssemblies.Add(cachedAssembly);
+
+ // var types = asm.GetTypes().Where(x => x.IsVisible && x.IsPublic).ToList();
+
+ // int i = 0;
+
+ // foreach (var type in types)
+ // {
+ // LoadingSymbolsProgress?.Invoke(null, new TangoProgressChangedEventArgs<int>()
+ // {
+ // Progress = new TangoProgress<int>()
+ // {
+ // IsIndeterminate = false,
+ // Maximum = types.Count,
+ // Value = i++,
+ // Message = $"Caching metadata for '{asmFileName}'..."
+ // }
+ // });
+
+ // KnownType knownType = new KnownType(type);
+
+ // if (type.IsPrimitive)
+ // {
+ // if (type == typeof(Int32))
+ // {
+ // knownType.Alias = "int";
+ // }
+ // else if (type == typeof(float))
+ // {
+ // knownType.Alias = "float";
+ // }
+ // else if (type == typeof(Double))
+ // {
+ // knownType.Alias = "double";
+ // }
+ // else if (type == typeof(long))
+ // {
+ // knownType.Alias = "long";
+ // }
+ // else if (type == typeof(bool))
+ // {
+ // knownType.Alias = "bool";
+ // }
+ // else if (type == typeof(uint))
+ // {
+ // knownType.Alias = "uint";
+ // }
+ // }
+
+ // _knownTypesCache.Add(type, knownType);
+ // cachedAssembly.KnownTypes.Add(knownType);
+ // //knownType.LoadDocumentation();
+ // }
+
+ // String cachedAssemblyFile = System.IO.Path.Combine(KNOWN_TYPES_CACHE_FOLDER, asmFileName);
+ // File.WriteAllText(cachedAssemblyFile, JsonConvert.SerializeObject(cachedAssembly, _jsonSettings));
+ // }
+ // }
+
+ // LoadingSymbolsCompleted?.Invoke(null, new EventArgs());
+
+ // _isLoadingCachedAssemblies = false;
+ //}
private void InvalidateHighlighting(bool loadKnownTypes = true)
{
@@ -1339,22 +1512,19 @@ namespace Tango.Scripting.Editors
Thread t = new Thread(() =>
{
- LoadCachedAssemblies(assemblies);
+ LoadUsingsSymbols(assemblies, usings);
if (loadKnownTypes)
{
_knownTypes.Clear();
- foreach (var asm in assemblies)
+ foreach (var knownType in _knownTypesCache.ToList().Select(x => x.Value).ToList())
{
- foreach (var knownType in _knownTypesCache.ToList().Select(x => x.Value).ToList())
+ if (usings.Exists(x => knownType.Type.Namespace == x))
{
- if (usings.Exists(x => knownType.Type.Namespace == x))
+ lock (_knownTypes)
{
- lock (_knownTypes)
- {
- _knownTypes.Add(knownType);
- }
+ _knownTypes.Add(knownType);
}
}
}
@@ -1589,7 +1759,11 @@ namespace Tango.Scripting.Editors
private ConstructionSession GetConstructionSession()
{
- var expression = _parser.GetCurrentConstructionExpression(GetCurrentLineText());
+ var currentLine = GetCurrentLineText();
+
+ //if (currentLine.Count(x => x == '(') > 1) return null;
+
+ var expression = _parser.GetCurrentConstructionExpression(currentLine);
if (expression != null)
{
@@ -1693,7 +1867,14 @@ namespace Tango.Scripting.Editors
private MethodSession GetMethodSession()
{
- var words = GetCurrentLineText().Split(' ');
+ var currentLine = GetCurrentLineText();
+
+ if (currentLine.Count(x => x == '(') > 1)
+ {
+ currentLine = currentLine.Split('(')[currentLine.Split('(').Length - 2];
+ }
+
+ var words = currentLine.Split(' ');
if (words.Count() > 0 && (words.First() == "private" || words.First() == "public" || words.First() == "void"))
{
@@ -1811,14 +1992,21 @@ namespace Tango.Scripting.Editors
private DeclaredMethodSession GetDeclaredMethodSession()
{
- var words = GetCurrentLineText().Split(' ');
+ var currentLine = GetCurrentLineText();
+
+ if (currentLine.Count(x => x == '(') > 1)
+ {
+ currentLine = currentLine.Split('(')[currentLine.Split('(').Length - 2];
+ }
+
+ var words = currentLine.Split(' ');
if (words.Count() > 0 && (words.First() == "private" || words.First() == "public" || words.First() == "void"))
{
return null;
}
- var expression = GetPreviousWords().LastOrDefault();
+ var expression = currentLine;
if (expression != null)
{
@@ -1833,7 +2021,7 @@ namespace Tango.Scripting.Editors
if (variable != null)
{
- var declaredType = _declaredTypes.FirstOrDefault(x => x.Name == Regex.Replace(variable.Class, "<.+>", "<T>"));
+ var declaredType = _declaredTypes.FirstOrDefault(x => x.Name == Regex.Replace(variable.Type, "<.+>", "<T>"));
if (declaredType != null)
{
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj
index d6c89f0a4..cabacbc28 100644
--- a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj
@@ -181,6 +181,7 @@
</Compile>
<Compile Include="AvalonEditCommands.cs" />
<Compile Include="CachedAssembly.cs" />
+ <Compile Include="CachedUsing.cs" />
<Compile Include="CodeCompletion\CompletionListBox.cs" />
<Compile Include="CodeCompletion\CompletionListBoxItem.cs" />
<Compile Include="CodeCompletion\CompletionWindowBase.cs" />
@@ -201,6 +202,7 @@
<Compile Include="Intellisense\CompletionItemPopupControl.cs" />
<Compile Include="Intellisense\EnumCompletionItem.cs" />
<Compile Include="Intellisense\EnumCompletionItemPopup.cs" />
+ <Compile Include="Intellisense\EventCompletionItem.cs" />
<Compile Include="Intellisense\FieldCompletionItem.cs" />
<Compile Include="Intellisense\FieldCompletionItemPopup.cs" />
<Compile Include="Intellisense\ICompletionItem.cs" />
@@ -340,6 +342,7 @@
<Compile Include="Indentation\DefaultIndentationStrategy.cs" />
<Compile Include="Indentation\IIndentationStrategy.cs" />
<Compile Include="Intellisense\KnownTypeConstructor.cs" />
+ <Compile Include="Intellisense\KnownTypeEvent.cs" />
<Compile Include="Intellisense\KnownTypeField.cs" />
<Compile Include="Intellisense\KnownTypeMember.cs" />
<Compile Include="Intellisense\KnownTypeMethodParameter.cs" />
@@ -634,9 +637,12 @@
<Analyzer Include="..\..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
<Analyzer Include="..\..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\event.png" />
+ </ItemGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UseGlobalSettings="True" />
+ <UserProperties BuildVersion_UseGlobalSettings="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Themes/Generic.xaml b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Themes/Generic.xaml
index ce5cb39e1..6455b8fcb 100644
--- a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Themes/Generic.xaml
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Themes/Generic.xaml
@@ -47,6 +47,7 @@
<BitmapImage x:Key="namespace" UriSource="pack://application:,,,/Tango.Scripting.Editors;component/Images/namespace.png" />
<BitmapImage x:Key="method" UriSource="pack://application:,,,/Tango.Scripting.Editors;component/Images/method.png" />
<BitmapImage x:Key="property" UriSource="pack://application:,,,/Tango.Scripting.Editors;component/Images/property.png" />
+ <BitmapImage x:Key="event" UriSource="pack://application:,,,/Tango.Scripting.Editors;component/Images/event.png" />
<!--Converters-->
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
@@ -567,4 +568,6 @@
</Setter.Value>
</Setter>
</Style>
+
+
</ResourceDictionary>