

def Completions(self, view, prefix, locations):
    SublimePapyrus.ClearLinterHighlights(view)
    completions = []
    flags = None
    global cacheLock
    global lex
    global syn
    global sem
    with cacheLock:
        bufferID = view.buffer_id()
        if (not bufferID):
            return
        currentScript = self.GetScript(bufferID)
        if (not currentScript):
            SublimePapyrus.ShowMessage('Run the linter once...')
            return
        (line, column) = view.rowcol(locations[0])
        line += 1
        lineString = view.substr(sublime.Region(view.line(locations[0]).begin(), (locations[0] - len(prefix)))).strip()
        settings = SublimePapyrus.GetSettings()
        settingFunctionEventParameters = settings.get('intelligent_code_completion_function_event_parameters', True)
        try:
            sem.GetContext(currentScript, line)
        except Linter.EmptyStateCancel as e:
            if (not lineString):
                for (name, obj) in e.functions[0].items():
                    if (obj.type == syn.STAT_FUNCTIONDEF):
                        completions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, False, 'parent'))
                    elif (obj.type == syn.STAT_EVENTDEF):
                        completions.append(SublimePapyrus.MakeEventCompletion(obj, sem, False, 'parent'))
                completions.append(('import\timport statement', 'Import ${0:$SELECTION}'))
                completions.append(('property\tproperty def.', '${1:Type} Property ${2:PropertyName} ${3:Auto}'))
                completions.append(('fullproperty\tfull property def.', '${1:Type} Property ${2:PropertyName}\n\t${1:Type} Function Get()\n\t\t${3}\n\tEndFunction\n\n\tFunction Set(${1:Type} Variable)\n\t\t${4}\n\tEndFunction\nEndProperty'))
                completions.append(('autostate\tauto state def.', 'Auto State ${1:StateName}\n\t${0}\nEndState'))
                completions.append(('state\tstate def.', 'State ${1:StateName}\n\t${0}\nEndState'))
                completions.append(('event\tevent def.', 'Event ${1:EventName}(${2:Parameters})\n\t${0}\nEndEvent'))
                completions.append(('function\tfunction def.', '${1:Type} Function ${2:FunctionName}(${3:Parameters})\n\t${0}\nEndFunction'))
                completions.extend(self.GetTypeCompletions(view, True))
                return completions
            else:
                tokens = []
                try:
                    for token in lex.Process(lineString):
                        if (token.type != lex.NEWLINE):
                            tokens.append(token)
                except Linter.LexicalError as f:
                    return
                if tokens:
                    if (tokens[(- 1)].type != lex.COMMENT_LINE):
                        try:
                            stat = syn.Process(tokens)
                            if (stat.type == syn.STAT_SCRIPTHEADER):
                                if (not stat.data.parent):
                                    completions.append(self.completionKeywordExtends)
                                if (not (lex.KW_CONDITIONAL in stat.data.flags)):
                                    completions.append(self.completionKeywordConditional)
                                if (not (lex.KW_HIDDEN in stat.data.flags)):
                                    completions.append(self.completionKeywordHidden)
                            elif (stat.type == syn.STAT_PROPERTYDEF):
                                if ((not (lex.KW_AUTO in stat.data.flags)) and (not (syn.KW_AUTOREADONLY in stat.data.flags))):
                                    completions.append(self.completionKeywordAuto)
                                if ((not (lex.KW_AUTOREADONLY in stat.data.flags)) and (not (syn.KW_AUTO in stat.data.flags))):
                                    completions.append(self.completionKeywordAutoReadOnly)
                                if (not (lex.KW_CONDITIONAL in stat.data.flags)):
                                    completions.append(self.completionKeywordConditional)
                                if (not (lex.KW_HIDDEN in stat.data.flags)):
                                    completions.append(self.completionKeywordHidden)
                            elif (stat.type == syn.STAT_VARIABLEDEF):
                                if (not (lex.KW_CONDITIONAL in stat.data.flags)):
                                    completions.append(self.completionKeywordConditional)
                            elif (stat.type == syn.STAT_FUNCTIONDEF):
                                if (not (lex.KW_NATIVE in stat.data.flags)):
                                    completions.append(self.completionKeywordNative)
                                if (not (lex.KW_GLOBAL in stat.data.flags)):
                                    completions.append(self.completionKeywordGlobal)
                            elif (stat.type == syn.STAT_EVENTDEF):
                                if (not (lex.KW_NATIVE in stat.data.flags)):
                                    completions.append(self.completionKeywordNative)
                            return completions
                        except Linter.ExpectedTypeError as f:
                            completions.extend(self.GetTypeCompletions(view, f.baseTypes))
                            return completions
                        except Linter.ExpectedKeywordError as f:
                            if (syn.KW_AUTO in e.keywords):
                                completions.append(('auto\tkeyword', 'Auto'))
                            if (syn.KW_AUTOREADONLY in e.keywords):
                                completions.append(('autoreadonly\tkeyword', 'AutoReadOnly'))
                            return completions
                        except Linter.ExpectedLiteralError as f:
                            if (tokens[1].type == lex.KW_PROPERTY):
                                if (tokens[0].type == lex.IDENTIFIER):
                                    completions.append(self.completionKeywordNone)
                                elif (tokens[0].type == lex.KW_BOOL):
                                    completions.append(self.completionKeywordTrue)
                                    completions.append(self.completionKeywordFalse)
                                elif (tokens[0].type == lex.KW_STRING):
                                    completions.append(('stringliteral\tstring literal', '"${0}"'))
                                return completions
                            elif ((tokens[1].type == lex.LEFT_BRACKET) and (tokens[2].type == lex.RIGHT_BRACKET) and (tokens[3].type == lex.KW_PROPERTY)):
                                completions.append(self.completionKeywordNone)
                                return completions
                        except Linter.SyntacticError as f:
                            return
            return
        except Linter.StateCancel as e:
            if (not lineString):
                for (name, stat) in e.functions[1].items():
                    if ((stat.type == syn.STAT_EVENTDEF) and (not e.functions[2].get(name, False))):
                        completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, False, 'self'))
                    elif ((stat.type == syn.STAT_FUNCTIONDEF) and (not e.functions[2].get(name, False))):
                        completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, False, 'self'))
                for (name, stat) in e.functions[0].items():
                    if ((stat.type == syn.STAT_EVENTDEF) and (not e.functions[2].get(name, False)) and (not e.functions[1].get(name, False))):
                        completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, False, 'parent'))
                    elif ((stat.type == syn.STAT_FUNCTIONDEF) and (not e.functions[2].get(name, False)) and (not e.functions[1].get(name, False))):
                        completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, False, 'parent'))
                return completions
            else:
                tokens = []
                try:
                    for token in lex.Process(lineString):
                        if (token.type != lex.NEWLINE):
                            tokens.append(token)
                except Linter.LexicalError as f:
                    return
                if tokens:
                    if (tokens[(- 1)].type != lex.COMMENT_LINE):
                        tokenCount = len(tokens)
                        if (tokenCount == 1):
                            if (tokens[0].type == lex.KW_FUNCTION):
                                for (name, stat) in e.functions[1].items():
                                    if ((stat.type == syn.STAT_FUNCTIONDEF) and (not stat.data.type) and (not e.functions[2].get(name, False))):
                                        completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, False, 'self', True))
                                for (name, stat) in e.functions[0].items():
                                    if ((stat.type == syn.STAT_FUNCTIONDEF) and (not stat.data.type) and (not e.functions[2].get(name, False)) and (not e.functions[1].get(name, False))):
                                        completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, False, 'parent', True))
                                return completions
                            elif (tokens[0].type == lex.KW_EVENT):
                                for (name, stat) in e.functions[1].items():
                                    if ((stat.type == syn.STAT_EVENTDEF) and (not e.functions[2].get(name, False))):
                                        completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, False, 'self', True))
                                for (name, stat) in e.functions[0].items():
                                    if ((stat.type == syn.STAT_EVENTDEF) and (not e.functions[2].get(name, False)) and (not e.functions[1].get(name, False))):
                                        completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, False, 'parent', True))
                                return completions
                        elif ((tokenCount == 2) and (tokens[1].type == lex.KW_FUNCTION)):
                            if ((tokens[0].type == lex.IDENTIFIER) or (tokens[0].type == lex.KW_BOOL) or (tokens[0].type == lex.KW_FLOAT) or (tokens[0].type == lex.KW_INT) or (tokens[0].type == lex.KW_STRING)):
                                funcType = tokens[0].value.upper()
                                for (name, stat) in e.functions[1].items():
                                    if ((stat.type == syn.STAT_FUNCTIONDEF) and (not stat.data.array) and (stat.data.type == funcType) and (not e.functions[2].get(name, False))):
                                        completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, False, 'self', True))
                                for (name, stat) in e.functions[0].items():
                                    if ((stat.type == syn.STAT_FUNCTIONDEF) and (not stat.data.array) and (stat.data.type == funcType) and (not e.functions[2].get(name, False)) and (not e.functions[1].get(name, False))):
                                        completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, False, 'parent', True))
                                return completions
                        elif ((tokenCount == 4) and (tokens[3].type == lex.KW_FUNCTION) and (tokens[1].type == lex.LEFT_BRACKET) and (tokens[2].type == lex.RIGHT_BRACKET)):
                            if ((tokens[0].type == lex.IDENTIFIER) or (tokens[0].type == lex.KW_BOOL) or (tokens[0].type == lex.KW_FLOAT) or (tokens[0].type == lex.KW_INT) or (tokens[0].type == lex.KW_STRING)):
                                funcType = tokens[0].value.upper()
                                for (name, stat) in e.functions[1].items():
                                    if ((stat.type == syn.STAT_FUNCTIONDEF) and stat.data.array and (stat.data.type == funcType) and (not e.functions[2].get(name, False))):
                                        completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, False, 'self', True))
                                for (name, stat) in e.functions[0].items():
                                    if ((stat.type == syn.STAT_FUNCTIONDEF) and stat.data.array and (stat.data.type == funcType) and (not e.functions[2].get(name, False)) and (not e.functions[1].get(name, False))):
                                        completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, False, 'parent', True))
                                return completions
            return
        except Linter.FunctionDefinitionCancel as e:
            if (not lineString):
                completions.append(('if\tif', 'If ${1:$SELECTION}\n\t${0}\nEndIf'))
                completions.append(('elseif\telse-if', 'ElseIf ${1:$SELECTION}\n\t${0}'))
                completions.append(('else\telse', 'Else\n\t${0}'))
                completions.append(('while\twhile-loop', 'While ${1:$SELECTION}\n\t${0}\nEndWhile'))
                completions.append(('for\tpseudo for-loop', 'Int ${1:iCount} = 0\nWhile ${1:iCount} < ${2:maxSize}\n\t${0}\n\t${1:iCount} += 1\nEndWhile'))
                if e.signature.data.type:
                    completions.append(('return\tstat.', 'Return '))
                else:
                    completions.append(('return\tstat.', 'Return'))
                if (not (sem.KW_GLOBAL in e.signature.data.flags)):
                    completions.append(self.completionKeywordSelf)
                    completions.append(self.completionKeywordParent)
                for (name, stat) in e.variables[0].items():
                    if (stat.type == syn.STAT_PROPERTYDEF):
                        completions.append(SublimePapyrus.MakePropertyCompletion(stat, 'parent'))
                for (name, stat) in e.variables[1].items():
                    if (stat.type == syn.STAT_VARIABLEDEF):
                        completions.append(SublimePapyrus.MakeVariableCompletion(stat))
                    elif (stat.type == syn.STAT_PROPERTYDEF):
                        completions.append(SublimePapyrus.MakePropertyCompletion(stat, 'self'))
                for (name, stat) in e.variables[2].items():
                    if (stat.type == syn.STAT_VARIABLEDEF):
                        completions.append(SublimePapyrus.MakeVariableCompletion(stat))
                    elif (stat.type == syn.STAT_PARAMETER):
                        completions.append(SublimePapyrus.MakeParameterCompletion(stat))
                if (len(e.variables) > 3):
                    for scope in e.variables[3:]:
                        for (name, stat) in scope.items():
                            if (stat.type == syn.STAT_VARIABLEDEF):
                                completions.append(SublimePapyrus.MakeVariableCompletion(stat))
                if (len(e.functions) > 2):
                    for (name, stat) in e.functions[2].items():
                        if (stat.type == syn.STAT_FUNCTIONDEF):
                            completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, True, 'self', parameters=settingFunctionEventParameters))
                        elif (stat.type == syn.STAT_EVENTDEF):
                            completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, True, 'self', parameters=settingFunctionEventParameters))
                    for (name, stat) in e.functions[1].items():
                        if ((stat.type == syn.STAT_FUNCTIONDEF) and (not e.functions[2].get(name, None))):
                            completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, True, 'self', parameters=settingFunctionEventParameters))
                        elif ((stat.type == syn.STAT_EVENTDEF) and (not e.functions[2].get(name, None))):
                            completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, True, 'self', parameters=settingFunctionEventParameters))
                    for (name, stat) in e.functions[0].items():
                        if ((stat.type == syn.STAT_FUNCTIONDEF) and (not e.functions[1].get(name, None)) and (not e.functions[2].get(name, None))):
                            completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, True, 'parent', parameters=settingFunctionEventParameters))
                        elif ((stat.type == syn.STAT_EVENTDEF) and (not e.functions[1].get(name, None)) and (not e.functions[2].get(name, None))):
                            completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, True, 'parent', parameters=settingFunctionEventParameters))
                else:
                    for (name, stat) in e.functions[1].items():
                        if (stat.type == syn.STAT_FUNCTIONDEF):
                            completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, True, 'self', parameters=settingFunctionEventParameters))
                        elif (stat.type == syn.STAT_EVENTDEF):
                            completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, True, 'self', parameters=settingFunctionEventParameters))
                    for (name, stat) in e.functions[0].items():
                        if ((stat.type == syn.STAT_FUNCTIONDEF) and (not e.functions[1].get(name, None))):
                            completions.append(SublimePapyrus.MakeFunctionCompletion(stat, sem, True, 'parent', parameters=settingFunctionEventParameters))
                        elif ((stat.type == syn.STAT_EVENTDEF) and (not e.functions[1].get(name, None))):
                            completions.append(SublimePapyrus.MakeEventCompletion(stat, sem, True, 'parent', parameters=settingFunctionEventParameters))
                for imp in e.imports:
                    functions = self.GetFunctionCompletions(imp, True)
                    if (not functions):
                        try:
                            script = sem.GetCachedScript(imp)
                            if script:
                                functions = []
                                impLower = imp.lower()
                                for (name, obj) in script.functions.items():
                                    if (lex.KW_GLOBAL in obj.data.flags):
                                        functions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, True, impLower, parameters=settingFunctionEventParameters))
                                self.SetFunctionCompletions(imp, functions, True)
                        except:
                            return
                    if functions:
                        completions.extend(functions)
                completions.extend(self.GetTypeCompletions(view, True))
                return completions
            else:
                tokens = []
                try:
                    for token in lex.Process(lineString):
                        if (token.type != lex.NEWLINE):
                            tokens.append(token)
                except Linter.LexicalError as f:
                    return
                if tokens:
                    if (tokens[(- 1)].type != lex.COMMENT_LINE):
                        try:
                            stat = syn.Process(tokens)
                            if (stat.type == syn.STAT_VARIABLEDEF):
                                completions.append(self.completionKeywordAs)
                                return completions
                            elif (stat.type == syn.STAT_ASSIGNMENT):
                                completions.append(self.completionKeywordAs)
                                return completions
                            elif (stat.type == syn.STAT_EXPRESSION):
                                completions.append(self.completionKeywordAs)
                                return completions
                        except Linter.ExpectedTypeError as f:
                            completions.extend(self.GetTypeCompletions(view, f.baseTypes))
                            return completions
                        except Linter.ExpectedIdentifierError as f:
                            if (tokens[(- 1)].type == lex.OP_DOT):
                                try:
                                    result = sem.NodeVisitor(syn.stack[(- 2)])
                                    if (result.type == lex.KW_SELF):
                                        for (name, obj) in e.functions[0].items():
                                            if (obj.type == syn.STAT_FUNCTIONDEF):
                                                completions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, True, 'parent', parameters=settingFunctionEventParameters))
                                            elif (obj.type == syn.STAT_EVENTDEF):
                                                completions.append(SublimePapyrus.MakeEventCompletion(obj, sem, True, 'parent', parameters=settingFunctionEventParameters))
                                        for (name, obj) in e.functions[1].items():
                                            if (obj.type == syn.STAT_FUNCTIONDEF):
                                                completions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, True, 'self', parameters=settingFunctionEventParameters))
                                            elif (obj.type == syn.STAT_EVENTDEF):
                                                completions.append(SublimePapyrus.MakeEventCompletion(obj, sem, True, 'self', parameters=settingFunctionEventParameters))
                                        for (name, obj) in e.variables[0].items():
                                            if (obj.type == syn.STAT_PROPERTYDEF):
                                                completions.append(SublimePapyrus.MakePropertyCompletion(obj, 'parent'))
                                        for (name, obj) in e.variables[1].items():
                                            if (obj.type == syn.STAT_PROPERTYDEF):
                                                completions.append(SublimePapyrus.MakePropertyCompletion(obj, 'self'))
                                        return completions
                                    elif result.array:
                                        typ = result.type.capitalize()
                                        completions.append(('find\tint func.', ('Find(${1:%s akElement}, ${2:Int aiStartIndex = 0})' % typ)))
                                        completions.append(('rfind\tint func.', ('RFind(${1:%s akElement}, ${2:Int aiStartIndex = -1})' % typ)))
                                        completions.append(('length\tkeyword', 'Length'))
                                        return completions
                                    else:
                                        if ((result.type == lex.KW_NONE) or (result.type == lex.KW_BOOL) or (result.type == lex.KW_FLOAT) or (result.type == lex.KW_INT) or (result.type == lex.KW_STRING)):
                                            return
                                        if (not result.object):
                                            functions = self.GetFunctionCompletions(result.type, True)
                                            if (not functions):
                                                try:
                                                    script = sem.GetCachedScript(result.type)
                                                    if script:
                                                        functions = []
                                                        typeLower = result.type.lower()
                                                        for (name, obj) in script.functions.items():
                                                            if (lex.KW_GLOBAL in obj.data.flags):
                                                                functions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, True, typeLower, parameters=settingFunctionEventParameters))
                                                        self.SetFunctionCompletions(result.type, functions, True)
                                                except:
                                                    return
                                            if functions:
                                                completions.extend(functions)
                                            return completions
                                        else:
                                            functions = self.GetFunctionCompletions(result.type, False)
                                            if (not functions):
                                                try:
                                                    script = sem.GetCachedScript(result.type)
                                                    if script:
                                                        functions = []
                                                        typeLower = result.type.lower()
                                                        for (name, obj) in script.functions.items():
                                                            if (lex.KW_GLOBAL not in obj.data.flags):
                                                                functions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, True, typeLower, parameters=settingFunctionEventParameters))
                                                        self.SetFunctionCompletions(result.type, functions, False)
                                                except:
                                                    return
                                            if functions:
                                                completions.extend(functions)
                                            properties = self.GetPropertyCompletions(result.type)
                                            if (not properties):
                                                try:
                                                    script = sem.GetCachedScript(result.type)
                                                    if script:
                                                        properties = []
                                                        typeLower = result.type.lower()
                                                        for (name, obj) in script.properties.items():
                                                            properties.append(SublimePapyrus.MakePropertyCompletion(obj, typeLower))
                                                        self.SetPropertyCompletions(result.type, properties)
                                                except:
                                                    return
                                            if properties:
                                                completions.extend(properties)
                                            return completions
                                    return
                                except Linter.SemanticError as g:
                                    return
                                return completions
                            else:
                                for (name, obj) in e.functions[0].items():
                                    if (obj.type == syn.STAT_FUNCTIONDEF):
                                        completions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, True, 'parent', parameters=settingFunctionEventParameters))
                                    elif (obj.type == syn.STAT_EVENTDEF):
                                        completions.append(SublimePapyrus.MakeEventCompletion(obj, sem, True, 'parent', parameters=settingFunctionEventParameters))
                                for (name, obj) in e.functions[1].items():
                                    if (obj.type == syn.STAT_FUNCTIONDEF):
                                        completions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, True, 'self', parameters=settingFunctionEventParameters))
                                    elif (obj.type == syn.STAT_EVENTDEF):
                                        completions.append(SublimePapyrus.MakeEventCompletion(obj, sem, True, 'self', parameters=settingFunctionEventParameters))
                                for (name, obj) in e.variables[0].items():
                                    if (obj.type == syn.STAT_PROPERTYDEF):
                                        completions.append(SublimePapyrus.MakePropertyCompletion(obj, 'parent'))
                                for (name, obj) in e.variables[1].items():
                                    if (obj.type == syn.STAT_PROPERTYDEF):
                                        completions.append(SublimePapyrus.MakePropertyCompletion(obj, 'self'))
                                    elif (obj.type == syn.STAT_VARIABLEDEF):
                                        completions.append(SublimePapyrus.MakeVariableCompletion(obj))
                                for scope in e.variables[2:]:
                                    for (name, obj) in scope.items():
                                        if (obj.type == syn.STAT_VARIABLEDEF):
                                            completions.append(SublimePapyrus.MakeVariableCompletion(obj))
                                        elif (obj.type == syn.STAT_PARAMETER):
                                            completions.append(SublimePapyrus.MakeParameterCompletion(obj))
                                completions.extend(self.GetTypeCompletions(view, False))
                                completions.append(self.completionKeywordFalse)
                                completions.append(self.completionKeywordTrue)
                                completions.append(self.completionKeywordNone)
                                completions.append(self.completionKeywordAs)
                                if (not (sem.KW_GLOBAL in e.signature.data.flags)):
                                    completions.append(self.completionKeywordSelf)
                                    completions.append(self.completionKeywordParent)
                                for imp in e.imports:
                                    functions = self.GetFunctionCompletions(imp, True)
                                    if (not functions):
                                        try:
                                            script = sem.GetCachedScript(imp)
                                            if script:
                                                functions = []
                                                impLower = imp.lower()
                                                for (name, obj) in script.functions.items():
                                                    if (lex.KW_GLOBAL in obj.data.flags):
                                                        functions.append(SublimePapyrus.MakeFunctionCompletion(obj, sem, True, impLower, parameters=settingFunctionEventParameters))
                                                self.SetFunctionCompletions(imp, functions, True)
                                        except:
                                            return
                                    if functions:
                                        completions.extend(functions)
                                stack = syn.stack[:]
                                arguments = []
                                for item in reversed(stack):
                                    if (item.type == sem.NODE_FUNCTIONCALLARGUMENT):
                                        arguments.insert(0, stack.pop())
                                    elif (item.type == sem.LEFT_PARENTHESIS):
                                        break
                                stackLength = len(stack)
                                func = None
                                if ((stackLength >= 2) and (stack[(- 2)].type == sem.IDENTIFIER)):
                                    name = stack[(- 2)].value.upper()
                                    if ((stackLength >= 4) and (stack[(- 3)].type == sem.OP_DOT)):
                                        try:
                                            result = sem.NodeVisitor(stack[(- 4)])
                                            if (result.type != sem.KW_SELF):
                                                try:
                                                    script = sem.GetCachedScript(result.type)
                                                    func = script.functions.get(name, None)
                                                except Linter.SemanticError as e:
                                                    return
                                            else:
                                                for scope in reversed(e.functions):
                                                    func = scope.get(name, None)
                                                    if func:
                                                        break
                                        except Linter.SemanticError as e:
                                            return
                                    else:
                                        for scope in reversed(e.functions):
                                            func = scope.get(name, None)
                                            if func:
                                                break
                                        for imp in e.imports:
                                            script = sem.GetCachedScript(imp)
                                            temp = script.functions.get(name, None)
                                            if temp:
                                                if func:
                                                    func = None
                                                else:
                                                    func = temp
                                                break
                                if (func and func.data.parameters):
                                    for param in func.data.parameters:
                                        completions.append(SublimePapyrus.MakeParameterCompletion(Linter.Statement(sem.STAT_PARAMETER, 0, param)))
                                    global SUBLIME_VERSION
                                    if ((SUBLIME_VERSION >= 3070) and (prefix == '') and settings.get('tooltip_function_parameters', True)):
                                        if (not view.is_popup_visible()):
                                            self.ShowFunctionInfo(view, tokens, func, len(arguments))
                                return completions
                        except Linter.SyntacticError as f:
                            if (syn.stack and (syn.stack[(- 2)].type == syn.LEFT_PARENTHESIS) and (syn.stack[(- 1)].type != syn.RIGHT_PARENTHESIS)):
                                completions.append(self.completionKeywordAs)
                                return completions
                            return
            return
        except Linter.PropertyDefinitionCancel as e:
            if (not lineString):
                typ = None
                if e.array:
                    typ = ('%s[]' % e.type.capitalize())
                else:
                    typ = ('%s' % e.type.capitalize())
                if (not ('GET' in e.functions)):
                    completions.append((('get\t%s func.' % typ), ('%s Function Get()\n\t${0}\nEndFunction' % typ)))
                if (not ('SET' in e.functions)):
                    completions.append(('set\tfunc.', ('Function Set(%s aParameter)\n\t${0}\nEndFunction' % typ)))
                return completions
            else:
                tokens = []
                try:
                    for token in lex.Process(lineString):
                        if (token.type != lex.NEWLINE):
                            tokens.append(token)
                except Linter.LexicalError as f:
                    return
                if tokens:
                    if (tokens[(- 1)].type != lex.COMMENT_LINE):
                        pass
            return
        except Linter.SemanticError as e:
            return
        return

dataset/ETHPy150Open Kapiainen/SublimePapyrus/Source/Modules/Skyrim/Plugin.py EventListener.Completions/original