Example #1
0
    def run(self):
        view = self.view

        self.patterns.reset()
        Settings.reset()

        AutocompleteList.clear()

        prev_word = SelectedRegion(view).get_previous_word()

        if (Constants.SELF_WORD == prev_word):
            class_names = self.find_class_names()
        else:
            class_names = [prev_word]

        if (len(class_names) > 0):
            for class_name in class_names:
                self.patterns.init_autocomplete_patterns(class_name)
            file_search_manager.check_project_folders(
                self.find_methods_in_line)

            Settings.get_word_param().enable(False)
            Settings.get_explicit_param().enable(False)
            Settings.get_autocomplete_param().enable(True)

            view.run_command("auto_complete")
        else:
            print "[G2f] could not find function definition"
Example #2
0
	def run(self):
		view = self.view

		self.patterns.reset()
		Settings.reset()
		
		AutocompleteList.clear()
	
		prev_word = SelectedRegion(view).get_previous_word()
	
		if (Constants.SELF_WORD == prev_word):
			class_names = self.find_class_names()
		else:
			class_names = [prev_word]
	
		if (len(class_names) > 0):
			for class_name in class_names:
				self.patterns.init_autocomplete_patterns(class_name)
			file_search_manager.check_project_folders(self.find_methods_in_line)
			
			Settings.get_word_param().enable(False)
			Settings.get_explicit_param().enable(False)
			Settings.get_autocomplete_param().enable(True)
	
			view.run_command("auto_complete")
		else:
			print "[G2f] could not find function definition"
Example #3
0
	def check_pattern_in_lines(self, lines):
		for pattern in self.patterns.get_patterns():
			for (content) in re.findall(pattern, lines):
				words = content.split('\n')
				for word in words:
					if Constants.EQUAL in word:
						word = word.split(Constants.EQUAL)[0].strip()
						out = (word, word)
						AutocompleteList.append(out)
Example #4
0
	def run(self, text):
		t1 = time.clock()
		
		del self.files[:]

		self.patterns.reset()
		Settings.reset()
		
		AutocompleteList.clear()

		self.do_search()

		t2 = time.clock()
		print t2 - t1
Example #5
0
	def find_methods_in_line(self, line, number, fn):
		if (Constants.FUNCTION in line) and (
			(Constants.POINT in line) or (Constants.COLON in line)):
			
			for pattern in self.patterns.get_patterns():
				match = pattern.search(line)
				if match:
					method = match.group(0)
					
					start_pos = line.find(Constants.COLON)
					if (start_pos < 0):
						start_pos = line.find(Constants.POINT)
					end_pos = line.find(')')
					if ((start_pos > 0) and (end_pos > start_pos)):
						subs = line[start_pos + 1 : end_pos + 1]
	
						method = re.sub("[.:\(\)]", ' ', method).strip().split()
						method = method[2]
						out = (method, subs)
	
					AutocompleteList.append(out)
Example #6
0
    def find_methods_in_line(self, line, number, fn):
        if (Constants.FUNCTION in line) and ((Constants.POINT in line) or
                                             (Constants.COLON in line)):

            for pattern in self.patterns.get_patterns():
                match = pattern.search(line)
                if match:
                    method = match.group(0)

                    start_pos = line.find(Constants.COLON)
                    if (start_pos < 0):
                        start_pos = line.find(Constants.POINT)
                    end_pos = line.find(')')
                    if ((start_pos > 0) and (end_pos > start_pos)):
                        subs = line[start_pos + 1:end_pos + 1]

                        method = re.sub("[.:\(\)]", ' ',
                                        method).strip().split()
                        method = method[2]
                        out = (method, subs)

                    AutocompleteList.append(out)
    def on_query_completions(self, view, prefix, locations):

        Settings.reset()

        enabled = Settings.get_word_param().is_enabled() and (0 != len(prefix))
        word_completions = 0 if enabled else sublime.INHIBIT_WORD_COMPLETIONS

        enabled = Settings.get_explicit_param().is_enabled()
        explicit_completions = 0 if enabled else sublime.INHIBIT_EXPLICIT_COMPLETIONS

        Settings.get_autocomplete_param().enable(False)

        return (AutocompleteList.get(), word_completions | explicit_completions)
Example #8
0
    def on_query_completions(self, view, prefix, locations):

        Settings.reset()

        enabled = Settings.get_word_param().is_enabled() and (0 != len(prefix))
        word_completions = 0 if enabled else sublime.INHIBIT_WORD_COMPLETIONS

        enabled = Settings.get_explicit_param().is_enabled()
        explicit_completions = 0 if enabled else sublime.INHIBIT_EXPLICIT_COMPLETIONS

        Settings.get_autocomplete_param().enable(False)

        return (AutocompleteList.get(),
                word_completions | explicit_completions)