Пример #1
0
    def run(self):
        import webbrowser

        self.active_view = ng.active_view()

        # grab first region
        region = self.active_view.sel()[0]

        # no selection has been made
        # so begin expanding to find word
        if not region.size():
            definition = viewlocation.find_word(ng.active_view(), region)
        else:
            definition = self.active_view.substr(region)

        # ensure data- is striped out before trying to
        # normalize and look up
        definition = definition.replace('data-', '')

        # convert selections such as app-version to appVersion
        # for proper look up
        definition = re.sub(
            '(\w*)-(\w*)',
            lambda match: match.group(1) + match.group(2).capitalize(),
            definition)

        webbrowser.open('http://docs.angularjs.org/api/ng.directive:' +
                        definition)
	def run(self):
		self.active_view = ng.active_view()

		if not ng.get_current_project_indexes().get('definitions'):
			message.alert('No indexing found for project')
			return

		# grab first region
		region = self.active_view.sel()[0]

		# no selection has been made
		# so begin expanding to find word
		if not region.size():
			definition = viewlocation.find_word(self.active_view, region)
		else:
			definition = self.active_view.substr(region)

		# ensure data- is striped out before trying to
		# normalize and look up
		definition = definition.replace('data-', '')

		# convert selections such as app-version to appVersion
		# for proper look up
		definition = re.sub('(\w*)-(\w*)', lambda match: match.group(1) + match.group(2).capitalize(), definition)
		for item in ng.get_current_project_indexes().get('definitions'):
			if(re.search('. '+definition+'$', item[0])):
				self.active_view = ng.active_window().open_file(item[1])
				ng.handle_file_open_go_to(int(item[2]))
				return
		message.alert('definition "%s" could not be found' % definition)
Пример #3
0
    def run(self):
        self.active_view = ng.active_view()

        if not ng.get_current_project_indexes().get('definitions'):
            message.alert('No indexing found for project')
            return

        # grab first region
        region = self.active_view.sel()[0]

        # no selection has been made
        # so begin expanding to find word
        if not region.size():
            definition = viewlocation.find_word(self.active_view, region)
        else:
            definition = self.active_view.substr(region)

        # ensure data- is striped out before trying to
        # normalize and look up
        definition = definition.replace('data-', '')

        # convert selections such as app-version to appVersion
        # for proper look up
        definition = re.sub(
            '(\w*)-(\w*)',
            lambda match: match.group(1) + match.group(2).capitalize(),
            definition)
        for item in ng.get_current_project_indexes().get('definitions'):
            if (re.search('. ' + definition + '$', item[0])):
                self.active_view = ng.active_window().open_file(item[1])
                ng.handle_file_open_go_to(int(item[2]))
                return
        message.alert('definition "%s" could not be found' % definition)
	def run(self):
		import webbrowser

		self.active_view = ng.active_view()

		# grab first region
		region = self.active_view.sel()[0]

		# no selection has been made
		# so begin expanding to find word
		if not region.size():
			definition = viewlocation.find_word(ng.active_view(), region)
		else:
			definition = self.active_view.substr(region)

		# ensure data- is striped out before trying to
		# normalize and look up
		definition = definition.replace('data-', '')

		# convert selections such as app-version to appVersion
		# for proper look up
		definition = re.sub('(\w*)-(\w*)', lambda match: match.group(1) + match.group(2).capitalize(), definition)

		webbrowser.open('http://docs.angularjs.org/api/ng.directive:' + definition)