当前位置: 首页>>代码示例>>Python>>正文


Python sublime.Window方法代码示例

本文整理汇总了Python中sublime.Window方法的典型用法代码示例。如果您正苦于以下问题:Python sublime.Window方法的具体用法?Python sublime.Window怎么用?Python sublime.Window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sublime的用法示例。


在下文中一共展示了sublime.Window方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: for_window

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def for_window(window: sublime.Window, create: bool = False) -> 'Optional[Debugger]':
		global instances
		id = window.id()
		instance = Debugger.instances.get(id)

		if not instance and create:
			if Debugger.creating.get(id):
				raise core.Error("We shouldn't be creating another debugger instance for this window...")

			Debugger.creating[id] = True
			try:
				instance = Debugger(window)
				Debugger.instances[id] = instance

			except dap.Error as e:
				core.log_exception()

			Debugger.creating[id] = False

		if instance and create:
			instance.show()

		return instance 
开发者ID:daveleroy,项目名称:sublime_debugger,代码行数:25,代码来源:debugger.py

示例2: _sessions_for_view_and_window

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def _sessions_for_view_and_window(view: sublime.View, window: Optional[sublime.Window],
                                  point: Optional[int] = None) -> Iterable[Session]:
    if not window:
        debug("no window for view", view.file_name())
        return []

    file_path = view.file_name()
    if not file_path:
        # debug("no session for unsaved file")
        return []

    manager = windows.lookup(window)
    scope_configs = manager._configs.scope_configs(view, point)
    sessions = (manager.get_session(config.name, file_path) for config in scope_configs)
    ready_sessions = (session for session in sessions if session and session.state == ClientStates.READY)
    return ready_sessions 
开发者ID:sublimelsp,项目名称:LSP,代码行数:18,代码来源:registry.py

示例3: get_window_env

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def get_window_env(window: sublime.Window, config: ClientConfig) -> Tuple[List[str], Dict[str, str]]:

    # Create a dictionary of Sublime Text variables
    variables = window.extract_variables()

    # Expand language server command line environment variables
    expanded_args = list(
        sublime.expand_variables(os.path.expanduser(arg), variables)
        for arg in config.binary_args
    )

    # Override OS environment variables
    env = os.environ.copy()
    for var, value in config.env.items():
        # Expand both ST and OS environment variables
        env[var] = os.path.expandvars(sublime.expand_variables(value, variables))

    return expanded_args, env 
开发者ID:sublimelsp,项目名称:LSP,代码行数:20,代码来源:clients.py

示例4: start_window_config

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def start_window_config(window: sublime.Window,
                        workspace_folders: List[WorkspaceFolder],
                        config: ClientConfig,
                        on_pre_initialize: Callable[[Session], None],
                        on_post_initialize: Callable[[Session], None],
                        on_post_exit: Callable[[str], None],
                        on_stderr_log: Optional[Callable[[str], None]]) -> Optional[Session]:
    args, env = get_window_env(window, config)
    config.binary_args = args
    return create_session(config=config,
                          workspace_folders=workspace_folders,
                          env=env,
                          settings=settings,
                          on_pre_initialize=on_pre_initialize,
                          on_post_initialize=on_post_initialize,
                          on_post_exit=lambda config_name: on_session_ended(window, config_name, on_post_exit),
                          on_stderr_log=on_stderr_log) 
开发者ID:sublimelsp,项目名称:LSP,代码行数:19,代码来源:clients.py

示例5: load_inline_diff_views

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def load_inline_diff_views(self, window, non_cached_files, cached_files):
        # type: (sublime.Window, List[str], List[str]) -> None
        for fpath in non_cached_files:
            syntax = util.file.guess_syntax_for_file(window, fpath)
            settings = {
                "file_path": fpath,
                "repo_path": self.repo_path,
                "syntax": syntax
            }
            window.run_command("gs_inline_diff", {
                "settings": settings,
                "cached": False
            })

        for fpath in cached_files:
            syntax = util.file.guess_syntax_for_file(window, fpath)
            settings = {
                "file_path": fpath,
                "repo_path": self.repo_path,
                "syntax": syntax
            }
            window.run_command("gs_inline_diff", {
                "settings": settings,
                "cached": True
            }) 
开发者ID:timbrel,项目名称:GitSavvy,代码行数:27,代码来源:status.py

