繁体   English   中英

为什么宏不起作用?

[英]Why the macro doesn't work?

这是宏,由于某种原因,它不起作用:

[
    { "command": "split_selection_into_lines" },
    { "command": "move_to", args: {"to": "hardeol"} },
    { "command": "move_to", args: {"to": "hardbol", "extend": true} },
]

我可以通过插件做同样的事情,但是我不喜欢在这里使用它:

import sublime_plugin
class SplitIntoLinesReverseCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.run_command("split_selection_into_lines")
        self.view.run_command("move_to", {"to": "hardeol"})
        self.view.run_command("move_to", {"to": "hardbol", "extend": True})

为什么宏不起作用?

该宏无效,因为用于定义它的JSON无效; args键需要用双引号引起来,但不是。 结果,宏将无法加载,因此无法执行。

如果您的配色方案支持,则无效字符将突出显示以为您指出问题。

更正后的版本为:

[
    { "command": "split_selection_into_lines" },
    { "command": "move_to", "args": {"to": "hardeol"} },
    { "command": "move_to", "args": {"to": "hardbol", "extend": true} },
]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM