Skip to content

Commit 327f378

Browse files
committed
Merge branch 'development' of https://github.com/fdorg/flashdevelop into development
2 parents 7e8fbe8 + 6aee6b1 commit 327f378

File tree

94 files changed

+4819
-557
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+4819
-557
lines changed

External/3rdParty/Scintilla/additional_keywords.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
3434
WordList ppDefinitions;
3535
WordList markerList;
3636
struct SymbolValue {
37-
@@ -589,6 +595,15 @@
38-
case 5:
39-
wordListN = &markerList;
37+
@@ -587,6 +593,15 @@
38+
wordListN = &ppDefinitions;
4039
break;
41-
+ case 6:
40+
case 5:
4241
+ wordListN = &keywords5;
4342
+ break;
44-
+ case 7:
43+
+ case 6:
4544
+ wordListN = &keywords6;
4645
+ break;
47-
+ case 8:
46+
+ case 7:
4847
+ wordListN = &keywords7;
4948
+ break;
49+
+ case 8:
50+
wordListN = &markerList;
51+
break;
5052
}
51-
Sci_Position firstModification = -1;
52-
if (wordListN) {
5353
@@ -809,6 +824,12 @@
5454
sc.ChangeState(SCE_C_WORD2|activitySet);
5555
} else if (keywords4.InList(s)) {

External/Plugins/ASCompletion/Completion/ASComplete.cs

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ static public bool OnChar(ScintillaControl Sci, int Value, bool autoHide)
184184
if (features.hasGenerics && position > 2)
185185
{
186186
char c0 = (char)Sci.CharAt(position - 2);
187-
if (c0 == '.' /*|| Char.IsLetterOrDigit(c0)*/)
187+
//TODO: We should check if we are actually on a generic type
188+
if ((ASContext.Context.CurrentModel.Version == 3 && c0 == '.') || Char.IsLetterOrDigit(c0))
188189
return HandleColonCompletion(Sci, "", autoHide);
189190
return false;
190191
}
@@ -2206,6 +2207,7 @@ static private bool HandleColonCompletion(ScintillaControl Sci, string tail, boo
22062207

22072208
private static ComaExpression GetFunctionContext(ScintillaControl Sci, bool autoHide)
22082209
{
2210+
ContextFeatures features = ASContext.Context.Features;
22092211
ComaExpression coma = ComaExpression.None;
22102212
int position = Sci.CurrentPos - 1;
22112213
char c = ' ';
@@ -2222,7 +2224,7 @@ private static ComaExpression GetFunctionContext(ScintillaControl Sci, bool auto
22222224
// var declaration
22232225
GetWordLeft(Sci, ref position);
22242226
string keyword = (c == ':') ? GetWordLeft(Sci, ref position) : null;
2225-
if (keyword == ASContext.Context.Features.varKey || keyword == ASContext.Context.Features.constKey)
2227+
if (keyword == features.varKey || (features.constKey != null && keyword == features.constKey))
22262228
coma = ComaExpression.VarDeclaration;
22272229
// function return type
22282230
else if ((char)Sci.CharAt(position) == ')')
@@ -2244,7 +2246,6 @@ private static ComaExpression GetFunctionContext(ScintillaControl Sci, bool auto
22442246
}
22452247
}
22462248
keyword = GetWordLeft(Sci, ref position);
2247-
ContextFeatures features = ASContext.Context.Features;
22482249
if (keyword == "" && Sci.CharAt(position) == '>' && features.hasGenerics)
22492250
{
22502251
int groupCount = 1;
@@ -2267,6 +2268,9 @@ private static ComaExpression GetFunctionContext(ScintillaControl Sci, bool auto
22672268
keyword = GetWordLeft(Sci, ref position);
22682269
if (keyword == features.functionKey || keyword == features.getKey || keyword == features.setKey)
22692270
coma = ComaExpression.FunctionDeclaration;
2271+
else if (ASContext.Context.CurrentModel.haXe && keyword == features.varKey &&
2272+
(ASContext.Context.CurrentMember == null || (ASContext.Context.CurrentMember.Flags & FlagType.Function) == 0))
2273+
coma = ComaExpression.VarDeclaration; // Haxe Properties
22702274
}
22712275
}
22722276
// needs more guessing
@@ -3484,7 +3488,7 @@ static private ASExpr GetExpression(ScintillaControl Sci, int position, bool ign
34843488
/// Find out in what context is a coma-separated expression
34853489
/// </summary>
34863490
/// <returns></returns>
3487-
private static ComaExpression DisambiguateComa(ScintillaControl Sci, int position, int minPos)
3491+
internal static ComaExpression DisambiguateComa(ScintillaControl Sci, int position, int minPos)
34883492
{
34893493
ContextFeatures features = ASContext.Context.Features;
34903494
// find block start '(' or '{'
@@ -3531,6 +3535,7 @@ private static ComaExpression DisambiguateComa(ScintillaControl Sci, int positio
35313535
string word1 = GetWordLeft(Sci, ref position);
35323536
if (word1 == "" && Sci.CharAt(position) == '>' && features.hasGenerics)
35333537
{
3538+
// Generic function: function generic<K>(arg:K)
35343539
int groupCount = 1;
35353540
position--;
35363541
while (position >= 0 && groupCount > 0)
@@ -3569,7 +3574,17 @@ private static ComaExpression DisambiguateComa(ScintillaControl Sci, int positio
35693574
if (":,(=".IndexOf(c) >= 0)
35703575
{
35713576
string line = Sci.GetLine(Sci.LineFromPosition(position));
3577+
//TODO: Very limited check, the case|default could be in a previous line, or it could be something else in the same line
35723578
if (Regex.IsMatch(line, @"\b(case|default)\b.*:")) break; // case: code block
3579+
if (c == ':' && Sci.ConfigurationLanguage == "haxe")
3580+
{
3581+
// Anonymous structures
3582+
ComaExpression coma = DisambiguateComa(Sci, position, minPos);
3583+
if (coma == ComaExpression.FunctionDeclaration || coma == ComaExpression.VarDeclaration)
3584+
{
3585+
return ComaExpression.VarDeclaration;
3586+
}
3587+
}
35733588
return ComaExpression.AnonymousObjectParam;
35743589
}
35753590
else if (c != ')' && c != '}' && !Char.IsLetterOrDigit(c)) return ComaExpression.AnonymousObject;
@@ -3580,7 +3595,28 @@ private static ComaExpression DisambiguateComa(ScintillaControl Sci, int positio
35803595
{
35813596
braceCount++;
35823597
}
3583-
else if (c == '?') return ComaExpression.AnonymousObject;
3598+
else if (c == '?')
3599+
{
3600+
//TODO: Change to ASContext.Context.CurrentModel
3601+
if (Sci.ConfigurationLanguage == "haxe") // Haxe optional fields
3602+
{
3603+
ComaExpression coma = DisambiguateComa(Sci, position - 1, minPos);
3604+
if (coma == ComaExpression.FunctionDeclaration)
3605+
{
3606+
// Function optional argument
3607+
return coma;
3608+
}
3609+
else if (coma == ComaExpression.VarDeclaration)
3610+
{
3611+
// Possible anonymous structure optional field. Check we are not in a ternary operator
3612+
position--;
3613+
string word1 = GetWordLeft(Sci, ref position);
3614+
c = (word1.Length > 0) ? word1[word1.Length - 1] : (char) Sci.CharAt(position);
3615+
if (c == ',' || c == '{') return coma;
3616+
}
3617+
}
3618+
return ComaExpression.AnonymousObject;
3619+
}
35843620
position--;
35853621
}
35863622
return ComaExpression.None;

0 commit comments

Comments
 (0)