Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Open Recent Files #12012

Merged
merged 29 commits into from
May 23, 2016
Merged

Open Recent Files #12012

merged 29 commits into from
May 23, 2016

Conversation

swmitra
Copy link
Collaborator

@swmitra swmitra commented Dec 17, 2015

This PR is aimed to provide the missing 'Open Recent Files' feature in brackets.
This feature is necessary when a user enables No Distractions mode. The MROF(Most recently opened files) list can be accessed and navigated in multiple ways ( using mouse only , using keyboard only and a mix of both).

Using mouse only

  • Select File->Open Recent to launch the MROF list ( refer to the screen shot below )
    filemenu
    and select(Click) on the file you want to open(refer to the list screen shot ).
    mroflist
  • The list can be closed using the 'X' button located at the top-right corner.
  • The list can be cleared using the 'Clear All' button located at the bottom-right corner.
  • The footer area shows the full path of the file selected/highlighted.

Mouse + Keyboard

  • press Alt+O to launch the MROF list.
  • Select the files using mouse left click or navigate using left/right arrow keys.

Keyboard only

  • Press Alt+Shift+N to navigate next in the file list.
  • Press Alt+Shift+P to navigate previous in the file list.
  • In this mode the MROF list pop over has auto dismissal after 1.5 secs when no navigation is performed.
  • Navigate to the file you want to open ( visual confirmation via MROF list highlight ) and the feature takes care of opening the editor and put the cursor in the last know position.
  • In this mode as the MROF list is for visual confirmation only , close and clear button is hidden in this mode ( refer to the screen shot below).
    mroflist k

NOTE
The file icons appearing in the screen shots is not part of brackets core. If any extension is installed which provides custom styling and icons to WorkingSetView as providers , MROF list borrows the same from WorkingSetView. (refer to the screen shot without icons below )
mroflist_base

@swmitra
Copy link
Collaborator Author

swmitra commented Dec 17, 2015

Tagging @sprintr @petetnt @zaggino @abose @nethip @ficristo for feedback.

@petetnt
Copy link
Collaborator

petetnt commented Dec 17, 2015

Great stuff @swmitra, I've been missing for such a feature for a long time!

Things right off the top:

  • Highlights on long filenames don't show correctly
    image
  • When you select an item and click elsewhere on the dialog, the extension loses the highlight color but the filename doesn't (see the above screenshot)
  • Should this be an modal window (with a darkened backdrop). Currently it looks a bit weird because it feels like you could drag it around, but you cannot. Other choice would be a dropdown list, similar to the the quick open bar.
    • If it will be an modal, it should look like the other modals I guess
  • There are some z-index problems with other modal windows
    image

