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
Cell statusbar API #121215
Cell statusbar API #121215
Conversation
src/vs/workbench/contrib/notebook/browser/contrib/statusBar/statusBarProviders.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/notebook/browser/contrib/statusBar/cellStatusBar.ts
Outdated
Show resolved
Hide resolved
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 added a simple notebook cell status bar items provider like
vscode.notebook.registerNotebookCellStatusBarItemProvider({
viewType: 'mimetype-test'
}, {
provideCellStatusBarItems: (cell, token) => {
return [{
alignment: vscode.NotebookCellStatusBarAlignment.Left,
command: undefined,
text: `${cell.outputs.length} outputs`,
tooltip: `${cell.outputs.length} outputs`
}];
}
})
and after scrolling up and down a couple of times. I'm seeing duplicated status bar items.
src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts
Outdated
Show resolved
Hide resolved
@@ -99,7 +99,11 @@ export abstract class BaseCellViewModel extends Disposable { | |||
id?: string; | |||
options: model.IModelDeltaDecoration; | |||
}>(); | |||
private _lastDecorationId: number = 0; | |||
private _lastItemId: number = 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.
this change is not intentional, right? it's still a decoration id.
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 see this one is being used for cell status bar. I wonder if we should keep decoration and status bar logic separate.
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 figured I'd reuse it, but it doesn't matter, I can keep it separate
src/vs/workbench/contrib/notebook/browser/contrib/statusBar/cellStatusBar.ts
Outdated
Show resolved
Hide resolved
It would be great if we debounce it a bit as while scrolling / cell resizing (as they have dynamic height), a cell can be created, disposed and then re-created within a short period. |
What do you mean? The downside of delaying it is that you will see cells without status bar items briefly, then the status bar items will blink into existence, and I found it annoying when testing. |
52b54a8
to
7d08e83
Compare
Fixed the issue with dupe items showing up, I thought a cancel token would be canceled on dispose by default. |
src/vs/vscode.proposed.d.ts
Outdated
readonly alignment: NotebookCellStatusBarAlignment; | ||
readonly command: string | Command | undefined; |
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.
mix of ?
and | undefined
src/vs/workbench/contrib/notebook/browser/notebookCellStatusBarServiceImpl.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/notebook/browser/notebookCellStatusBarServiceImpl.ts
Outdated
Show resolved
Hide resolved
const unregisterThing = (handle: number) => { | ||
const entry = this._notebookCellStatusBarRegistrations.get(handle); | ||
if (entry) { | ||
this._notebookCellStatusBarRegistrations.delete(handle); |
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.
missing dispose?
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.
Only skimmed over the view-parts but what I have seens looks good. Thanks
Services are always better than singletons, tho that's all they are: better singletons |
fc4d3e4
to
5a9e4c5
Compare
Fix #105809
Much better implementation of the cell statusbar API.
Open questions/todos
statusMessage
metadata