Skip to content

Commit 1cd48ff

Browse files
author
SlavaRa
committed
fixes add ";" for imports
1 parent 80925d7 commit 1cd48ff

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
@@ -3958,7 +3958,6 @@ static internal void HandleCompletionInsert(ScintillaControl sci, int position,
39583958
// let the context handle the insertion
39593959
if (ASContext.Context.OnCompletionInsert(sci, position, text, trigger))
39603960
return;
3961-
39623961
// event inserted
39633962
if (item is EventItem)
39643963
{
@@ -3969,18 +3968,19 @@ static internal void HandleCompletionInsert(ScintillaControl sci, int position,
39693968
// default handling
39703969
if (ASContext.Context.Settings != null)
39713970
{
3971+
int textEndPosition = position + text.Length;
39723972
// was a fully qualified type inserted?
3973-
ASExpr expr = GetExpression(sci, position + text.Length);
3973+
ASExpr expr = GetExpression(sci, textEndPosition);
39743974
if (expr.Value == null) return;
3975-
3975+
ASResult type = GetExpressionType(sci, textEndPosition);
3976+
if (type.IsPackage) return;
39763977
ContextFeatures features = ASContext.Context.Features;
39773978

39783979
// add ; for imports
39793980
if (" \n\t".IndexOf(trigger) >= 0 && expr.WordBefore != null
39803981
&& (expr.WordBefore == features.importKey || expr.WordBefore == features.importKeyAlt))
39813982
{
3982-
sci.InsertText(sci.CurrentPos, ";");
3983-
sci.SetSel(sci.CurrentPos + 1, sci.CurrentPos + 1);
3983+
if (!sci.GetLine(sci.CurrentLine).Contains(";")) sci.InsertText(sci.CurrentPos, ";");
39843984
return;
39853985
}
39863986

0 commit comments

Comments
 (0)