コード例 #1
0
ファイル: emmet-plugin.py プロジェクト: ivoianchev/Emmet
def init():
	"Init Emmet plugin"
	# load settings
	globals()['user_settings'] = sublime.load_settings('Preferences.sublime-settings')
	globals()['settings'] = sublime.load_settings('Emmet.sublime-settings')
	settings.add_on_change('extensions_path', update_settings)

	# setup environment for PyV8 loading
	pyv8_paths = [
		os.path.join(PACKAGES_PATH, 'PyV8'),
		os.path.join(PACKAGES_PATH, 'PyV8', pyv8loader.get_arch()),
		os.path.join(PACKAGES_PATH, 'PyV8', 'pyv8-%s' % pyv8loader.get_arch())
	]

	sys.path += pyv8_paths

	# unpack recently loaded binary, is exists
	for p in pyv8_paths:
		pyv8loader.unpack_pyv8(p)
	
	# provide some contributions to JS
	contrib = {
		'sublime': sublime, 
		'sublimeReplaceSubstring': replace_substring,
		'sublimeGetOption': settings.get
	}

	# create JS environment
	delegate = SublimeLoaderDelegate()
	globals()['ctx'] = Context(
		files=['../editor.js'], 
		ext_path=get_extensions_path(), 
		contrib=contrib, 
		logger=delegate.log,
		reader=js_file_reader
	)


	

	update_settings()

	if not settings.get('disable_pyv8_update', False):
		pyv8loader.load(pyv8_paths[1], delegate) 
	else:
		print('PyV8 auto-update is disabled')

	if settings.get('remove_html_completions', False):
		sublime.set_timeout(cmpl.remove_html_completions, 2000)
コード例 #2
0
def init():
	"Init Emmet plugin"
	# load settings
	globals()['user_settings'] = sublime.load_settings('Preferences.sublime-settings')
	globals()['settings'] = sublime.load_settings('Emmet.sublime-settings')
	settings.add_on_change('extensions_path', update_settings)

	# setup environment for PyV8 loading
	pyv8_paths = [
		os.path.join(PACKAGES_PATH, 'PyV8'),
		os.path.join(PACKAGES_PATH, 'PyV8', pyv8loader.get_arch()),
		os.path.join(PACKAGES_PATH, 'PyV8', 'pyv8-%s' % pyv8loader.get_arch())
	]

	sys.path += pyv8_paths

	# unpack recently loaded binary, is exists
	for p in pyv8_paths:
		pyv8loader.unpack_pyv8(p)
	
	# provide some contributions to JS
	contrib = {
		'sublime': sublime, 
		'sublimeReplaceSubstring': replace_substring,
		'sublimeGetOption': settings.get
	}

	# create JS environment
	delegate = SublimeLoaderDelegate()
	globals()['ctx'] = Context(
		files=['../editor.js'], 
		ext_path=get_extensions_path(), 
		contrib=contrib, 
		logger=delegate.log,
		reader=js_file_reader
	)

	update_settings()

	if not settings.get('disable_pyv8_update', False):
		pyv8loader.load(pyv8_paths[1], delegate) 
	else:
		print('PyV8 auto-update is disabled')

	if settings.get('remove_html_completions', False):
		sublime.set_timeout(cmpl.remove_html_completions, 2000)
コード例 #3
0
def init():
    "Init Emmet plugin"
    # load settings
    globals()["user_settings"] = sublime.load_settings("Preferences.sublime-settings")
    globals()["settings"] = sublime.load_settings("Emmet.sublime-settings")
    settings.add_on_change("extensions_path", update_settings)

    # setup environment for PyV8 loading
    pyv8_paths = [
        os.path.join(PACKAGES_PATH, "PyV8"),
        os.path.join(PACKAGES_PATH, "PyV8", pyv8loader.get_arch()),
        os.path.join(PACKAGES_PATH, "PyV8", "pyv8-%s" % pyv8loader.get_arch()),
    ]

    sys.path += pyv8_paths

    # unpack recently loaded binary, is exists
    for p in pyv8_paths:
        pyv8loader.unpack_pyv8(p)

        # provide some contributions to JS
    contrib = {"sublime": sublime, "sublimeReplaceSubstring": replace_substring, "sublimeGetOption": settings.get}

    # create JS environment
    delegate = SublimeLoaderDelegate()
    globals()["ctx"] = Context(
        files=["../editor.js"],
        ext_path=settings.get("extensions_path", None),
        contrib=contrib,
        logger=delegate.log,
        reader=js_file_reader,
    )

    update_settings()

    pyv8loader.load(pyv8_paths[1], delegate)

    if settings.get("remove_html_completions", False):
        sublime.set_timeout(cmpl.remove_html_completions, 2000)