示例6: __init__

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def __init__(self, window, panel_name, file_regex=None,
                 line_regex=None, path=None, read_only=True,
                 auto_show=True):
        if not isinstance(window, Window):
            raise ValueError("window parameter is invalid")
        if not isinstance(panel_name, basestring):
            raise ValueError("panel_name must be a string")

        self.window = window
        self.panel_name = panel_name
        self.view = window.get_output_panel(panel_name)
        self.view.set_read_only(read_only)
        self.settings = ViewSettings(self.view)

        self.set_path(path, file_regex, line_regex)

        self.auto_show = auto_show 
开发者ID:OmniSharp,项目名称:omnisharp-sublime,代码行数:19,代码来源:output_panel.py

示例7: __init__

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def __init__(self, param):
        # no super() call! this would get the references confused
        if isinstance(param, sublime.Window):
            self.window = param
            self._window_command = True  # probably called from build system
            self.typ = WindowCommand
        elif isinstance(param, sublime.View):
            self.view   = param
            self._window_command = False
            self.typ = TextCommand
        else:
            raise TypeError("Something really bad happened and you are responsible")

        self._update_members() 
开发者ID:typeintandem,项目名称:tandem,代码行数:16,代码来源:__init__.py

示例8: create_window_commands

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def create_window_commands(window_id):
    window = sublime.Window(window_id)
    cmds = []
    for class_ in window_command_classes:
        cmds.append(class_(window))
    return cmds 
开发者ID:Wramberg,项目名称:TerminalView,代码行数:8,代码来源:sublime_plugin.py

示例9: on_window_command

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def on_window_command(window_id, name, args):
    window = sublime.Window(window_id)
    for callback in all_callbacks['on_window_command']:
        try:
            res = callback.on_window_command(window, name, args)
            if isinstance(res, tuple):
                return res
            elif res:
                return (res, None)
        except:
            traceback.print_exc()

    return ("", None) 
开发者ID:Wramberg,项目名称:TerminalView,代码行数:15,代码来源:sublime_plugin.py

示例10: on_post_window_command

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def on_post_window_command(window_id, name, args):
    window = sublime.Window(window_id)
    for callback in all_callbacks['on_post_window_command']:
        try:
            callback.on_post_window_command(window, name, args)
        except:
            traceback.print_exc() 
开发者ID:Wramberg,项目名称:TerminalView,代码行数:9,代码来源:sublime_plugin.py

示例11: open

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def open(window_or_view: Union[sublime.View, sublime.Window]):
	if isinstance(window_or_view, sublime.View):
		view = window_or_view 
		window = view.window()
	else:
		window = window_or_view
		view = window.active_view()

	if get_setting(view, 'open_at_startup', False) and (not window.id() in was_opened_at_startup) and Debugger.should_auto_open_in_window(window):
		was_opened_at_startup.add(window.id())
		Debugger.for_window(window, create=True) 
开发者ID:daveleroy,项目名称:sublime_debugger,代码行数:13,代码来源:main.py

示例12: on_load_project

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def on_load_project(window: sublime.Window):
	if debugger := Debugger.get(window):
		debugger.project.reload() 
开发者ID:daveleroy,项目名称:sublime_debugger,代码行数:5,代码来源:main.py

示例13: on_pre_close_window

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def on_pre_close_window(window: sublime.Window):
	if debugger := Debugger.get(window):
		debugger.dispose() 
开发者ID:daveleroy,项目名称:sublime_debugger,代码行数:5,代码来源:main.py

示例14: __init__

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def __init__(self, window: sublime.Window, on_output, args):
		global debugger_exec_for_id
		global id
		id += 1
		debugger_exec_for_id[id] = self

		self.future = core.create_future()
		self.on_output_callback = on_output

		window.run_command("debugger_exec", {
			"id": id,
			"args": args,
		})

		async def kill_if_canceled():
			try:
				await self.future
			except core.CancelledError as e:
				core.log_info("Cancel task")
				window.run_command("debugger_exec", {
					"id": id,
					"args": {
						"kill": True
					},
				})
				raise e
		core.run(kill_if_canceled()) 
开发者ID:daveleroy,项目名称:sublime_debugger,代码行数:29,代码来源:terminal_build.py

示例15: open_settings

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import Window [as 别名]
def open_settings(window: sublime.Window):
	window.run_command('edit_settings', {
		'base_file': '${packages}/Debugger/debugger.sublime-settings'
	}) 
开发者ID:daveleroy,项目名称:sublime_debugger,代码行数:6,代码来源:commands.py


注:本文中的sublime.Window方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。