Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚刚查看了厨房水槽演示,发现有一个选项“显示令牌信息”显示鼠标在什么类型的文本上(变量、函数等)
我想创建类似的东西,可以在当前光标位置获取单词的当前标记字符串。有谁知道该怎么做?
谢谢!
这样:
editor.on('mousemove', function(e) { var position = e.getCursorPosition(); var token = editor.session.getTokenAt(position.row, position.column); });
它将返回一个对象:
token = { type: "paren.rparen", value: "}", index: 0, start: 0 }