-
Notifications
You must be signed in to change notification settings - Fork 209
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
Decouple srcmd from node libs and AI #140
Conversation
case 'markdown': | ||
return encodeMarkdownCell(cell); | ||
case 'placeholder': | ||
return encodePlacebolderCell(cell); |
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.
@nichochar there shouldn't be a coupling here to AI-specific things, so we can instead represent a placeholder cell as a cell and then render whatever the contents of the cell's text is.
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.
This also allows it to be used for other things in the future if needed.
// Make sure we copy cells so we don't mutate the session | ||
const cellsWithPlaceholder: CellWithPlaceholderType[] = [...session.cells]; | ||
|
||
cellsWithPlaceholder.splice(insertIdx, 0, { |
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.
Since CellWithPlaceholderType
is a superset of the CellType
, any existing calls or cell representations will succeed just fine, but here, in the one place we need to do something different, we can leverage this superset type and pass in the cell instead of relying on the encoder to know what to do for AI.
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.
LGTM
No description provided.