Hirse / brackets-outline-list

Extension for Brackets and Phoenix to display a list of the functions or definitions in the currently opened document.
MIT License
79 stars 30 forks source link

Add the ability to collapse nodes in the outline for XML. #59

Open burtnoir opened 8 years ago

burtnoir commented 8 years ago

This change allows the user to click on an icon to the left of the node to collapse the children of that node - much like in the file tree. It allows you to close an inner node then open and close an outer one without affecting the state of the inner set. The one thing I wasn't sure about was my change in _getIndentationLevel - it's a bit severe but I was having problems when browsing a document with different indentation than my editor settings so I decided to simplify things and rely on the actual indentation in the document.

Hirse commented 8 years ago

Thanks for your PR. I really like this idea. :smile:

Could you give some more explanation as to why you changed the _getIndentationLevel function because based on some quick tests it works fine for me even with mixed indentation styles?

burtnoir commented 8 years ago

Thanks for looking at this one so quickly. Sorry for all the indentation issues, I was editing and testing out different indentations at the same time which wasn't the best idea :) I'll sort that stuff and the inline function out later this evening.

I was looking at a sample XML that had indentation of three spaces and then I had Brackets set to a tab size of 4 (from memory) and it resulted in no indentation for the first indent level. No indentation means no icon and so you can't collapse. Here is the file: sample.txt

I will give this one some more thought to see if I can come up with something better. In general I guess it needs to handle edge cases where the editor indent size is greater than the document's indent.

burtnoir commented 8 years ago

I think I dealt with the indentation and the inline. It's late here now so I'll look at the _getIndentationLevel change tomorrow.

Hirse commented 8 years ago

Thanks for your effort.

Generally, I don't think this extension has to handle indentation problems. We should be safe to assume a valid document and an indentation that equals the Brackets settings.

And btw, to detect and automatically set the indentation I have another extension: https://github.com/Hirse/brackets-detect-indentation

burtnoir commented 8 years ago

That sounds fair - I'll revert the indentation stuff when I get home. And I'll be sure to check out the other extension :)