aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-02-17 01:49:14 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-02-17 01:49:14 +0200
commite2a5664b9425953e33b39c21dab8d5c24adfa78f (patch)
treefd2ba7df2f8f52706aaa8183e5cf1c5dc5c8cc03 /Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors
parent497c38292a1dda9b873f12336b5bbbe4a33c74d6 (diff)
downloadTango-e2a5664b9425953e33b39c21dab8d5c24adfa78f.tar.gz
Tango-e2a5664b9425953e33b39c21dab8d5c24adfa78f.zip
Some work on scripting engine...
Diffstat (limited to 'Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors')
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionList.cs2
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBox.cs11
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBoxItem.cs59
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindow.cs87
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindowBase.cs96
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/HighlightingColorizer.cs2
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/OffsetColorizer.cs39
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/Resources/CSharp-Mode.xshd37
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubclass.gifbin0 -> 290 bytes
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubevent.gifbin0 -> 365 bytes
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubmethod.gifbin0 -> 599 bytes
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubproperty.gifbin0 -> 435 bytes
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Rendering/TextView.cs4
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/ScriptEditor.cs571
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj82
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Themes/Generic.xaml107
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/app.config79
-rw-r--r--Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/packages.config43
19 files changed, 1037 insertions, 184 deletions
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionList.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionList.cs
index a50b82463..ea6e1856f 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionList.cs
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionList.cs
@@ -218,7 +218,7 @@ namespace Tango.Scripting.Editors.CodeCompletion
/// <summary>
/// Filters CompletionList items to show only those matching given query, and selects the best match.
/// </summary>
- void SelectItemFiltering(string query)
+ public void SelectItemFiltering(string query)
{
// if the user just typed one more character, don't filter all data but just filter what we are already displaying
var listToFilter = (this.currentList != null && (!string.IsNullOrEmpty(this.currentText)) && (!string.IsNullOrEmpty(query)) &&
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBox.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBox.cs
index f515c955c..235c07304 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBox.cs
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBox.cs
@@ -26,7 +26,9 @@ namespace Tango.Scripting.Editors.CodeCompletion
Border border = this.GetVisualChild(0) as Border;
if (border != null)
scrollViewer = border.Child as ScrollViewer;
- }
+ scrollViewer.BorderThickness = new Thickness(0);
+
+ }
}
/// <summary>
@@ -92,5 +94,10 @@ namespace Tango.Scripting.Editors.CodeCompletion
{
this.FirstVisibleItem = index - VisibleItemCount / 2;
}
- }
+
+ protected override DependencyObject GetContainerForItemOverride()
+ {
+ return new CompletionListBoxItem();
+ }
+ }
}
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBoxItem.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBoxItem.cs
new file mode 100644
index 000000000..bb6acf69e
--- /dev/null
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionListBoxItem.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace Tango.Scripting.Editors.CodeCompletion
+{
+ public class CompletionListBoxItem : ListBoxItem
+ {
+ public ToolTip toolTip;
+
+ public DataTemplate ToolTipContentTemplate
+ {
+ get { return (DataTemplate)GetValue(ToolTipContentTemplateProperty); }
+ set { SetValue(ToolTipContentTemplateProperty, value); }
+ }
+ public static readonly DependencyProperty ToolTipContentTemplateProperty =
+ DependencyProperty.Register("ToolTipContentTemplate", typeof(DataTemplate), typeof(CompletionListBoxItem), new PropertyMetadata(null));
+
+ public CompletionListBoxItem()
+ {
+ toolTip = new ToolTip();
+ toolTip.PlacementTarget = this;
+ toolTip.HorizontalOffset = 15;
+ toolTip.Background = Brushes.Transparent;
+ toolTip.BorderThickness = new Thickness(0);
+ toolTip.Opacity = 1;
+ toolTip.HasDropShadow = true;
+ toolTip.Placement = System.Windows.Controls.Primitives.PlacementMode.Right;
+ this.Unloaded += CompletionListBoxItem_Unloaded;
+ }
+
+ private void CompletionListBoxItem_Unloaded(object sender, RoutedEventArgs e)
+ {
+ toolTip.StaysOpen = false;
+ toolTip.IsOpen = false;
+ }
+
+ protected override void OnSelected(RoutedEventArgs e)
+ {
+ base.OnSelected(e);
+ toolTip.Content = DataContext;
+ toolTip.ContentTemplate = ToolTipContentTemplate;
+ toolTip.StaysOpen = true;
+ toolTip.IsOpen = true;
+ }
+
+ protected override void OnUnselected(RoutedEventArgs e)
+ {
+ base.OnUnselected(e);
+ toolTip.StaysOpen = false;
+ toolTip.IsOpen = false;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindow.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindow.cs
index 44621df72..0e8cd781d 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindow.cs
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindow.cs
@@ -21,7 +21,8 @@ namespace Tango.Scripting.Editors.CodeCompletion
public class CompletionWindow : CompletionWindowBase
{
readonly CompletionList completionList = new CompletionList();
- ToolTip toolTip = new ToolTip();
+
+ public event Action<ICompletionData> InsertionRequest;
/// <summary>
/// Gets the completion list used in this completion window.
@@ -36,79 +37,58 @@ namespace Tango.Scripting.Editors.CodeCompletion
/// </summary>
public CompletionWindow(TextArea textArea) : base(textArea)
{
+
// keep height automatic
this.CloseAutomatically = true;
- this.SizeToContent = SizeToContent.Height;
- this.MaxHeight = 300;
- this.Width = 175;
+ this.SizeToContent = SizeToContent.WidthAndHeight;
+ this.WindowStyle = WindowStyle.None;
+ this.ResizeMode = ResizeMode.NoResize;
this.Content = completionList;
// prevent user from resizing window to 0x0
this.MinHeight = 15;
this.MinWidth = 30;
//this.Background = new SolidColorBrush(Color.FromRgb(15, 15, 15));
this.Foreground = Brushes.Gainsboro;
-
- toolTip.PlacementTarget = this;
- toolTip.Placement = PlacementMode.Right;
- toolTip.Closed += toolTip_Closed;
-
- AttachEvents();
}
- #region ToolTip handling
- void toolTip_Closed(object sender, RoutedEventArgs e)
+ public override void ShowCompletion()
{
- // Clear content after tooltip is closed.
- // We cannot clear is immediately when setting IsOpen=false
- // because the tooltip uses an animation for closing.
- if (toolTip != null)
- toolTip.Content = null;
+ base.ShowCompletion();
+ AttachEvents();
}
- void completionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ public override void HideCompletion()
{
- var item = completionList.SelectedItem;
- if (item == null)
- return;
- object description = item.Description;
- if (description != null)
+ base.HideCompletion();
+
+ foreach (var item in completionList.ListBox.Items)
{
- string descriptionText = description as string;
- if (descriptionText != null)
+ var box = completionList.ListBox.ItemContainerGenerator.ContainerFromItem(item) as CompletionListBoxItem;
+ if (box != null && box.IsSelected)
{
- toolTip.Content = new TextBlock
- {
- Text = descriptionText,
- TextWrapping = TextWrapping.Wrap
- };
+ box.toolTip.IsOpen = false;
}
- else
- {
- toolTip.Content = description;
- }
- toolTip.IsOpen = true;
- }
- else
- {
- toolTip.IsOpen = false;
}
}
- #endregion
void completionList_InsertionRequested(object sender, EventArgs e)
{
- Close();
+ HideCompletion();
// The window must close before Complete() is called.
// If the Complete callback pushes stacked input handlers, we don't want to pop those when the CC window closes.
var item = completionList.SelectedItem;
+ //if (item != null)
+ // item.Complete(this.TextArea, new AnchorSegment(this.TextArea.Document, this.StartOffset, this.EndOffset - this.StartOffset), e);
+
if (item != null)
- item.Complete(this.TextArea, new AnchorSegment(this.TextArea.Document, this.StartOffset, this.EndOffset - this.StartOffset), e);
+ {
+ InsertionRequest?.Invoke(item);
+ }
}
void AttachEvents()
{
this.completionList.InsertionRequested += completionList_InsertionRequested;
- this.completionList.SelectionChanged += completionList_SelectionChanged;
this.TextArea.Caret.PositionChanged += CaretPositionChanged;
this.TextArea.MouseWheel += textArea_MouseWheel;
this.TextArea.PreviewTextInput += textArea_PreviewTextInput;
@@ -118,7 +98,6 @@ namespace Tango.Scripting.Editors.CodeCompletion
protected override void DetachEvents()
{
this.completionList.InsertionRequested -= completionList_InsertionRequested;
- this.completionList.SelectionChanged -= completionList_SelectionChanged;
this.TextArea.Caret.PositionChanged -= CaretPositionChanged;
this.TextArea.MouseWheel -= textArea_MouseWheel;
this.TextArea.PreviewTextInput -= textArea_PreviewTextInput;
@@ -126,17 +105,6 @@ namespace Tango.Scripting.Editors.CodeCompletion
}
/// <inheritdoc/>
- protected override void OnClosed(EventArgs e)
- {
- base.OnClosed(e);
- if (toolTip != null)
- {
- toolTip.IsOpen = false;
- toolTip = null;
- }
- }
-
- /// <inheritdoc/>
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
@@ -150,6 +118,11 @@ namespace Tango.Scripting.Editors.CodeCompletion
{
e.Handled = RaiseEventPair(this, PreviewTextInputEvent, TextInputEvent,
new TextCompositionEventArgs(e.Device, e.TextComposition));
+
+ if (e.Text == " ")
+ {
+ HideCompletion();
+ }
}
void textArea_MouseWheel(object sender, MouseWheelEventArgs e)
@@ -193,7 +166,7 @@ namespace Tango.Scripting.Editors.CodeCompletion
{
if (CloseAutomatically && CloseWhenCaretAtBeginning)
{
- Close();
+ HideCompletion();
}
else
{
@@ -205,7 +178,7 @@ namespace Tango.Scripting.Editors.CodeCompletion
{
if (CloseAutomatically)
{
- Close();
+ HideCompletion();
}
}
else
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindowBase.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindowBase.cs
index 40c611843..b5bab3f97 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindowBase.cs
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/CodeCompletion/CompletionWindowBase.cs
@@ -12,6 +12,7 @@ using Tango.Scripting.Editors.Document;
using Tango.Scripting.Editors.Editing;
using Tango.Scripting.Editors.Rendering;
using Tango.Scripting.Editors.Utils;
+using System.ComponentModel;
namespace Tango.Scripting.Editors.CodeCompletion
{
@@ -60,17 +61,31 @@ namespace Tango.Scripting.Editors.CodeCompletion
if (textArea == null)
throw new ArgumentNullException("textArea");
this.TextArea = textArea;
- parentWindow = Window.GetWindow(textArea);
- this.Owner = parentWindow;
- this.AddHandler(MouseUpEvent, new MouseButtonEventHandler(OnMouseUp), true);
-
- StartOffset = EndOffset = this.TextArea.Caret.Offset;
-
- AttachEvents();
- }
-
- #region Event Handlers
- void AttachEvents()
+
+ parentWindow = Window.GetWindow(TextArea);
+ this.Owner = parentWindow;
+ this.AddHandler(MouseUpEvent, new MouseButtonEventHandler(OnMouseUp), true);
+ }
+
+ public virtual void ShowCompletion()
+ {
+ StartOffset = EndOffset = this.TextArea.Caret.Offset;
+
+ AttachEvents();
+ SetPosition();
+ UpdatePosition();
+ Show();
+ }
+
+ public virtual void HideCompletion()
+ {
+ DetachEvents();
+ Hide();
+ }
+
+ #region Event Handlers
+
+ void AttachEvents()
{
document = this.TextArea.Document;
if (document != null) {
@@ -133,7 +148,7 @@ namespace Tango.Scripting.Editors.CodeCompletion
public override void Detach()
{
base.Detach();
- window.Close();
+ window.HideCompletion();
}
const Key KeyDeadCharProcessed = (Key)0xac; // Key.DeadCharProcessed; // new in .NET 4
@@ -166,17 +181,18 @@ namespace Tango.Scripting.Editors.CodeCompletion
IScrollInfo scrollInfo = this.TextArea.TextView;
Rect visibleRect = new Rect(scrollInfo.HorizontalOffset, scrollInfo.VerticalOffset, scrollInfo.ViewportWidth, scrollInfo.ViewportHeight);
- // close completion window when the user scrolls so far that the anchor position is leaving the visible area
- if (visibleRect.Contains(visualLocation) || visibleRect.Contains(visualLocationTop))
- UpdatePosition();
- else
- Close();
- }
+ // close completion window when the user scrolls so far that the anchor position is leaving the visible area
+ if (visibleRect.Contains(visualLocation) || visibleRect.Contains(visualLocationTop))
+ UpdatePosition();
+ else
+ HideCompletion();
+
+ }
void TextAreaDocumentChanged(object sender, EventArgs e)
{
- Close();
- }
+ HideCompletion();
+ }
void TextAreaLostFocus(object sender, RoutedEventArgs e)
{
@@ -242,8 +258,8 @@ namespace Tango.Scripting.Editors.CodeCompletion
if (CloseOnFocusLost) {
Debug.WriteLine("CloseIfFocusLost: this.IsActive=" + this.IsActive + " IsTextAreaFocused=" + IsTextAreaFocused);
if (!this.IsActive && !IsTextAreaFocused) {
- Close();
- }
+ HideCompletion();
+ }
}
}
@@ -268,21 +284,29 @@ namespace Tango.Scripting.Editors.CodeCompletion
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
+ SetPosition();
- if (document != null && this.StartOffset != this.TextArea.Caret.Offset) {
- SetPosition(new TextViewPosition(document.GetLocation(this.StartOffset)));
- } else {
- SetPosition(this.TextArea.Caret.Position);
- }
- sourceIsInitialized = true;
+ //sourceIsInitialized = true;
}
+
+ private void SetPosition()
+ {
+ if (document != null && this.StartOffset != this.TextArea.Caret.Offset)
+ {
+ SetPosition(new TextViewPosition(document.GetLocation(this.StartOffset)));
+ }
+ else
+ {
+ SetPosition(this.TextArea.Caret.Position);
+ }
+ }
/// <inheritdoc/>
protected override void OnClosed(EventArgs e)
{
- base.OnClosed(e);
- DetachEvents();
- }
+ DetachEvents();
+ HideCompletion();
+ }
/// <inheritdoc/>
protected override void OnKeyDown(KeyEventArgs e)
@@ -290,8 +314,8 @@ namespace Tango.Scripting.Editors.CodeCompletion
base.OnKeyDown(e);
if (!e.Handled && e.Key == Key.Escape) {
e.Handled = true;
- Close();
- }
+ HideCompletion();
+ }
}
Point visualLocation, visualLocationTop;
@@ -365,9 +389,9 @@ namespace Tango.Scripting.Editors.CodeCompletion
void textArea_Document_Changing(object sender, DocumentChangeEventArgs e)
{
if (e.Offset + e.RemovalLength == this.StartOffset && e.RemovalLength > 0) {
- Close(); // removal immediately in front of completion segment: close the window
- // this is necessary when pressing backspace after dot-completion
- }
+ HideCompletion(); // removal immediately in front of completion segment: close the window
+ // this is necessary when pressing backspace after dot-completion
+ }
if (e.Offset == StartOffset && e.RemovalLength == 0 && ExpectInsertionBeforeStart) {
StartOffset = e.GetNewOffset(StartOffset, AnchorMovementType.AfterInsertion);
this.ExpectInsertionBeforeStart = false;
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/HighlightingColorizer.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/HighlightingColorizer.cs
index 4bfacc96c..9dfcc3976 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/HighlightingColorizer.cs
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/HighlightingColorizer.cs
@@ -226,7 +226,7 @@ namespace Tango.Scripting.Editors.Highlighting
// If the highlighting state change applies to the lines below, too, the construction of each line
// will invalidate the next line, and the construction pass will regenerate all lines.
- Debug.WriteLine("OnHighlightStateChanged forces redraw of line " + (lineNumber + 1));
+ //Debug.WriteLine("OnHighlightStateChanged forces redraw of line " + (lineNumber + 1));
// If the VisualLine construction is in progress, we have to avoid sending redraw commands for
// anything above the line currently being constructed.
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/OffsetColorizer.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/OffsetColorizer.cs
new file mode 100644
index 000000000..a05d1fc75
--- /dev/null
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/OffsetColorizer.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using Tango.Scripting.Editors.Document;
+using Tango.Scripting.Editors.Rendering;
+
+namespace Tango.Scripting.Editors.Highlighting
+{
+ public class OffsetColorizer : DocumentColorizingTransformer
+ {
+ public int StartOffset { get; set; }
+ public int EndOffset { get; set; }
+ public Brush Brush { get; set; }
+ public DocumentLine Line { get; set; }
+
+ public OffsetColorizer(DocumentLine line, int start, int end, Brush brush)
+ {
+ Line = line;
+ StartOffset = start;
+ EndOffset = end;
+ Brush = brush;
+ }
+
+ protected override void ColorizeLine(DocumentLine line)
+ {
+ if (Line == line)
+ {
+ try
+ {
+ ChangeLinePart(StartOffset, EndOffset, element => element.TextRunProperties.SetForegroundBrush(Brush));
+ }
+ catch { }
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/Resources/CSharp-Mode.xshd b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/Resources/CSharp-Mode.xshd
index 2635d162c..a8ca62be2 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/Resources/CSharp-Mode.xshd
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Highlighting/Resources/CSharp-Mode.xshd
@@ -8,6 +8,7 @@
<Color name="Punctuation" exampleText="a(b.c);" />
<Color name="ValueTypes" foreground="#3F8FD6" exampleText="bool b = true;" />
<Color name="ReferenceTypes" foreground="#4EC9B0" exampleText="object o;" />
+ <Color name="InterfaceTypes" foreground="#B5CE8A" exampleText="object o;" />
<Color name="MethodCall" foreground="Gainsboro" exampleText="o.ToString();"/>
<Color name="NumberLiteral" foreground="#B5CE8A" exampleText="3.1415f"/>
<Color name="ThisOrBaseReference" exampleText="this.Do(); base.Do();"/>
@@ -21,15 +22,17 @@
<Color name="OperatorKeywords" foreground="Pink" exampleText="public static implicit operator..."/>
<Color name="ParameterModifiers" foreground="DeepPink" exampleText="(ref int a, params int[] b)"/>
<Color name="Modifiers" foreground="#3F8FD6" exampleText="static readonly int a;"/>
- <Color name="CustomTypes" foreground="#4EC9B0" />
<Color name="CustomKeywords" foreground="#FAFF00" />
<Color name="Visibility" foreground="#3F8FD6" exampleText="public override void ToString();"/>
<Color name="NamespaceKeywords" foreground="#569CD6" exampleText="namespace A.B { using System; }"/>
<Color name="GetSetAddRemove" foreground="#3F8FD6" exampleText="int Prop { get; set; }"/>
<Color name="TrueFalse" foreground="#3F8FD6" exampleText="b = false; a = true;" />
<Color name="TypeKeywords" foreground="#3F8FD6" exampleText="if (x is int) { a = x as int; type = typeof(int); size = sizeof(int); c = new object(); }"/>
-
- <!--<Property name="DocCommentMarker" value="///" />-->
+
+ <!--RegEx-->
+ <Color name="ScriptClass" foreground="#4EC9B0" exampleText="object o;" />
+
+ <!--<Property name="DocCommentMarker" value="///" />-->
<RuleSet name="CommentMarkerSet">
<Keywords foreground="Red">
@@ -114,20 +117,6 @@
@[\w\d_]+
</Rule>
- <Keywords color="CustomTypes">
- <Word>String</Word>
- <Word>Thread</Word>
- <Word>DateTime</Word>
- <Word>Task</Word>
- <Word>Bitmap</Word>
- <Word>BitmapSource</Word>
- <Word>TimeSpan</Word>
- <Word>Dispatcher</Word>
- <Word>StubManager</Word>
- <Word>Int32</Word>
- <Word>Double</Word>
- </Keywords>
-
<Keywords color="CustomKeywords">
<Word>include</Word>
<Word>import</Word>
@@ -234,12 +223,12 @@
</Keywords>
<Keywords color="ReferenceTypes">
- <Word>Object</Word>
- <Word>String</Word>
- <Word>Int32</Word>
- <Word>Int64</Word>
- <Word>Double</Word>
+ <Word>@ReferenceTypes@</Word>
</Keywords>
+
+ <Keywords color="InterfaceTypes">
+ <Word>@InterfaceTypes@</Word>
+ </Keywords>
<Keywords color="OperatorKeywords">
<Word>explicit</Word>
@@ -311,5 +300,9 @@
<Rule color="Punctuation">
[?,.;()\[\]{}+\-/%*&lt;&gt;^+~!|&amp;]+
</Rule>
+
+ <!--<Rule color="ScriptClass">
+ (?&lt;=public class ).+
+ </Rule>-->
</RuleSet>
</SyntaxDefinition>
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubclass.gif b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubclass.gif
new file mode 100644
index 000000000..28abc36a7
--- /dev/null
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubclass.gif
Binary files differ
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubevent.gif b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubevent.gif
new file mode 100644
index 000000000..7c2466f0e
--- /dev/null
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubevent.gif
Binary files differ
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubmethod.gif b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubmethod.gif
new file mode 100644
index 000000000..040280d15
--- /dev/null
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubmethod.gif
Binary files differ
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubproperty.gif b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubproperty.gif
new file mode 100644
index 000000000..49d5042b9
--- /dev/null
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Images/pubproperty.gif
Binary files differ
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Properties/AssemblyInfo.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Properties/AssemblyInfo.cs
index 73d5cf2eb..96d9a2678 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Properties/AssemblyInfo.cs
@@ -30,7 +30,7 @@ using System.Windows.Markup;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: CLSCompliant(true)]
+//[assembly: CLSCompliant(true)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Rendering/TextView.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Rendering/TextView.cs
index 63f577634..6bbf13618 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Rendering/TextView.cs
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Rendering/TextView.cs
@@ -931,7 +931,7 @@ namespace Tango.Scripting.Editors.Rendering
TextRunProperties globalTextRunProperties = CreateGlobalTextRunProperties();
VisualLineTextParagraphProperties paragraphProperties = CreateParagraphProperties(globalTextRunProperties);
- Debug.WriteLine("Measure availableSize=" + availableSize + ", scrollOffset=" + scrollOffset);
+ //Debug.WriteLine("Measure availableSize=" + availableSize + ", scrollOffset=" + scrollOffset);
var firstLineInView = heightTree.GetLineByVisualPosition(scrollOffset.Y);
// number of pixels clipped from the first visual line(s)
@@ -1026,7 +1026,7 @@ namespace Tango.Scripting.Editors.Rendering
if (heightTree.GetIsCollapsed(documentLine.LineNumber))
throw new InvalidOperationException("Trying to build visual line from collapsed line");
- Debug.WriteLine("Building line " + documentLine.LineNumber);
+ //Debug.WriteLine("Building line " + documentLine.LineNumber);
VisualLine visualLine = new VisualLine(this, documentLine);
VisualLineTextSource textSource = new VisualLineTextSource(visualLine) {
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/ScriptEditor.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/ScriptEditor.cs
index b4a98804c..316b95ed7 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/ScriptEditor.cs
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/ScriptEditor.cs
@@ -1,7 +1,11 @@
-using System;
+using Microsoft.CodeAnalysis;
+using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Diagnostics;
+using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@@ -15,24 +19,44 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
+using System.Xml;
using Tango.Core.Commands;
using Tango.Scripting.Editors.CodeCompletion;
using Tango.Scripting.Editors.Document;
using Tango.Scripting.Editors.Editing;
using Tango.Scripting.Editors.Folding;
+using Tango.Scripting.Editors.Highlighting;
+using Tango.Scripting.Editors.Highlighting.Xshd;
using Tango.Scripting.Parsing;
namespace Tango.Scripting.Editors
{
public class ScriptEditor : TextEditor
{
+ private char[] word_separators = { ' ', '\t', '\n', '.', '(', ',', '-', '*', '/', '+', '$', '=' };
+ private string[] _blocking_type_words = { "class", "void" };
+ private String dotNetXmlFolder = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.X";
+
private DispatcherTimer _update_timer;
private FoldingManager foldingManager;
private BraceFoldingStrategy foldingStrategy;
private CompletionWindow completionWindow;
- private List<Type> _types = new List<Type>();
private ScriptParser _parser;
private List<String> _current_usings;
+ private List<Type> _knownTypes;
+ private List<INamedTypeSymbol> _declaredTypes;
+ private Dictionary<Type, String> _known_types_docs_cache;
+ private Dictionary<Assembly, XmlDocument> _assemblies_docs_cache;
+
+ #region Mini Classes
+
+ private class ScriptClass
+ {
+ public String Name { get; set; }
+ public int Index { get; set; }
+ }
+
+ #endregion
#region Completion
@@ -40,7 +64,7 @@ namespace Tango.Scripting.Editors
/// Represents an auto complete item.
/// </summary>
/// <seealso cref="ICSharpCode.AvalonEdit.CodeCompletion.ICompletionData" />
- internal class CompletionData : ICompletionData
+ internal class CompletionData : DependencyObject, ICompletionData
{
private String _description;
@@ -52,11 +76,13 @@ namespace Tango.Scripting.Editors
/// <summary>
/// Initializes a new instance of the <see cref="CompletionData"/> class.
/// </summary>
- /// <param name="text">The text.</param>
+ /// <param name="name">The text.</param>
/// <param name="description">The description.</param>
- public CompletionData(string text, String description)
+ public CompletionData(String type, string name, String ns, String description)
{
- this.Text = text;
+ Type = type;
+ this.Text = name;
+ Namespace = ns;
_description = description;
}
@@ -87,6 +113,10 @@ namespace Tango.Scripting.Editors
get { return _description; }
}
+ public String Type { get; set; }
+
+ public String Namespace { get; set; }
+
/// <summary>
/// Gets the priority. This property is used in the selection logic. You can use it to prefer selecting those items
/// which the user is accessing most frequently.
@@ -107,6 +137,21 @@ namespace Tango.Scripting.Editors
textArea.Document.Replace(completionSegment, this.Text);
}
+ public bool IsSelected
+ {
+ get { return (bool)GetValue(IsSelectedProperty); }
+ set { SetValue(IsSelectedProperty, value); }
+ }
+ public static readonly DependencyProperty IsSelectedProperty =
+ DependencyProperty.Register("IsSelected", typeof(bool), typeof(CompletionData), new PropertyMetadata(false, IsSelectedChanged));
+
+ private static void IsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ Debug.WriteLine("Selected");
+ }
+
+
+
/// <summary>
/// Returns a <see cref="System.String" /> that represents this instance.
/// </summary>
@@ -123,6 +168,9 @@ namespace Tango.Scripting.Editors
#region Properties
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable folding.
+ /// </summary>
public bool EnableFolding
{
get { return (bool)GetValue(EnableFoldingProperty); }
@@ -142,11 +190,47 @@ namespace Tango.Scripting.Editors
public static readonly DependencyProperty IndentCommandProperty =
DependencyProperty.Register("IndentCommand", typeof(RelayCommand), typeof(ScriptEditor), new PropertyMetadata(null));
+ /// <summary>
+ /// Gets or sets the reference assemblies.
+ /// </summary>
+ public ObservableCollection<ReferenceAssembly> ReferenceAssemblies
+ {
+ get { return (ObservableCollection<ReferenceAssembly>)GetValue(ReferenceAssembliesProperty); }
+ set { SetValue(ReferenceAssembliesProperty, value); }
+ }
+ public static readonly DependencyProperty ReferenceAssembliesProperty =
+ DependencyProperty.Register("ReferenceAssemblies", typeof(ObservableCollection<ReferenceAssembly>), typeof(ScriptEditor), new PropertyMetadata(null));
#endregion
+ #region Constructors
+
+ /// <summary>
+ /// Initializes the <see cref="ScriptEditor"/> class.
+ /// </summary>
+ static ScriptEditor()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ScriptEditor), new FrameworkPropertyMetadata(typeof(ScriptEditor)));
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ScriptEditor"/> class.
+ /// </summary>
public ScriptEditor()
{
+ _known_types_docs_cache = new Dictionary<Type, string>();
+ _assemblies_docs_cache = new Dictionary<Assembly, XmlDocument>();
+ _declaredTypes = new List<INamedTypeSymbol>();
+
+ _current_usings = new List<string>();
+
+ ReferenceAssemblies = new ObservableCollection<ReferenceAssembly>();
+
+ //Add basic assemblies...
+ ReferenceAssemblies.Add(new ReferenceAssembly(typeof(String))); //mscorelib
+ ReferenceAssemblies.Add(new ReferenceAssembly(typeof(Enumerable))); //System.Core
+
+ _knownTypes = new List<Type>();
_parser = new ScriptParser();
TextArea.IndentationStrategy = new Indentation.CSharp.CSharpIndentationStrategy(Options);
@@ -160,20 +244,68 @@ namespace Tango.Scripting.Editors
IndentCommand = new RelayCommand(IndentCode);
TextArea.TextEntered += TextArea_TextEntered;
+
+ completionWindow = new CompletionWindow(TextArea);
+ completionWindow.WindowStyle = WindowStyle.None;
+ completionWindow.AllowsTransparency = true;
+ completionWindow.ResizeMode = ResizeMode.NoResize;
+ completionWindow.InsertionRequest += CompletionWindow_InsertionRequest;
}
+ #endregion
+
+ #region Update Time Tick
+
+ /// <summary>
+ /// Handles the Tick event of the UpdateTimer control.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void UpdateTimer_Tick(object sender, EventArgs e)
{
InvalidateFolding();
InvalidateUsings();
+ InvalidateScriptTypesHighlightings();
+ }
+
+ #endregion
+
+ #region Properties Changes
+
+ private void OnEnableFoldingChanged()
+ {
+ if (EnableFolding)
+ {
+ foldingManager = FoldingManager.Install(TextArea);
+ }
+ else
+ {
+ FoldingManager.Uninstall(foldingManager);
+ }
}
- private void InvalidateUsings()
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Invalidates all using statements in the script.
+ /// </summary>
+ public void InvalidateUsings()
{
- var usings = _parser.GetUsings(Text);
+ var oldUsings = _current_usings.ToList();
+ _current_usings = _parser.GetUsings(Text);
+
+ if (_current_usings.Exists(x => !oldUsings.Exists(y => y == x)) || oldUsings.Exists(x => !_current_usings.Exists(y => y == x)))
+ {
+ InvalidateHighlighting();
+ }
}
- private void InvalidateFolding()
+ /// <summary>
+ /// Invalidates the script folding if enabled.
+ /// </summary>
+ public void InvalidateFolding()
{
if (EnableFolding)
{
@@ -186,29 +318,245 @@ namespace Tango.Scripting.Editors
}
}
- private void OnEnableFoldingChanged()
+ /// <summary>
+ /// Indents the code.
+ /// </summary>
+ public void IndentCode()
{
- if (EnableFolding)
+ Text = Indentation.CSharp.CSharpIndentationHelper.IndentCSharpCode(Text);
+ }
+
+ /// <summary>
+ /// Gets the current line.
+ /// </summary>
+ /// <returns></returns>
+ public DocumentLine GetCurrentLine()
+ {
+ int offset = CaretOffset;
+ var line = Document.GetLineByOffset(offset);
+ return line;
+ }
+
+ /// <summary>
+ /// Gets the current line text.
+ /// </summary>
+ /// <returns></returns>
+ public String GetCurrentLineText()
+ {
+ var text = Document.GetText(GetCurrentLine());
+ return text;
+ }
+
+ /// <summary>
+ /// Gets the current word.
+ /// </summary>
+ /// <returns></returns>
+ public String GetCurrentWord()
+ {
+ return GetWordByEndIndex(CaretOffset);
+ }
+
+ public String GetWordByEndIndex(int index)
+ {
+ String word = String.Empty;
+ var line = GetCurrentLine();
+
+ int position = index;
+
+ for (int i = position - 1; i >= line.Offset; i--)
{
- foldingManager = FoldingManager.Install(TextArea);
+ char c = Document.GetText(i, 1).First();
+
+ if (word_separators.Contains(c))
+ {
+ break;
+ }
+
+ word += c;
}
- else
+
+ word = new string(word.Reverse().ToArray());
+
+ if (word.Length > 0)
{
- FoldingManager.Uninstall(foldingManager);
+ word = word.Replace(".", "");
}
+
+ return word;
}
- public void IndentCode()
+ public int GetCurrentWordStartIndex()
{
- Text = Indentation.CSharp.CSharpIndentationHelper.IndentCSharpCode(Text);
+ var line = GetCurrentLine();
+
+ int position = CaretOffset;
+
+ for (int i = position - 1; i >= line.Offset; i--)
+ {
+ char c = Document.GetText(i, 1).First();
+
+ if (word_separators.Contains(c))
+ {
+ return i + 1;
+ }
+ }
+
+ return line.Offset;
+ }
+
+ public String GetPreviousWord()
+ {
+ int index = GetCurrentWordStartIndex() - 1;
+ return GetWordByEndIndex(index);
}
+ #endregion
+
+ #region Highlighting
+
+ private async void InvalidateHighlighting()
+ {
+ _parser.GetDeclaredTypes(Text);
+
+ _knownTypes.Clear();
+
+ var assemblies = ReferenceAssemblies.ToList();
+ var usings = _current_usings.ToList();
+
+ foreach (var asm in assemblies.Select(x => x.Assembly))
+ {
+ Parallel.ForEach(asm.GetTypes().Where(x => x.IsVisible && x.IsPublic && !x.IsPrimitive), (type) =>
+ {
+ if (usings.Exists(x => type.Namespace == x))
+ {
+ lock (_knownTypes)
+ {
+ _knownTypes.Add(type);
+ }
+ }
+ });
+ }
+
+ if (_knownTypes.Count > 0 || _declaredTypes.Count > 0)
+ {
+ String text = String.Empty;
+
+ await Task.Factory.StartNew(() =>
+ {
+ Stream xshd_stream = typeof(ScriptEditor).Assembly.GetManifestResourceStream("Tango.Scripting.Editors.Highlighting.Resources.CSharp-Mode.xshd");
+
+ using (StreamReader reader = new StreamReader(xshd_stream))
+ {
+ text = reader.ReadToEnd();
+ }
+
+ List<String> referenceTypes = new List<string>();
+ List<String> interfaceTypes = new List<string>();
+
+ foreach (var type in _knownTypes)
+ {
+ String name = type.Name;
+
+ if (type.ContainsGenericParameters)
+ {
+ name = new String(name.TakeWhile(x => x != '`').ToArray());
+ }
+
+ if (type.IsClass || (type.IsValueType && !type.IsPrimitive))
+ {
+ referenceTypes.Add(String.Format("<Word>{0}</Word>", name));
+ }
+ else if (type.IsInterface || type.IsEnum)
+ {
+ interfaceTypes.Add(String.Format("<Word>{0}</Word>", name));
+ }
+ }
+
+ foreach (var type in _declaredTypes)
+ {
+ if (type.TypeKind == TypeKind.Interface || type.TypeKind == TypeKind.Enum)
+ {
+ interfaceTypes.Add(String.Format("<Word>{0}</Word>", type.Name));
+ }
+ else if (type.TypeKind == TypeKind.Class)
+ {
+ referenceTypes.Add(String.Format("<Word>{0}</Word>", type.Name));
+ }
+ }
+
+ if (referenceTypes.Count > 0)
+ {
+ text = text.Replace("<Word>@ReferenceTypes@</Word>", String.Join(Environment.NewLine, referenceTypes.Distinct()));
+ }
+
+ if (interfaceTypes.Count > 0)
+ {
+ text = text.Replace("<Word>@InterfaceTypes@</Word>", String.Join(Environment.NewLine, interfaceTypes.Distinct()));
+ }
+ });
+
+ using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(text)))
+ {
+ XmlTextReader xshd_reader = new XmlTextReader(ms);
+ SyntaxHighlighting = HighlightingLoader.Load(xshd_reader, HighlightingManager.Instance);
+ xshd_reader.Close();
+ }
+ }
+ }
+
+ private void InvalidateScriptTypesHighlightings()
+ {
+ var declaredTypes = _parser.GetDeclaredTypes(Text);
+
+ if (declaredTypes.Exists(x => !_declaredTypes.Exists(y => y.Name == x.Name)) || _declaredTypes.Exists(x => !declaredTypes.Exists(y => y.Name == x.Name)))
+ {
+ _declaredTypes = declaredTypes;
+ InvalidateHighlighting();
+ }
+
+ //for (int i = 0; i < TextArea.TextView.LineTransformers.Count; i++)
+ //{
+ // if (TextArea.TextView.LineTransformers[i] is OffsetColorizer)
+ // {
+ // TextArea.TextView.LineTransformers.RemoveAt(i);
+ // }
+ //}
+
+ //foreach (var cls in scriptClasses)
+ //{
+ // Document.BeginUpdate();
+
+ // var line = Document.GetLineByOffset(cls.Index);
+
+ // OffsetColorizer colorizer = new OffsetColorizer(line, cls.Index, cls.Index + cls.Name.Length, Brushes.Red);
+ // TextArea.TextView.LineTransformers.Add(colorizer);
+
+ // Document.EndUpdate();
+ //}
+ }
+
+ #endregion
+
+ #region Override Methods
+
+ /// <summary>
+ /// Invoked when an unhandled <see cref="E:System.Windows.Input.Keyboard.PreviewKeyDown" /> attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
+ /// </summary>
+ /// <param name="e">The <see cref="T:System.Windows.Input.KeyEventArgs" /> that contains the event data.</param>
protected override void OnPreviewKeyDown(KeyEventArgs e)
{
base.OnPreviewKeyDown(e);
HandleKeyCombinations(e);
}
+ #endregion
+
+ #region Key Combination Handling
+
+ /// <summary>
+ /// Handles the key combinations.
+ /// </summary>
+ /// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param>
private void HandleKeyCombinations(KeyEventArgs e)
{
if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.K) && Keyboard.IsKeyDown(Key.D))
@@ -244,58 +592,189 @@ namespace Tango.Scripting.Editors
}
}
- public DocumentLine GetCurrentLine()
- {
- int offset = CaretOffset;
- var line = Document.GetLineByOffset(offset);
- return line;
- }
-
- public String GetCurrentLineText()
- {
- var text = Document.GetText(GetCurrentLine());
- return text;
- }
+ #endregion
- public void InsertTypes(List<Type> types)
- {
- _types = types;
- }
+ #region Intellisense
+ /// <summary>
+ /// Handles the TextEntered event of the TextArea control.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="TextCompositionEventArgs"/> instance containing the event data.</param>
private void TextArea_TextEntered(object sender, TextCompositionEventArgs e)
{
+ List<Object> items = new List<object>();
+
if (e.Text == ".")
{
- String word = String.Empty;
- var line = GetCurrentLine();
- String lineText = Document.GetText(line);
-
- int position = CaretOffset;
+ var word = GetCurrentWord();
+ }
+ else
+ {
+ var previous_word = GetPreviousWord();
+ var word = GetCurrentWord();
- for (int i = lineText.Length - 1; i >= 0; i--)
+ if (previous_word != word)
{
- if (lineText[i] == ' ' || lineText[i] == '\t')
+ if (_knownTypes.Exists(x => x.Name == previous_word))
{
- break;
+ return;
}
- word += lineText[i];
+ if (_blocking_type_words.Contains(previous_word))
+ {
+ return;
+ }
}
- word = new string(word.Reverse().ToArray());
+ if (!String.IsNullOrWhiteSpace(word))
+ {
+ if (char.IsUpper(word.First()))
+ {
+ IList<ICompletionData> data = completionWindow.CompletionList.CompletionData;
+ data.Clear();
+
+ foreach (var type in _declaredTypes.Where(x => x.Name.StartsWith(word)))
+ {
+ data.Add(new CompletionData(type.TypeKind.ToString().ToLower(), type.Name, type.ContainingNamespace?.Name, "Declared inside the current script..."));
+ }
+
+ foreach (var type in _knownTypes.Where(x => x.Name.StartsWith(word)))
+ {
+ String doc = GetKnownTypeDocumentation(type);
+ data.Add(new CompletionData(GetTypeOfType(type), type.Name, type.Namespace, doc));
+ }
+
+ if (data.Count > 0)
+ {
+ completionWindow.ShowCompletion();
+
+ if (completionWindow.CompletionList.ListBox != null)
+ {
+ completionWindow.CompletionList.SelectItemFiltering(word);
+ }
+ }
+ else
+ {
+ completionWindow.HideCompletion();
+ }
+ }
+ }
+ }
+ }
+
+ private void CompletionWindow_InsertionRequest(ICompletionData item)
+ {
+ int index = GetCurrentWordStartIndex();
+ int max = GetCurrentLine().EndOffset;
+
+ Document.Replace(index, Math.Min(max - index, item.Text.Length), item.Text);
+ }
- if (word.Length > 0)
+ private String GetKnownTypeDocumentation(Type type)
+ {
+ if (_known_types_docs_cache.ContainsKey(type))
+ {
+ return _known_types_docs_cache[type];
+ }
+
+ XmlDocument _docuDoc = null;
+
+ if (_assemblies_docs_cache.ContainsKey(type.Assembly))
+ {
+ _docuDoc = _assemblies_docs_cache[type.Assembly];
+ }
+
+ if (_docuDoc == null)
+ {
+ String dllPath = type.Assembly.Location;
+
+ string docuPath = dllPath.Substring(0, dllPath.LastIndexOf(".")) + ".XML";
+
+ if (File.Exists(docuPath))
{
- word = word.Replace(".", "");
+ _docuDoc = new XmlDocument();
+ _docuDoc.Load(docuPath);
+ }
+ else if (File.Exists(System.IO.Path.Combine(dotNetXmlFolder, System.IO.Path.GetFileName(docuPath))))
+ {
+ _docuDoc = new XmlDocument();
+ _docuDoc.Load(System.IO.Path.Combine(dotNetXmlFolder, System.IO.Path.GetFileName(docuPath)));
}
+ _assemblies_docs_cache.Add(type.Assembly, _docuDoc);
+ }
+ if (_docuDoc != null)
+ {
+ string path = "T:" + type.FullName;
+ XmlNode xmlDocuOfType = _docuDoc.SelectSingleNode("//member[starts-with(@name, '" + path + "')]");
+
+ _known_types_docs_cache.Add(type, xmlDocuOfType.InnerText);
+
+ return xmlDocuOfType.InnerText;
}
+
+ return String.Empty;
}
- static ScriptEditor()
+ private String GetTypeOfType(Type type)
{
- DefaultStyleKeyProperty.OverrideMetadata(typeof(ScriptEditor), new FrameworkPropertyMetadata(typeof(ScriptEditor)));
+ if (type.IsClass) return "class";
+ if (type.IsEnum) return "enum";
+ if (type.IsInterface) return "interface";
+ if (type.IsValueType) return "struct";
+
+ return "";
}
+
+ private List<String> GetScriptClassNames()
+ {
+ List<String> list = new List<String>();
+
+ Regex r = new Regex(@"(class\s+)(\w+)");
+ var matches = r.Matches(Text);
+
+ foreach (var m in matches.OfType<Match>())
+ {
+ var g = m.Groups.OfType<Group>().Last();
+ list.Add(g.Value);
+ }
+
+ return list.Distinct().ToList();
+ }
+
+ private List<String> GetScriptInterfaceOfEnumNames()
+ {
+ List<String> list = new List<String>();
+
+ Regex r = new Regex(@"((enum|interface)\s+)(\w+)");
+ var matches = r.Matches(Text);
+
+ foreach (var m in matches.OfType<Match>())
+ {
+ var g = m.Groups.OfType<Group>().Last();
+ list.Add(g.Value);
+ }
+
+ return list.Distinct().ToList();
+ }
+
+ private List<String> GetScriptEnumsAndInterfaces()
+ {
+ List<String> list = new List<string>();
+
+ Regex r = new Regex(@"((public|private|internal)\s+(enum|interface)\s+\w+)");
+ var matches = r.Matches(Text);
+
+ foreach (var m in matches)
+ {
+
+ }
+
+ return list;
+ }
+
+ #endregion
}
}
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj
index 4031baf3c..18ed1ff70 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj
@@ -71,6 +71,12 @@
<Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL">
<HintPath>..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath>
</Reference>
+ <Reference Include="Microsoft.CodeAnalysis, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.CodeAnalysis.Common.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.CodeAnalysis.CSharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+ </Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
@@ -78,6 +84,16 @@
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
+ </Reference>
+ <Reference Include="System.ComponentModel.Composition" />
+ <Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
+ </Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
@@ -85,7 +101,47 @@
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.Diagnostics.FileVersionInfo, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Diagnostics.StackTrace, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll</HintPath>
+ </Reference>
<Reference Include="System.Drawing" />
+ <Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
+ </Reference>
+ <Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
+ </Reference>
+ <Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Numerics" />
+ <Reference Include="System.Reflection.Metadata, Version=1.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Reflection.Metadata.1.4.2\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Text.Encoding.CodePages.4.3.0\lib\net46\System.Text.Encoding.CodePages.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Threading.Thread, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll</HintPath>
+ </Reference>
+ <Reference Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
+ </Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
@@ -94,6 +150,18 @@
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml.XPath, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml.XPath.XDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll</HintPath>
+ </Reference>
<Reference Include="Tango.Core">
<HintPath>..\..\..\Build\Core\Debug\Tango.Core.dll</HintPath>
</Reference>
@@ -110,6 +178,7 @@
<ItemGroup>
<Compile Include="AvalonEditCommands.cs" />
<Compile Include="CodeCompletion\CompletionListBox.cs" />
+ <Compile Include="CodeCompletion\CompletionListBoxItem.cs" />
<Compile Include="CodeCompletion\CompletionWindowBase.cs" />
<Compile Include="CodeCompletion\CompletionList.cs" />
<Compile Include="CodeCompletion\CompletionWindow.cs">
@@ -223,6 +292,7 @@
<Compile Include="Highlighting\IHighlighter.cs" />
<Compile Include="Highlighting\IHighlightingDefinition.cs" />
<Compile Include="Highlighting\HighlightingRule.cs" />
+ <Compile Include="Highlighting\OffsetColorizer.cs" />
<Compile Include="Highlighting\Resources\Resources.cs" />
<Compile Include="Highlighting\HighlightingRuleSet.cs" />
<Compile Include="Highlighting\HighlightingSpan.cs" />
@@ -490,9 +560,19 @@
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\pubclass.gif" />
+ <Resource Include="Images\pubevent.gif" />
+ <Resource Include="Images\pubmethod.gif" />
+ <Resource Include="Images\pubproperty.gif" />
+ </ItemGroup>
+ <ItemGroup>
+ <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>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_UseGlobalSettings="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UseGlobalSettings="True" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Themes/Generic.xaml b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Themes/Generic.xaml
index 0a6ffb56f..d113ca2a2 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Themes/Generic.xaml
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Themes/Generic.xaml
@@ -3,28 +3,105 @@
xmlns:local="clr-namespace:Tango.Scripting.Editors"
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:editing="clr-namespace:Tango.Scripting.Editors.Editing"
- xmlns:folding="clr-namespace:Tango.Scripting.Editors.Folding">
-
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="/Tango.Scripting.Editors;component/TextEditor.xaml" />
- <ResourceDictionary Source="/Tango.Scripting.Editors;component/Search/DropDownButton.xaml" />
- <ResourceDictionary Source="/Tango.Scripting.Editors;component/Search/SearchPanel.xaml" />
- <ResourceDictionary Source="/Tango.Scripting.Editors;component/CodeCompletion/CompletionList.xaml" />
- <ResourceDictionary Source="/Tango.Scripting.Editors;component/CodeCompletion/InsightWindow.xaml" />
- </ResourceDictionary.MergedDictionaries>
+ xmlns:folding="clr-namespace:Tango.Scripting.Editors.Folding"
+ xmlns:completion="clr-namespace:Tango.Scripting.Editors.CodeCompletion">
+
+ <ResourceDictionary.MergedDictionaries>
+ <ResourceDictionary Source="/Tango.Scripting.Editors;component/TextEditor.xaml" />
+ <ResourceDictionary Source="/Tango.Scripting.Editors;component/Search/DropDownButton.xaml" />
+ <ResourceDictionary Source="/Tango.Scripting.Editors;component/Search/SearchPanel.xaml" />
+ <ResourceDictionary Source="/Tango.Scripting.Editors;component/CodeCompletion/CompletionList.xaml" />
+ <ResourceDictionary Source="/Tango.Scripting.Editors;component/CodeCompletion/InsightWindow.xaml" />
+ </ResourceDictionary.MergedDictionaries>
<!--Colors-->
<Color x:Key="ScriptBackground">#1E1E1E</Color>
+ <Color x:Key="CompletionBackground">#232323</Color>
+ <Color x:Key="CompletionToolTipBackground">#3B3B3B</Color>
<Color x:Key="ScriptForeground">#E6E6E6</Color>
<Color x:Key="ScriptFoldingForeground">#A0A0A0</Color>
<Color x:Key="ScriptLineNumberForeground">#2B91AF</Color>
-
+
<!--Brushes-->
<SolidColorBrush x:Key="ScriptBackgroundBrush" Color="{StaticResource ScriptBackground}"></SolidColorBrush>
<SolidColorBrush x:Key="ScriptForegroundBrush" Color="{StaticResource ScriptForeground}"></SolidColorBrush>
<SolidColorBrush x:Key="ScriptFoldingForegroundBrush" Color="{StaticResource ScriptFoldingForeground}"></SolidColorBrush>
<SolidColorBrush x:Key="ScriptLineNumberForegroundBrush" Color="{StaticResource ScriptLineNumberForeground}"></SolidColorBrush>
-
+ <SolidColorBrush x:Key="CompletionBackgroundBrush" Color="{StaticResource CompletionBackground}"></SolidColorBrush>
+ <SolidColorBrush x:Key="CompletionToolTipBackgroundBrush" Color="{StaticResource CompletionToolTipBackground}"></SolidColorBrush>
+
+ <Style TargetType="{x:Type completion:CompletionList}">
+ <Setter Property="Background" Value="{StaticResource CompletionBackgroundBrush}"></Setter>
+ <Setter Property="BorderThickness" Value="0"></Setter>
+
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type completion:CompletionList}">
+ <Border MinWidth="320" MaxHeight="200" BorderBrush="#434343" BorderThickness="1" Padding="0" Background="{StaticResource CompletionBackgroundBrush}">
+ <DockPanel>
+ <Border DockPanel.Dock="Bottom" Height="25" Background="#181818" BorderThickness="0 1 0 0" BorderBrush="#434343">
+
+ </Border>
+ <completion:CompletionListBox x:Name="PART_ListBox" BorderThickness="0" Padding="0" Background="{StaticResource CompletionBackgroundBrush}" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
+ <completion:CompletionListBox.Style>
+ <Style TargetType="ListBox">
+ <Setter Property="ItemContainerStyle">
+ <Setter.Value>
+ <Style TargetType="completion:CompletionListBoxItem">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="ListBoxItem">
+ <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" TextElement.Foreground="{TemplateBinding Foreground}">
+ <ContentPresenter/>
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ <Setter Property="ToolTipContentTemplate">
+ <Setter.Value>
+ <DataTemplate>
+ <Border Background="{StaticResource CompletionToolTipBackgroundBrush}" CornerRadius="3" BorderThickness="0.5" BorderBrush="#434343" Padding="10 5" TextElement.Foreground="{StaticResource ScriptForegroundBrush}" TextElement.FontSize="12">
+ <TextBlock TextWrapping="Wrap">
+ <Run Text="{Binding Type,Mode=OneWay}" Foreground="#3F8FD6"></Run>
+ <Run Text="{Binding Namespace,Mode=OneWay}"></Run>.<Run Text="{Binding Text,Mode=OneWay}" Foreground="#4EC9B0"></Run>
+ <LineBreak/>
+ <Run Text="{Binding Description,Mode=OneWay}"></Run>
+ </TextBlock>
+ </Border>
+ </DataTemplate>
+ </Setter.Value>
+ </Setter>
+ <Setter Property="Background" Value="{StaticResource CompletionBackgroundBrush}"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource ScriptForegroundBrush}"></Setter>
+ <Setter Property="Padding" Value="2"></Setter>
+ <Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay}"></Setter>
+ <Setter Property="BorderThickness" Value="0"></Setter>
+ <Style.Triggers>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="Background" Value="#187DBB"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource ScriptForegroundBrush}"></Setter>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </completion:CompletionListBox.Style>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Horizontal">
+ <Image Source="{Binding Image}" Width="16" Height="16" Margin="0,0,4,0"/>
+ <ContentControl Content="{Binding Content}" />
+ </StackPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </completion:CompletionListBox>
+ </DockPanel>
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
<Style TargetType="{x:Type folding:FoldingMargin}">
<Setter Property="FoldingMarkerBackgroundBrush" Value="{StaticResource ScriptBackgroundBrush}"></Setter>
@@ -33,12 +110,12 @@
<Setter Property="SelectedFoldingMarkerBrush" Value="{StaticResource ScriptFoldingForegroundBrush}"></Setter>
<Setter Property="Control.Cursor" Value="/Tango.Scripting.Editors;component/themes/RightArrow.cur"/>
</Style>
-
- <Style TargetType="{x:Type editing:LineNumberMargin}">
+
+ <Style TargetType="{x:Type editing:LineNumberMargin}">
<Setter Property="Width" Value="55"></Setter>
<Setter Property="Foreground" Value="{StaticResource ScriptLineNumberForegroundBrush}"></Setter>
- <Setter Property="Control.Cursor" Value="/Tango.Scripting.Editors;component/themes/RightArrow.cur"/>
- </Style>
+ <Setter Property="Control.Cursor" Value="/Tango.Scripting.Editors;component/themes/RightArrow.cur"/>
+ </Style>
<Style TargetType="{x:Type local:ScriptEditor}">
<Setter Property="Background" Value="{StaticResource ScriptBackgroundBrush}"></Setter>
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/app.config b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/app.config
index 6033f322c..d3a17b4de 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/app.config
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/app.config
@@ -1,4 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
+ <runtime>
+
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
+
+ </dependentAssembly>
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
+
+ </dependentAssembly>
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
+
+ </dependentAssembly>
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
+
+ </dependentAssembly>
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
+
+ </dependentAssembly>
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
+
+ </dependentAssembly>
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
+
+ </dependentAssembly>
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
+
+ </dependentAssembly>
+
+ <dependentAssembly>
+
+ <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+
+ <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+
+ </dependentAssembly>
+
+ </assemblyBinding>
+
+ </runtime>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/packages.config b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/packages.config
index f69b3c48f..00eef19db 100644
--- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/packages.config
+++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/packages.config
@@ -1,4 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net461" />
+ <package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net461" />
+ <package id="Microsoft.CodeAnalysis.Common" version="2.4.0" targetFramework="net461" />
+ <package id="Microsoft.CodeAnalysis.CSharp" version="2.4.0" targetFramework="net461" />
+ <package id="System.AppContext" version="4.3.0" targetFramework="net461" />
+ <package id="System.Collections" version="4.3.0" targetFramework="net461" />
+ <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
+ <package id="System.Collections.Immutable" version="1.3.1" targetFramework="net461" />
+ <package id="System.Console" version="4.3.0" targetFramework="net461" />
+ <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
+ <package id="System.Diagnostics.FileVersionInfo" version="4.3.0" targetFramework="net461" />
+ <package id="System.Diagnostics.StackTrace" version="4.3.0" targetFramework="net461" />
+ <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
+ <package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net461" />
+ <package id="System.Globalization" version="4.3.0" targetFramework="net461" />
+ <package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
+ <package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
+ <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
+ <package id="System.Linq" version="4.3.0" targetFramework="net461" />
+ <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
+ <package id="System.Reflection" version="4.3.0" targetFramework="net461" />
+ <package id="System.Reflection.Metadata" version="1.4.2" targetFramework="net461" />
+ <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
+ <package id="System.Runtime" version="4.3.0" targetFramework="net461" />
+ <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
+ <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
+ <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
+ <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
+ <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
+ <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
+ <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
+ <package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
+ <package id="System.Text.Encoding.CodePages" version="4.3.0" targetFramework="net461" />
+ <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
+ <package id="System.Threading" version="4.3.0" targetFramework="net461" />
+ <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
+ <package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net461" />
+ <package id="System.Threading.Thread" version="4.3.0" targetFramework="net461" />
+ <package id="System.ValueTuple" version="4.3.0" targetFramework="net461" />
+ <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" />
+ <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
+ <package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net461" />
+ <package id="System.Xml.XPath" version="4.3.0" targetFramework="net461" />
+ <package id="System.Xml.XPath.XDocument" version="4.3.0" targetFramework="net461" />
</packages> \ No newline at end of file