aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-03-11 18:26:59 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-03-11 18:26:59 +0200
commitac251de510cfb75c2967f85efc17ac8f8ad20ea0 (patch)
treea1806f6494ac27176e40ad3c4953a60ba8ca0e96 /Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors
parentb0bbc0bec1aaed2230b8a4aa1c08e379fed4629a (diff)
downloadTango-ac251de510cfb75c2967f85efc17ac8f8ad20ea0.tar.gz
Tango-ac251de510cfb75c2967f85efc17ac8f8ad20ea0.zip
Working on script 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/ScriptEditor.cs114
1 files changed, 78 insertions, 36 deletions
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 bcc05bde5..d2f5dd169 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
@@ -558,6 +558,8 @@ namespace Tango.Scripting.Editors
InvalidateHighlighting();
}
+ _declaredTypes = declaredTypes;
+
//for (int i = 0; i < TextArea.TextView.LineTransformers.Count; i++)
//{
// if (TextArea.TextView.LineTransformers[i] is OffsetColorizer)
@@ -680,10 +682,12 @@ namespace Tango.Scripting.Editors
HidePopup();
var lineText = GetCurrentLineText();
- var previousWordsLast = GetPreviousWords().LastOrDefault();
+ var previousWords = GetPreviousWords();
+ var previousWordsLast = previousWords.LastOrDefault();
String currentWord = previousWordsLast != null ? previousWordsLast.Replace("\t", "") : String.Empty;
String currentWordIncludingParenthesis = currentWord.Split('(').LastOrDefault();
+ if (previousWords.Count > 0 && previousWords.First().StartsWith("//")) return;
if (e.Text == " " && GetPreviousWord() == "new")
{
@@ -758,7 +762,51 @@ namespace Tango.Scripting.Editors
if (declaredType != null)
{
+ completionWindow.HideCompletion();
+ IList<ICompletionData> data = new List<ICompletionData>();
+
+ var typeMembers = declaredType.Symbols.ToList();
+
+ foreach (var methodGroup in typeMembers.GroupBy(x => x.Name))
+ {
+ var member = methodGroup.First();
+ if (member.Kind == SymbolKind.Method)
+ {
+ data.Add(new MethodCompletionItem()
+ {
+ Class = declaredType.Name,
+ Name = member.Name,
+ ReturnType = member.Type,
+ Description = member.Summary,
+ //Parameters = method.Parameters,
+ Overloads = methodGroup.Count() - 1,
+ });
+
+ }
+ else if (member.Kind == SymbolKind.Property)
+ {
+ data.Add(new PropertyCompletionItem()
+ {
+ Class = declaredType.Name,
+ Name = member.Name,
+ Type = member.Type,
+ Description = member.Summary,
+ });
+ }
+ else if (member.Kind == SymbolKind.Field)
+ {
+ data.Add(new FieldCompletionItem()
+ {
+ Class = declaredType.Name,
+ Name = member.Name,
+ Type = member.Type,
+ Description = member.Summary,
+ });
+ }
+ }
+
+ ShowCompletionWindow(data, GetCurrentWord());
}
}
}
@@ -766,29 +814,34 @@ namespace Tango.Scripting.Editors
{
completionWindow.HideCompletion();
- var session = GetConstructionSession();
-
- if (session != null)
+ try
{
- var content = CreateConstructionSessionPopupContent(session);
- if (content.Methods.Count > 0)
+ var session = GetConstructionSession();
+
+ if (session != null)
{
- ShowPopup(content);
+ var content = CreateConstructionSessionPopupContent(session);
+ if (content.Methods.Count > 0)
+ {
+ ShowPopup(content);
+ }
}
- }
- var methodSession = GetMethodSession();
+ var methodSession = GetMethodSession();
- if (methodSession != null)
- {
- var content = CreateMethodSessionPopupContent(methodSession);
- if (content.Methods.Count > 0)
+ if (methodSession != null)
{
- ShowPopup(content);
+ var content = CreateMethodSessionPopupContent(methodSession);
+ if (content.Methods.Count > 0)
+ {
+ ShowPopup(content);
+ }
}
}
-
- var a = GetMethodSession();
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex);
+ }
}
else if (lineText.StartsWith("using"))
{
@@ -851,7 +904,7 @@ namespace Tango.Scripting.Editors
data.Add(new StructCompletionItem()
{
Name = type.Name,
- Description = "Declared inside the current script...",
+ Description = type.Summary,
Namespace = type.ContainingNamespace,
Priority = 1,
});
@@ -861,7 +914,7 @@ namespace Tango.Scripting.Editors
data.Add(new EnumCompletionItem()
{
Name = type.Name,
- Description = "Declared inside the current script...",
+ Description = type.Summary,
Namespace = type.ContainingNamespace,
Priority = 1,
});
@@ -871,7 +924,7 @@ namespace Tango.Scripting.Editors
data.Add(new InterfaceCompletionItem()
{
Name = type.Name,
- Description = "Declared inside the current script...",
+ Description = type.Summary,
Namespace = type.ContainingNamespace,
Priority = 1,
});
@@ -881,7 +934,7 @@ namespace Tango.Scripting.Editors
data.Add(new ClassCompletionItem()
{
Name = type.Name,
- Description = "Declared inside the current script...",
+ Description = type.Summary,
Namespace = type.ContainingNamespace,
Priority = 1,
});
@@ -940,36 +993,25 @@ namespace Tango.Scripting.Editors
}
}
- foreach (var symbol in _parser.GetContextSymbols(Document.Text, CaretOffset))
+ foreach (var symbol in _parser.GetContextSymbols(Document.Text, CaretOffset).Where(x => x.Name.StartsWith(GetCurrentWord())))
{
if (symbol.Kind == SymbolKind.Property)
{
data.Add(new PropertyCompletionItem()
{
Class = symbol.Class,
- Description = "Property defined in this script.",
- Name = symbol.Name,
- Type = symbol.Type,
- Priority = 2,
- });
- }
- else if (symbol.Kind == SymbolKind.Field || symbol.Kind == SymbolKind.Local)
- {
- data.Add(new FieldCompletionItem()
- {
- Class = symbol.Class,
- Description = "Field defined in this script.",
+ Description = symbol.Summary,
Name = symbol.Name,
Type = symbol.Type,
Priority = 2,
});
}
- else if (symbol.Kind == SymbolKind.Parameter)
+ else if (symbol.Kind == SymbolKind.Field || symbol.Kind == SymbolKind.Local || symbol.Kind == SymbolKind.Parameter)
{
data.Add(new FieldCompletionItem()
{
Class = symbol.Class,
- Description = "Method parameter defined in this script.",
+ Description = symbol.Summary,
Name = symbol.Name,
Type = symbol.Type,
Priority = 2,
@@ -980,7 +1022,7 @@ namespace Tango.Scripting.Editors
data.Add(new MethodCompletionItem()
{
Class = symbol.Class,
- Description = "Method defined in this script.",
+ Description = symbol.Summary,
Name = symbol.Name,
ReturnType = symbol.Type,
Priority = 2,