|
4 | 4 | 'use strict';
|
5 | 5 |
|
6 | 6 | import { inject, injectable } from 'inversify';
|
7 |
| -import { Uri } from 'vscode'; |
| 7 | +import { commands, Uri } from 'vscode'; |
8 | 8 | import { IExtensionSingleActivationService } from '../../activation/types';
|
9 | 9 | import { IApplicationShell, ICommandManager } from '../../common/application/types';
|
10 | 10 | import { ContextKey } from '../../common/contextKey';
|
@@ -57,18 +57,25 @@ export class TrustCommandHandler implements IExtensionSingleActivationService {
|
57 | 57 | DataScience.doNotTrustNotebook(),
|
58 | 58 | DataScience.trustAllNotebooks()
|
59 | 59 | );
|
60 |
| - if (selection !== DataScience.trustNotebook() || model.isTrusted) { |
61 |
| - return; |
| 60 | + |
| 61 | + switch (selection) { |
| 62 | + case DataScience.trustAllNotebooks(): |
| 63 | + commands.executeCommand('workbench.action.openSettings', 'python.dataScience.alwaysTrustNotebooks'); |
| 64 | + break; |
| 65 | + case DataScience.trustNotebook(): |
| 66 | + // Update model trust |
| 67 | + model.update({ |
| 68 | + source: 'user', |
| 69 | + kind: 'updateTrust', |
| 70 | + oldDirty: model.isDirty, |
| 71 | + newDirty: model.isDirty, |
| 72 | + isNotebookTrusted: true |
| 73 | + }); |
| 74 | + const contents = model.getContent(); |
| 75 | + await this.trustService.trustNotebook(model.file, contents); |
| 76 | + break; |
| 77 | + default: |
| 78 | + break; |
62 | 79 | }
|
63 |
| - // Update model trust |
64 |
| - model.update({ |
65 |
| - source: 'user', |
66 |
| - kind: 'updateTrust', |
67 |
| - oldDirty: model.isDirty, |
68 |
| - newDirty: model.isDirty, |
69 |
| - isNotebookTrusted: true |
70 |
| - }); |
71 |
| - const contents = model.getContent(); |
72 |
| - await this.trustService.trustNotebook(model.file, contents); |
73 | 80 | }
|
74 | 81 | }
|
0 commit comments