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.
我创建了一个TokensProvider为我的自定义语言提供语法突出显示。这有效,但它仅在编辑文本时重绘。
TokensProvider
问题是 - 我的自定义语言取决于外部上下文,即使文本没有变化。因此,即使文本没有改变,我也需要触发语法高亮重绘。
我怎样才能做到这一点?
挖掘vscoderepo,看起来像以下行:
vscode
monaco.editor.getModel(url)._resetTokenizationState()
不幸的是,这看起来像是一个未记录的 API,可能会在未来的版本中中断,所以公共 API 会很好。