Allow workspace item objects to be passed to Workspace.open#14125
Allow workspace item objects to be passed to Workspace.open#14125nathansobo merged 5 commits intomasterfrom
Conversation
|
I really like getting rid of the indirection requirement! My only question is how |
|
What am I missing about |
|
Sorry you're right. Not sure what I was thinking. 🤔 |
|
Adjusted this a bit... Passing in the I also added support for passing items to |
|
Oh now I know what I was thinking! |
|
@matthewwithanm Ah, because there could be multiple items with the same URI. I feel like it could be okay to change the definition of "match" when passing a single item to just be instance equality, as I did in my latest commit. Whatayathink? |
Also, ensure that passing an item that is not yet present in the workspace does not interfere with resolving the location where we want to place the item.
11afe18 to
56cefbb
Compare
|
it is a bit of a bummer that you won't be able to get the existing behavior without adding an opener. also, i feel like this might introduce some weirdness. like, package authors will forget that the item can be cloned (via splitting). the user will split it and there'll be two in the workspace. if they're just storing the item instance, and calling |
Signed-off-by: Nathan Sobo <nathan@github.com>
2167f84 to
a8a5f83
Compare
Currently, in order to add a given item to the workspace, there is some indirection involved. You must add an opener function that returns that item based on some URI, and then to call
Workspace.openwith that URI:The URIs are involved because the workspace uses them as a serializable identifier for the items. But often the indirection of the opener concept is unnecessary. This PR adds the ability to add a given item directly to the workspace:
The item can still have a
getURImethod, so the workspace will still be able to identifiy it for purposes like remembering which Dock you last placed it in./cc @nathansobo @matthewwithanm