Example #1
0
 def on_post_save(self, view):
     filename=view.file_name()
     if not filename:
         return
     if not helper.checkFileExt(filename,"lua"):
         return
     # rebuild user definition
     curTime=time.time()
     if curTime-self.lastTime<2:
         return
     self.lastTime=curTime
     a=rebuild.rebuildSingle(filename,TEMP_PATH)
     arr=a[0]
     path=a[1]
     # remove prev
     global USER_DEFINITION_LIST
     for i in range(len(USER_DEFINITION_LIST)-1,0,-1):
         item=USER_DEFINITION_LIST[i]
         if item[2]==path:
             USER_DEFINITION_LIST.remove(item)
     USER_DEFINITION_LIST.extend(arr)
     path=os.path.join(TEMP_PATH, "user_definition.json")
     data=json.dumps(USER_DEFINITION_LIST)
     if not os.path.exists(TEMP_PATH):
         os.makedirs(TEMP_PATH)
     helper.writeFile(path,data)
     sublime.status_message("Current file definition rebuild complete!")
 def on_post_save(self, view):
     filename=view.file_name()
     if not filename:
         return
     if not helper.checkFileExt(filename,"lua"):
         return
     # rebuild user definition
     curTime=time.time()
     if curTime-self.lastTime<2:
         return
     self.lastTime=curTime
     a=rebuild.rebuildSingle(filename,TEMP_PATH)
     arr=a[0]
     path=a[1] 
     # remove prev
     global USER_DEFINITION_LIST
     for i in range(len(USER_DEFINITION_LIST)-1,0,-1):
         item=USER_DEFINITION_LIST[i]
         if item[2]==path:
             USER_DEFINITION_LIST.remove(item)
     USER_DEFINITION_LIST.extend(arr)
     path=os.path.join(TEMP_PATH, "user_definition.json")
     data=json.dumps(USER_DEFINITION_LIST)
     if not os.path.exists(TEMP_PATH):
         os.makedirs(TEMP_PATH)
     helper.writeFile(path,data)
     sublime.status_message("Current file definition rebuild complete!")
    def on_post_save(self, view):
        filename = view.file_name()
        if not filename:
            return
        if not helper.checkFileExt(filename, "js"):
            return
        # rebuild user definition
        curTime = time.time()
        if curTime - self.lastTime < 2:
            return
        self.lastTime = curTime

        if not os.path.exists(TEMP_PATH):
            os.makedirs(TEMP_PATH)
        rebuild.rebuildSingle(filename, TEMP_PATH)

        sublime.status_message("Current file definition rebuild complete!")