Skip to content

Commit ad8fdf5

Browse files
committed
Merge branch 'development' into fd5
Conflicts: External/Plugins/CodeRefactor/Commands/OrganizeImports.cs External/Plugins/FlashDebugger/Debugger/FlashInterface.cs
2 parents 12cb86d + 6db102b commit ad8fdf5

18 files changed

Lines changed: 1067 additions & 1081 deletions

File tree

‎External/Plugins/AS2Context/Context.cs‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,13 @@ public Context(AS2Settings initSettings)
107107
features.importKey = "import";
108108
features.typesPreKeys = new string[] { "import", "new", "instanceof", "extends", "implements" };
109109
features.codeKeywords = new string[] {
110-
"class", "interface", "var", "function", "new", "delete", "instanceof", "return", "break", "continue",
110+
"var", "function", "new", "delete", "instanceof", "return", "break", "continue",
111111
"if", "else", "for", "in", "while", "do", "switch", "case", "default", "with",
112112
"null", "undefined", "true", "false", "try", "catch", "finally", "throw"
113113
};
114+
features.accessKeywords = new string[] { "override", "public", "private", "intrinsic", "static" };
115+
features.declKeywords = new string[] { "var", "function" };
116+
features.typesKeywords = new string[] { "import", "class", "interface" };
114117
features.varKey = "var";
115118
features.functionKey = "function";
116119
features.getKey = "get";
@@ -1018,12 +1021,8 @@ public override FileModel ResolvePackage(string name, bool lazyMode)
10181021
{
10191022
if (type.IndexType != null) continue;
10201023
MemberModel item = type.ToMemberModel();
1021-
if (type.Access == Visibility.Private)
1022-
{
1023-
item.Type = item.Name;
1024-
item.Access = Visibility.Private;
1025-
}
1026-
pModel.Imports.Add(item);
1024+
if (type.Access != Visibility.Private)
1025+
pModel.Imports.Add(item);
10271026
}
10281027
foreach (MemberModel member in model.Members)
10291028
pModel.Members.Add(member.Clone() as MemberModel);

‎External/Plugins/AS3Context/Context.cs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,15 @@ public Context(AS3Settings initSettings)
102102
features.importKey = "import";
103103
features.typesPreKeys = new string[] { "import", "new", "typeof", "is", "as", "extends", "implements" };
104104
features.codeKeywords = new string[] {
105-
"class", "interface", "var", "function", "const", "new", "delete", "typeof", "is", "as", "return",
105+
"var", "function", "const", "new", "delete", "typeof", "is", "as", "return",
106106
"break", "continue", "if", "else", "for", "each", "in", "while", "do", "switch", "case", "default", "with",
107107
"null", "true", "false", "try", "catch", "finally", "throw", "use", "namespace"
108-
};
108+
};
109+
features.accessKeywords = new string[] {
110+
"extern", "dynamic", "inline", "final", "public", "private", "protected", "internal", "static", "override"
111+
};
112+
features.declKeywords = new string[] { "var", "function", "const", "namespace", "get", "set" };
113+
features.typesKeywords = new string[] { "import", "class", "interface" };
109114
features.varKey = "var";
110115
features.constKey = "const";
111116
features.functionKey = "function";

