Skip to content

Commit 29b81a4

Browse files
committed
Merge pull request #883 from SlavaRa/feature/fixes_add_;_for_imports
Fixes add ";" for imports
2 parents dc3ba2c + 1cd48ff commit 29b81a4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

External/Plugins/ASCompletion/Completion/ASComplete.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3951,7 +3951,6 @@ static internal void HandleCompletionInsert(ScintillaControl sci, int position,
39513951
// let the context handle the insertion
39523952
if (ASContext.Context.OnCompletionInsert(sci, position, text, trigger))
39533953
return;
3954-
39553954
// event inserted
39563955
if (item is EventItem)
39573956
{
@@ -3962,18 +3961,19 @@ static internal void HandleCompletionInsert(ScintillaControl sci, int position,
39623961
// default handling
39633962
if (ASContext.Context.Settings != null)
39643963
{
3964+
int textEndPosition = position + text.Length;
39653965
// was a fully qualified type inserted?
3966-
ASExpr expr = GetExpression(sci, position + text.Length);
3966+
ASExpr expr = GetExpression(sci, textEndPosition);
39673967
if (expr.Value == null) return;
3968-
3968+
ASResult type = GetExpressionType(sci, textEndPosition);
3969+
if (type.IsPackage) return;
39693970
ContextFeatures features = ASContext.Context.Features;
39703971

39713972
// add ; for imports
39723973
if (" \n\t".IndexOf(trigger) >= 0 && expr.WordBefore != null
39733974
&& (expr.WordBefore == features.importKey || expr.WordBefore == features.importKeyAlt))
39743975
{
3975-
sci.InsertText(sci.CurrentPos, ";");
3976-
sci.SetSel(sci.CurrentPos + 1, sci.CurrentPos + 1);
3976+
if (!sci.GetLine(sci.CurrentLine).Contains(";")) sci.InsertText(sci.CurrentPos, ";");
39773977
return;
39783978
}
39793979

0 commit comments

Comments
 (0)