@@ -143,6 +143,7 @@ def __init__(self):
143
143
self .completionKeywordFalse = ("false\t keyword" , "False" ,)
144
144
self .completionKeywordNone = ("none\t keyword" , "None" ,)
145
145
self .completionKeywordTrue = ("true\t keyword" , "True" ,)
146
+ self .scriptContents = None
146
147
147
148
# Clear cache in order to force an update
148
149
def on_close (self , view ):
@@ -396,6 +397,8 @@ def Exit():
396
397
scriptContents = view .substr (sublime .Region (0 , view .size ()))
397
398
else :
398
399
scriptContents = self .scriptContents
400
+ if not scriptContents :
401
+ return Exit ()
399
402
lineCount = scriptContents .count ("\n " ) + 1
400
403
statements = []
401
404
lines = []
@@ -549,11 +552,15 @@ def Completions(self, view, prefix, locations):
549
552
completions .append (SublimePapyrus .MakeEventCompletion (obj , sem , False , "parent" ))
550
553
completions .append (("import\t import statement" , "Import ${0:$SELECTION}" ,))
551
554
completions .append (("property\t property def." , "${1:Type} Property ${2:PropertyName} ${3:Auto}" ,))
555
+ completions .append (("endproperty\t keyword" , "EndProperty" ,))
552
556
completions .append (("fullproperty\t full property def." , "${1:Type} Property ${2:PropertyName}\n \t ${1:Type} Function Get()\n \t \t ${3}\n \t EndFunction\n \n \t Function Set(${1:Type} Variable)\n \t \t ${4}\n \t EndFunction\n EndProperty" ,))
553
557
completions .append (("autostate\t auto state def." , "Auto State ${1:StateName}\n \t ${0}\n EndState" ,))
554
558
completions .append (("state\t state def." , "State ${1:StateName}\n \t ${0}\n EndState" ,))
559
+ completions .append (("endstate\t keyword" , "EndState" ,))
555
560
completions .append (("event\t event def." , "Event ${1:EventName}(${2:Parameters})\n \t ${0}\n EndEvent" ,))
561
+ completions .append (("endevent\t keyword" , "EndEvent" ,))
556
562
completions .append (("function\t function def." , "${1:Type} Function ${2:FunctionName}(${3:Parameters})\n \t ${0}\n EndFunction" ,))
563
+ completions .append (("endfunction\t keyword" , "EndFunction" ,))
557
564
# Types to facilitate variable declarations
558
565
completions .extend (self .GetTypeCompletions (view , True ))
559
566
return completions
@@ -707,7 +714,9 @@ def Completions(self, view, prefix, locations):
707
714
completions .append (("if\t if" , "If ${1:$SELECTION}\n \t ${0}\n EndIf" ,))
708
715
completions .append (("elseif\t else-if" , "ElseIf ${1:$SELECTION}\n \t ${0}" ,))
709
716
completions .append (("else\t else" , "Else\n \t ${0}" ,))
717
+ completions .append (("endif\t keyword" , "EndIf" ,))
710
718
completions .append (("while\t while-loop" , "While ${1:$SELECTION}\n \t ${0}\n EndWhile" ,))
719
+ completions .append (("endwhile\t keyword" , "EndWhile" ,))
711
720
completions .append (("for\t pseudo for-loop" , "Int ${1:iCount} = 0\n While ${1:iCount} < ${2:maxSize}\n \t ${0}\n \t ${1:iCount} += 1\n EndWhile" ,))
712
721
if e .signature .data .type :
713
722
completions .append (("return\t stat." , "Return " ,))
0 commit comments