Avoid too many editor tabs open by single click: Use Sublime policy: Only open new tab if current tab is modified or open by double click

已回答

Hi, to quickly get what I am saying, please watch the video.

when I choose "Auto Scroll To Source" mode in Navigation Pane, I will turn into a single-click-open mode:

Once I single-click a file in Navigation Pane, it will open a new editor tab for that file.

I click and click to view temporarily(not edit), the result can be imagined: many editor tabs open, so i have to manually close them or switch between these temporary tabs and real editing files, that is tedious.

So I suggest we can introduce Sublime Text tab-reuse policy:

Single-click a file => it will reuse current tab if which is also opened by single-click and not changed.

Double-click a file => always open new tab

Single-click a file then change it => the tab will not be reused by other file

See in Intellij-IDEA based IDE:

1. Enable single-click open mode:

2. Single-click some files, many new tabs will be added

 

But see Sublime Text(2 or 3)

1. Single-click many files without editing any, result is just one tab, with italic title:

2. If I modified the file, then later single-click will open new tab

To quickly get what I am saying, please watch the video.

 

Regards

评论操作 固定链接

There is tab limit number you can specify and tab closing policy in Editor Tabs settings: first close non-modified or less frequently used tabs.

Note that IDE automatically saves the file content without explicit save action (e.g. after you have changed the current tab or just closed it).

To navigate to recent tabs you can via the Ctrl(Cmd)+E popup.

Related request: https://youtrack.jetbrains.com/issue/IDEA-110130

-1
评论操作 固定链接

Thank you!

I tried various tab policy, but none of them are as neat as Sublime Text. 

JB does not distinguish double-click and single-click.

0
评论操作 固定链接

As you said, JB does save changes automatically, seems this is the reason why they can not implement Sublime Text policy.

PS: It's also a pity that JB does not show "changed" flag of flag on file.

I know JB want prevent changed content from being lost when close IDE, 

but actually it does not means it must save file.

Instead of lost modified flag by saving file, JB can save file to temporary file, just one important point: when close JB, it should not bother user for unsaved file, and restore modified content and modified flag when reopen.

That's exactly what SublimeText doing.

-1
评论操作 固定链接

>PS: It's also a pity that JB does not show "changed" flag of flag on file.

Please enable Mark modified tabs with asterisk option in Preferences | Editor | General | Editor Tabs.

See also https://stackoverflow.com/a/7377886/2000323 about Auto-save feature.

2
评论操作 固定链接

thank you! This feature is useful.

0
评论操作 固定链接

"...many editor tabs open, so i have to manually close them or switch between these temporary tabs and real editing files, that is tedious."

You said it! I am going crazy because of IntelliJ's tabs issue. To compound the problem, IntelliJ IDEA does not appear to allow tab organization according to most-recent-file-opened first. If you want to find a recent tab (without having to navigate repeatedly using ctrl+alt+left), it's a problem.

I wish I could go back to Visual Studio!

In Visual Studio, tabs are organized according to most-recent-file-opened first, AND, Visual Studio has an awesome 'peek definition' capability, which allows NESTED peeks. Thus, you can have a little popup window that allows you to peek at a definition (without opening a new tab), and then you can drill down through as many peeks as you want, navigating backward and forward -- all within THE "peek definition" POPUP window. :)

IntelliJ does have "quick definition" (ctrl+shift+i), but you can only do it for one item, apparently. You can't get a "quick definition" for something that you're looking at already in IntelliJ's "quick definition" popup window. If I have that wrong, please let me know.

1
评论操作 固定链接

exactly, the NESTED "peek definition" is also what I want to propose.

0
评论操作 固定链接

There is a ticket for this feature request, please upvote: https://youtrack.jetbrains.com/issue/IDEA-98647

0
评论操作 固定链接

I'm as well annoyed by this tab explosion behaviour. In contrast the single vs. double click behaviour of sublime text (and by the way now it's the same in VS Code) is so simple, explicit and useful that for just some quick browsing of code I use VSCode more and more these days. It's just more efficient while navigating.
(I don't like the tab closing policy, it too often catches me on the wrong foot: closing when I don't want to close and not closing when I want to close :). I also think it's unnecessarily unintuitive in the way that I typically don't have the exact currently open tab number in my mind so don't know what a click in Project Explorer will result in: a newly opened tab or automatically closing some older tab. VSCode/SublimeText behaviour in contrast is simple and explicit, I'd call it intelligent :))

1
评论操作 固定链接

The post Michal Dekys made seems to have gotten a confused response about 'Quick Definition' rather than what is actually being requested. And now that post links to this one! In this thread it is now a little bit more confusing because someone has additionally mentioned 'Nested Quick Definition' as a desired feature, which is not what the original post is referring to. :) 

I would also like to support the request for Sublime Text / VS Code style one-tab preview style. When going through my files with 'Autoscroll to Source' on, I spend about 30% of my time backtracking and closing tabs. Other than that though, I love JetBrains IDEs.

4
评论操作 固定链接

Strong plus one. This is making me consider setting up VS Code this weekend.

1
评论操作 固定链接

ya i have been flirting with going to vscode. phpstorm just has too many benefits for me, so i jumped back after a week. but the temporary tabs were very noticeable and would be a great feature, and *should* be pretty simple to implement, no?

does this have an actual feature request somewhere to upvote??

0
评论操作 固定链接

Hey guys, now there is a plugin that provides this functionality to all IntelliJ IDEs: https://plugins.jetbrains.com/plugin/12778-quick-file-preview

4
评论操作 固定链接

Thanks alot Martin! Really great!!

0
评论操作 固定链接

Thank you Martin! This is spot on.

0
评论操作 固定链接

thank you so much Martin!

0
评论操作 固定链接

@Martin Sommer 

The plugin is great despite Jetbrains have implemented their own file preview functionality. Unfortunately neither their implementation nor this plugin work for tabs opened with ctrl+click navigation, thus I still end up with a lot of unnecessary tabs.<br/>
Would be great if tabs opened via cltr+click on class/variable will be auto closed if not edited as well.

0
评论操作 固定链接

Fires3as0n thank you for the feedback, I've forwarded it to the team. Please try if the Settings (Preferences on macOS) | Advanced Settings | Open declaration source in the same tab option helps.

0
评论操作 固定链接

Andrey Dernov thank you for the reply. Open declaration source in the same tab is an interesting option, unfortunately it does not solve the problem:
1. Not only it opens the file in current tab, it also moves tab to be the last one, I am used to organize my active tabs in precise order, and this behavior ruins it.
2. If there are chages, it still opens a new tab instead of reusing existing one
3. When navigating to file that does not belong to the project (e.g. 3rd party library class), it also opens a new tab, which is never auto closed afterwards :(

0

请先登录再写评论。