c# - Visual Studio 2017 Community: "Using" suggestions for classes
问题描述
I'd like to achieve something similar to what IntelliJ is capable of. For example, if I type only a part of class' name in IntelliJ I get a list of suggestions for namespaces/packages. If I choose one of them - the class' name get autocompleted and appropriate package name gets added on top with import statement.
Now, when I try to do something similar in Visual Studio 2017 Community, it's a different story. Let's take System.Console class as an example.
- If I type "Cons" and press ctrl+space or alt+enter - I don't get any good suggestions
- If I type "Cons", add "using System" manually and press ctrl+space - I get the System.Console suggestion
- If I type "Conso" and press alt+enter - It basically behaves like IntelliJ - which means it appends the "using System" statement and autocompletes the class' name to Console. The option is the last one though, so I have to scroll through bunch of others (such as generate property, generate local etc.).
My question is - can I make Intellisense behave like in the 3rd case, but
- Make it work for shorter phrases (right now it kind of works for "Conso" but not for anything shorter)
- Make it so I get the "using" suggestions under ctrl+shift menu
- Prioritize the "using" option so it's on the top of the action list
What I tried:
- Enabled "Suggest usings for types (...)" under Text Editor -> C# -> Advanced
解决方案
This extension for VS2017 and 2019 seems to do most of what I asked: https://marketplace.visualstudio.com/items?itemName=Dreamescaper.IntelliSenseExtender
Keep in mind that suggestions for non-imported types are not enabled by default. You have to turn them on in: tools -> options -> Intellisense Extender
推荐阅读
- python - 有没有一种方法可以只从矩阵中的每一行和每一列中获取所需的索引范围的元素?
- javascript - 外部 Javascript 变量的 HTML 表单输入
- python - 如何在 python 3.7 中使用正则表达式来拥有 2 个或 3 个组?
- ruby-on-rails - Rails:是否可以自动调整独角兽工作进程的数量?
- sql - 根据用户输入转换 oracle 日期格式
- javascript - 如何遍历对象数组并计算存在多少重复值?
- java - 如何创建 EditText 和 Button 以便 EditText 应该在按下按钮存储 prev 值时接受新输入?
- java - AWS 中 Java Sping 启动应用程序部署问题的服务器运行状况错误
- r - 在 R 中使用 Rogan-Gladen 估计器调整 ODE 模型输出
- azure - 如何获取 Invoke-AzureRmVMRunCommand 命令的输出流?