-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core 617 orphan collection #215
Conversation
Mostly to get the tests to run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first time looking at this codebase, but I'll give it a shot
} | ||
|
||
async renameNode(node: BookOrTocNode) { | ||
// TODO Implement the rename functionality using inline editing (wait for the API to be available) | ||
// https://github.com/microsoft/vscode/issues/97190 | ||
// https://stackoverflow.com/questions/70594061/change-an-existing-label-name-in-tree-view-vscode-extension | ||
let oldTitle: string | undefined = '' | ||
if (node.type !== BookRootNode.Singleton && 'title' in node.value) { | ||
/* istanbul ignore next */ | ||
if (isClientTocNode(node)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming seems a bit confusing because isClientTocNode
and ClientOnlyTocKinds
seem to mean opposite things. Maybe isServerTocNode
? Or isClientOnlyTocNode
and invert the logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about isTocLeafNode
? The function is for checking if the node can be moved/renamed/deleted (leaf nodes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that this was a little confusing. My goal was to illustrate that the orphan collection is something that is specific to the tree view. I did not want to entangle it with the ClientTocNode
. I replaced the ClientOnlyTocKinds
enum with an OrphanCollectionKind
constant in hopes of making the difference more clear.
dragging.type !== BookRootNode.Singleton | ||
) { | ||
if (target.type === ClientOnlyTocKinds.OrphanCollection) { | ||
await this.removeNode(dragging) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So they never get put in the OrphanCollection, they just go under it somehow? How does the OrphanCollection actually gets elements, like in your screenshot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Orphans are sent by the language server here after the remove event is handled.
- This updates the client's toc tree with books and orphans.
- Orphans are added to the OrphanCollection here on update.
- The OrphanCollection is added as the last top level tree item here and rendered here and then the OrphanCollection's children are eventually returned here.
So the language server is telling the client which modules are orphaned and the client renders them under the orphan collection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, here's a video instead of a screenshot.
Screen.Recording.2025-01-14.at.5.06.57.PM.mov
Use OrphanCollectionKind instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarifications, and the change looks good to me.
https://openstax.atlassian.net/browse/CORE-617
I also fixed a problem where ancillary tree items were being rendered with the same icon as a subbook despite being closer to pages.