Пример #1
0
def start_plugin():
	ws.start(int(eutils.get_setting('port')))
	logger.setLevel(logging.DEBUG if eutils.get_setting('debug', False) else logging.INFO)

	# collect all view's file paths
	for view in eutils.all_views():
		_view_file_names[view.id()] = eutils.file_name(view)
Пример #2
0
def start_plugin():
    ws.start(int(eutils.get_setting('port')))
    logger.setLevel(
        logging.DEBUG if eutils.get_setting('debug', False) else logging.INFO)

    # collect all view's file paths
    for view in eutils.all_views():
        _view_file_names[view.id()] = eutils.file_name(view)
Пример #3
0
def send_patches(buf_id=None, p=None):
    if not buf_id or not p:
        return

    p = eutils.parse_json(p)
    view = eutils.view_for_buffer_id(buf_id)
    if p and view is not None:
        ws.send({"action": "update", "data": {"editorFile": eutils.file_name(view), "patch": p}})
Пример #4
0
	def on_post_save(self, view):
		k = view.id()
		new_name = eutils.file_name(view)
		if k in _view_file_names and _view_file_names[k] != new_name:
			send_message({
				'action': 'renameFile',
				'data': {
					'oldname': _view_file_names[k],
					'newname': new_name
				}
			})
			_view_file_names[k] = new_name
Пример #5
0
def apply_patch_on_view(view, patch):
	"Waita until view is loaded and applies patch on it"
	if view.is_loading():
		return sublime.set_timeout(lambda: apply_patch_on_view(view, patch), 100)

	# make sure it's a CSS file
	if not eutils.is_css_view(view, True):
		logger.debug('File %s is not CSS, aborting' % eutils.file_name(view))
		return

	focus_view(view)
	lsutils.diff.patch(view.buffer_id(), patch, apply_patched_source)
Пример #6
0
 def on_post_save(self, view):
     k = view.id()
     new_name = eutils.file_name(view)
     if k in _view_file_names and _view_file_names[k] != new_name:
         send_message({
             'action': 'renameFile',
             'data': {
                 'oldname': _view_file_names[k],
                 'newname': new_name
             }
         })
         _view_file_names[k] = new_name
Пример #7
0
def start_plugin():
	global settings
	settings = sublime.load_settings('LiveStyle.sublime-settings')
	
	start_server(int(settings.get('port')))
	logger.setLevel(logging.DEBUG if settings.get('debug', False) else logging.INFO)
	settings.add_on_change('settings', handle_settings_change)

	lsutils.diff.import_pyv8()

	# collect all view's file paths
	for view in eutils.all_views():
		_view_file_names[view.id()] = eutils.file_name(view)
Пример #8
0
def apply_patch_on_view(view, patch):
    "Waita until view is loaded and applies patch on it"
    if view.is_loading():
        return sublime.set_timeout(lambda: apply_patch_on_view(view, patch),
                                   100)

    # make sure it's a CSS file
    if not eutils.is_css_view(view, True):
        logger.debug('File %s is not CSS, aborting' % eutils.file_name(view))
        return

    focus_view(view)
    lsutils.diff.patch(view.buffer_id(), patch, apply_patched_source)
Пример #9
0
def start_plugin():
    global settings
    settings = sublime.load_settings('LiveStyle.sublime-settings')

    start_server(int(settings.get('port')))
    logger.setLevel(
        logging.DEBUG if settings.get('debug', False) else logging.INFO)
    settings.add_on_change('settings', handle_settings_change)

    lsutils.diff.import_pyv8()

    # collect all view's file paths
    for view in eutils.all_views():
        _view_file_names[view.id()] = eutils.file_name(view)
Пример #10
0
def send_patches(buf_id=None, p=None):
    if not buf_id or not p:
        return

    p = parse_json(p)
    view = eutils.view_for_buffer_id(buf_id)
    if p and view is not None:
        send_message({
            'action': 'update',
            'data': {
                'editorFile': eutils.file_name(view),
                'patch': p
            }
        })
Пример #11
0
def send_patches(buf_id=None, p=None):
	if not buf_id or not p:
		return

	p = eutils.parse_json(p)
	view = eutils.view_for_buffer_id(buf_id)
	if p and view is not None:
		ws.send({
			'action': 'update',
			'data': {
				'editorFile': eutils.file_name(view),
				'patch': p
			}
		})
Пример #12
0
def send_patches(buf_id=None, p=None):
	if not buf_id or not p:
		return

	logger.debug(p)
	p = json.loads(p)
	view = eutils.view_for_buffer_id(buf_id)
	if p and view is not None:
		send_message({
			'action': 'update',
			'data': {
				'editorFile': eutils.file_name(view),
				'patch': p
			}
		})
Пример #13
0
	def on_load(self, view):
		_view_file_names[view.id()] = eutils.file_name(view)

		if eutils.is_css_view(view):
			update_files()
Пример #14
0
    def on_load(self, view):
        _view_file_names[view.id()] = eutils.file_name(view)

        if eutils.is_css_view(view):
            update_files()
Пример #15
0
 def on_post_save(self, view):
     k = view.id()
     new_name = eutils.file_name(view)
     if k in _view_file_names and _view_file_names[k] != new_name:
         ws.send({"action": "renameFile", "data": {"oldname": _view_file_names[k], "newname": new_name}})
         _view_file_names[k] = new_name