有没有办法如何通过原始字符串和字符串中子字符串的开头和结尾的索引来计算摩纳哥编辑器中的位置?
find matches API有可能:
editor.getModel().findMatches('sub_string')
我想知道是否有任何其他方式,因为可以有多个匹配,API方法不完全适合我当前的任务。
有一个API方法getPositionAt
(见here)
const position = editor.getModel().getPositionAt(index);
const { lineNumber, column } = position;