Allow plugins to read uncommitted script.Source in Team Create

I have a few plugins that help programmers navigate their code, and they use the Script.Source property. I noticed a huge problem- they were displaying incorrect data. After some testing, I realized this is not a bug on my end but rather a undesirable side effect of how Team Create Drafts work.

When in Team Create, the .Source property does not update until you commit the draft.

There is currently no way for plugins to read uncommitted sources.

This means that plugins are seeing sources that differ from what is actually on the user’s screen.
Because of this, these plugins are rather worthless in Team Create because they display old data until the user commits their changes.


It would be nice if .Source behavior was changed to show the client’s version so I wouldn’t need to update my plugins, but adding a .UncommittedSource or something would be fine as well.

28 Likes

I’ve got a plugin that relies on script source too that would exhibit this same problem. It seems rather pointless to have the Source property not show the client’s version of the script. I can’t think of a use case where you’d want it to be the committed version of the script rather than the one you’re currently working on - that seems useless for almost any possible plugin.

8 Likes

Upon further investigation, I think this might even be a “bug” in that this behavior is unexpected and does not match the behavior of non-Collab Edit team create!

With Collaborative Editing disabled, the .Source value updates locally (your plugins see your changes) but does not replicate to the server and other clients (other clients’ plugins will not see your changes) until you close the script to commit.

With Collaborative Editing enabled, the .Source value does not update at all, for anyone, until you commit via the drafts window.

I would like Collaborative Editing to behave the same as non Collaborative Editing- locally updating the .Source and replicating that upon commit. It is intuitive and useful behavior.

2 Likes

This would definitely be great to have. I wanted to make a plugin that would enable coders to use code snippets. When you type a certain sequence of letters it would do it for you to save time on typing boilerplate code (seen in many VS Code extensions and IDEs).

Unfortunately with the current behavior (which is honestly a bit weird and unintuitive as boatbomber has also noted) this is not possible with collaborative editing enabled. This is especially an issue when working with a team of coders where having that versioning feature can be vital. So turning off collaborative editing is sadly not an option for me.

Edit: This also negatively effects another plugin I have. It’s basically a glorified loadstring for a selected script, but since it uses loadstring I need to get the source. And the source may not be updated with what the user would expect it to be due to the current behavior of collaborative editing. This scenario actually just happened to me.

1 Like