vmware-archive / scripted

The Scripted code editor
Eclipse Public License 1.0
1.56k stars 166 forks source link

Don't Allow Same File Open Twice #99

Open cawoodm opened 11 years ago

cawoodm commented 11 years ago

It is possible (nay common) to open the same file twice (Ctrl+Shift+E) and then edit the one and navigate on. The 2nd window contains the old code and if you then edit it, this last edit wins. Dangerous - don't allow it.

In general this 2nd editor is nice but a bit clunky. Often, you have file A in front of you and want file B in the 2nd editor. The current flow is Ctrl+Shift+E, open file B and then swap editors. I propose a double-click (or Shift+click) in the navigator to open the file B in the 2nd editor. Another type of click (Ctrl+Click) could open the clicked file in the 1st editor and shift the current one to the 2nd.

cawoodm commented 11 years ago

Also, when you swap (Ctrl+Shift+S) Scripted warns about unsaved changes but they are actually not lost.

aclement commented 11 years ago

Shift+Click in the navigator does open the clicked file in the 2nd editor. The shift modifier on any file reference (in navigator, results view, etc) should always open the target in the 2nd editor. No-shift will target the main editor. I'll agree some kind of shift mechanic could be nice to push the main to the side and load the new element in the main.

But we are going to have multiple editors I hope - hosted in the side panel - and we will need a way to target an editor window for the file being clicked/selected. I've not decided what that'll be yet. It could be Shift+1,2,3,4,5,6,7,8,9 or something like that. When shift is held over a openable element possibly some overlay appears on the browser window to show which number will select which editor window as the target for the load.

cawoodm commented 11 years ago

In that case I would not be a fan of Shift+digit+click but would suggest for your consideration the right-click context menu not least because...

...I'd still like to be able to open a file in my browser. So there would then be a case for right-clicking on a project file and saying "View in Browser". There would have to be some prefix which mapped the filename to a URL so maybe a .scripted setting:

"previewURL": "http://localhost/work/$filename"
scothis commented 11 years ago

-1 for shift-[0-9]-click

When asking to open a file, if it's already open just focus it, otherwise open it. I can't imagine a case where I would want to explicitly target a particular side pannel. A user should be able to reorder and close side panels as needed.

aclement commented 11 years ago

@Marc - opening the file in the browser seems a very reasonable context menu action. We should spin that out as another issue (I don't recall already having one). On a related topic. Have you tried the integrated play/stop button for serving the project? I'd be interested in whether that is of any use to you. If not, is there something 'play' and 'stop' could call that would be better in your case? Scott wants 'play' to call npm start, for example.

@Scott Yes, I think you are right. We need to get those secondary side panel things open so we can start experimenting with the user experience. I am not using the side panel secondary editor much myself at all, and I don't know why that is. I guess in Eclipse I don't often find I need to work on two files at once, just occasionally.

cawoodm commented 11 years ago

@aclement, the play button is a cool feature - I don't need it as I have mongoose running all the time. I did think that "Play" should not only start a server but actually run the application* as it does in other IDEs like Visual Studio etc. And that get's back to my request above which I may have forgotten to place.

cawoodm commented 11 years ago

One intuitive way to target a panel would be drag and drop but I think it's an edge case really. Not sure it's worth it to have > 2 panels...