visual-studio-code - php中语言为html且前面的文本匹配正则表达式时的Vscode键绑定
问题描述
我正在尝试从 sublime 迁移到 vscode,但不知道如何移动我的一些 keybindigs。其中之一是“=”,<?=$1?>
当我在 php 文件中编辑 html 代码时插入。更重要的是,我已经将它配置为匹配前面的一些文本,因此它不会插入“=”,属性<img src=""/>
将按原样显示。在崇高它被配置为
{ "keys": ["="], "command": "run_macro_file", "args": {"file": "res://Packages/User/macro/php/quick_echo_php.sublime-macro"}, "context":[
{"key": "selector", "operator": "equal", "operand": "embedding.php", "match_all":true},
{"key": "selector", "operator": "not_equal", "operand": "meta.embedded.line.php", "match_all":true},
{"key": "selector", "operator": "not_equal", "operand": "source.php", "match_all":true},
{"key": "selector", "operator": "not_equal", "operand": "source.js.embedded.html", "match_all":true},
{"key": "selector", "operator": "not_equal", "operand": "punctuation.definition.tag.end.html", "match_all":true},
{"key": "preceding_text", "operator": "not_regex_match", "operand": ".*<"},
{"key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\?"},
{"key": "preceding_text", "operator": "not_regex_match", "operand": ".*[a-zA-Zа-яА-Я]+"},
{"key": "setting.command_mode", "operand": false}
]},
在 vscode 中,我结束的是
{
"key": "=",
"command": "editor.action.insertSnippet",
"args": {"snippet": "<?=$1?>"},
"when": "vim.active && !inDebugRepl && vim.mode == Insert && editorLangId =~ /php|html/"
},
很明显这是没用的,因为“=”在所有 php 中都是非常必要的符号,例如$a = 1;
我在“开发人员:检查上下文键”中没有发现任何有用的东西。我什至尝试在 php 文件中聚焦 html 行之后在 vscode 开发控制台中按 ctrl+f "html" 并在那里看到零匹配。我只是找不到 keybindigs 的范围,但它存在于片段中。
PS "langId"
in"args"
对以太没有帮助。
解决方案
推荐阅读
- python - 如何将数组的一个元素传递给多处理中的进程
- node.js - Scavenger:分配失败 - JavaScript 堆内存不足
- input - 如何使用 Jsoup 访问嵌套的输入属性
- python - (再次)在 Windows 上访问 Python 中的长路径
- javascript - 如何在地图中为我的密钥道具生成唯一密钥?反应
- laravel - Laravel,自动生成新链接
- rust - 我可以运行夜间和稳定的编译器吗?
- firebase - 如何阻止从控制台更改 Firebase 实时数据库
- sharepoint - 以“归档格式”从 OneNote 文档中提取文本
- c++ - 无效指针的条件