Skip to content

Commit 7e8fbe8

Browse files
committed
Merge branch 'development' of https://github.com/fdorg/flashdevelop into development
2 parents 198c309 + d32a39a commit 7e8fbe8

File tree

9 files changed

+172
-134
lines changed

9 files changed

+172
-134
lines changed
Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
1-
diff -r 1092d3d24959 include/SciLexer.h
2-
--- a/include/SciLexer.h Tue Jan 15 09:51:15 2013 +1100
3-
+++ b/include/SciLexer.h Wed Feb 06 22:13:27 2013 +0100
4-
@@ -161,6 +161,9 @@
5-
#define SCE_C_TRIPLEVERBATIM 21
6-
#define SCE_C_HASHQUOTEDSTRING 22
7-
#define SCE_C_PREPROCESSORCOMMENT 23
8-
+#define SCE_C_WORD3 24
9-
+#define SCE_C_WORD4 25
10-
+#define SCE_C_WORD5 26
1+
diff --git a/include/SciLexer.h b/include/SciLexer.h
2+
--- a/include/SciLexer.h
3+
+++ b/include/SciLexer.h
4+
@@ -177,6 +177,9 @@
5+
#define SCE_C_USERLITERAL 25
6+
#define SCE_C_TASKMARKER 26
7+
#define SCE_C_ESCAPESEQUENCE 27
8+
+#define SCE_C_WORD3 100
9+
+#define SCE_C_WORD4 101
10+
+#define SCE_C_WORD5 102
1111
#define SCE_D_DEFAULT 0
1212
#define SCE_D_COMMENT 1
1313
#define SCE_D_COMMENTLINE 2
14-
diff -r 1092d3d24959 lexers/LexCPP.cxx
15-
--- a/lexers/LexCPP.cxx Tue Jan 15 09:51:15 2013 +1100
16-
+++ b/lexers/LexCPP.cxx Wed Feb 06 22:13:27 2013 +0100
17-
@@ -247,6 +247,9 @@
18-
"Documentation comment keywords",
14+
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
15+
--- a/lexers/LexCPP.cxx
16+
+++ b/lexers/LexCPP.cxx
17+
@@ -353,6 +353,9 @@
1918
"Global classes and typedefs",
2019
"Preprocessor definitions",
20+
"Task marker and error marker keywords",
2121
+ "Extended(1) keywords and identifiers",
2222
+ "Extended(2) keywords and identifiers",
2323
+ "Extended(3) keywords and identifiers",
2424
0,
2525
};
2626

