Java 如何在 Intellij IDEA 中展开折叠包链?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22001171/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 11:57:24  来源:igfitidea点击:

How to expand folded package chain in Intellij IDEA?

javaintellij-idea

提问by JBT

Intellij IDEA automatically chain packages together if the intermediate ones are otherwise empty. It is a nice feature in general. However, sometimes you don't want them to be chained, especially when you are in the middle of creating new package structures for your new project. I might have come across the setting for disabling this feature for a certain package, but I can't find it where now. So, does anyone know how to control this feature? Thank you very much.

如果中间包是空的,Intellij IDEA 会自动将包链接在一起。总的来说,这是一个不错的功能。但是,有时您不希望它们被链接起来,尤其是当您正在为新项目创建新的包结构时。我可能遇到过为某个包禁用此功能的设置,但我现在找不到它。那么,有谁知道如何控制这个功能?非常感谢。

BTW, in case you need clarification, what I mean by package chaining is as follows. Suppose you have this package structure:

顺便说一句,如果您需要澄清,我所说的包链的意思如下。假设你有这个包结构:

$ tree com
com
└── company
    └── project
        └── some
            └── feature

Since there are really nothing else inside the intermediate folders, Intellij IDEA will automatically display it like

由于中间文件夹里面真的没有其他东西,Intellij IDEA会自动显示它像

com.company.project.some.feature

in the project explorer, which looks like the packages are chained together.

在项目资源管理器中,看起来包是链接在一起的。

采纳答案by Daniel Kaplan

Uncheck "Hide Empty Middle Packages" under the Project View settings dropdown:

取消选中项目视图设置下拉菜单下的“隐藏空中间包”:

Hide Empty Middle Packages

隐藏空中间包

回答by Khojiakbar

As another solution of how to create another file in the intermediate package:

作为如何在中间包中创建另一个文件的另一种解决方案:

Use expanded hierarchy of packages on the top of the window as shown below As shown below

使用窗口顶部的扩展包层次结构,如下所示 如下所示