companion icon indicating copy to clipboard operation
companion copied to clipboard

[WIP] Feat/issue 2581/list of variables are used

Open tgadler opened this issue 4 months ago • 2 comments

Fixes issue 2581 for CustomVariables. Left to do is to extend it to also include other Variables. Furthermore I would appreciate some feedback on the layout.

tgadler avatar Mar 04 '24 15:03 tgadler

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 04 '24 15:03 CLAassistant

I have some concerns about the approach here

  1. It is doing a poll for each custom-variable listed, so for each custom-variable it is searching through all controls for usages of that variable. This means the cost of showing this info will grow exponentially as configs get more complex. It would be better to do one search to find all the usages of all of the custom-variables, and save some cpu work (and try to get it back to being a linear growth).
  2. It would be nice if this could use a visitor pattern similar to https://github.com/bitfocus/companion/blob/main/companion/lib/Util/Visitors/ReferencesCollector.js . That will help ensure that as changes are made to the system, this will be updated to match how other areas of the system interpret things. For example, this will currently miss some references from internal actions, where the custom variable is stored as internal:custom_my_var instead of as $(internal:custom_my_var). Although even this will miss some references from internal actions where they store just the my_var part, so these visitors will need to be extended to support visiting those too. Additionally, some refactoring will need to be done to be able to use the visitor in a more general way, it is currently tied into the import/export logic a bit too much.

Julusian avatar Mar 11 '24 19:03 Julusian