aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-22 14:10:42 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-22 14:10:42 +0200
commit8c658845bdf60c9864d1c968b9420d40a789ca9d (patch)
tree538625ca74648b457403c69d634b354975839a4e /Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs
parent28f37792757709f1db89e6f5640ba3f7aa9f9069 (diff)
downloadTango-8c658845bdf60c9864d1c968b9420d40a789ca9d.tar.gz
Tango-8c658845bdf60c9864d1c968b9420d40a789ca9d.zip
Improved Stubs.UI.
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs')
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs51
1 files changed, 33 insertions, 18 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs
index e6d17a4b5..6327196bc 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs
@@ -23,6 +23,7 @@ using System.Windows.Shapes;
using System.Windows.Threading;
using System.Xml;
using Tango.Core.Commands;
+using Tango.Scripting;
using Tango.SharedUI;
using Tango.SharedUI.Helpers;
@@ -168,31 +169,33 @@ namespace Tango.SharedUI.Controls
List<KeyValuePair<String, Type>> types = new List<KeyValuePair<String, Type>>();
- types.Add(new KeyValuePair<string, Type>("Thread", typeof(Thread)));
- types.Add(new KeyValuePair<string, Type>("DateTime", typeof(DateTime)));
- types.Add(new KeyValuePair<string, Type>("TimeSpan", typeof(TimeSpan)));
- types.Add(new KeyValuePair<string, Type>("Dispatcher", typeof(Dispatcher)));
- types.Add(new KeyValuePair<string, Type>("Task", typeof(Task)));
- types.Add(new KeyValuePair<string, Type>("List", typeof(IList<Object>)));
- types.Add(new KeyValuePair<string, Type>("int", typeof(Int32)));
- types.Add(new KeyValuePair<string, Type>("double", typeof(Double)));
- types.Add(new KeyValuePair<string, Type>("String", typeof(String)));
- types.Add(new KeyValuePair<string, Type>("string", typeof(String)));
+ types.AddRange(IntellisenseTypes);
- if (HighlightTypes != null)
+
+ if (IntellisenseTypes != null)
{
- foreach (var t in HighlightTypes)
+ ScriptParser parser = new ScriptParser();
+
+ try
{
- types.Add(new KeyValuePair<string, Type>(t.Key.ToCamelCase(), t.Value));
+ var variables = parser.ParseScript(textEditor.Text);
+
+ foreach (var v in variables)
+ {
+ var hT = IntellisenseTypes.SingleOrDefault(x => x.Value.Name == v.Type);
+
+ if (hT.Value != null)
+ {
+ types.Add(new KeyValuePair<string, Type>(v.Name, hT.Value));
+ }
+ }
+
}
+ catch { }
}
- KeyValuePair<String, Type> type = types.SingleOrDefault(x => keyword == x.Key);
+ KeyValuePair<String, Type> type = types.LastOrDefault(x => keyword == x.Key);
- if (type.Key == null)
- {
- type = types.OrderBy(x => keyword.CompareSimilarity(x.Key)).LastOrDefault();
- }
if (type.Key != null)
{
ok = true;
@@ -349,6 +352,18 @@ namespace Tango.SharedUI.Controls
public static readonly DependencyProperty HighlightTypesProperty =
DependencyProperty.Register("HighlightTypes", typeof(ObservableCollection<KeyValuePair<string, Type>>), typeof(ScriptEditorControl), new PropertyMetadata(null));
+ /// <summary>
+ /// Gets or sets the intellisense types.
+ /// </summary>
+ public ObservableCollection<KeyValuePair<String,Type>> IntellisenseTypes
+ {
+ get { return (ObservableCollection<KeyValuePair<String,Type>>)GetValue(IntellisenseTypesProperty); }
+ set { SetValue(IntellisenseTypesProperty, value); }
+ }
+ public static readonly DependencyProperty IntellisenseTypesProperty =
+ DependencyProperty.Register("IntellisenseTypes", typeof(ObservableCollection<KeyValuePair<String,Type>>), typeof(ScriptEditorControl), new PropertyMetadata(null));
+
+
#endregion
#region Virtual Methods