This diff stores the currently collapsed / folded segments of YAML into local storage and restores them. Folding is saved per-pipeline, so collapsing the "solids" section of one pipeline in the config editor won't collapse it for other pipelines, but will collapse it in all the tabs of the current one. To make it fairly robust, the collapsed state refers to YAML paths (eg: "resources.config.db_info") not line numbers.
- Group Reviewers
Hey folks! re: complexity I sort of agree - I could move this to a separate file / plugin type of thing, but it's definitely less straightforward than I'd hoped. We could switch to just storing line numbers that are folded instead of YAML paths, but I think being able to move between tabs and have your folding preserved is kind of nice, and with just indexes we might apply the folding incorrectly and not know. (eg: "fold line 12" might result in something being incorrectly folded if the YAML had changed.)
Re: same pipeline in different repos, the two pipelines with the same name would share folding state. Not sure if that's worth fixing. I'd debating just making the whole app use a single folded state but I imagined folks would be interested in different chunks for different pipelines.
Re: multiple tabs, the last tab in which you folded/unfold part of the document "wins" and determines the folding state on reload / new page.
Anyway—just let me know about this one! I'm totally fine abandoning if we think the code surface area just isn't worth it.
Ahh I just left this for future-me. Basically if you edit this function you need to use a YAML document that is more than 40 lines long or it might appear to be working fine when it's really not.