西秀岭

导航

Sublime Text - XPath Plugin shortcutSublime Text - XPath 插件快捷方式

【问题标题】:Sublime Text - XPath Plugin shortcutSublime Text - XPath 插件快捷方式
【发布时间】:2017-08-09 09:19:21
【问题描述】:

我已经安装了Sublime Text - XPath Plugin,但是我在 Sublime 中找不到启动 XPath 搜索的快捷方式或按钮。特别是“输入 xpath”行。

【问题讨论】:

 

标签: xpath sublimetext3 sublime-text-plugin


【解决方案1】:

打开命令面板 (Ctrl+Shift+P),然后选择 XPath: Query document。这将打开“Enter xpath”输入面板。

XPath 插件默认没有设置键绑定。 Example.sublime-keymap 文件显示了您可能想要设置的示例。

Example.sublime-keymap 文件底部的示例,标记为“显示 XPath 查询输入框”,是显示“输入 xpath”输入面板的键绑定,它使用的键是 Ctrl+Shift+Alt+Super+q很难清楚地表明作者打算让用户更改它们。查看示例键绑定的作用,然后将您想要的键复制并粘贴到您的用户键文件中,将他们使用的键更改为您喜欢的键。

例如,您可能希望将以下绑定添加到您的用户密钥,以使用 Ctrl+Shift+X 密钥显示“输入 xpath”提示:

注意:请注意以下示例中的有用行:"prefill_query": "//text()", // an XPath query to put into the input box by default - can omit and use "prefill_path_at_cursor": true instead to use the path of the node under the first cursor。您可能想要添加 2 个不同的键绑定来显示“输入 xpath”提示;一个使用"prefill_query": "//text(),",另一个使用"prefill_path_at_cursor": true,

// Show the XPath query input box
{
    "keys": ["ctrl+shift+x"],
    "command": "query_xpath",
    "args": {
        "prefill_query": "//text()", // an XPath query to put into the input box by default - can omit and use "prefill_path_at_cursor": true instead to use the path of the node under the first cursor
        "live_mode": true, // as per settings
        "normalize_whitespace_in_preview": false, // as per settings
        "intelligent_auto_complete": true, // as per settings
        "goto_element": "names", // same options available as for goto_relative
        "goto_attribute": "value", // options are name, value, entire
        "max_results_to_show": 1000 // as per settings
    }
},

【讨论】:

  • 我打开了命令面板 (CP),即使我安装了 xpath 插件(我通过打开 CP 验证它并在“包控制:列出包”中找到它)除了“设置”之外没有其他选项语法:CP 中的 Xpath 1.0"。
  • 您可能需要将语法更改为 xml 以使其正常工作

posted on 2023-02-23 13:57  西秀岭  阅读(39)  评论(0编辑  收藏  举报