def next_queued(release=False): "Move to next queued diff request, if possible" if release: logger.debug('Release diff lock') _state['locked_by'] = None # make sure current command lock is still valid if _state['locked_by'] and _state['created'] < time() - wait_timeout: logger.debug('Waiting response is obsolete, reset') _state['locked_by'] = None if not _state['locked_by'] and _state['pending']: uri = _state['pending'].pop(0) view = editor_utils.view_for_uri(uri) if not view: # looks like view for pending diff is already closed, move to next one logger.debug('No view, move to next queued diff item') return next_queued() logger.debug('Send "calculate-diff" message') _state['locked_by'] = uri _state['created'] = time() client.send('calculate-diff', editor_utils.payload(view)) else: logger.debug('Diff lock, waiting for response')
def handle_unsaved_changes_request(data): if not editor_utils.get_setting('send_unsaved_changes'): return files = data.get('files', []) for f in files: view = editor_utils.view_for_uri(f) if view and view.is_dirty(): send_unsaved_changes(view)
def handle_unsaved_changes_request(data): if not editor_utils.get_setting("send_unsaved_changes"): return files = data.get("files", []) for f in files: view = editor_utils.view_for_uri(f) if view and view.is_dirty(): send_unsaved_changes(view)
def handle_patch_request(data): view = editor_utils.view_for_uri(data['uri']) if view: view.run_command('livestyle_replace_content', {'payload': data})
def apply_incoming_updates(data): view = editor_utils.view_for_uri(data.get('uri')) if view: client.send('apply-patch', editor_utils.payload(view, { 'patches': data['patches'] }))
def handle_patch_request(data): view = editor_utils.view_for_uri(data["uri"]) if view: view.run_command("livestyle_replace_content", {"payload": data})
def apply_incoming_updates(data): view = editor_utils.view_for_uri(data.get("uri")) if view: client.send("apply-patch", editor_utils.payload(view, {"patches": data["patches"]}))