27-
@@ -323,6 +326,9 @@
27+
@@ -443,6 +446,9 @@
2828
WordList keywords2;
2929
WordList keywords3;
3030
WordList keywords4;
31-
+ WordList keywords5;
32-
+ WordList keywords6;
33-
+ WordList keywords7;
31+
+ WordList keywords5;
32+
+ WordList keywords6;
33+
+ WordList keywords7;
3434
WordList ppDefinitions;
35-
std::map<std::string, std::string> preprocessorDefinitionsStart;
36-
OptionsCPP options;
37-
@@ -411,6 +417,15 @@
38-
case 4:
39-
wordListN = &ppDefinitions;
35+
WordList markerList;
36+
struct SymbolValue {
37+
@@ -589,6 +595,15 @@
38+
case 5:
39+
wordListN = &markerList;
4040
break;
41-
+ case 5:
42-
+ wordListN = &keywords5;
43-
+ break;
44-
+ case 6:
45-
+ wordListN = &keywords6;
46-
+ break;
47-
+ case 7:
48-
+ wordListN = &keywords7;
49-
+ break;
41+
+ case 6:
42+
+ wordListN = &keywords5;
43+
+ break;
44+
+ case 7:
45+
+ wordListN = &keywords6;
46+
+ break;
47+
+ case 8:
48+
+ wordListN = &keywords7;
49+
+ break;
5050
}
51-
int firstModification = -1;
51+
Sci_Position firstModification = -1;
5252
if (wordListN) {
53-
@@ -605,6 +620,12 @@
53+
@@ -809,6 +824,12 @@
5454
sc.ChangeState(SCE_C_WORD2|activitySet);
5555
} else if (keywords4.InList(s)) {
5656
sc.ChangeState(SCE_C_GLOBALCLASS|activitySet);
5757
+ } else if (keywords5.InList(s)) {
58-
+ sc.ChangeState(SCE_C_WORD3|activitySet);
59-
+ } else if (keywords6.InList(s)) {
60-
+ sc.ChangeState(SCE_C_WORD4|activitySet);
61-
+ } else if (keywords7.InList(s)) {
62-
+ sc.ChangeState(SCE_C_WORD5|activitySet);
63-
}
64-
const bool literalString = sc.ch == '\"';
65-
if (literalString || sc.ch == '\'') {
58+
+ sc.ChangeState(SCE_C_WORD3|activitySet);
59+
+ } else if (keywords6.InList(s)) {
60+
+ sc.ChangeState(SCE_C_WORD4|activitySet);
61+
+ } else if (keywords7.InList(s)) {
62+
+ sc.ChangeState(SCE_C_WORD5|activitySet);
63+
} else {
64+
int subStyle = classifierIdentifiers.ValueFor(s);
65+
if (subStyle >= 0) {

External/Plugins/ASCompletion/Completion/ASComplete.cs

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3674,7 +3674,7 @@ static public bool IsTextStyle(int style)
36743674
{
36753675
return style == 0 || style == 10 /*punctuation*/ || style == 11 /*identifier*/
36763676
|| style == 16 /*word2 (secondary keywords: class name)*/
3677-
|| style == 24 /*word4 (add keywords4)*/ || style == 25 /*word5 (add keywords5)*/
3677+
|| style == 101 /*word4 (add keywords4)*/ || style == 102 /*word5 (add keywords5)*/
36783678
|| style == 127 /*PHP*/;
36793679
}
36803680

@@ -3686,8 +3686,8 @@ static public bool IsTextStyleEx(int style)
36863686
return style == 0 || style == 5 /*word (secondary keywords)*/
36873687
|| style == 10 /*punctuation*/ || style == 11 /*identifier*/
36883688
|| style == 16 /*word2 (secondary keywords: class name)*/
3689-
|| style == 19 /*globalclass (primary keywords)*/ || style == 23 /*word3 (add keywords3)*/
3690-
|| style == 24 /*word4 (add keywords4)*/ || style == 25 /*word5 (add keywords5)*/
3689+
|| style == 19 /*globalclass (primary keywords)*/ || style == 100 /*word3 (add keywords3)*/
3690+
|| style == 101 /*word4 (add keywords4)*/ || style == 102 /*word5 (add keywords5)*/
36913691
|| style == 127 /*PHP*/;
36923692
}
36933693

@@ -4274,74 +4274,73 @@ public static bool HasSnippet(string word)
42744274
/// <param name="sci"></param>
42754275
/// <param name="value">Character inserted</param>
42764276
/// <returns>Code was generated</returns>
4277-
static private bool CodeAutoOnChar(ScintillaControl sci, int value)
4277+
static bool CodeAutoOnChar(ScintillaControl sci, int value)
42784278
{
42794279
if (ASContext.Context.Settings == null || !ASContext.Context.Settings.GenerateImports)
42804280
return false;
42814281

42824282
int position = sci.CurrentPos;
42834283

4284-
if (value == '*' && position > 1 && sci.CharAt(position-2) == '.' && LastExpression != null)
4285-
{
4286-
// context
4287-
if (LastExpression.Separator == ' ' && LastExpression.WordBefore != null
4288-
&& !ASContext.Context.Features.HasTypePreKey(LastExpression.WordBefore))
4289-
return false;
4284+
if (value == '*' && position > 1 && sci.CharAt(position - 2) == '.' && LastExpression != null)
4285+
return HandleWildcardList(sci, position, LastExpression);
42904286

4291-
FileModel cFile = ASContext.Context.CurrentModel;
4292-
ClassModel cClass = ASContext.Context.CurrentClass;
4293-
ASResult context = EvalExpression(LastExpression.Value, LastExpression, cFile, cClass, true, false);
4294-
if (context.IsNull() || !context.IsPackage || context.InFile == null)
4295-
return false;
4287+
return false;
4288+
}
42964289

4297-
string package = LastExpression.Value;
4298-
int startPos = LastExpression.Position;
4299-
string check = "";
4300-
char c;
4301-
while (startPos > LastExpression.PositionExpression && check.Length <= package.Length && check != package)
4302-
{
4303-
c = (char)sci.CharAt(--startPos);
4304-
if (c > 32) check = c+check;
4305-
}
4306-
if (check != package)
4307-
return false;
4290+
/// <summary>
4291+
/// User entered a qualified package with a wildcard, eg. flash.geom.*, at an unexpected position, eg. not after 'import'.
4292+
/// Remove expression, generate coresponding wildcard import, and show list of types of this package
4293+
/// </summary>
4294+
static bool HandleWildcardList(ScintillaControl sci, int position, ASExpr expr)
4295+
{
4296+
// validate context
4297+
var context = ASContext.Context;
4298+
if (expr.Separator == ' ' && expr.WordBefore != null
4299+
&& context.Features.HasTypePreKey(expr.WordBefore))
4300+
return false;
43084301

4309-
// insert import
4310-
string statement = "import " + package + "*;" + LineEndDetector.GetNewLineMarker(sci.EOLMode);
4311-
int endPos = sci.CurrentPos;
4312-
int line = 0;
4313-
int curLine = sci.LineFromPosition(position);
4314-
bool found = false;
4315-
while (line < curLine)
4302+
var cFile = context.CurrentModel;
4303+
var cClass = context.CurrentClass;
4304+
var resolved = EvalExpression(expr.Value, expr, cFile, cClass, true, false);
4305+
if (resolved.IsNull() || !resolved.IsPackage || resolved.InFile == null)
4306+
return false;
4307+
4308+
string package = resolved.InFile.Package;
4309+
string check = Regex.Replace(expr.Value, "\\s", "").TrimEnd('.');
4310+
if (check != package)
4311+
return false;
4312+
4313+
sci.BeginUndoAction();
4314+
try
4315+
{
4316+
// remove temp wildcard
4317+
int startPos = expr.PositionExpression;
4318+
sci.SetSel(startPos, position);
4319+
sci.ReplaceSel("");
4320+
4321+
// generate import
4322+
if (context.Settings.GenerateImports)
43164323
{
4317-
if (sci.GetLine(line++).IndexOf("import") >= 0) found = true;
4318-
else if (found) {
4319-
line--;
4320-
break;
4324+
var wildcard = new MemberModel { Name = "*", Type = package + ".*" };
4325+
if (!context.IsImported(wildcard, sci.LineFromPosition(position)))
4326+
{
4327+
startPos += ASGenerator.InsertImport(wildcard, true);
4328+
sci.SetSel(startPos, startPos);
43214329
}
43224330
}
4323-
if (line == curLine) line = 0;
4324-
position = sci.PositionFromLine(line);
4325-
line = sci.FirstVisibleLine;
4326-
sci.SetSel(position, position);
4327-
sci.ReplaceSel(statement);
4328-
4329-
// prepare insertion of the term as usual
4330-
startPos += statement.Length;
4331-
endPos += statement.Length;
4332-
sci.SetSel(startPos, endPos);
4333-
sci.ReplaceSel("");
4334-
sci.LineScroll(0, line-sci.FirstVisibleLine+1);
4335-
4336-
// create classes list
4337-
List<ICompletionListItem> list = new List<ICompletionListItem>();
4338-
foreach(MemberModel import in cClass.InFile.Imports)
4339-
if (import.Type.StartsWith(package))
4340-
list.Add(new MemberItem(import));
4341-
CompletionList.Show(list, false);
4342-
return true;
43434331
}
4344-
return false;
4332+
finally
4333+
{
4334+
sci.EndUndoAction();
4335+
}
4336+
4337+
// show types
4338+
var list = new List<ICompletionListItem>();
4339+
var imports = context.ResolvePackage(package, false).Imports;
4340+
foreach (MemberModel import in imports)
4341+
list.Add(new MemberItem(import));
4342+
CompletionList.Show(list, false);
4343+
return true;
43454344
}
43464345

43474346
#endregion

0 commit comments

Comments
 (0)