ace-editor如何获得大括号之间的代码值:
{
"name":"Product",
"properties":
{
"id":
{
"type":"number",
"description":"Product identifier",
"required":true
},
"name":
{
"description":"Name of the product",
"type":"string",
"required":true
}
}
}
如果光标开启:"type":"number"
然后它应该返回
{
"type":"number",
"description":"Product identifier",
"required":true
}
答案 0 :(得分:1)
查看jumpToMatching中找到下一个{}
的代码,然后调用findMatchingBracket,一旦你有范围调用editor.session.getTextRange(range)