-
Notifications
You must be signed in to change notification settings - Fork 114
Positron Notebooks: Inline Chat #9147
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
Conversation
E2E Tests 🚀 |
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 is awesome. I tested it out and it works fantastic. This makes the notebooks way more easy to use now that I've forgotten how to write python code the old-fashioned way!
// --- Start Positron --- | ||
// Find the Positron notebook instance for the given URI and containing the given editor. | ||
for (const notebookInstance of positronNotebookService.getInstances()) { | ||
if (isEqual(notebookInstance.uri, data.notebook)) { | ||
const candidate = `<positron-notebook>${notebookInstance.id}#${uri}`; | ||
if (!fallback) { | ||
fallback = candidate; | ||
} | ||
if (notebookInstance.cells.get().some(cell => cell.editor === editor)) { | ||
return candidate; | ||
} | ||
} | ||
} | ||
// --- End Positron --- |
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 wonder if we could put this type of thing into the instance itself. The logic would probably be the same just a different location.
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've moved a bunch of it to the service and instance
* TODO: Some notebook functionality (possibly debugging and outlines) require that the editor control | ||
* also have a `notebookEditor: INotebookEditor` property. We'll need to investigate what that unlocks, | ||
* whether to implement INotebookEditor, or find a different solution. | ||
*/ |
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.
Yeah this is something i've been mildly dreading implementing, glad we have a scaffold now!
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 spent a bunch of time looking into INotebookEditor
, and I'm not totally convinced we should implement it. Worth a discussion though
notebookInstance.selectionStateMachine.onNewState((state) => { | ||
if (state.type === SelectionState.EditingSelection) { | ||
this._activeCodeEditor = state.selectedCell.editor; | ||
} else if (state.type === SelectionState.NoSelection) { | ||
this._activeCodeEditor = undefined; | ||
} else { | ||
this._activeCodeEditor = state.selected[0]?.editor; | ||
} | ||
}) | ||
); |
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'm curious how you find the selection state machine. You're the first person outside of me to touch it and it is a bit... different than what vscode does.
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 selection state machine is :chef-kissed-fingers:
@@ -5,8 +5,9 @@ | |||
|
|||
import { VSBuffer } from '../../../../base/common/buffer.js'; | |||
import { Disposable } from '../../../../base/common/lifecycle.js'; | |||
import { ISettableObservable } from '../../../../base/common/observableInternal/base.js'; |
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.
Did this path change recently? I keep needing to make this change everywhere.
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 think so yea
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.
lovely!
a3b992e
to
b978511
Compare
ad1d8bb
to
d70dd4c
Compare
Addresses #8733.
Release Notes
New Features
Bug Fixes
QA Notes
@:notebooks @:assistant