‎External/Plugins/ASCompletion/Completion/ASComplete.cs‎

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static public bool OnChar(ScintillaControl Sci, int Value, bool autoHide)
152152
return HandleFunctionCompletion(Sci, autoHide);
153153
break;
154154
}
155-
if (word == "class" || word == "package" || word == "interface")
155+
if (word == "package" || Array.IndexOf(features.typesKeywords, word) >= 0)
156156
return false;
157157
// new/extends/instanceof/...
158158
if (features.HasTypePreKey(word))
@@ -161,9 +161,7 @@ static public bool OnChar(ScintillaControl Sci, int Value, bool autoHide)
161161
if (features.hasImports && (word == features.importKey || word == features.importKeyAlt))
162162
return HandleImportCompletion(Sci, "", autoHide);
163163
// public/internal/private/protected/static
164-
if (word == features.publicKey || word == features.internalKey
165-
|| word == features.protectedKey || word == features.privateKey
166-
|| word == features.staticKey || word == features.inlineKey)
164+
if (Array.IndexOf(features.accessKeywords, word) >= 0)
167165
return HandleDeclarationCompletion(Sci, "", autoHide);
168166
// override
169167
if (word == features.overrideKey)
@@ -1198,8 +1196,10 @@ static private bool HandleDeclarationCompletion(ScintillaControl Sci, string tai
11981196
if (Sci.CharAt(position - 1) <= 32) tail = "";
11991197

12001198
// completion support
1201-
ContextFeatures features = ASContext.Context.Features;
1202-
List<string> support = features.GetDeclarationKeywords(Sci.GetLine(line));
1199+
IASContext ctx = ASContext.Context;
1200+
ContextFeatures features = ctx.Features;
1201+
bool insideClass = !ctx.CurrentClass.IsVoid() && ctx.CurrentClass.LineFrom < line;
1202+
List<string> support = features.GetDeclarationKeywords(Sci.GetLine(line), insideClass);
12031203
if (support.Count == 0) return true;
12041204

12051205
// current model
@@ -1211,12 +1211,16 @@ static private bool HandleDeclarationCompletion(ScintillaControl Sci, string tai
12111211
int tempLine = line-1;
12121212
int tempIndent;
12131213
string tempText;
1214-
while(tempLine > 0)
1214+
while (tempLine > 0)
12151215
{
12161216
tempText = Sci.GetLine(tempLine).Trim();
1217-
if (tempText.IndexOf("class") >= 0 || tempText.IndexOf("interface") >=0 || tempText.IndexOf("enum") >= 0)
1217+
if (insideClass && IsTypeDecl(tempText, features.typesKeywords))
1218+
{
1219+
tempIndent = Sci.GetLineIndentation(tempLine);
1220+
tab = tempIndent + Sci.TabWidth;
12181221
break;
1219-
if (tempText.Length > 0 && (tempText.EndsWith("}") || IsDeclaration(tempText)))
1222+
}
1223+
if (tempText.Length > 0 && (tempText.EndsWith("}") || IsDeclaration(tempText, features)))
12201224
{
12211225
tempIndent = Sci.GetLineIndentation(tempLine);
12221226
tab = tempIndent;
@@ -1241,20 +1245,19 @@ static private bool HandleDeclarationCompletion(ScintillaControl Sci, string tai
12411245
return true;
12421246
}
12431247

1244-
private static bool IsDeclaration(string line)
1248+
private static bool IsTypeDecl(string line, string[] typesKeywords)
12451249
{
1246-
ContextFeatures features = ASContext.Context.Features;
1247-
if (!string.IsNullOrEmpty(features.privateKey) && line.StartsWith(features.privateKey)) return true;
1248-
if (!string.IsNullOrEmpty(features.protectedKey) && line.StartsWith(features.protectedKey)) return true;
1249-
if (!string.IsNullOrEmpty(features.internalKey) && line.StartsWith(features.internalKey)) return true;
1250-
if (!string.IsNullOrEmpty(features.publicKey) && line.StartsWith(features.publicKey)) return true;
1251-
if (!string.IsNullOrEmpty(features.varKey) && line.StartsWith(features.varKey)) return true;
1252-
if (!string.IsNullOrEmpty(features.constKey) && line.StartsWith(features.constKey)) return true;
1253-
if (!string.IsNullOrEmpty(features.overrideKey) && line.StartsWith(features.overrideKey)) return true;
1254-
if (!string.IsNullOrEmpty(features.inlineKey) && line.StartsWith(features.inlineKey)) return true;
1255-
if (!string.IsNullOrEmpty(features.functionKey) && line.StartsWith(features.functionKey)) return true;
1256-
if (!string.IsNullOrEmpty(features.staticKey) && line.StartsWith(features.staticKey)) return true;
1257-
if (!string.IsNullOrEmpty(features.finalKey) && line.StartsWith(features.finalKey)) return true;
1250+
foreach (string keyword in typesKeywords)
1251+
if (line.IndexOf(keyword) >= 0) return true;
1252+
return false;
1253+
}
1254+
1255+
private static bool IsDeclaration(string line, ContextFeatures features)
1256+
{
1257+
foreach (string keyword in features.accessKeywords)
1258+
if (line.StartsWith(keyword)) return true;
1259+
foreach (string keyword in features.declKeywords)
1260+
if (line.StartsWith(keyword)) return true;
12581261
return false;
12591262
}
12601263

@@ -1751,9 +1754,7 @@ static private bool HandleDotCompletion(ScintillaControl Sci, bool autoHide)
17511754

17521755
// complete keyword
17531756
string word = expr.WordBefore;
1754-
if (word != null &&
1755-
(word == features.varKey || word == features.functionKey || word == features.constKey
1756-
|| word == features.getKey || word == features.setKey))
1757+
if (word != null && Array.IndexOf(features.declKeywords, word) >= 0)
17571758
return false;
17581759
ClassModel argumentType = null;
17591760
if (dotIndex < 0)
@@ -1927,11 +1928,7 @@ static private bool HandleDotCompletion(ScintillaControl Sci, bool autoHide)
19271928
mix.Merge(cFile.GetSortedMembersList());
19281929
mix.Merge(ctx.GetTopLevelElements());
19291930
mix.Merge(ctx.GetVisibleExternalElements());
1930-
MemberList decl = new MemberList();
1931-
foreach (string key in features.codeKeywords)
1932-
decl.Add(new MemberModel(key, key, FlagType.Template, 0));
1933-
decl.Sort();
1934-
mix.Merge(decl);
1931+
mix.Merge(GetKeywords());
19351932
}
19361933

19371934
// show
@@ -1953,6 +1950,30 @@ static private bool HandleDotCompletion(ScintillaControl Sci, bool autoHide)
19531950
return true;
19541951
}
19551952

1953+
private static MemberList GetKeywords()
1954+
{
1955+
IASContext ctx = ASContext.Context;
1956+
ContextFeatures features = ctx.Features;
1957+
ClassModel cClass = ctx.CurrentClass;
1958+
bool inClass = !cClass.IsVoid();
1959+
1960+
MemberList decl = new MemberList();
1961+
if (inClass || !ctx.CurrentModel.haXe)
1962+
{
1963+
foreach (string key in features.codeKeywords)
1964+
decl.Add(new MemberModel(key, key, FlagType.Template, 0));
1965+
}
1966+
if (!inClass)
1967+
{
1968+
foreach (string key in features.accessKeywords)
1969+
decl.Add(new MemberModel(key, key, FlagType.Template, 0));
1970+
foreach (string key in features.typesKeywords)
1971+
decl.Add(new MemberModel(key, key, FlagType.Template, 0));
1972+
}
1973+
decl.Sort();
1974+
return decl;
1975+
}
1976+
19561977
private static bool DeclarationSectionOnly()
19571978
{
19581979
ClassModel inClass = ASContext.Context.CurrentClass;

‎External/Plugins/ASCompletion/Completion/ASDocumentation.cs‎

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ namespace ASCompletion.Completion
2121
{
2222
public class CommentBlock
2323
{
24-
public string Description;
25-
public string InfoTip;
26-
public string Return;
27-
public ArrayList ParamName; // TODO: change ArrayList for List<string>
28-
public ArrayList ParamDesc;
29-
public ArrayList TagName;
30-
public ArrayList TagDesc;
24+
public string Description;
25+
public string InfoTip;
26+
public string Return;
27+
public bool IsFunctionWithArguments;
28+
public ArrayList ParamName; // TODO: change ArrayList for List<string>
29+
public ArrayList ParamDesc;
30+
public ArrayList TagName;
31+
public ArrayList TagDesc;
3132
}
3233

3334
public class ASDocumentation
@@ -408,10 +409,16 @@ static public string RemoveHTMLTags(string tip)
408409
static public string GetTipShortDetails(MemberModel member, string highlightParam)
409410
{
410411
if (member == null || member.Comments == null || !ASContext.CommonSettings.SmartTipsEnabled) return "";
411-
CommentBlock cb = ParseComment(member.Comments);
412+
CommentBlock cb = ParseComment(member.Comments);
413+
cb.IsFunctionWithArguments = IsFunctionWidthArguments(member);
412414
return " \u2026" + GetTipShortDetails(cb, highlightParam);
413415
}
414416

417+
static bool IsFunctionWidthArguments(MemberModel member)
418+
{
419+
return (member.Flags & FlagType.Function) > 0 && member.Parameters.Count > 0;
420+
}
421+
415422
/// <summary>
416423
/// Short contextual details to display in tips
417424
/// </summary>
@@ -429,7 +436,7 @@ static public string GetTipShortDetails(CommentBlock cb, string highlightParam)
429436
if (highlightParam == (string)cb.ParamName[i])
430437
{
431438
details += "\n" + MethodCallTip.HLTextStyleBeg + highlightParam + ":" + MethodCallTip.HLTextStyleEnd
432-
+ " " + Get2LinesOf((string)cb.ParamDesc[i]).TrimStart();
439+
+ " " + Get2LinesOf((string)cb.ParamDesc[i], true).TrimStart();
433440
return details;
434441
}
435442
}
@@ -440,27 +447,32 @@ static public string GetTipShortDetails(CommentBlock cb, string highlightParam)
440447
if (cb.InfoTip != null && cb.InfoTip.Length > 0)
441448
details += "\n"+cb.InfoTip;
442449
else if (cb.Description != null && cb.Description.Length > 0)
443-
details += Get2LinesOf(cb.Description);
450+
details += Get2LinesOf(cb.Description, cb.IsFunctionWithArguments);
444451
}
445452

446453
return details;
447454
}
448455

449456
static private string GetShortcutDocs()
450457
{
451-
return "\n[i](" + TextHelper.GetString("Info.ShowDetails") + ")[/i]";
458+
return "\n[COLOR=#666666:MULTIPLY][i](" + TextHelper.GetString("Info.ShowDetails") + ")[/i][/COLOR]";
452459
}
453460

454461
/// <summary>
455462
/// Split multiline text and return 2 lines or less of text
456463
/// </summary>
457464
static public string Get2LinesOf(string text)
465+
{
466+
return Get2LinesOf(text, false);
467+
}
468+
469+
static public string Get2LinesOf(string text, bool alwaysAddShortcutDocs)
458470
{
459471
string[] lines = text.Split('\n');
460472
text = "";
461473
int n = Math.Min(lines.Length, 2);
462474
for (int i = 0; i < n; i++) text += "\n" + lines[i];
463-
if (lines.Length > 2) text += " \x86" + GetShortcutDocs();
475+
if (lines.Length > 2 || alwaysAddShortcutDocs) text += " \x86" + GetShortcutDocs();
464476
return text;
465477
}
466478

@@ -473,7 +485,8 @@ static public string Get2LinesOf(string text)
473485
static public string GetTipFullDetails(MemberModel member, string highlightParam)
474486
{
475487
if (member == null || member.Comments == null || !ASContext.CommonSettings.SmartTipsEnabled) return "";
476-
CommentBlock cb = ParseComment(member.Comments);
488+
CommentBlock cb = ParseComment(member.Comments);
489+
cb.IsFunctionWithArguments = IsFunctionWidthArguments(member);
477490
return GetTipFullDetails(cb, highlightParam);
478491
}
479492

0 commit comments

Comments
 (0)