有没有办法从我的VSCODE扩展语言函数中找到文本范围?
我正在使用typescript-language-features
来创建VSCODE语言扩展。作为该扩展名的一部分,我想注册一个悬停提供商(使用 vscode.languages.RegisterHoverProvider
)提供语法帮助。
我怀疑选择上下文相关建议的最佳方法是评估当前光标下文的文本范围。该范围可用于我的提供商吗?如果是这样,您可以建议一种访问它的方法吗?
谢谢!
I am authoring a VSCode language extension using the typescript-language-features
. As part of that extension, I'd like to register a hover provider (using vscode.languages.registerHoverProvider
) that offers syntax help.
I suspect that the best way to select context-relative suggestions is to evaluate the current textmate scope of the text under the cursor. Is that scope available to my providers? If so, can you suggest a method for accessing it?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您的假设是错误的。 TextMate-Scope(如您所谓的)是针对某些字母组合的示波器ID的简单,基于正则的分配。对于诸如代码提示或代码完成之类的内容,它根本无济于事。
取而代之的是,您必须为要支持的语言编写自己的解析器,从而为给定位置提供精确的符号信息。然后,这可以用于派发代码提示和其他信息。
No, your assumption is wrong. The textmate-scope (as you call it) is a simple, regex-based assignment of a scope ID for certain letter combinations. It doesn't help at all for things like code hints or code completion.
Instead you have to write your own parser for the language you want to support, which in turn can give you precise symbol information for a given position. This can then be used to derive code hints and other information.