Example #1
0
	def run(self, edit):
		socket = DataManager.instance().getSocket(self.view.window().id())
		fileName = self.view.file_name()
		print(fileName)

		for sel in self.view.sel():
			print('--------------------------------------')
			pnt = sel.a
			region = self.view.word(sel)

			name = self.view.substr(region)
			if self.view.substr(self.view.word(region.a-1)) == '::':
				className = self.view.substr(self.view.word(region.a-2))
				if className:
					name = className + '::' + name
			elif self.view.substr(self.view.word(region.b+1)) == '::':
				funcName = self.view.substr(self.view.word(region.b+2))
				if funcName:
					name = name + '::' + funcName

			scope = self.view.scope_name(pnt)
			line = self.view.rowcol(region.a)[0]+1
 
			kind = '*'
			print('scope', scope)
			if scope.find('variable.function') != -1:
				kind = 'function, member'
			elif scope.find('entity.name.function') != -1:
				kind = 'function, member'
			elif scope.find('variable.other') != -1:
				kind = 'variable, member'
			elif scope.find('class') != -1:
				kind = 'class, struct'
			# socket.remoteCall('showInAtlas', {'n':name, 'f':fileName,'k':kind, 'l':line})
			socket.remoteCall('showInAtlas', [name, kind, fileName, line])
Example #2
0
    def run(self, edit):
        socket = DataManager.instance().getSocket(self.view.window().id())
        fileName = self.view.file_name()
        print(fileName)

        for sel in self.view.sel():
            print('--------------------------------------')
            pnt = sel.a
            region = self.view.word(sel)

            name = self.view.substr(region)
            if self.view.substr(self.view.word(region.a - 1)) == '::':
                className = self.view.substr(self.view.word(region.a - 2))
                if className:
                    name = className + '::' + name
            elif self.view.substr(self.view.word(region.b + 1)) == '::':
                funcName = self.view.substr(self.view.word(region.b + 2))
                if funcName:
                    name = name + '::' + funcName

            scope = self.view.scope_name(pnt)
            line = self.view.rowcol(region.a)[0] + 1

            kind = '*'
            print('scope', scope)
            if scope.find('variable.function') != -1:
                kind = 'function, member'
            elif scope.find('entity.name.function') != -1:
                kind = 'function, member'
            elif scope.find('variable.other') != -1:
                kind = 'variable, member'
            elif scope.find('class') != -1:
                kind = 'class, struct'
            # socket.remoteCall('showInAtlas', {'n':name, 'f':fileName,'k':kind, 'l':line})
            socket.remoteCall('showInAtlas', [name, kind, fileName, line])
Example #3
0
    def on_modified(self, view):
        #print('selection modified--------------------------------------------')
        if time.time() - SelectionListener.lastTime < 2:
            return

        SelectionListener.lastTime = time.time()
        regions = view.find_by_selector('entity.name.function')
        nameSet = set()
        line = -1
        for sel in view.sel():
            #print('--------------------------------------')
            pnt = sel.b

            bestRegion = None
            bestDist = 100000000
            for region in regions:
                dist = pnt - region.a
                if dist > 0 and dist < bestDist:
                    bestDist = dist
                    bestRegion = region
            if not bestRegion:
                continue
            name = view.substr(bestRegion)
            scopeName = view.scope_name((bestRegion.a + bestRegion.b) / 2)
            line = view.rowcol((bestRegion.a + bestRegion.b) / 2)[0] + 1
            nameSet.add(name)

        if len(nameSet) == 1:
            name = list(nameSet)[0]
            socket = DataManager.instance().getSocket(view.window().id())
            fileName = view.file_name()
            # socket.remoteCall('showInAtlas', {'n':name, 'f':fileName,'k':'function','l':line})
            socket.remoteCall('showInAtlas',
                              [name, fileName, 'function', line])
Example #4
0
	def on_modified(self, view):
		#print('selection modified--------------------------------------------')
		if time.time() - SelectionListener.lastTime < 2:
			return

		SelectionListener.lastTime = time.time()
		regions = view.find_by_selector('entity.name.function')
		nameSet = set()
		line = -1
		for sel in view.sel():
			#print('--------------------------------------')
			pnt = sel.b

			bestRegion = None
			bestDist = 100000000
			for region in regions:
				dist = pnt - region.a
				if dist > 0 and dist < bestDist:
					bestDist = dist
					bestRegion = region
			if not bestRegion:
				continue
			name = view.substr(bestRegion)
			scopeName = view.scope_name((bestRegion.a+bestRegion.b)/2)
			line = view.rowcol((bestRegion.a+bestRegion.b)/2)[0]+1
			nameSet.add(name)
 
		if len(nameSet) == 1: 
			name = list(nameSet)[0]
			socket = DataManager.instance().getSocket(view.window().id())
			fileName = view.file_name()
			# socket.remoteCall('showInAtlas', {'n':name, 'f':fileName,'k':'function','l':line})
			socket.remoteCall('showInAtlas', [name, fileName, 'function', line])
