Beispiel #1
0
def expand_jdata(v):
	if gs.is_a(v, {}):
		for k in v:
			v[k] = expand_jdata(v[k])
	elif gs.is_a(v, []):
		v = [expand_jdata(e) for e in v]
	else:
		if gs.PY3K and isinstance(v, bytes):
			v = gs.ustr(v)

		if gs.is_a_string(v) and v.startswith('base64:'):
			try:
				v = gs.ustr(base64.b64decode(v[7:]))
			except Exception:
				v = ''
				gs.error_traceback(DOMAIN)
	return v
Beispiel #2
0
def expand_jdata(v):
    if gs.is_a(v, {}):
        for k in v:
            v[k] = expand_jdata(v[k])
    elif gs.is_a(v, []):
        v = [expand_jdata(e) for e in v]
    else:
        if gs.PY3K and isinstance(v, bytes):
            v = gs.ustr(v)

        if gs.is_a_string(v) and v.startswith('base64:'):
            try:
                v = gs.ustr(base64.b64decode(v[7:]))
            except Exception:
                v = ''
                gs.error_traceback(DOMAIN)
    return v
Beispiel #3
0
def do_sync_active_view(view):
	fn = view.file_name()
	if fn:
		gs.set_attr('last_active_fn', fn)
		if fn.lower().endswith('.go'):
			gs.set_attr('last_active_go_fn', fn)

	if gs.is_pkg_view(view):
		m = {}
		psettings = view.settings().get('GoSublime')
		if psettings and gs.is_a(psettings, {}):
			m = gs.mirror_settings(psettings)
		gs.set_attr('last_active_project_settings', gs.dval(m, {}))
Beispiel #4
0
def do_sync_active_view(view):
	fn = view.file_name() or ''
	gs.set_attr('active_fn', fn)

	if fn:
		gs.set_attr('last_active_fn', fn)
		if fn.lower().endswith('.go'):
			gs.set_attr('last_active_go_fn', fn)

	if gs.is_pkg_view(view):
		m = {}
		psettings = view.settings().get('GoSublime')
		if psettings and gs.is_a(psettings, {}):
			m = gs.mirror_settings(psettings)
		gs.set_attr('last_active_project_settings', gs.dval(m, {}))
Beispiel #5
0
def do_sync_active_view(view):
    fn = view.file_name() or ''
    gs.set_attr('active_fn', fn)

    if fn:
        gs.set_attr('last_active_fn', fn)
        if fn.lower().endswith('.go'):
            gs.set_attr('last_active_go_fn', fn)

    win = view.window()
    if win is not None and view in win.views():
        m = {}
        psettings = view.settings().get('GoSublime')
        if psettings and gs.is_a(psettings, {}):
            m = gs.mirror_settings(psettings)
        gs.set_attr('last_active_project_settings', gs.dval(m, {}))
Beispiel #6
0
def do_sync_active_view(view):
	fn = view.file_name() or ''
	gs.set_attr('active_fn', fn)

	if fn:
		gs.set_attr('last_active_fn', fn)
		if fn.lower().endswith('.go'):
			gs.set_attr('last_active_go_fn', fn)

	win = view.window()
	if win is not None and view in win.views():
		m = {}
		psettings = view.settings().get('GoSublime')
		if psettings and gs.is_a(psettings, {}):
			psettings['env']['GOPATH'] = expand_template(psettings['env']['GOPATH'])
			m = gs.mirror_settings(psettings)
		gs.set_attr('last_active_project_settings', gs.dval(m, {}))
Beispiel #7
0
def fix_shell_cmd(shell, cmd):
    if not gs.is_a(cmd, []):
        cmd = [cmd]

    if shell:
        cmd_str = " ".join(cmd)
        sh = gs.setting("shell")
        if not sh:
            return (shell, gs.astr(cmd_str))

        shell = False
        cmd_map = {"CMD": cmd_str}
        cmd = []
        for v in sh:
            if v:
                cmd.append(string.Template(v).safe_substitute(cmd_map))

    return (shell, [gs.astr(v) for v in cmd])
Beispiel #8
0
def fix_shell_cmd(shell, cmd):
	if not gs.is_a(cmd, []):
		cmd = [cmd]

	if shell:
		sh = gs.setting('shell')
		cmd_str = ' '.join(cmd)
		cmd_map = {'CMD': cmd_str}
		if sh:
			shell = False
			cmd = []
			for v in sh:
				if v:
					cmd.append(string.Template(v).safe_substitute(cmd_map))
		else:
			cmd = [cmd_str]

	return (shell, [gs.astr(v) for v in cmd])