def _start_diff(buf_id): view = eutils.view_for_buffer_id(buf_id) if view is None: return state = _diff_state[buf_id] prev_content = state['content'] content = eutils.content(view) syntax = get_syntax(view) state['required'] = False client = ws.find_client({'supports': 'css'}) if client: logger.debug('Use connected "%s" client for diff' % client.name()) lock_state(state) ws.send({ 'action': 'diff', 'data': { 'file': buf_id, 'syntax': syntax, 'source1': prev_content, 'source2': content } }, client) else: logger.error('No suitable client for diff')
def _start_diff(buf_id): view = eutils.view_for_buffer_id(buf_id) if view is None: return state = _diff_state[buf_id] prev_content = state['content'] content = eutils.content(view) syntax = get_syntax(view) state['required'] = False client = ws.find_client({'supports': 'css'}) if client: logger.debug('Use connected "%s" client for diff' % client.name()) lock_state(state) ws.send( { 'action': 'diff', 'data': { 'file': buf_id, 'syntax': syntax, 'source1': prev_content, 'source2': content } }, client) else: logger.error('No suitable client for diff')
def _start_patch(buf_id, patch): view = eutils.view_for_buffer_id(buf_id) if view is None: logger.debug('No view to patch') return content = eutils.content(view) syntax = get_syntax(view) state = _patch_state[buf_id] client = ws.find_client({'supports': 'css'}) logger.debug('Client: %s' % client) if client: logger.debug('Use connected "%s" client for patching' % client.name()) lock_state(state) ws.send({ 'action': 'patch', 'data': { 'file': buf_id, 'syntax': syntax, 'patches': patch, 'source': content } }, client) else: logger.error('No suitable client for patching')
def _start_patch(buf_id, patch): view = eutils.view_for_buffer_id(buf_id) if view is None: logger.debug('No view to patch') return content = eutils.content(view) syntax = get_syntax(view) state = _patch_state[buf_id] client = ws.find_client({'supports': 'css'}) logger.debug('Client: %s' % client) if client: logger.debug('Use connected "%s" client for patching' % client.name()) lock_state(state) ws.send( { 'action': 'patch', 'data': { 'file': buf_id, 'syntax': syntax, 'patches': patch, 'source': content } }, client) else: logger.error('No suitable client for patching')