Example #5
0
	def run(self):
		curPath = os.path.split(os.path.realpath(__file__))[0] 
		print('curPath ', curPath)
		print('curWindow', self.window.id())

		socketThread = DataManager.instance().getSocket(self.window.id())

		# command line window
		subprocess.Popen('%s\\codeView.bat %s' % (curPath, socketThread.remoteAddress[1]), cwd = curPath, stdout = None)
		
		# no command line window
		curPath = curPath + '\\CodeViewPy'
		cmdStr = 'main %s' % (socketThread.remoteAddress[1], )
		# subprocess.Popen(cmdStr, cwd = curPath, shell = True )

		if not socketThread.isListening():
			socketThread.start()
Example #6
0
    def run(self):
        curPath = os.path.split(os.path.realpath(__file__))[0]
        print('curPath ', curPath)
        print('curWindow', self.window.id())

        socketThread = DataManager.instance().getSocket(self.window.id())

        # command line window
        subprocess.Popen('%s\\codeView.bat %s' %
                         (curPath, socketThread.remoteAddress[1]),
                         cwd=curPath,
                         stdout=None)

        # no command line window
        curPath = curPath + '\\CodeViewPy'
        cmdStr = 'main %s' % (socketThread.remoteAddress[1], )
        # subprocess.Popen(cmdStr, cwd = curPath, shell = True )

        if not socketThread.isListening():
            socketThread.start()
Example #7
0
	def run(self, edit):
		socket = DataManager.instance().getSocket(self.view.window().id())
		socket.remoteCall('showScheme',[5])
Example #8
0
 def run(self, edit):
     socket = DataManager.instance().getSocket(self.view.window().id())
     socket.remoteCall('onDeleteSelectedItemsAndAddToStop', None)
Example #9
0
	def run(self, edit):
		socket = DataManager.instance().getSocket(self.view.window().id())
		socket.remoteCall('onAnalyze', None)
Example #10
0
	def run(self, edit):
		socket = DataManager.instance().getSocket(self.view.window().id())
		socket.remoteCall('onClearOldestItem', None)
Example #11
0
	def run(self, edit):
		socket = DataManager.instance().getSocket(self.view.window().id())
		socket.remoteCall('onDeleteNearbyItems', None)
Example #12
0
	def run(self, edit):
		socket = DataManager.instance().getSocket(self.view.window().id())
		socket.remoteCall('goToDownLeft', None)
Example #13
0
	def run(self, edit):
		socket = DataManager.instance().getSocket(self.view.window().id())
		socket.remoteCall('onDeleteSelectedItemsAndAddToStop', None)
Example #14
0
	def run(self, edit):
		socket = DataManager.instance().getSocket(self.view.window().id())
		socket.remoteCall('toggleSelectedEdgeToScheme',[5])
Example #15
0
 def run(self, edit):
     socket = DataManager.instance().getSocket(self.view.window().id())
     socket.remoteCall('goToDownLeft', None)
Example #16
0
 def run(self, edit):
     socket = DataManager.instance().getSocket(self.view.window().id())
     socket.remoteCall('toggleSelectedEdgeToScheme', [4])
Example #17
0
 def run(self, edit):
     socket = DataManager.instance().getSocket(self.view.window().id())
     socket.remoteCall('showScheme', [5])
Example #18
0
 def run(self, edit):
     socket = DataManager.instance().getSocket(self.view.window().id())
     socket.remoteCall('onAnalyze', None)
Example #19
0
 def run(self, edit):
     socket = DataManager.instance().getSocket(self.view.window().id())
     socket.remoteCall('onClearOldestItem', None)
Example #20
0
 def run(self, edit):
     socket = DataManager.instance().getSocket(self.view.window().id())
     socket.remoteCall('onDeleteNearbyItems', None)
Example #21
0
	def run(self, edit): 
		socket = DataManager.instance().getSocket(self.view.window().id())
		socket.remoteCall('onAddSimilarCodeItem', None)
Example #22
0
 def run(self, edit):
     socket = DataManager.instance().getSocket(self.view.window().id())
     socket.remoteCall('onAddSimilarCodeItem', None)