@@ -0,0 +1,165 @@
<style>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The styles should probably be in its own CSS file and then loaded with ExtensionUtils.loadStyleSheet(module, "styles/recent-files.css");

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it purposefully in the template as it affects the DOM only when appended, to minimize any unintentional style override.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As all the selectors are prepended with mrof (or start with #mrof-container ID) I don't think there should be anything that touches anything outside of the MROF-list 📝

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done @petetnt

@swmitra
Copy link
Collaborator Author

swmitra commented Dec 17, 2015

@petetnt Can you please check the last commit. Fixed all the UI corruption issues.

@petetnt
Copy link
Collaborator

petetnt commented Dec 17, 2015

@swmitra can confirm, 713a0dd fixed all the UI corruption issues (and the CSS thing I mentioned above) 👍

@swmitra
Copy link
Collaborator Author

swmitra commented Dec 17, 2015

@petetnt Thanks a lot for quick confirmation 😄

@sprintr
Copy link
Contributor

sprintr commented Dec 17, 2015

👍 For this feature.

The dialog box used for this feature is different from the one used normally e.g (File -> Project Settings or View -> Themes). I believe it would be better to use a single style of dialog boxes.

The dialog boxes used for the Project Settings, Themes and extension manager are modal dialog boxes. I believe in this case we would need a modeless dialog box since it also opens the file in the background.

@@ -0,0 +1,402 @@
/*
* Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the copyright year to 2015 or maybe 2016 just to be on the safe side.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sprintr The theme used for this dialog is inline with the theme used in the project panel (side bar). That is why this dialog has a different look than the rest of the dialogs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just don't feel comfortable with it maybe because it is the first time I see it. @larz0 or @GarthDB may give an opinion on this design change.

@sprintr
Copy link
Contributor

sprintr commented Dec 17, 2015

When a file has unsaved changes the same behavior occurs that @petetnt pointed out earlier.

2015-12-17 21_08_20- c__users_aminullah_appdata_roaming_brackets_brackets json html - brackets

* Shows the current MROF list
* @private
*/
function _createMROFDisplayList() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function spans almost 100 lines. Most likely could use some refactoring ✏️

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Minor refactoring
@swmitra
Copy link
Collaborator Author

swmitra commented Dec 18, 2015

@sprintr Can you please check with aa5f73e commit. Fixed the UI corruption issue and most of the comments.
@petetnt Addressed comments.

@petetnt
Copy link
Collaborator

petetnt commented Dec 18, 2015

Found another issue while doing further testing against aa5f73e

  • The dialog can be opened multiple times (with ALT+O or File -> Open Recent Files) on top of itself. (After opening the dialog while the dialog is already open, one cannot remove the dialog without restarting Brackets (or removing it manually from the DOM), but that will be fixed automatically after preventing the wrong behavior).

The following is not an issue, more of an question regarding split view use:

  • File has been opened so that it ends up in the MROF-list. User closes the file from the working set. Later the user opens the file again from the MROF-list and it opens to the pane it was in previously:
    • ❓ Should files that have been removed from the working set be opened in the currently active pane instead of contextData.paneId?

Great job as always @swmitra 👍

@swmitra
Copy link
Collaborator Author

swmitra commented May 16, 2016

@marcelgerber I have addressed most of the comments and fixed the scroll issue(had to navigate to a lot of files to simulate 😄 ) . Can you please have a look?
Thanks again for reviewing this feature 👍

@marcelgerber
Copy link
Contributor

Thank you! Looks good from my side now (I didn't have a thorough look at the code, though)

@ficristo
Copy link
Collaborator

I gave a try, a couple of questions:

  • why doesn't match the current modal styles (view/Themes, Extension Manager)? I like the thin header and footer but since I use a light theme seems odd at first
  • if I delete a file which is in the list and then I click on it, on the recent list, it says An error occured when trying to open the file <filename>. The file/directory could not be found. This 'error' is kind of expected. Maybe is fine as is, I don't know, but Notepad++ says that the file doesn't exists and ask to create it.
  • what is the behaviour of the clear button? To me it redorders in some ways the list; should remove all the files from the list?

By the way good job!

@nethip
Copy link
Contributor

nethip commented May 17, 2016

@ficristo

if I delete a file which is in the list and then I click on it, on the recent list, it says An error occured when trying to open the file <filename>. The file/directory could not be found. This 'error' is kind of expected. Maybe is fine as is, I don't know, but Notepad++ says that the file doesn't exists and ask to create it.

Good catch 👍 and good feedback as well.

@swmitra
Copy link
Collaborator Author

swmitra commented May 18, 2016

Thanks a lot @ficristo for trying this feature out. Really appreciated 👍

  • Regarding the deleted file point, is this the scenario where the file is deleted while the open file list is on(shown). As it has been designed to work with a snapshot of the list, we don't update the list in anyway while shown.

EDIT

Just saw the problem and it's a timing issue as the file system sync call is async, display list preparation should happen only after we are done with sync. Fixed and updated the PR.

Basically existence check is done on all entries before showing the list, but once shown we don't really check for existence.

  • The clear button clears all the un-linked entries (which are not part of working set). The recent file list is a super set of working set files so we don't really want to clear all the entries as that will restrict Ctrl+Tab navigation.

@ficristo
Copy link
Collaborator

Trying to clarifing my issue: I only think the message is a bit misleading.
It says an error is occured which is kind of expected and the message is about folder / files.

I think I'll be a bit confused about the clear button until I'll get accustomed 😛.

I don't have strong opinions about what to do (I didn't check the last commit...)

@swmitra
Copy link
Collaborator Author

swmitra commented May 18, 2016

@ficristo The entry for non-existing files will not be shown in the list so that we can avoid clicking on a link pointing to an unreachable file entry(as per last commit).

Thanks a ton for using the feature and providing us good feedback 👍

@swmitra swmitra closed this May 18, 2016
@swmitra swmitra reopened this May 18, 2016
@swmitra
Copy link
Collaborator Author

swmitra commented May 18, 2016

// Sorry closed it by accident while pressing 'comment'.

@swmitra
Copy link
Collaborator Author

swmitra commented May 18, 2016

Added "recent.files.navigation" preference to enable/disable (true/false) recent files navigation.

@nethip
Copy link
Contributor

nethip commented May 19, 2016

@swmitra Does it make sense it have something like navigation.enableNavigationDialog?

@nethip
Copy link
Contributor

nethip commented May 19, 2016

@swmitra One last change. I think when changing preference for this, you need to rebuild the MRU by removing the non workspace items and by syncing your MRU with the workspace one.

@swmitra
Copy link
Collaborator Author

swmitra commented May 19, 2016

Thanks a lot @nethip for actively using the feature for review 👍
It really helps to provide a good feature experience in that way 😄

@swmitra
Copy link
Collaborator Author

swmitra commented May 19, 2016

Ping @nethip for a final check (hopefully 😄 )

@nethip
Copy link
Contributor

nethip commented May 23, 2016

@swmitra I did give it a spin. LGTM.

Thanks @swmitra for this wonderful and a very helpful feature. 👍

@nethip nethip merged commit 59b33be into master May 23, 2016
@nethip nethip deleted the swmitra/NavigationHistory branch May 23, 2016 06:00
@abose
Copy link
Contributor

abose commented May 24, 2016

Awesome!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants