rename onDidChangeNotebookAssociation to onDidChangeSelectedNotebooks
This commit is contained in:
parent
41f117753e
commit
e43c3957f6
5 changed files with 16 additions and 15 deletions
6
.vscode/searches/api-todos.code-search
vendored
6
.vscode/searches/api-todos.code-search
vendored
|
@ -2,13 +2,9 @@
|
|||
# Including: */vscode.d.ts
|
||||
# ContextLines: 1
|
||||
|
||||
2 results - 1 file
|
||||
1 result - 1 file
|
||||
|
||||
src/vs/vscode.d.ts:
|
||||
11804 */
|
||||
11805: //todo@API inline?
|
||||
11806 export interface NotebookExecuteHandler {
|
||||
|
||||
11935 */
|
||||
11936: //todo@api selected vs associated, jsdoc
|
||||
11937 readonly onDidChangeNotebookAssociation: Event<{ notebook: NotebookDocument, selected: boolean }>;
|
||||
|
|
|
@ -40,7 +40,7 @@ class Kernel {
|
|||
this.controller.executeHandler = this._execute.bind(this);
|
||||
this.controller.supportsExecutionOrder = true;
|
||||
this.controller.supportedLanguages = ['typescript', 'javascript'];
|
||||
this.controller.onDidChangeNotebookAssociation(e => {
|
||||
this.controller.onDidChangeSelectedNotebooks(e => {
|
||||
if (e.selected) {
|
||||
this.associatedNotebooks.add(e.notebook.uri.toString());
|
||||
} else {
|
||||
|
|
17
src/vs/vscode.d.ts
vendored
17
src/vs/vscode.d.ts
vendored
|
@ -11834,7 +11834,8 @@ declare module 'vscode' {
|
|||
* There can be multiple controllers and the editor will let users choose which controller to use for a certain notebook. The
|
||||
* {@link NotebookController.notebookType `notebookType`}-property defines for what kind of notebooks a controller is for and
|
||||
* the {@link NotebookController.updateNotebookAffinity `updateNotebookAffinity`}-function allows controllers to set a preference
|
||||
* for specific notebook documents.
|
||||
* for specific notebook documents. When a controller has been selected its
|
||||
* {@link NotebookController.onDidChangeSelectedNotebooks onDidChangeSelectedNotebooks}-event fires.
|
||||
*
|
||||
* When a cell is being run the editor will invoke the {@link NotebookController.executeHandler `executeHandler`} and a controller
|
||||
* is expected to create and finalize a {@link NotebookCellExecution notebook cell execution}. However, controllers are also free
|
||||
|
@ -11929,12 +11930,16 @@ declare module 'vscode' {
|
|||
interruptHandler?: (notebook: NotebookDocument) => void | Thenable<void>;
|
||||
|
||||
/**
|
||||
* An event that fires whenever a controller has been selected for a notebook document. Selecting a controller
|
||||
* for a notebook is a user gesture and happens either explicitly or implicitly when interacting while a
|
||||
* controller was suggested.
|
||||
* An event that fires whenever a controller has been selected or un-selected for a notebook document.
|
||||
*
|
||||
* There can be multiple controllers for a notebook and in that case a controllers needs to be _selected_. This is a user gesture
|
||||
* and happens either explicitly or implicitly when interacting with a notebook for which a controller was _suggested_. When possible,
|
||||
* the editor _suggests_ a controller that is most likely to be _selected_.
|
||||
*
|
||||
* _Note_ that controller selection is persisted (by the controllers {@link NotebookController.id id}) and restored as soon as a
|
||||
* controller is re-created or as a notebook is {@link workspace.onDidOpenNotebookDocument opened}.
|
||||
*/
|
||||
//todo@api selected vs associated, jsdoc
|
||||
readonly onDidChangeNotebookAssociation: Event<{ notebook: NotebookDocument, selected: boolean }>;
|
||||
readonly onDidChangeSelectedNotebooks: Event<{ notebook: NotebookDocument, selected: boolean }>;
|
||||
|
||||
/**
|
||||
* A controller can set affinities for specific notebook documents. This allows a controller
|
||||
|
|
|
@ -112,7 +112,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
|
|||
const controller: vscode.NotebookController = {
|
||||
get id() { return id; },
|
||||
get notebookType() { return data.notebookType; },
|
||||
onDidChangeNotebookAssociation: onDidChangeSelection.event,
|
||||
onDidChangeSelectedNotebooks: onDidChangeSelection.event,
|
||||
get label() {
|
||||
return data.label;
|
||||
},
|
||||
|
|
|
@ -102,7 +102,7 @@ suite('NotebookKernelService', () => {
|
|||
assert.ok(info.all[1] === kernel);
|
||||
});
|
||||
|
||||
test('onDidChangeNotebookAssociation not fired on initial notebook open #121904', function () {
|
||||
test('onDidChangeSelectedNotebooks not fired on initial notebook open #121904', function () {
|
||||
|
||||
const uri = URI.parse('foo:///one');
|
||||
const jupyter = { uri, viewType: 'jupyter' };
|
||||
|
@ -123,7 +123,7 @@ suite('NotebookKernelService', () => {
|
|||
assert.strictEqual(info.selected === jupyterKernel, true);
|
||||
});
|
||||
|
||||
test('onDidChangeNotebookAssociation not fired on initial notebook open #121904, p2', async function () {
|
||||
test('onDidChangeSelectedNotebooks not fired on initial notebook open #121904, p2', async function () {
|
||||
|
||||
const uri = URI.parse('foo:///one');
|
||||
const jupyter = { uri, viewType: 'jupyter' };
|
||||
|
|
Loading…
Reference in a new issue