I just want to leave this here for those who understand
And yes, I will move these by copying the JSON and editing it in NPP, because I value my sanity.
I really hope this is fixed one day though so I don't have to export it out
Edit:
Actually, even editing it in NPP is hard... I think I'll write a script to process it
Maybe @PGriffith can add a graphical interface to do it in Kindling haha
(I'm only joking, mostly)
9 Likes
It may not be a good solution, but I'm curious how well my recent adventures editing views in YAML would work for this...
I'm finding a lot of things are much easier and more manageable in the YAML version: weirdly escaped expressions and scripts are directly editable; nesting levels are easier to manage (just add/remove indent to match); and the indent also makes it easier to tell which properties are on which component.
I suspect YAML wouldn't fully resolve your complications, but I think it would help.
It's dirt-simple, but here: Minimal JSON-to-YAML converter with smarter multi-line handling · GitHub
Only pip requirement is pip install ruamel.yaml
EDIT: Just tried moving a bunch of bound array items in YAML. It's still a lot of indexing to be manually updated, but it's easier on my eyes to spot them.
I often end up using the Vim plugin in VS Code with macros to do this kind of repetitive editing work. Although I haven't looked into the specific format for these arrays, it could be a good middle ground between manual editing and scripting. Of course if you're going to do it a lot, please write a script (and please share it with us
)
1 Like
Yes, there have been many times where I haven wanted to do the same thing. Like you mentioned, one thing would be to copy the object and paste it in a simple editor (like NPP or even Excel can work). Then you can make your change, copy it from the editor, and paste it back into Ignition. Of course it can be hard if your objects are large.
Beyond that, unfortunately, I don't have any great workarounds as of yet. Maybe add as a feature request? Or maybe request or make an Ignition Exchange resource?
I'm actually interested if this is something that can be accomplished with a VS Code extension? I'm sure it is...
This one looks like it would be a good candidate to modify?? @kgamble
(I've had a look and my 15min tells me I'm currently in over my head)
1 Like
So to clarify, the goal is to be able to insert/move/delete objects in an array while persisting binding locations?
1 Like
Yep, that's the gist! Just to clarify, delete
would remove the binding. This would be unbelievably useful to have (although it shouldn't be necessary imnsho)
Hmm thinking about it, here's a few thoughts:
- Would it make sense to use a JSON editor for this? Or essentially just create a version of the project explorer that shows the components properties underneath it similar to the json explorer?
- Would you want to essentially "click and drag" to move around the props if they are in an array? Not sure where else this would be useful. Maybe a "shift + click and drag" edits it the way it currently works?
- Almost feels easier to build something based off something like this tree viewer
EDIT: After looking around for more than 10 seconds I realized that VS Code currently creates an outline
of the json doc, essentially this would be what's needed?
Something that would make this 100x easier is if any of the JSON schemas are publicly available (especially for perspective views). Would make it much easier to create the DocumentSymbol provider needed to do a lot of these things. I mean, I could obviously make the schema by hand... but it will evolve and change and that's a painful task *cough @PGriffith
2 Likes
That looks a bit nicer 
I knew about this one already, and it's super helpful, but I didn't think you'd be able to hook into this and make it do your own thing like editing the propConfig, or can you?
1 Like
You can! By creating a DocumentSymbolProvider I could essentially create that exact outline, however one of the requirements would be to have the JSON schema defined
Once again, I could do so by hand, but what an obnoxious task that would be. As opposed to it potentially being made public as a part of the sdk *cough @PerryAJ (i don’t know who to keep “coughing” into this thread for that really specific request lol)
EDIT: Actually, after a little digging around I found that the schemas are located inside the jar file for perspective.common
, so I could technically get what I am looking for there... Maybe there is an answer here. Still feels like a relatively hacky one
2 Likes