-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Diff] Add tab context menu entry to diff 2 tabs #3315
Conversation
7cce77f
to
cfa3730
Compare
Thanks for this.
|
None of ST's core/default plugins uses typing so far. I don't see any reason for them here. |
This happens for me on this branch if you use the regular Diff files... entry from the sidebar context menu. The If I set "diff_changes_to_buffer": true in the settings, the tab title appears odd for diffs of two existing files from the tab context menu: there is an unexpected "Unsaved Changes:" prefix and a part of the filename is removed if both files start with a similar filename. For example: In general I like the idea from this PR. The functionality already exists, and I always wondered why diffs are only available for files from the side bar, instead of all views. No more need to install 3rd-party packages for basic diffs :) |
Thanks for the feedback all, it seems I didn't do enough testing after making some quick changes 😅
I like to think that double quotes are being used for human-readable/localizable strings, and single quotes for internal stuff, so I made some changes in that direction. But if you want a single/uniform quote type, let's decide which we prefer and switch them all. @jwortmann should be fixed now, thanks for the detailed report |
I'm just thinking loud, Keith. It was unexpected for me. I use single quotes. Your reasoning seems fine. Whatever works and/or people are used to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change definitly adds value to the existing plugin. I've used it every here and then without issues. Not sure if a new context menu item is something @sublimehq should decide about, but I am fine with it as is.
I can confirm that it works well and doesn't raise an error anymore, but I still have two suggestions for small possible improvements:
in line 168.
- def get_name_for_view(view, fallback_name):
- return view.file_name() or view.name() or fallback_name
+ def get_name_for_view(view):
+ return view.file_name() or view.name() or "Unsaved view ({})".format(view.id()) |
- change fallback name - strip leading directory separator from relative file paths
@jwortmann done :) I tweaked the common path logic slightly to also handle when the only part in common is |
Perfect 👌 |
Been using it for sometime & seems solid so far. |
Merge? |
Waiting for some comment from sublimehq about the new plugin functionality. I am fine with it, though I'd be happy to also be able to diff views from different groups. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work on this, it's a good addition. The command should also be added to Tab Sidebar Context.sublime-menu
so it can work in the side-bar.
0d43acf
0d43acf
Fixes #3313