How can I get Netbeans to use import statements instead of fully qualified class names on autocomplete?(如何让 Netbeans 在自动完成时使用 import 语句而不是完全限定的类名?)
问题描述
我最近从 PDT 转移到 Netbeans,有些事情我想不通.如何让 IDE 在自动完成类名的文件开头使用use"语句?喜欢:
I've moved from PDT to Netbeans recently, and there is something I can't figure out. How do I get the IDE to use 'use' statements at the beginning of a file on autocompleting class names?
Like:
use FooBarBaz;
class Something extends Baz { /* ... */ }
相反,如果我使用自动完成功能,我会得到
Instead, if I use autocompletion I get
class Something extends FooBarBaz { /* ... */ }
我已经检查了代码完成设置,但最有希望的选项(智能)希望我首先编写导入,以便对短类名称使用自动完成功能.PDT 能够将该行写入文件的开头.
I've checked the code completion settings, but the most promising option (smart) wanted me to first write the imports in order to use autocompletion for short class names. PDT was capable writing that line to the beginning of the file.
推荐答案
在较新版本的 Netbeans(即 7.3+)中,您可以按 Ctrl+Shift+I
(Alt+Shift+I
不会按预期工作.
In newer versions of Netbeans (i.e. 7.3+), you can press Ctrl+Shift+I
(Alt+Shift+I
won't work as expected, though).
首先,它会在您的文件中搜索任何智能或完全限定的实例,然后询问您找到的实例应该是什么类型.然后,它将完全限定的 use 语句添加到您的文件顶部,并将源中的现有实例更改为非限定.
First, it searches for any smart or fully qualified instances in your file and then asks you of what types the found ones should be. It then adds fully qualified use statements to the top of your file and changes existing instances in the source to unqualified.
这篇关于如何让 Netbeans 在自动完成时使用 import 语句而不是完全限定的类名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何让 Netbeans 在自动完成时使用 import 语句而不是完全限定的类名?
基础教程推荐
- PHP 守护进程/worker 环境 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- HTTP 与 FTP 上传 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01