Skip to content

Commit 407cb5a

Browse files
authored
add workspaceTrust to nb "codeaction" infra (microsoft#180968)
1 parent ccd3092 commit 407cb5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { IStoredFileWorkingCopySaveParticipant, IWorkingCopyFileService } from '
2424
import { NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon';
2525
import { ICommandService } from 'vs/platform/commands/common/commands';
2626
import { ILogService } from 'vs/platform/log/common/log';
27+
import { IWorkspaceTrustManagementService } from 'vs/platform/workspace/common/workspaceTrust';
2728

2829
class FormatOnSaveParticipant implements IStoredFileWorkingCopySaveParticipant {
2930
constructor(
@@ -92,10 +93,16 @@ class CodeActionOnSaveParticipant implements IStoredFileWorkingCopySaveParticipa
9293
@IConfigurationService private readonly configurationService: IConfigurationService,
9394
@ICommandService private readonly commandService: ICommandService,
9495
@ILogService private readonly logService: ILogService,
96+
@IWorkspaceTrustManagementService private readonly workspaceTrustManagementService: IWorkspaceTrustManagementService,
9597
) {
9698
}
9799

98100
async participate(workingCopy: IStoredFileWorkingCopy<IStoredFileWorkingCopyModel>, context: { reason: SaveReason }, progress: IProgress<IProgressStep>, _token: CancellationToken): Promise<void> {
101+
const isTrusted = this.workspaceTrustManagementService.isWorkspaceTrusted();
102+
if (!isTrusted) {
103+
return;
104+
}
105+
99106
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
100107
return;
101108
}

0 commit comments

Comments
 (0)