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])
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])
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])
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])
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()
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()
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('showScheme',[5])
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('onDeleteSelectedItemsAndAddToStop', None)
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('onAnalyze', None)
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('onClearOldestItem', None)
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('onDeleteNearbyItems', None)
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('goToDownLeft', None)
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('toggleSelectedEdgeToScheme',[5])
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('toggleSelectedEdgeToScheme', [4])
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('showScheme', [5])
def run(self, edit): socket = DataManager.instance().getSocket(self.view.window().id()) socket.remoteCall('onAddSimilarCodeItem', None)