简体   繁体   English

多个自动完成扩展在 vscode 中是否相互扩展?

[英]Do multiple Autocomplete Extension extend each other in vscode?

So say I have C++ Intellisense and I also want to deploy my own autocomplete extension, that would provide a small autocomplete functionality based on different conditions.所以说我有 C++ Intellisense,我还想部署我自己的自动完成扩展,它将根据不同的条件提供一个小的自动完成功能。

My question is would my autocomplete extension work by extending the C++ Intellisense or by replacing it and becoming the only autocomplete extension?我的问题是我的自动完成扩展是否可以通过扩展 C++ Intellisense 或替换它并成为唯一的自动完成扩展来工作? If the answer is latter then what are my Options?如果答案是后者,那么我的选择是什么?

C++ Intellisense is just an example that I would have to deal in my project, it can be any other small autocomplete extension that works on the same.cpp file. C++ Intellisense 只是我在我的项目中必须处理的一个示例,它可以是适用于 same.cpp 文件的任何其他小型自动完成扩展。

I have tried to perform a similar experiment using the vscode-extension-sample of autocomplete on PlainText file.我曾尝试在纯文本文件上使用自动完成的vscode-extension-sample执行类似的实验。 Where just writing a Lorem Ipsum before trying the Extension Sample and then just writing any single word from Lorem Ipsum does not autocomplete.在尝试扩展示例之前仅编写 Lorem Ipsum,然后仅从 Lorem Ipsum 编写任何单个单词都不会自动完成。 It is possible that this is not a good example, because as much I am aware there are no Intellisense for plaintext and VSCode may be using it's own built in auto-complete features that are overridden in case of plaintext.这可能不是一个很好的例子,因为据我所知,明文没有智能感知,而且 VSCode 可能正在使用它自己的内置自动完成功能,这些功能在明文的情况下会被覆盖。

Also the Activation Event was onStartup * because of other features in my trial extension.由于我的试用扩展中的其他功能,激活事件也是 onStartup *

So inorder to make sure that both intellisense and autocomplete work together in your extension, you have to use registerCompletionItemProvider , but where you will put DocumentSelector as * .因此,为了确保智能感知和自动完成功能在您的扩展程序中协同工作,您必须使用registerCompletionItemProvider ,但您将DocumentSelector放置为*

This is because if you put a specific stuff like {language: "cpp"} , the match score is of 10, higher than intellisense and if you are always returning some result, then no way Intellisense will work in parallel, so it also opens possibility of providing specific result.这是因为如果你放一个特定的东西,比如{language: "cpp"} ,匹配分数是 10,高于 intellisense 并且如果你总是返回一些结果,那么 Intellisense 将无法并行工作,所以它也会打开提供具体结果的可能性。

Source:资源:

  1. add completionitemprovider and keep suggestions Look at comments. 添加completionitemprovider并保留建议查看评论。
  2. https://github.com/microsoft/vscode/issues/24464 https://github.com/microsoft/vscode/issues/24464

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

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