Seldaek / php-console

PHP Debug Console
Other
529 stars 93 forks source link

Toggle widgets and behaviours #16

Closed enderandpeter closed 10 years ago

enderandpeter commented 11 years ago

This is a pull request for establishing a way to toggle some of the most prominent features of ACE, namely collapsing/expanding code blocks (widgets) and auto-pairing grouping characters (behaviours). I'm not sure why the changes from rlerdorf's commit are showing up as though they are new changes. I think the one difference in my version is that there is a newline at the end of the file. I can't say how that happened...

The clickable boxes I made to toggle these features are just something to suggest how to go about setting up such an interface. Perhaps you'd prefer a different visual approach. I think it would be great to let the user invoke other features of the ACE editor as well, especially allowing them to choose a theme, but I think users would really appreciate turning just these features on and off. Please let me know what you think.

Seldaek commented 11 years ago

Well the question is whether this is meant to be a minimal UI just allowing you to try quick snippets, or if it should be a full blown editor. The answer to me is the former, but if some of ACE's behaviors are really annoying then maybe a small pop-out configuration screen could be added (and options stored in cookies I guess).

enderandpeter commented 11 years ago

I think I've always seen this tool as something to try quick snippets. I finally got Xdebug working with Eclipse and I see how that kind of thing is what you'd want to use to really manage projects, but this utility is great for working with PHP code directly in the browser.

A very out-of-the-way pop up sort of panel would be best, for sure. To start, I would go about something that lets you change just those two features, widgets and behaviours. By the way, although I'm from the US and I find that "u" all kinds of awkward (as does my browser's spelling correction :-) ), I thought it might be best to call them "behaviours" because that's what ACE calls them. Cookies is a good plan too.

enderandpeter commented 11 years ago

So I was first going to use cookies, but a few things changed my mind. I realized it would really be best to have a way to easily change the values of options and clear them if need be. The MDN provides a code snippet for doing this. But then I thought it would be good to have a more persistent type of data since the user is more than likely expecting the browser to remember their choice indefinitely. Web Storage is perfect for this and another code snippet on MDN provides portability for browsers that don’t support the Storage object. Cookies are used if window.localStorage is not available.

And so with this code, Web Storage is used by default and cookies otherwise. Although I suspect most users will be using a modern up to date browser that supports the Storage object, the compatibility provided by the free MDN snippet will help in the event the user is forced to use IE 8 or something so horrid.

I know it’s a lot of new code here, but I think this sort of addition will be very helpful in the long run. Looking at the diffs, you would think I changed absolutely everything, but you'll see that's not the case. I've been using Eclipse to work with Git lately, and I like to think it will provide more conveniences than complications. And I’m certainly not in love with the little UI I devised. There are plenty other approaches that are prettier/more out of the way, I’m sure. What are your thoughts?

stof commented 10 years ago

looks like you are changing line endings in the files

enderandpeter commented 10 years ago

Yeah, I think you might be right. I was really confused as to how editing a few lines in this file ended up resulting in so many changes. I have no idea how that happened because my editor here tells me that the line endings for the files are of the Dos/Windows variety and I've never changed that. But needless to say, I'll want to be a little more careful. I think I'll close this issue for now, but I'll probably reinstate in when I have a more simple and solid plan for toggling the ACE editor options.