简体   繁体   English

特定摩纳哥编辑器实例的CompletionProvider

[英]CompletionProvider for a specific Monaco editor instance

Monaco Editor allows registering a custom completion provider via monaco.languages.registerCompletionProvider . Monaco Editor允许通过monaco.languages.registerCompletionProvider注册自定义完成提供程序。 However, this registers the provider globally across all instances for the given language. 但是,这会在给定语言的所有实例中全局注册提供程序。

In my specific case I want to provide auto completion of tables and columns in an SQL editor. 在我的特定情况下,我想在SQL编辑器中提供表和列的自动完成功能。 But I have many instances and they need to use different sets of tables / columns. 但是我有很多实例,它们需要使用不同的表/列集。

Is there a way to register auto completion for only a specific editor instance? 有没有一种方法可以只为特定的编辑器实例注册自动完成功能?

No you can't, they go into a global registry. 不,您不能,他们进入了全球注册中心。 But the provider is passed the editor model as a parameter, so you can just only provide completion items for the model/editor you are interested in, and return empty for the others. 但是,提供程序是作为参数传递给编辑器模型的,因此您只能为您感兴趣的模型/编辑器提供完成项,而对其他模型/编辑器则返回空。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM