@codingame/monaco-vscode-api 32.0.0 → 32.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/services.js +3 -3
- package/vscode/src/vs/base/common/paging.js +66 -2
- package/vscode/src/vs/platform/extensionManagement/common/unsupportedExtensionsMigration.d.ts +14 -0
- package/vscode/src/vs/platform/extensionManagement/common/unsupportedExtensionsMigration.js +145 -0
- package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.d.ts +19 -0
- package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.js +25 -0
- package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.service.d.ts +1 -1
- package/vscode/src/vs/platform/product/common/product.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatScreenshotContext.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.js +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +43 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/common/actions/chatContextKeys.js +86 -86
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatModes.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/editing/chatEditingService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +23 -23
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModel.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatToolInvocation.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookSchema.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookTypes.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptFileAttributes.js +79 -79
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/promptTypes.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/askQuestionsTool.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +22 -22
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsService.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/widget/input/modelPickerWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +11 -11
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/dictation/editorDictation.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorAccessibilityHelp.js +5 -5
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +10 -10
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.js +6 -6
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMinimap.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleRenderControlCharacter.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleRenderWhitespace.js +12 -12
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +5 -5
- package/vscode/src/vs/workbench/contrib/codeEditor/common/languageConfigurationExtensionPoint.js +65 -65
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +2 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsAccessibility.js +12 -12
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +9 -9
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +14 -14
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +16 -16
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/common/commentContextKeys.js +12 -12
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorDiffInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInput.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +29 -29
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +14 -14
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +75 -75
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +6 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/debugColors.js +12 -12
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +38 -38
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debugIcons.js +57 -57
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +4 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +18 -18
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +5 -5
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +9 -9
- package/vscode/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debug.js +65 -65
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +6 -6
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/dropOrPasteInto/browser/commands.js +2 -2
- package/vscode/src/vs/workbench/contrib/dropOrPasteInto/browser/configurationSchema.js +4 -4
- package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.d.ts +76 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.js +470 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.js +83 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.js +66 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.d.ts +83 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +1353 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant.js +49 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionFeaturesTab.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionFeaturesTab.js +728 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.d.ts +63 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js +522 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendations.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendations.js +18 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.js +263 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +2227 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.js +179 -179
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.js +40 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.js +77 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsDependencyChecker.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsDependencyChecker.js +93 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsIcons.js +25 -25
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.js +100 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewer.js +7 -7
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.d.ts +151 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +1031 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.d.ts +235 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.js +1600 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.js +30 -30
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.d.ts +314 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +3449 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.js +368 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/keymapRecommendations.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/keymapRecommendations.js +30 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/languageRecommendations.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/languageRecommendations.js +30 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionEditor.css +910 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionManagement.css +12 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionsViewlet.css +229 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/loading-dark.svg +31 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/loading-hc.svg +31 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/loading.svg +31 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/runtimeExtensionsEditor.css +86 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.js +38 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/unsupportedExtensionsMigrationContribution.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/unsupportedExtensionsMigrationContribution.js +41 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.js +38 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.js +179 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionQuery.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionQuery.js +90 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/common/extensions.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsFileTemplate.js +5 -5
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +50 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +3 -3
- package/vscode/src/vs/workbench/contrib/extensions/common/runtimeExtensionsInput.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/runtimeExtensionsInput.js +47 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/searchExtensionsTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/configuration.js +4 -4
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpenerService.js +3 -3
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +8 -8
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +18 -18
- package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +14 -14
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +39 -39
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.js +84 -84
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands._save.js +4 -4
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +2 -2
- package/vscode/src/vs/workbench/contrib/files/browser/fileConstants.js +6 -6
- package/vscode/src/vs/workbench/contrib/files/browser/fileImportExport.js +28 -28
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._configuration.js +50 -50
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._editorPane.js +2 -2
- package/vscode/src/vs/workbench/contrib/files/browser/views/emptyView.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerDecorationsProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerView.js +7 -7
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerViewer.js +17 -17
- package/vscode/src/vs/workbench/contrib/files/browser/views/openEditorsView.js +7 -7
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +4 -4
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/common/files.js +16 -16
- package/vscode/src/vs/workbench/contrib/folding/browser/folding.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +20 -20
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsNone.js +4 -4
- package/vscode/src/vs/workbench/contrib/format/browser/formatModified.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlayHints/browser/inlayHintsAccessibilty.js +4 -4
- package/vscode/src/vs/workbench/contrib/list/browser/listResizeColumnAction.js +2 -2
- package/vscode/src/vs/workbench/contrib/list/browser/tableColumnResizeQuickPick.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommandsAddConfiguration.js +66 -66
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +40 -40
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfiguration.js +42 -42
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +16 -16
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTypes.js +4 -4
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +4 -4
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +23 -23
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +8 -8
- package/vscode/src/vs/workbench/contrib/meteredConnection/browser/meteredConnection.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/meteredConnection/browser/meteredConnectionStatus.js +4 -4
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/icons.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.js +3 -3
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +17 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +29 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingWidgets.js +3 -3
- package/vscode/src/vs/workbench/contrib/preferences/browser/preferencesIcons.js +13 -13
- package/vscode/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.js +10 -10
- package/vscode/src/vs/workbench/contrib/preferences/browser/settingsLayout.js +60 -60
- package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +3 -3
- package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +21 -21
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +15 -15
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +17 -17
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +59 -59
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistory.js +11 -11
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryChatContext.js +6 -6
- package/vscode/src/vs/workbench/contrib/scm/common/quickDiff.js +14 -14
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +9 -9
- package/vscode/src/vs/workbench/contrib/search/browser/patternInputWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsBase.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +9 -9
- package/vscode/src/vs/workbench/contrib/search/browser/searchChatContext.js +5 -5
- package/vscode/src/vs/workbench/contrib/search/browser/searchFindInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchIcons.js +20 -20
- package/vscode/src/vs/workbench/contrib/search/browser/searchMessage.js +2 -2
- package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +14 -14
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +55 -55
- package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +11 -11
- package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +2 -2
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +4 -4
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +5 -5
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.js +3 -3
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsFile.js +3 -3
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsService.js +9 -9
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +29 -29
- package/vscode/src/vs/workbench/contrib/tasks/common/constants.js +1 -1
- package/vscode/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.js +6 -6
- package/vscode/src/vs/workbench/contrib/tasks/common/taskService.js +6 -6
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcons.js +13 -13
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalMenus.js +40 -40
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +15 -15
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +10 -10
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +23 -23
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalContextKey.js +17 -17
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStrings.js +26 -26
- package/vscode/src/vs/workbench/contrib/terminalContrib/accessibility/common/terminalAccessibilityConfiguration.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/autoReplies/common/terminalAutoRepliesConfiguration.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +9 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.js +72 -72
- package/vscode/src/vs/workbench/contrib/terminalContrib/commandGuide/common/terminalCommandGuideConfiguration.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/history/common/terminal.history.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/inlineHint/common/terminalInitialHintConfiguration.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/notification/common/terminalNotificationConfiguration.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/common/terminalStickyScrollConfiguration.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/suggest/common/terminalSuggestConfiguration.js +30 -30
- package/vscode/src/vs/workbench/contrib/terminalContrib/typeAhead/common/terminalTypeAheadConfiguration.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/zoom/common/terminal.zoom.js +2 -2
- package/vscode/src/vs/workbench/contrib/testing/common/constants.js +11 -11
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +2 -2
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +3 -3
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomains.js +6 -6
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindAccessibilityHelp.js +30 -30
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/welcomeOnboarding/common/onboardingTypes.js +14 -14
- package/vscode/src/vs/workbench/contrib/workspace/common/workspace.js +2 -2
- package/vscode/src/vs/workbench/services/accounts/browser/defaultAccount.d.ts +35 -0
- package/vscode/src/vs/workbench/services/accounts/browser/defaultAccount.js +876 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +11 -11
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +5 -5
- package/vscode/src/vs/workbench/services/chat/common/chatEntitlementService.js +16 -16
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +16 -16
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +1 -1
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +16 -16
- package/vscode/src/vs/workbench/services/editor/common/editorResolverService.js +2 -2
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionsIcons.js +3 -3
- package/vscode/src/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +6 -6
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +10 -10
- package/vscode/src/vs/workbench/services/extensions/common/extensionsRegistry.js +88 -88
- package/vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +5 -5
- package/vscode/src/vs/workbench/services/language/common/languageService.js +24 -24
- package/vscode/src/vs/workbench/services/log/common/logConstants.js +1 -1
- package/vscode/src/vs/workbench/services/policies/common/accountPolicyService.js +1 -1
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorInput.js +2 -2
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.js +7 -7
- package/vscode/src/vs/workbench/services/preferences/common/preferencesEditorInput.js +4 -4
- package/vscode/src/vs/workbench/services/preferences/common/preferencesModels.js +2 -2
- package/vscode/src/vs/workbench/services/preferences/common/preferencesValidation.js +30 -30
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +8 -8
- package/vscode/src/vs/workbench/services/remote/common/tunnelModel.js +6 -6
- package/vscode/src/vs/workbench/services/search/common/queryBuilder.js +1 -1
- package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +9 -9
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModel.js +3 -3
- package/vscode/src/vs/workbench/services/themes/common/colorExtensionPoint.js +18 -18
- package/vscode/src/vs/workbench/services/themes/common/colorThemeData.js +8 -8
- package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +13 -13
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +24 -24
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +3 -3
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +1 -1
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +13 -13
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +16 -16
|
@@ -0,0 +1,3449 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
3
|
+
import { mainWindow } from '../../../../base/browser/window.js';
|
|
4
|
+
import { index } from '../../../../base/common/arrays.js';
|
|
5
|
+
import { ThrottledDelayer, Promises, createCancelablePromise } from '../../../../base/common/async.js';
|
|
6
|
+
import { getErrorMessage, CancellationError, isCancellationError } from '../../../../base/common/errors.js';
|
|
7
|
+
import { CancellationToken } from '../../../../base/common/cancellation.js';
|
|
8
|
+
import { fromNow } from '../../../../base/common/date.js';
|
|
9
|
+
import { Emitter, Event } from '../../../../base/common/event.js';
|
|
10
|
+
import { MarkdownString } from '../../../../base/common/htmlContent.js';
|
|
11
|
+
import { Disposable, MutableDisposable, toDisposable } from '../../../../base/common/lifecycle.js';
|
|
12
|
+
import { FileAccess } from '../../../../base/common/network.js';
|
|
13
|
+
import { singlePagePager } from '../../../../base/common/paging.js';
|
|
14
|
+
import { isWeb, language } from '../../../../base/common/platform.js';
|
|
15
|
+
import { joinPath } from '../../../../base/common/resources.js';
|
|
16
|
+
import { semverExports } from '../../../../../../../_virtual/semver.js';
|
|
17
|
+
import { isBoolean, isUndefined, isDefined, isString } from '../../../../base/common/types.js';
|
|
18
|
+
import { URI } from '../../../../base/common/uri.js';
|
|
19
|
+
import { ILanguageService } from '../../../../editor/common/languages/language.service.js';
|
|
20
|
+
import { localize } from '../../../../nls.js';
|
|
21
|
+
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.service.js';
|
|
22
|
+
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.service.js';
|
|
23
|
+
import { IDialogService, IFileDialogService } from '../../../../platform/dialogs/common/dialogs.service.js';
|
|
24
|
+
import { getExtensionGalleryManifestResourceUri, ExtensionGalleryResourceType } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.js';
|
|
25
|
+
import { IExtensionGalleryManifestService } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.service.js';
|
|
26
|
+
import { AllowedExtensionsConfigKey, WEB_EXTENSION_TAG, EXTENSION_INSTALL_SKIP_PUBLISHER_TRUST_CONTEXT, InstallOperation, TargetPlatformToString, EXTENSION_IDENTIFIER_REGEX, shouldRequireRepositorySignatureFor, ExtensionManagementError, ExtensionManagementErrorCode, isTargetPlatformCompatible } from '../../../../platform/extensionManagement/common/extensionManagement.js';
|
|
27
|
+
import { IExtensionGalleryService, IAllowedExtensionsService } from '../../../../platform/extensionManagement/common/extensionManagement.service.js';
|
|
28
|
+
import { getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData, findMatchingMaliciousEntry, areSameExtensions, groupByExtension, getGalleryExtensionId } from '../../../../platform/extensionManagement/common/extensionManagementUtil.js';
|
|
29
|
+
import { ExtensionType, TargetPlatform, ExtensionIdentifier, isApplicationScopedExtension } from '../../../../platform/extensions/common/extensions.js';
|
|
30
|
+
import { isEngineValid, areApiProposalsCompatible } from '../../../../platform/extensions/common/extensionValidator.js';
|
|
31
|
+
import { IFileService } from '../../../../platform/files/common/files.service.js';
|
|
32
|
+
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
33
|
+
import { getLocale } from '../../../../platform/languagePacks/common/languagePacks.js';
|
|
34
|
+
import { ILogService } from '../../../../platform/log/common/log.service.js';
|
|
35
|
+
import { NotificationPriority } from '../../../../platform/notification/common/notification.js';
|
|
36
|
+
import { INotificationService } from '../../../../platform/notification/common/notification.service.js';
|
|
37
|
+
import { IProductService } from '../../../../platform/product/common/productService.service.js';
|
|
38
|
+
import { ProgressLocation } from '../../../../platform/progress/common/progress.js';
|
|
39
|
+
import { IProgressService } from '../../../../platform/progress/common/progress.service.js';
|
|
40
|
+
import { IQuickInputService } from '../../../../platform/quickinput/common/quickInput.service.js';
|
|
41
|
+
import { StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
|
|
42
|
+
import { IStorageService } from '../../../../platform/storage/common/storage.service.js';
|
|
43
|
+
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.service.js';
|
|
44
|
+
import { TelemetryTrustedValue } from '../../../../platform/telemetry/common/telemetryUtils.js';
|
|
45
|
+
import { StateType } from '../../../../platform/update/common/update.js';
|
|
46
|
+
import { IUpdateService } from '../../../../platform/update/common/update.service.js';
|
|
47
|
+
import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.service.js';
|
|
48
|
+
import { IURLService } from '../../../../platform/url/common/url.service.js';
|
|
49
|
+
import { IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.service.js';
|
|
50
|
+
import { IIgnoredExtensionsManagementService } from '../../../../platform/userDataSync/common/ignoredExtensions.service.js';
|
|
51
|
+
import { SyncResource } from '../../../../platform/userDataSync/common/userDataSync.js';
|
|
52
|
+
import { IUserDataAutoSyncService, IUserDataSyncEnablementService } from '../../../../platform/userDataSync/common/userDataSync.service.js';
|
|
53
|
+
import { IWorkspaceContextService } from '../../../../platform/workspace/common/workspace.service.js';
|
|
54
|
+
import { SIDE_GROUP, MODAL_GROUP, ACTIVE_GROUP } from '../../../services/editor/common/editorService.js';
|
|
55
|
+
import { IEditorService } from '../../../services/editor/common/editorService.service.js';
|
|
56
|
+
import { EnablementState } from '../../../services/extensionManagement/common/extensionManagement.js';
|
|
57
|
+
import { IWorkbenchExtensionEnablementService, IWorkbenchExtensionManagementService, IExtensionManagementServerService } from '../../../services/extensionManagement/common/extensionManagement.service.js';
|
|
58
|
+
import { IExtensionManifestPropertiesService } from '../../../services/extensions/common/extensionManifestPropertiesService.service.js';
|
|
59
|
+
import { toExtension, toExtensionDescription } from '../../../services/extensions/common/extensions.js';
|
|
60
|
+
import { IExtensionService } from '../../../services/extensions/common/extensions.service.js';
|
|
61
|
+
import { IHostService } from '../../../services/host/browser/host.service.js';
|
|
62
|
+
import { LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js';
|
|
63
|
+
import { ILifecycleService } from '../../../services/lifecycle/common/lifecycle.service.js';
|
|
64
|
+
import { ILocaleService } from '../../../services/localization/common/locale.service.js';
|
|
65
|
+
import { IUserDataProfileService } from '../../../services/userDataProfile/common/userDataProfile.service.js';
|
|
66
|
+
import { IViewsService } from '../../../services/views/common/viewsService.service.js';
|
|
67
|
+
import { ShowCurrentReleaseNotesActionId } from '../../update/common/update.js';
|
|
68
|
+
import { ExtensionState, HasOutdatedExtensionsContext, AutoUpdateConfigurationKey, AutoCheckUpdatesConfigurationKey, AutoRestartConfigurationKey, ExtensionRuntimeActionType, VIEWLET_ID } from '../common/extensions.js';
|
|
69
|
+
import { ExtensionsInput } from '../common/extensionsInput.js';
|
|
70
|
+
import { IMeteredConnectionService } from '../../../../platform/meteredConnection/common/meteredConnection.service.js';
|
|
71
|
+
import Severity$1 from '../../../../base/common/severity.js';
|
|
72
|
+
|
|
73
|
+
var ExtensionsWorkbenchService_1;
|
|
74
|
+
let Extension = class Extension {
|
|
75
|
+
constructor(
|
|
76
|
+
stateProvider,
|
|
77
|
+
runtimeStateProvider,
|
|
78
|
+
server,
|
|
79
|
+
local,
|
|
80
|
+
_gallery,
|
|
81
|
+
resourceExtensionInfo,
|
|
82
|
+
galleryService,
|
|
83
|
+
telemetryService,
|
|
84
|
+
logService,
|
|
85
|
+
fileService,
|
|
86
|
+
productService
|
|
87
|
+
) {
|
|
88
|
+
this.stateProvider = stateProvider;
|
|
89
|
+
this.runtimeStateProvider = runtimeStateProvider;
|
|
90
|
+
this.server = server;
|
|
91
|
+
this.local = local;
|
|
92
|
+
this._gallery = _gallery;
|
|
93
|
+
this.resourceExtensionInfo = resourceExtensionInfo;
|
|
94
|
+
this.galleryService = galleryService;
|
|
95
|
+
this.telemetryService = telemetryService;
|
|
96
|
+
this.logService = logService;
|
|
97
|
+
this.fileService = fileService;
|
|
98
|
+
this.productService = productService;
|
|
99
|
+
this.enablementState = EnablementState.EnabledGlobally;
|
|
100
|
+
this.galleryResourcesCache = ( new Map());
|
|
101
|
+
}
|
|
102
|
+
get resourceExtension() {
|
|
103
|
+
if (this.resourceExtensionInfo) {
|
|
104
|
+
return this.resourceExtensionInfo.resourceExtension;
|
|
105
|
+
}
|
|
106
|
+
if (this.local?.isWorkspaceScoped) {
|
|
107
|
+
return {
|
|
108
|
+
type: "resource",
|
|
109
|
+
identifier: this.local.identifier,
|
|
110
|
+
location: this.local.location,
|
|
111
|
+
manifest: this.local.manifest,
|
|
112
|
+
changelogUri: this.local.changelogUrl,
|
|
113
|
+
readmeUri: this.local.readmeUrl
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
get gallery() {
|
|
119
|
+
return this._gallery;
|
|
120
|
+
}
|
|
121
|
+
set gallery(gallery) {
|
|
122
|
+
this._gallery = gallery;
|
|
123
|
+
this.galleryResourcesCache.clear();
|
|
124
|
+
}
|
|
125
|
+
get missingFromGallery() {
|
|
126
|
+
return !!this._missingFromGallery;
|
|
127
|
+
}
|
|
128
|
+
set missingFromGallery(missing) {
|
|
129
|
+
this._missingFromGallery = missing;
|
|
130
|
+
}
|
|
131
|
+
get type() {
|
|
132
|
+
return this.local ? this.local.type : ExtensionType.User;
|
|
133
|
+
}
|
|
134
|
+
get isBuiltin() {
|
|
135
|
+
return this.local ? this.local.isBuiltin : false;
|
|
136
|
+
}
|
|
137
|
+
get isWorkspaceScoped() {
|
|
138
|
+
if (this.local) {
|
|
139
|
+
return this.local.isWorkspaceScoped;
|
|
140
|
+
}
|
|
141
|
+
if (this.resourceExtensionInfo) {
|
|
142
|
+
return this.resourceExtensionInfo.isWorkspaceScoped;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
get name() {
|
|
147
|
+
if (this.gallery) {
|
|
148
|
+
return this.gallery.name;
|
|
149
|
+
}
|
|
150
|
+
return this.getManifestFromLocalOrResource()?.name ?? "";
|
|
151
|
+
}
|
|
152
|
+
get displayName() {
|
|
153
|
+
if (this.gallery) {
|
|
154
|
+
return this.gallery.displayName || this.gallery.name;
|
|
155
|
+
}
|
|
156
|
+
return this.getManifestFromLocalOrResource()?.displayName ?? this.name;
|
|
157
|
+
}
|
|
158
|
+
get identifier() {
|
|
159
|
+
if (this.gallery) {
|
|
160
|
+
return this.gallery.identifier;
|
|
161
|
+
}
|
|
162
|
+
if (this.resourceExtension) {
|
|
163
|
+
return this.resourceExtension.identifier;
|
|
164
|
+
}
|
|
165
|
+
return this.local?.identifier ?? {
|
|
166
|
+
id: ""
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
get uuid() {
|
|
170
|
+
return this.gallery ? this.gallery.identifier.uuid : this.local?.identifier.uuid;
|
|
171
|
+
}
|
|
172
|
+
get publisher() {
|
|
173
|
+
if (this.gallery) {
|
|
174
|
+
return this.gallery.publisher;
|
|
175
|
+
}
|
|
176
|
+
return this.getManifestFromLocalOrResource()?.publisher ?? "";
|
|
177
|
+
}
|
|
178
|
+
get publisherDisplayName() {
|
|
179
|
+
if (this.gallery) {
|
|
180
|
+
return this.gallery.publisherDisplayName || this.gallery.publisher;
|
|
181
|
+
}
|
|
182
|
+
if (this.local?.publisherDisplayName) {
|
|
183
|
+
return this.local.publisherDisplayName;
|
|
184
|
+
}
|
|
185
|
+
return this.publisher;
|
|
186
|
+
}
|
|
187
|
+
get publisherUrl() {
|
|
188
|
+
return this.gallery?.publisherLink ? ( URI.parse(this.gallery.publisherLink)) : undefined;
|
|
189
|
+
}
|
|
190
|
+
get publisherDomain() {
|
|
191
|
+
return this.gallery?.publisherDomain;
|
|
192
|
+
}
|
|
193
|
+
get publisherSponsorLink() {
|
|
194
|
+
return this.gallery?.publisherSponsorLink ? ( URI.parse(this.gallery.publisherSponsorLink)) : undefined;
|
|
195
|
+
}
|
|
196
|
+
get version() {
|
|
197
|
+
return this.local ? this.local.manifest.version : this.latestVersion;
|
|
198
|
+
}
|
|
199
|
+
get private() {
|
|
200
|
+
return this.gallery ? this.gallery.private : this.local ? this.local.private : false;
|
|
201
|
+
}
|
|
202
|
+
get pinned() {
|
|
203
|
+
return !!this.local?.pinned;
|
|
204
|
+
}
|
|
205
|
+
get latestVersion() {
|
|
206
|
+
return this.gallery ? this.gallery.version : this.getManifestFromLocalOrResource()?.version ?? "";
|
|
207
|
+
}
|
|
208
|
+
get description() {
|
|
209
|
+
return this.gallery ? this.gallery.description : this.getManifestFromLocalOrResource()?.description ?? "";
|
|
210
|
+
}
|
|
211
|
+
get url() {
|
|
212
|
+
return this.gallery?.detailsLink;
|
|
213
|
+
}
|
|
214
|
+
get iconUrl() {
|
|
215
|
+
return this.galleryIconUrl || this.resourceExtensionIconUrl || this.localIconUrl || this.defaultIconUrl;
|
|
216
|
+
}
|
|
217
|
+
get iconUrlFallback() {
|
|
218
|
+
return this.gallery?.assets.icon?.fallbackUri;
|
|
219
|
+
}
|
|
220
|
+
get localIconUrl() {
|
|
221
|
+
if (this.local && this.local.manifest.icon) {
|
|
222
|
+
return ( FileAccess.uriToBrowserUri(joinPath(this.local.location, this.local.manifest.icon)).toString(true));
|
|
223
|
+
}
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
get resourceExtensionIconUrl() {
|
|
227
|
+
if (this.resourceExtension?.manifest.icon) {
|
|
228
|
+
return ( FileAccess.uriToBrowserUri(
|
|
229
|
+
joinPath(this.resourceExtension.location, this.resourceExtension.manifest.icon)
|
|
230
|
+
).toString(true));
|
|
231
|
+
}
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
get galleryIconUrl() {
|
|
235
|
+
return this.gallery?.assets.icon?.uri;
|
|
236
|
+
}
|
|
237
|
+
get defaultIconUrl() {
|
|
238
|
+
if (this.type === ExtensionType.System && this.local) {
|
|
239
|
+
if (this.local.manifest && this.local.manifest.contributes) {
|
|
240
|
+
if (Array.isArray(this.local.manifest.contributes.themes) && this.local.manifest.contributes.themes.length) {
|
|
241
|
+
return ( ( FileAccess.asBrowserUri("vs/workbench/contrib/extensions/browser/media/theme-icon.png")).toString(true));
|
|
242
|
+
}
|
|
243
|
+
if (Array.isArray(this.local.manifest.contributes.grammars) && this.local.manifest.contributes.grammars.length) {
|
|
244
|
+
return ( ( FileAccess.asBrowserUri("vs/workbench/contrib/extensions/browser/media/language-icon.svg")).toString(true));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
get repository() {
|
|
251
|
+
return this.gallery && this.gallery.assets.repository ? this.gallery.assets.repository.uri : undefined;
|
|
252
|
+
}
|
|
253
|
+
get licenseUrl() {
|
|
254
|
+
return this.gallery && this.gallery.assets.license ? this.gallery.assets.license.uri : undefined;
|
|
255
|
+
}
|
|
256
|
+
get supportUrl() {
|
|
257
|
+
return this.gallery && this.gallery.supportLink ? this.gallery.supportLink : undefined;
|
|
258
|
+
}
|
|
259
|
+
get state() {
|
|
260
|
+
return this.stateProvider(this);
|
|
261
|
+
}
|
|
262
|
+
get isMalicious() {
|
|
263
|
+
return !!this.malicious || this.enablementState === EnablementState.DisabledByMalicious;
|
|
264
|
+
}
|
|
265
|
+
get maliciousInfoLink() {
|
|
266
|
+
return this.malicious?.learnMoreLink;
|
|
267
|
+
}
|
|
268
|
+
get installCount() {
|
|
269
|
+
return this.gallery ? this.gallery.installCount : undefined;
|
|
270
|
+
}
|
|
271
|
+
get rating() {
|
|
272
|
+
return this.gallery ? this.gallery.rating : undefined;
|
|
273
|
+
}
|
|
274
|
+
get ratingCount() {
|
|
275
|
+
return this.gallery ? this.gallery.ratingCount : undefined;
|
|
276
|
+
}
|
|
277
|
+
get ratingUrl() {
|
|
278
|
+
return this.gallery?.ratingLink;
|
|
279
|
+
}
|
|
280
|
+
get outdated() {
|
|
281
|
+
try {
|
|
282
|
+
if (!this.gallery || !this.local) {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
if (this.type === ExtensionType.System && this.productService.quality === "stable" && !this.productService.builtInExtensionsEnabledWithAutoUpdates?.some(id => id.toLowerCase() === this.identifier.id.toLowerCase())) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
if (semverExports.gt(this.latestVersion, this.version)) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
if (this.outdatedTargetPlatform) {
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
} catch (error) {}
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
get outdatedTargetPlatform() {
|
|
301
|
+
return !!this.local && !!this.gallery && ![TargetPlatform.UNDEFINED, TargetPlatform.WEB].includes(this.local.targetPlatform) && this.gallery.properties.targetPlatform !== TargetPlatform.WEB && this.local.targetPlatform !== this.gallery.properties.targetPlatform && semverExports.eq(this.latestVersion, this.version);
|
|
302
|
+
}
|
|
303
|
+
get runtimeState() {
|
|
304
|
+
return this.runtimeStateProvider(this);
|
|
305
|
+
}
|
|
306
|
+
get telemetryData() {
|
|
307
|
+
const {
|
|
308
|
+
local,
|
|
309
|
+
gallery
|
|
310
|
+
} = this;
|
|
311
|
+
if (gallery) {
|
|
312
|
+
return getGalleryExtensionTelemetryData(gallery);
|
|
313
|
+
} else if (local) {
|
|
314
|
+
return getLocalExtensionTelemetryData(local);
|
|
315
|
+
} else {
|
|
316
|
+
return {};
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
get preview() {
|
|
320
|
+
return this.local?.manifest.preview ?? this.gallery?.preview ?? false;
|
|
321
|
+
}
|
|
322
|
+
get preRelease() {
|
|
323
|
+
return !!this.local?.preRelease;
|
|
324
|
+
}
|
|
325
|
+
get isPreReleaseVersion() {
|
|
326
|
+
if (this.local) {
|
|
327
|
+
return this.local.isPreReleaseVersion;
|
|
328
|
+
}
|
|
329
|
+
return !!this.gallery?.properties.isPreReleaseVersion;
|
|
330
|
+
}
|
|
331
|
+
get hasPreReleaseVersion() {
|
|
332
|
+
return this.gallery ? this.gallery.hasPreReleaseVersion : !!this.local?.hasPreReleaseVersion;
|
|
333
|
+
}
|
|
334
|
+
get hasReleaseVersion() {
|
|
335
|
+
return !!this.resourceExtension || !!this.gallery?.hasReleaseVersion;
|
|
336
|
+
}
|
|
337
|
+
getLocal() {
|
|
338
|
+
return this.local && !this.outdated ? this.local : undefined;
|
|
339
|
+
}
|
|
340
|
+
async getManifest(token) {
|
|
341
|
+
const local = this.getLocal();
|
|
342
|
+
if (local) {
|
|
343
|
+
return local.manifest;
|
|
344
|
+
}
|
|
345
|
+
if (this.gallery) {
|
|
346
|
+
return this.getGalleryManifest(token);
|
|
347
|
+
}
|
|
348
|
+
if (this.resourceExtension) {
|
|
349
|
+
return this.resourceExtension.manifest;
|
|
350
|
+
}
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
async getGalleryManifest(token = CancellationToken.None) {
|
|
354
|
+
if (this.gallery) {
|
|
355
|
+
let cache = this.galleryResourcesCache.get("manifest");
|
|
356
|
+
if (!cache) {
|
|
357
|
+
if (this.gallery.assets.manifest) {
|
|
358
|
+
this.galleryResourcesCache.set(
|
|
359
|
+
"manifest",
|
|
360
|
+
cache = this.galleryService.getManifest(this.gallery, token).catch(e => {
|
|
361
|
+
this.galleryResourcesCache.delete("manifest");
|
|
362
|
+
throw e;
|
|
363
|
+
})
|
|
364
|
+
);
|
|
365
|
+
} else {
|
|
366
|
+
this.logService.error(( localize(9891, "Manifest is not found")), this.identifier.id);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return cache;
|
|
370
|
+
}
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
hasReadme() {
|
|
374
|
+
if (this.local && this.local.readmeUrl) {
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
if (this.gallery && this.gallery.assets.readme) {
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
if (this.resourceExtension?.readmeUri) {
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
return this.type === ExtensionType.System;
|
|
384
|
+
}
|
|
385
|
+
async getReadme(token) {
|
|
386
|
+
const local = this.getLocal();
|
|
387
|
+
if (local?.readmeUrl) {
|
|
388
|
+
const content = await this.fileService.readFile(local.readmeUrl);
|
|
389
|
+
return ( content.value.toString());
|
|
390
|
+
}
|
|
391
|
+
if (this.gallery) {
|
|
392
|
+
if (this.gallery.assets.readme) {
|
|
393
|
+
return this.galleryService.getReadme(this.gallery, token);
|
|
394
|
+
}
|
|
395
|
+
this.telemetryService.publicLog("extensions:NotFoundReadMe", this.telemetryData);
|
|
396
|
+
}
|
|
397
|
+
if (this.type === ExtensionType.System) {
|
|
398
|
+
return Promise.resolve(`# ${this.displayName || this.name}
|
|
399
|
+
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
|
|
400
|
+
## Features
|
|
401
|
+
${this.description}
|
|
402
|
+
`);
|
|
403
|
+
}
|
|
404
|
+
if (this.resourceExtension?.readmeUri) {
|
|
405
|
+
const content = await this.fileService.readFile(this.resourceExtension?.readmeUri);
|
|
406
|
+
return ( content.value.toString());
|
|
407
|
+
}
|
|
408
|
+
return Promise.reject(( new Error("not available")));
|
|
409
|
+
}
|
|
410
|
+
hasChangelog() {
|
|
411
|
+
if (this.local && this.local.changelogUrl) {
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
if (this.gallery && this.gallery.assets.changelog) {
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
return this.type === ExtensionType.System;
|
|
418
|
+
}
|
|
419
|
+
async getChangelog(token) {
|
|
420
|
+
const local = this.getLocal();
|
|
421
|
+
if (local?.changelogUrl) {
|
|
422
|
+
const content = await this.fileService.readFile(local.changelogUrl);
|
|
423
|
+
return ( content.value.toString());
|
|
424
|
+
}
|
|
425
|
+
if (this.gallery?.assets.changelog) {
|
|
426
|
+
return this.galleryService.getChangelog(this.gallery, token);
|
|
427
|
+
}
|
|
428
|
+
if (this.type === ExtensionType.System) {
|
|
429
|
+
return Promise.resolve(
|
|
430
|
+
`Please check the [VS Code Release Notes](command:${ShowCurrentReleaseNotesActionId}) for changes to the built-in extensions.`
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
return Promise.reject(( new Error("not available")));
|
|
434
|
+
}
|
|
435
|
+
get categories() {
|
|
436
|
+
const {
|
|
437
|
+
local,
|
|
438
|
+
gallery,
|
|
439
|
+
resourceExtension
|
|
440
|
+
} = this;
|
|
441
|
+
if (local && local.manifest.categories && !this.outdated) {
|
|
442
|
+
return local.manifest.categories;
|
|
443
|
+
}
|
|
444
|
+
if (gallery) {
|
|
445
|
+
return gallery.categories;
|
|
446
|
+
}
|
|
447
|
+
if (resourceExtension) {
|
|
448
|
+
return resourceExtension.manifest.categories ?? [];
|
|
449
|
+
}
|
|
450
|
+
return [];
|
|
451
|
+
}
|
|
452
|
+
get tags() {
|
|
453
|
+
const {
|
|
454
|
+
gallery
|
|
455
|
+
} = this;
|
|
456
|
+
if (gallery) {
|
|
457
|
+
return gallery.tags.filter(tag => !tag.startsWith("_"));
|
|
458
|
+
}
|
|
459
|
+
return [];
|
|
460
|
+
}
|
|
461
|
+
get dependencies() {
|
|
462
|
+
const {
|
|
463
|
+
local,
|
|
464
|
+
gallery,
|
|
465
|
+
resourceExtension
|
|
466
|
+
} = this;
|
|
467
|
+
if (local && local.manifest.extensionDependencies && !this.outdated) {
|
|
468
|
+
return local.manifest.extensionDependencies;
|
|
469
|
+
}
|
|
470
|
+
if (gallery) {
|
|
471
|
+
return gallery.properties.dependencies || [];
|
|
472
|
+
}
|
|
473
|
+
if (resourceExtension) {
|
|
474
|
+
return resourceExtension.manifest.extensionDependencies || [];
|
|
475
|
+
}
|
|
476
|
+
return [];
|
|
477
|
+
}
|
|
478
|
+
get extensionPack() {
|
|
479
|
+
const {
|
|
480
|
+
local,
|
|
481
|
+
gallery,
|
|
482
|
+
resourceExtension
|
|
483
|
+
} = this;
|
|
484
|
+
if (local && local.manifest.extensionPack && !this.outdated) {
|
|
485
|
+
return local.manifest.extensionPack;
|
|
486
|
+
}
|
|
487
|
+
if (gallery) {
|
|
488
|
+
return gallery.properties.extensionPack || [];
|
|
489
|
+
}
|
|
490
|
+
if (resourceExtension) {
|
|
491
|
+
return resourceExtension.manifest.extensionPack || [];
|
|
492
|
+
}
|
|
493
|
+
return [];
|
|
494
|
+
}
|
|
495
|
+
setExtensionsControlManifest(extensionsControlManifest) {
|
|
496
|
+
this.malicious = findMatchingMaliciousEntry(this.identifier, extensionsControlManifest.malicious);
|
|
497
|
+
this.deprecationInfo = extensionsControlManifest.deprecated ? extensionsControlManifest.deprecated[this.identifier.id.toLowerCase()] : undefined;
|
|
498
|
+
}
|
|
499
|
+
getManifestFromLocalOrResource() {
|
|
500
|
+
if (this.local) {
|
|
501
|
+
return this.local.manifest;
|
|
502
|
+
}
|
|
503
|
+
if (this.resourceExtension) {
|
|
504
|
+
return this.resourceExtension.manifest;
|
|
505
|
+
}
|
|
506
|
+
return null;
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
Extension = ( __decorate([( __param(6, IExtensionGalleryService)), ( __param(7, ITelemetryService)), ( __param(8, ILogService)), ( __param(9, IFileService)), ( __param(10, IProductService))], Extension));
|
|
510
|
+
const EXTENSIONS_AUTO_UPDATE_KEY = "extensions.autoUpdate";
|
|
511
|
+
const EXTENSIONS_DONOT_AUTO_UPDATE_KEY = "extensions.donotAutoUpdate";
|
|
512
|
+
const EXTENSIONS_DISMISSED_NOTIFICATIONS_KEY = "extensions.dismissedNotifications";
|
|
513
|
+
let Extensions = class Extensions extends Disposable {
|
|
514
|
+
get onChange() {
|
|
515
|
+
return this._onChange.event;
|
|
516
|
+
}
|
|
517
|
+
get onReset() {
|
|
518
|
+
return this._onReset.event;
|
|
519
|
+
}
|
|
520
|
+
constructor(
|
|
521
|
+
server,
|
|
522
|
+
stateProvider,
|
|
523
|
+
runtimeStateProvider,
|
|
524
|
+
isWorkspaceServer,
|
|
525
|
+
galleryService,
|
|
526
|
+
extensionEnablementService,
|
|
527
|
+
workbenchExtensionManagementService,
|
|
528
|
+
telemetryService,
|
|
529
|
+
instantiationService
|
|
530
|
+
) {
|
|
531
|
+
super();
|
|
532
|
+
this.server = server;
|
|
533
|
+
this.stateProvider = stateProvider;
|
|
534
|
+
this.runtimeStateProvider = runtimeStateProvider;
|
|
535
|
+
this.isWorkspaceServer = isWorkspaceServer;
|
|
536
|
+
this.galleryService = galleryService;
|
|
537
|
+
this.extensionEnablementService = extensionEnablementService;
|
|
538
|
+
this.workbenchExtensionManagementService = workbenchExtensionManagementService;
|
|
539
|
+
this.telemetryService = telemetryService;
|
|
540
|
+
this.instantiationService = instantiationService;
|
|
541
|
+
this._onChange = this._register(( new Emitter()));
|
|
542
|
+
this._onReset = this._register(( new Emitter()));
|
|
543
|
+
this.installing = [];
|
|
544
|
+
this.uninstalling = [];
|
|
545
|
+
this.installed = [];
|
|
546
|
+
this._register(
|
|
547
|
+
server.extensionManagementService.onInstallExtension(e => this.onInstallExtension(e))
|
|
548
|
+
);
|
|
549
|
+
this._register(
|
|
550
|
+
server.extensionManagementService.onDidInstallExtensions(e => this.onDidInstallExtensions(e))
|
|
551
|
+
);
|
|
552
|
+
this._register(
|
|
553
|
+
server.extensionManagementService.onUninstallExtension(e => this.onUninstallExtension(e.identifier))
|
|
554
|
+
);
|
|
555
|
+
this._register(
|
|
556
|
+
server.extensionManagementService.onDidUninstallExtension(e => this.onDidUninstallExtension(e))
|
|
557
|
+
);
|
|
558
|
+
this._register(
|
|
559
|
+
server.extensionManagementService.onDidUpdateExtensionMetadata(e => this.onDidUpdateExtensionMetadata(e.local))
|
|
560
|
+
);
|
|
561
|
+
this._register(server.extensionManagementService.onDidChangeProfile(() => this.reset()));
|
|
562
|
+
this._register(
|
|
563
|
+
extensionEnablementService.onEnablementChanged(e => this.onEnablementChanged(e))
|
|
564
|
+
);
|
|
565
|
+
this._register(Event.any(this.onChange, this.onReset)(() => this._local = undefined));
|
|
566
|
+
if (this.isWorkspaceServer) {
|
|
567
|
+
this._register(this.workbenchExtensionManagementService.onInstallExtension(e => {
|
|
568
|
+
if (e.workspaceScoped) {
|
|
569
|
+
this.onInstallExtension(e);
|
|
570
|
+
}
|
|
571
|
+
}));
|
|
572
|
+
this._register(this.workbenchExtensionManagementService.onDidInstallExtensions(e => {
|
|
573
|
+
const result = e.filter(e => e.workspaceScoped);
|
|
574
|
+
if (result.length) {
|
|
575
|
+
this.onDidInstallExtensions(result);
|
|
576
|
+
}
|
|
577
|
+
}));
|
|
578
|
+
this._register(this.workbenchExtensionManagementService.onUninstallExtension(e => {
|
|
579
|
+
if (e.workspaceScoped) {
|
|
580
|
+
this.onUninstallExtension(e.identifier);
|
|
581
|
+
}
|
|
582
|
+
}));
|
|
583
|
+
this._register(this.workbenchExtensionManagementService.onDidUninstallExtension(e => {
|
|
584
|
+
if (e.workspaceScoped) {
|
|
585
|
+
this.onDidUninstallExtension(e);
|
|
586
|
+
}
|
|
587
|
+
}));
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
get local() {
|
|
591
|
+
if (!this._local) {
|
|
592
|
+
this._local = [];
|
|
593
|
+
for (const extension of this.installed) {
|
|
594
|
+
this._local.push(extension);
|
|
595
|
+
}
|
|
596
|
+
for (const extension of this.installing) {
|
|
597
|
+
if (!( this.installed.some(installed => areSameExtensions(installed.identifier, extension.identifier)))) {
|
|
598
|
+
this._local.push(extension);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return this._local;
|
|
603
|
+
}
|
|
604
|
+
async queryInstalled(productVersion) {
|
|
605
|
+
await this.fetchInstalledExtensions(productVersion);
|
|
606
|
+
this._onChange.fire(undefined);
|
|
607
|
+
return this.local;
|
|
608
|
+
}
|
|
609
|
+
async syncInstalledExtensionsWithGallery(galleryExtensions, productVersion, flagExtensionsMissingFromGallery) {
|
|
610
|
+
const extensions = await this.mapInstalledExtensionWithCompatibleGalleryExtension(galleryExtensions, productVersion);
|
|
611
|
+
for (const [extension, gallery] of extensions) {
|
|
612
|
+
if (extension.local && extension.local.type !== ExtensionType.System && !extension.local.identifier.uuid) {
|
|
613
|
+
extension.local = await this.updateMetadata(extension.local, gallery);
|
|
614
|
+
}
|
|
615
|
+
if (!extension.gallery || extension.gallery.version !== gallery.version || extension.gallery.properties.targetPlatform !== gallery.properties.targetPlatform) {
|
|
616
|
+
extension.gallery = gallery;
|
|
617
|
+
this._onChange.fire({
|
|
618
|
+
extension
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
if (flagExtensionsMissingFromGallery) {
|
|
623
|
+
const extensionsToQuery = [];
|
|
624
|
+
for (const extension of this.local) {
|
|
625
|
+
if (extension.gallery) {
|
|
626
|
+
continue;
|
|
627
|
+
}
|
|
628
|
+
if (extension.missingFromGallery) {
|
|
629
|
+
continue;
|
|
630
|
+
}
|
|
631
|
+
if (!extension.identifier.uuid) {
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
if (!( flagExtensionsMissingFromGallery.some(f => areSameExtensions(f, extension.identifier)))) {
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
extensionsToQuery.push(extension);
|
|
638
|
+
}
|
|
639
|
+
if (extensionsToQuery.length) {
|
|
640
|
+
const queryResult = await this.galleryService.getExtensions(( extensionsToQuery.map(e => ({
|
|
641
|
+
...e.identifier,
|
|
642
|
+
version: e.version
|
|
643
|
+
}))), CancellationToken.None);
|
|
644
|
+
const queriedIds = [];
|
|
645
|
+
const missingIds = [];
|
|
646
|
+
for (const extension of extensionsToQuery) {
|
|
647
|
+
queriedIds.push(extension.identifier.id);
|
|
648
|
+
const gallery = queryResult.find(g => areSameExtensions(g.identifier, extension.identifier));
|
|
649
|
+
if (gallery) {
|
|
650
|
+
extension.gallery = gallery;
|
|
651
|
+
} else {
|
|
652
|
+
extension.missingFromGallery = true;
|
|
653
|
+
missingIds.push(extension.identifier.id);
|
|
654
|
+
}
|
|
655
|
+
this._onChange.fire({
|
|
656
|
+
extension
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
this.telemetryService.publicLog2("extensions:missingFromGallery", {
|
|
660
|
+
queriedIds: ( new TelemetryTrustedValue(queriedIds.join(";"))),
|
|
661
|
+
missingIds: ( new TelemetryTrustedValue(missingIds.join(";")))
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
async mapInstalledExtensionWithCompatibleGalleryExtension(galleryExtensions, productVersion) {
|
|
667
|
+
const mappedExtensions = this.mapInstalledExtensionWithGalleryExtension(galleryExtensions);
|
|
668
|
+
const targetPlatform = await this.server.extensionManagementService.getTargetPlatform();
|
|
669
|
+
const compatibleGalleryExtensions = [];
|
|
670
|
+
const compatibleGalleryExtensionsToFetch = [];
|
|
671
|
+
await Promise.allSettled(( mappedExtensions.map(async ([extension, gallery]) => {
|
|
672
|
+
if (extension.local) {
|
|
673
|
+
if (await this.galleryService.isExtensionCompatible(gallery, extension.local.preRelease, targetPlatform, productVersion)) {
|
|
674
|
+
compatibleGalleryExtensions.push(gallery);
|
|
675
|
+
} else {
|
|
676
|
+
compatibleGalleryExtensionsToFetch.push({
|
|
677
|
+
...extension.local.identifier,
|
|
678
|
+
preRelease: extension.local.preRelease
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
})));
|
|
683
|
+
if (compatibleGalleryExtensionsToFetch.length) {
|
|
684
|
+
const result = await this.galleryService.getExtensions(compatibleGalleryExtensionsToFetch, {
|
|
685
|
+
targetPlatform,
|
|
686
|
+
compatible: true,
|
|
687
|
+
queryAllVersions: true,
|
|
688
|
+
productVersion
|
|
689
|
+
}, CancellationToken.None);
|
|
690
|
+
compatibleGalleryExtensions.push(...result);
|
|
691
|
+
}
|
|
692
|
+
return this.mapInstalledExtensionWithGalleryExtension(compatibleGalleryExtensions);
|
|
693
|
+
}
|
|
694
|
+
mapInstalledExtensionWithGalleryExtension(galleryExtensions) {
|
|
695
|
+
const mappedExtensions = [];
|
|
696
|
+
const byUUID = ( new Map()),
|
|
697
|
+
byID = ( new Map());
|
|
698
|
+
for (const gallery of galleryExtensions) {
|
|
699
|
+
byUUID.set(gallery.identifier.uuid, gallery);
|
|
700
|
+
byID.set(gallery.identifier.id.toLowerCase(), gallery);
|
|
701
|
+
}
|
|
702
|
+
for (const installed of this.installed) {
|
|
703
|
+
if (installed.uuid) {
|
|
704
|
+
const gallery = byUUID.get(installed.uuid);
|
|
705
|
+
if (gallery) {
|
|
706
|
+
mappedExtensions.push([installed, gallery]);
|
|
707
|
+
continue;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
if (installed.local?.source !== "resource") {
|
|
711
|
+
const gallery = byID.get(installed.identifier.id.toLowerCase());
|
|
712
|
+
if (gallery) {
|
|
713
|
+
mappedExtensions.push([installed, gallery]);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return mappedExtensions;
|
|
718
|
+
}
|
|
719
|
+
async updateMetadata(localExtension, gallery) {
|
|
720
|
+
let isPreReleaseVersion = false;
|
|
721
|
+
if (localExtension.manifest.version !== gallery.version) {
|
|
722
|
+
this.telemetryService.publicLog2("galleryService:updateMetadata");
|
|
723
|
+
const galleryWithLocalVersion = (await this.galleryService.getExtensions([{
|
|
724
|
+
...localExtension.identifier,
|
|
725
|
+
version: localExtension.manifest.version
|
|
726
|
+
}], CancellationToken.None))[0];
|
|
727
|
+
isPreReleaseVersion = !!galleryWithLocalVersion?.properties?.isPreReleaseVersion;
|
|
728
|
+
}
|
|
729
|
+
return this.workbenchExtensionManagementService.updateMetadata(localExtension, {
|
|
730
|
+
id: gallery.identifier.uuid,
|
|
731
|
+
publisherDisplayName: gallery.publisherDisplayName,
|
|
732
|
+
publisherId: gallery.publisherId,
|
|
733
|
+
isPreReleaseVersion
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
canInstall(galleryExtension) {
|
|
737
|
+
return this.server.extensionManagementService.canInstall(galleryExtension);
|
|
738
|
+
}
|
|
739
|
+
onInstallExtension(event) {
|
|
740
|
+
const {
|
|
741
|
+
source
|
|
742
|
+
} = event;
|
|
743
|
+
if (source && !URI.isUri(source)) {
|
|
744
|
+
const extension = this.installed.find(e => areSameExtensions(e.identifier, source.identifier)) ?? this.instantiationService.createInstance(
|
|
745
|
+
Extension,
|
|
746
|
+
this.stateProvider,
|
|
747
|
+
this.runtimeStateProvider,
|
|
748
|
+
this.server,
|
|
749
|
+
undefined,
|
|
750
|
+
source,
|
|
751
|
+
undefined
|
|
752
|
+
);
|
|
753
|
+
this.installing.push(extension);
|
|
754
|
+
this._onChange.fire({
|
|
755
|
+
extension
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
async fetchInstalledExtensions(productVersion) {
|
|
760
|
+
const extensionsControlManifest = await this.server.extensionManagementService.getExtensionsControlManifest();
|
|
761
|
+
const all = await this.server.extensionManagementService.getInstalled(undefined, undefined, productVersion);
|
|
762
|
+
if (this.isWorkspaceServer) {
|
|
763
|
+
all.push(
|
|
764
|
+
...(await this.workbenchExtensionManagementService.getInstalledWorkspaceExtensions(true))
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
const installed = groupByExtension(all, r => r.identifier).reduce((result, extensions) => {
|
|
768
|
+
if (extensions.length === 1) {
|
|
769
|
+
result.push(extensions[0]);
|
|
770
|
+
} else {
|
|
771
|
+
let workspaceExtension, userExtension, systemExtension;
|
|
772
|
+
for (const extension of extensions) {
|
|
773
|
+
if (extension.isWorkspaceScoped) {
|
|
774
|
+
workspaceExtension = extension;
|
|
775
|
+
} else if (extension.type === ExtensionType.User) {
|
|
776
|
+
userExtension = extension;
|
|
777
|
+
} else {
|
|
778
|
+
systemExtension = extension;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
const extension = workspaceExtension ?? userExtension ?? systemExtension;
|
|
782
|
+
if (extension) {
|
|
783
|
+
result.push(extension);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return result;
|
|
787
|
+
}, []);
|
|
788
|
+
const byId = index(this.installed, e => e.local ? e.local.identifier.id : e.identifier.id);
|
|
789
|
+
this.installed = ( installed.map(local => {
|
|
790
|
+
const extension = byId[local.identifier.id] || this.instantiationService.createInstance(
|
|
791
|
+
Extension,
|
|
792
|
+
this.stateProvider,
|
|
793
|
+
this.runtimeStateProvider,
|
|
794
|
+
this.server,
|
|
795
|
+
local,
|
|
796
|
+
undefined,
|
|
797
|
+
undefined
|
|
798
|
+
);
|
|
799
|
+
extension.local = local;
|
|
800
|
+
extension.enablementState = this.extensionEnablementService.getEnablementState(local);
|
|
801
|
+
extension.setExtensionsControlManifest(extensionsControlManifest);
|
|
802
|
+
return extension;
|
|
803
|
+
}));
|
|
804
|
+
}
|
|
805
|
+
async reset() {
|
|
806
|
+
this.installed = [];
|
|
807
|
+
this.installing = [];
|
|
808
|
+
this.uninstalling = [];
|
|
809
|
+
await this.fetchInstalledExtensions();
|
|
810
|
+
this._onReset.fire();
|
|
811
|
+
}
|
|
812
|
+
async onDidInstallExtensions(results) {
|
|
813
|
+
const extensions = [];
|
|
814
|
+
for (const event of results) {
|
|
815
|
+
const {
|
|
816
|
+
local,
|
|
817
|
+
source
|
|
818
|
+
} = event;
|
|
819
|
+
const gallery = source && !URI.isUri(source) ? source : undefined;
|
|
820
|
+
const location = source && URI.isUri(source) ? source : undefined;
|
|
821
|
+
const installingExtension = gallery ? this.installing.filter(e => areSameExtensions(e.identifier, gallery.identifier))[0] : null;
|
|
822
|
+
this.installing = installingExtension ? this.installing.filter(e => e !== installingExtension) : this.installing;
|
|
823
|
+
let extension = installingExtension ? installingExtension : (location || local) ? this.instantiationService.createInstance(
|
|
824
|
+
Extension,
|
|
825
|
+
this.stateProvider,
|
|
826
|
+
this.runtimeStateProvider,
|
|
827
|
+
this.server,
|
|
828
|
+
local,
|
|
829
|
+
undefined,
|
|
830
|
+
undefined
|
|
831
|
+
) : undefined;
|
|
832
|
+
if (extension) {
|
|
833
|
+
if (local) {
|
|
834
|
+
const installed = this.installed.filter(e => areSameExtensions(e.identifier, extension.identifier))[0];
|
|
835
|
+
if (installed) {
|
|
836
|
+
extension = installed;
|
|
837
|
+
} else {
|
|
838
|
+
this.installed.push(extension);
|
|
839
|
+
}
|
|
840
|
+
extension.local = local;
|
|
841
|
+
if (!extension.gallery) {
|
|
842
|
+
extension.gallery = gallery;
|
|
843
|
+
}
|
|
844
|
+
extension.enablementState = this.extensionEnablementService.getEnablementState(local);
|
|
845
|
+
}
|
|
846
|
+
extensions.push(extension);
|
|
847
|
+
}
|
|
848
|
+
this._onChange.fire(!local || !extension ? undefined : {
|
|
849
|
+
extension,
|
|
850
|
+
operation: event.operation
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
if (extensions.length) {
|
|
854
|
+
const manifest = await this.server.extensionManagementService.getExtensionsControlManifest();
|
|
855
|
+
for (const extension of extensions) {
|
|
856
|
+
extension.setExtensionsControlManifest(manifest);
|
|
857
|
+
}
|
|
858
|
+
this.matchInstalledExtensionsWithGallery(extensions);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
async onDidUpdateExtensionMetadata(local) {
|
|
862
|
+
const extension = this.installed.find(e => areSameExtensions(e.identifier, local.identifier));
|
|
863
|
+
if (extension?.local) {
|
|
864
|
+
extension.local = local;
|
|
865
|
+
this._onChange.fire({
|
|
866
|
+
extension
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
async matchInstalledExtensionsWithGallery(extensions) {
|
|
871
|
+
const toMatch = extensions.filter(e => e.local && !e.gallery && e.local.source !== "resource");
|
|
872
|
+
if (!toMatch.length) {
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
if (!this.galleryService.isEnabled()) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const galleryExtensions = await this.galleryService.getExtensions(( toMatch.map(e => ({
|
|
879
|
+
...e.identifier,
|
|
880
|
+
preRelease: e.local?.preRelease
|
|
881
|
+
}))), {
|
|
882
|
+
compatible: true,
|
|
883
|
+
targetPlatform: await this.server.extensionManagementService.getTargetPlatform()
|
|
884
|
+
}, CancellationToken.None);
|
|
885
|
+
for (const extension of extensions) {
|
|
886
|
+
const compatible = galleryExtensions.find(e => areSameExtensions(e.identifier, extension.identifier));
|
|
887
|
+
if (compatible) {
|
|
888
|
+
extension.gallery = compatible;
|
|
889
|
+
this._onChange.fire({
|
|
890
|
+
extension
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
onUninstallExtension(identifier) {
|
|
896
|
+
const extension = this.installed.filter(e => areSameExtensions(e.identifier, identifier))[0];
|
|
897
|
+
if (extension) {
|
|
898
|
+
const uninstalling = this.uninstalling.filter(e => areSameExtensions(e.identifier, identifier))[0] || extension;
|
|
899
|
+
this.uninstalling = [
|
|
900
|
+
uninstalling,
|
|
901
|
+
...this.uninstalling.filter(e => !areSameExtensions(e.identifier, identifier))
|
|
902
|
+
];
|
|
903
|
+
this._onChange.fire(uninstalling ? {
|
|
904
|
+
extension: uninstalling
|
|
905
|
+
} : undefined);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
onDidUninstallExtension(
|
|
909
|
+
{
|
|
910
|
+
identifier,
|
|
911
|
+
error
|
|
912
|
+
}
|
|
913
|
+
) {
|
|
914
|
+
const uninstalled = this.uninstalling.find(e => areSameExtensions(e.identifier, identifier)) || this.installed.find(e => areSameExtensions(e.identifier, identifier));
|
|
915
|
+
this.uninstalling = this.uninstalling.filter(e => !areSameExtensions(e.identifier, identifier));
|
|
916
|
+
if (!error) {
|
|
917
|
+
this.installed = this.installed.filter(e => !areSameExtensions(e.identifier, identifier));
|
|
918
|
+
}
|
|
919
|
+
if (uninstalled) {
|
|
920
|
+
this._onChange.fire({
|
|
921
|
+
extension: uninstalled
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
onEnablementChanged(platformExtensions) {
|
|
926
|
+
const extensions = this.local.filter(e => ( platformExtensions.some(p => areSameExtensions(e.identifier, p.identifier))));
|
|
927
|
+
for (const extension of extensions) {
|
|
928
|
+
if (extension.local) {
|
|
929
|
+
const enablementState = this.extensionEnablementService.getEnablementState(extension.local);
|
|
930
|
+
if (enablementState !== extension.enablementState) {
|
|
931
|
+
extension.enablementState = enablementState;
|
|
932
|
+
this._onChange.fire({
|
|
933
|
+
extension
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
getExtensionState(extension) {
|
|
940
|
+
if (extension.gallery && ( this.installing.some(
|
|
941
|
+
e => !!e.gallery && areSameExtensions(e.gallery.identifier, extension.gallery.identifier)
|
|
942
|
+
))) {
|
|
943
|
+
return ExtensionState.Installing;
|
|
944
|
+
}
|
|
945
|
+
if (( this.uninstalling.some(e => areSameExtensions(e.identifier, extension.identifier)))) {
|
|
946
|
+
return ExtensionState.Uninstalling;
|
|
947
|
+
}
|
|
948
|
+
const local = this.installed.filter(
|
|
949
|
+
e => e === extension || (e.gallery && extension.gallery && areSameExtensions(e.gallery.identifier, extension.gallery.identifier))
|
|
950
|
+
)[0];
|
|
951
|
+
return local ? ExtensionState.Installed : ExtensionState.Uninstalled;
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
Extensions = ( __decorate([( __param(4, IExtensionGalleryService)), ( __param(5, IWorkbenchExtensionEnablementService)), ( __param(6, IWorkbenchExtensionManagementService)), ( __param(7, ITelemetryService)), ( __param(8, IInstantiationService))], Extensions));
|
|
955
|
+
let ExtensionsWorkbenchService = class ExtensionsWorkbenchService extends Disposable {
|
|
956
|
+
static {
|
|
957
|
+
ExtensionsWorkbenchService_1 = this;
|
|
958
|
+
}
|
|
959
|
+
static {
|
|
960
|
+
this.UpdatesCheckInterval = 1000 * 60 * 60 * 12;
|
|
961
|
+
}
|
|
962
|
+
get onChange() {
|
|
963
|
+
return this._onChange.event;
|
|
964
|
+
}
|
|
965
|
+
get onReset() {
|
|
966
|
+
return this._onReset.event;
|
|
967
|
+
}
|
|
968
|
+
constructor(
|
|
969
|
+
instantiationService,
|
|
970
|
+
editorService,
|
|
971
|
+
extensionManagementService,
|
|
972
|
+
galleryService,
|
|
973
|
+
extensionGalleryManifestService,
|
|
974
|
+
configurationService,
|
|
975
|
+
telemetryService,
|
|
976
|
+
notificationService,
|
|
977
|
+
urlService,
|
|
978
|
+
extensionEnablementService,
|
|
979
|
+
hostService,
|
|
980
|
+
progressService,
|
|
981
|
+
extensionManagementServerService,
|
|
982
|
+
languageService,
|
|
983
|
+
extensionsSyncManagementService,
|
|
984
|
+
userDataAutoSyncService,
|
|
985
|
+
productService,
|
|
986
|
+
contextKeyService,
|
|
987
|
+
extensionManifestPropertiesService,
|
|
988
|
+
logService,
|
|
989
|
+
extensionService,
|
|
990
|
+
localeService,
|
|
991
|
+
lifecycleService,
|
|
992
|
+
fileService,
|
|
993
|
+
userDataProfileService,
|
|
994
|
+
userDataProfilesService,
|
|
995
|
+
storageService,
|
|
996
|
+
dialogService,
|
|
997
|
+
userDataSyncEnablementService,
|
|
998
|
+
updateService,
|
|
999
|
+
uriIdentityService,
|
|
1000
|
+
workspaceContextService,
|
|
1001
|
+
viewsService,
|
|
1002
|
+
fileDialogService,
|
|
1003
|
+
quickInputService,
|
|
1004
|
+
allowedExtensionsService,
|
|
1005
|
+
meteredConnectionService
|
|
1006
|
+
) {
|
|
1007
|
+
super();
|
|
1008
|
+
this.instantiationService = instantiationService;
|
|
1009
|
+
this.editorService = editorService;
|
|
1010
|
+
this.extensionManagementService = extensionManagementService;
|
|
1011
|
+
this.galleryService = galleryService;
|
|
1012
|
+
this.extensionGalleryManifestService = extensionGalleryManifestService;
|
|
1013
|
+
this.configurationService = configurationService;
|
|
1014
|
+
this.telemetryService = telemetryService;
|
|
1015
|
+
this.notificationService = notificationService;
|
|
1016
|
+
this.extensionEnablementService = extensionEnablementService;
|
|
1017
|
+
this.hostService = hostService;
|
|
1018
|
+
this.progressService = progressService;
|
|
1019
|
+
this.extensionManagementServerService = extensionManagementServerService;
|
|
1020
|
+
this.languageService = languageService;
|
|
1021
|
+
this.extensionsSyncManagementService = extensionsSyncManagementService;
|
|
1022
|
+
this.userDataAutoSyncService = userDataAutoSyncService;
|
|
1023
|
+
this.productService = productService;
|
|
1024
|
+
this.extensionManifestPropertiesService = extensionManifestPropertiesService;
|
|
1025
|
+
this.logService = logService;
|
|
1026
|
+
this.extensionService = extensionService;
|
|
1027
|
+
this.localeService = localeService;
|
|
1028
|
+
this.lifecycleService = lifecycleService;
|
|
1029
|
+
this.fileService = fileService;
|
|
1030
|
+
this.userDataProfileService = userDataProfileService;
|
|
1031
|
+
this.userDataProfilesService = userDataProfilesService;
|
|
1032
|
+
this.storageService = storageService;
|
|
1033
|
+
this.dialogService = dialogService;
|
|
1034
|
+
this.userDataSyncEnablementService = userDataSyncEnablementService;
|
|
1035
|
+
this.updateService = updateService;
|
|
1036
|
+
this.uriIdentityService = uriIdentityService;
|
|
1037
|
+
this.workspaceContextService = workspaceContextService;
|
|
1038
|
+
this.viewsService = viewsService;
|
|
1039
|
+
this.fileDialogService = fileDialogService;
|
|
1040
|
+
this.quickInputService = quickInputService;
|
|
1041
|
+
this.allowedExtensionsService = allowedExtensionsService;
|
|
1042
|
+
this.meteredConnectionService = meteredConnectionService;
|
|
1043
|
+
this.localExtensions = null;
|
|
1044
|
+
this.remoteExtensions = null;
|
|
1045
|
+
this.webExtensions = null;
|
|
1046
|
+
this.extensionsServers = [];
|
|
1047
|
+
this._onChange = this._register(( new Emitter()));
|
|
1048
|
+
this._onDidChangeExtensionsNotification = this._register(( new Emitter()));
|
|
1049
|
+
this.onDidChangeExtensionsNotification = this._onDidChangeExtensionsNotification.event;
|
|
1050
|
+
this._onReset = this._register(( new Emitter()));
|
|
1051
|
+
this.installing = [];
|
|
1052
|
+
this.tasksInProgress = [];
|
|
1053
|
+
this.autoRestartListenerDisposable = this._register(( new MutableDisposable()));
|
|
1054
|
+
this.hasOutdatedExtensionsContextKey = HasOutdatedExtensionsContext.bindTo(contextKeyService);
|
|
1055
|
+
if (extensionManagementServerService.localExtensionManagementServer) {
|
|
1056
|
+
this.localExtensions = this._register(instantiationService.createInstance(
|
|
1057
|
+
Extensions,
|
|
1058
|
+
extensionManagementServerService.localExtensionManagementServer,
|
|
1059
|
+
ext => this.getExtensionState(ext),
|
|
1060
|
+
ext => this.getRuntimeState(ext),
|
|
1061
|
+
!extensionManagementServerService.remoteExtensionManagementServer
|
|
1062
|
+
));
|
|
1063
|
+
this._register(
|
|
1064
|
+
this.localExtensions.onChange(e => this.onDidChangeExtensions(e?.extension))
|
|
1065
|
+
);
|
|
1066
|
+
this._register(this.localExtensions.onReset(e => this.reset()));
|
|
1067
|
+
this.extensionsServers.push(this.localExtensions);
|
|
1068
|
+
}
|
|
1069
|
+
if (extensionManagementServerService.remoteExtensionManagementServer) {
|
|
1070
|
+
this.remoteExtensions = this._register(instantiationService.createInstance(
|
|
1071
|
+
Extensions,
|
|
1072
|
+
extensionManagementServerService.remoteExtensionManagementServer,
|
|
1073
|
+
ext => this.getExtensionState(ext),
|
|
1074
|
+
ext => this.getRuntimeState(ext),
|
|
1075
|
+
true
|
|
1076
|
+
));
|
|
1077
|
+
this._register(
|
|
1078
|
+
this.remoteExtensions.onChange(e => this.onDidChangeExtensions(e?.extension))
|
|
1079
|
+
);
|
|
1080
|
+
this._register(this.remoteExtensions.onReset(e => this.reset()));
|
|
1081
|
+
this.extensionsServers.push(this.remoteExtensions);
|
|
1082
|
+
}
|
|
1083
|
+
if (extensionManagementServerService.webExtensionManagementServer) {
|
|
1084
|
+
this.webExtensions = this._register(instantiationService.createInstance(
|
|
1085
|
+
Extensions,
|
|
1086
|
+
extensionManagementServerService.webExtensionManagementServer,
|
|
1087
|
+
ext => this.getExtensionState(ext),
|
|
1088
|
+
ext => this.getRuntimeState(ext),
|
|
1089
|
+
!(extensionManagementServerService.remoteExtensionManagementServer || extensionManagementServerService.localExtensionManagementServer)
|
|
1090
|
+
));
|
|
1091
|
+
this._register(this.webExtensions.onChange(e => this.onDidChangeExtensions(e?.extension)));
|
|
1092
|
+
this._register(this.webExtensions.onReset(e => this.reset()));
|
|
1093
|
+
this.extensionsServers.push(this.webExtensions);
|
|
1094
|
+
}
|
|
1095
|
+
this.updatesCheckDelayer = ( new ThrottledDelayer(ExtensionsWorkbenchService_1.UpdatesCheckInterval));
|
|
1096
|
+
this.autoUpdateDelayer = ( new ThrottledDelayer(1000));
|
|
1097
|
+
this._register(toDisposable(() => {
|
|
1098
|
+
this.updatesCheckDelayer.cancel();
|
|
1099
|
+
this.autoUpdateDelayer.cancel();
|
|
1100
|
+
}));
|
|
1101
|
+
urlService.registerHandler(this);
|
|
1102
|
+
this.whenInitialized = this.initialize();
|
|
1103
|
+
}
|
|
1104
|
+
async initialize() {
|
|
1105
|
+
await Promise.all([
|
|
1106
|
+
this.queryLocal(),
|
|
1107
|
+
this.extensionService.whenInstalledExtensionsRegistered()
|
|
1108
|
+
]);
|
|
1109
|
+
if (this._store.isDisposed) {
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
this.onDidChangeRunningExtensions(this.extensionService.extensions, []);
|
|
1113
|
+
this._register(this.extensionService.onDidChangeExtensions((
|
|
1114
|
+
{
|
|
1115
|
+
added,
|
|
1116
|
+
removed
|
|
1117
|
+
}
|
|
1118
|
+
) => this.onDidChangeRunningExtensions(added, removed)));
|
|
1119
|
+
await this.lifecycleService.when(LifecyclePhase.Eventually);
|
|
1120
|
+
if (this._store.isDisposed) {
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
this.initializeAutoUpdate();
|
|
1124
|
+
this.updateExtensionsNotificaiton();
|
|
1125
|
+
this.reportInstalledExtensionsTelemetry();
|
|
1126
|
+
this._register(
|
|
1127
|
+
this.storageService.onDidChangeValue(StorageScope.PROFILE, EXTENSIONS_DISMISSED_NOTIFICATIONS_KEY, this._store)(e => this.onDidDismissedNotificationsValueChange())
|
|
1128
|
+
);
|
|
1129
|
+
this._register(
|
|
1130
|
+
this.storageService.onDidChangeValue(StorageScope.APPLICATION, EXTENSIONS_AUTO_UPDATE_KEY, this._store)(e => this.onDidSelectedExtensionToAutoUpdateValueChange())
|
|
1131
|
+
);
|
|
1132
|
+
this._register(
|
|
1133
|
+
this.storageService.onDidChangeValue(StorageScope.APPLICATION, EXTENSIONS_DONOT_AUTO_UPDATE_KEY, this._store)(e => this.onDidSelectedExtensionToAutoUpdateValueChange())
|
|
1134
|
+
);
|
|
1135
|
+
this._register(Event.debounce(this.onChange, () => undefined, 100)(() => {
|
|
1136
|
+
this.updateExtensionsNotificaiton();
|
|
1137
|
+
this.reportProgressFromOtherSources();
|
|
1138
|
+
}));
|
|
1139
|
+
}
|
|
1140
|
+
initializeAutoUpdate() {
|
|
1141
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
1142
|
+
if (e.affectsConfiguration(AutoUpdateConfigurationKey)) {
|
|
1143
|
+
if (this.isAutoUpdateEnabled()) {
|
|
1144
|
+
this.eventuallyAutoUpdateExtensions();
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
if (e.affectsConfiguration(AutoCheckUpdatesConfigurationKey)) {
|
|
1148
|
+
if (this.isAutoCheckUpdatesEnabled()) {
|
|
1149
|
+
this.checkForUpdates(`Enabled auto check updates`);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}));
|
|
1153
|
+
this._register(
|
|
1154
|
+
this.extensionEnablementService.onEnablementChanged(platformExtensions => {
|
|
1155
|
+
if (this.isAutoCheckUpdatesEnabled() && this.getAutoUpdateValue() === "onlyEnabledExtensions" && ( platformExtensions.some(e => this.extensionEnablementService.isEnabled(e)))) {
|
|
1156
|
+
this.checkForUpdates("Extension enablement changed");
|
|
1157
|
+
}
|
|
1158
|
+
})
|
|
1159
|
+
);
|
|
1160
|
+
this._register(
|
|
1161
|
+
Event.debounce(this.onChange, () => undefined, 100)(() => this.hasOutdatedExtensionsContextKey.set(this.outdated.length > 0))
|
|
1162
|
+
);
|
|
1163
|
+
this._register(this.updateService.onStateChange(e => {
|
|
1164
|
+
if ((e.type === StateType.CheckingForUpdates && e.explicit) || e.type === StateType.AvailableForDownload || e.type === StateType.Downloaded) {
|
|
1165
|
+
this.telemetryService.publicLog2("extensions:updatecheckonproductupdate");
|
|
1166
|
+
if (this.isAutoCheckUpdatesEnabled()) {
|
|
1167
|
+
this.checkForUpdates("Product update");
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}));
|
|
1171
|
+
this._register(
|
|
1172
|
+
this.allowedExtensionsService.onDidChangeAllowedExtensionsConfigValue(() => {
|
|
1173
|
+
if (this.isAutoCheckUpdatesEnabled()) {
|
|
1174
|
+
this.checkForUpdates("Allowed extensions changed");
|
|
1175
|
+
}
|
|
1176
|
+
})
|
|
1177
|
+
);
|
|
1178
|
+
this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(() => {
|
|
1179
|
+
if (this.isAutoCheckUpdatesEnabled()) {
|
|
1180
|
+
this.checkForUpdates("Connection is no longer metered");
|
|
1181
|
+
}
|
|
1182
|
+
if (isWeb && !this.isAutoUpdateEnabled()) {
|
|
1183
|
+
this.autoUpdateBuiltinExtensions();
|
|
1184
|
+
}
|
|
1185
|
+
}));
|
|
1186
|
+
this.hasOutdatedExtensionsContextKey.set(this.outdated.length > 0);
|
|
1187
|
+
this.eventuallyCheckForUpdates(true);
|
|
1188
|
+
if (isWeb) {
|
|
1189
|
+
this.syncPinnedBuiltinExtensions();
|
|
1190
|
+
if (!this.isAutoUpdateEnabled()) {
|
|
1191
|
+
this.autoUpdateBuiltinExtensions();
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
this.registerAutoRestartListener();
|
|
1195
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
1196
|
+
if (e.affectsConfiguration(AutoRestartConfigurationKey)) {
|
|
1197
|
+
this.registerAutoRestartListener();
|
|
1198
|
+
}
|
|
1199
|
+
}));
|
|
1200
|
+
}
|
|
1201
|
+
isAutoUpdateEnabled() {
|
|
1202
|
+
if (this.meteredConnectionService.isConnectionMetered) {
|
|
1203
|
+
return false;
|
|
1204
|
+
}
|
|
1205
|
+
return this.getAutoUpdateValue() !== false;
|
|
1206
|
+
}
|
|
1207
|
+
getAutoUpdateValue() {
|
|
1208
|
+
const autoUpdate = this.configurationService.getValue(AutoUpdateConfigurationKey);
|
|
1209
|
+
if (autoUpdate === "onlySelectedExtensions") {
|
|
1210
|
+
return false;
|
|
1211
|
+
}
|
|
1212
|
+
return isBoolean(autoUpdate) || autoUpdate === "onlyEnabledExtensions" ? autoUpdate : true;
|
|
1213
|
+
}
|
|
1214
|
+
async updateAutoUpdateForAllExtensions(isAutoUpdateEnabled) {
|
|
1215
|
+
const wasAutoUpdateEnabled = this.isAutoUpdateEnabled();
|
|
1216
|
+
if (wasAutoUpdateEnabled === isAutoUpdateEnabled) {
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
const result = await this.dialogService.confirm({
|
|
1220
|
+
title: ( localize(9892, "Auto Update Extensions")),
|
|
1221
|
+
message: isAutoUpdateEnabled ? ( localize(9893, "Do you want to enable auto update for all extensions?")) : ( localize(9894, "Do you want to disable auto update for all extensions?")),
|
|
1222
|
+
detail: ( localize(
|
|
1223
|
+
9895,
|
|
1224
|
+
"This will reset any auto update settings you have set for individual extensions."
|
|
1225
|
+
))
|
|
1226
|
+
});
|
|
1227
|
+
if (!result.confirmed) {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
this.setEnabledAutoUpdateExtensions([]);
|
|
1231
|
+
await this.configurationService.updateValue(AutoUpdateConfigurationKey, isAutoUpdateEnabled);
|
|
1232
|
+
this.setDisabledAutoUpdateExtensions([]);
|
|
1233
|
+
await this.updateExtensionsPinnedState(!isAutoUpdateEnabled);
|
|
1234
|
+
this._onChange.fire(undefined);
|
|
1235
|
+
}
|
|
1236
|
+
registerAutoRestartListener() {
|
|
1237
|
+
this.autoRestartListenerDisposable.value = undefined;
|
|
1238
|
+
if (this.configurationService.getValue(AutoRestartConfigurationKey) === true) {
|
|
1239
|
+
this.autoRestartListenerDisposable.value = this.hostService.onDidChangeFocus(focus => {
|
|
1240
|
+
if (!focus && this.configurationService.getValue(AutoRestartConfigurationKey) === true) {
|
|
1241
|
+
this.updateRunningExtensions(undefined, true);
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
reportInstalledExtensionsTelemetry() {
|
|
1247
|
+
const extensionIds = ( this.installed.filter(
|
|
1248
|
+
extension => !extension.isBuiltin && (extension.enablementState === EnablementState.EnabledWorkspace || extension.enablementState === EnablementState.EnabledGlobally)
|
|
1249
|
+
).map(extension => ExtensionIdentifier.toKey(extension.identifier.id)));
|
|
1250
|
+
this.telemetryService.publicLog2("installedExtensions", {
|
|
1251
|
+
extensionIds: ( new TelemetryTrustedValue(extensionIds.join(";"))),
|
|
1252
|
+
count: extensionIds.length
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
async onDidChangeRunningExtensions(added, removed) {
|
|
1256
|
+
const changedExtensions = [];
|
|
1257
|
+
const extensionsToFetch = [];
|
|
1258
|
+
for (const desc of added) {
|
|
1259
|
+
const extension = this.installed.find(e => areSameExtensions({
|
|
1260
|
+
id: desc.identifier.value,
|
|
1261
|
+
uuid: desc.uuid
|
|
1262
|
+
}, e.identifier));
|
|
1263
|
+
if (extension) {
|
|
1264
|
+
changedExtensions.push(extension);
|
|
1265
|
+
} else {
|
|
1266
|
+
extensionsToFetch.push(desc);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
const workspaceExtensions = [];
|
|
1270
|
+
for (const desc of removed) {
|
|
1271
|
+
if (this.workspaceContextService.isInsideWorkspace(desc.extensionLocation)) {
|
|
1272
|
+
workspaceExtensions.push(desc);
|
|
1273
|
+
} else {
|
|
1274
|
+
extensionsToFetch.push(desc);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
if (extensionsToFetch.length) {
|
|
1278
|
+
const extensions = await this.getExtensions(( extensionsToFetch.map(e => ({
|
|
1279
|
+
id: e.identifier.value,
|
|
1280
|
+
uuid: e.uuid
|
|
1281
|
+
}))), CancellationToken.None);
|
|
1282
|
+
changedExtensions.push(...extensions);
|
|
1283
|
+
}
|
|
1284
|
+
if (workspaceExtensions.length) {
|
|
1285
|
+
const extensions = await this.getResourceExtensions(( workspaceExtensions.map(e => e.extensionLocation)), true);
|
|
1286
|
+
changedExtensions.push(...extensions);
|
|
1287
|
+
}
|
|
1288
|
+
for (const changedExtension of changedExtensions) {
|
|
1289
|
+
this._onChange.fire(changedExtension);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
updateExtensionsPinnedState(pinned) {
|
|
1293
|
+
return this.progressService.withProgress({
|
|
1294
|
+
location: ProgressLocation.Extensions,
|
|
1295
|
+
title: ( localize(9896, "Updating Extensions Auto Update State"))
|
|
1296
|
+
}, () => this.extensionManagementService.resetPinnedStateForAllUserExtensions(pinned));
|
|
1297
|
+
}
|
|
1298
|
+
reset() {
|
|
1299
|
+
for (const task of this.tasksInProgress) {
|
|
1300
|
+
task.cancel();
|
|
1301
|
+
}
|
|
1302
|
+
this.tasksInProgress = [];
|
|
1303
|
+
this.installing = [];
|
|
1304
|
+
this.onDidChangeExtensions();
|
|
1305
|
+
this._onReset.fire();
|
|
1306
|
+
}
|
|
1307
|
+
onDidChangeExtensions(extension) {
|
|
1308
|
+
this._installed = undefined;
|
|
1309
|
+
this._local = undefined;
|
|
1310
|
+
this._onChange.fire(extension);
|
|
1311
|
+
}
|
|
1312
|
+
get local() {
|
|
1313
|
+
if (!this._local) {
|
|
1314
|
+
if (this.extensionsServers.length === 1) {
|
|
1315
|
+
this._local = this.installed;
|
|
1316
|
+
} else {
|
|
1317
|
+
this._local = [];
|
|
1318
|
+
const byId = groupByExtension(this.installed, r => r.identifier);
|
|
1319
|
+
for (const extensions of byId) {
|
|
1320
|
+
this._local.push(this.getPrimaryExtension(extensions));
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return this._local;
|
|
1325
|
+
}
|
|
1326
|
+
get installed() {
|
|
1327
|
+
if (!this._installed) {
|
|
1328
|
+
this._installed = [];
|
|
1329
|
+
for (const extensions of this.extensionsServers) {
|
|
1330
|
+
for (const extension of extensions.local) {
|
|
1331
|
+
this._installed.push(extension);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
return this._installed;
|
|
1336
|
+
}
|
|
1337
|
+
get outdated() {
|
|
1338
|
+
return this.installed.filter(e => e.outdated && e.local && e.state === ExtensionState.Installed);
|
|
1339
|
+
}
|
|
1340
|
+
async queryLocal(server) {
|
|
1341
|
+
if (server) {
|
|
1342
|
+
if (this.localExtensions && this.extensionManagementServerService.localExtensionManagementServer === server) {
|
|
1343
|
+
return this.localExtensions.queryInstalled(this.getProductVersion());
|
|
1344
|
+
}
|
|
1345
|
+
if (this.remoteExtensions && this.extensionManagementServerService.remoteExtensionManagementServer === server) {
|
|
1346
|
+
return this.remoteExtensions.queryInstalled(this.getProductVersion());
|
|
1347
|
+
}
|
|
1348
|
+
if (this.webExtensions && this.extensionManagementServerService.webExtensionManagementServer === server) {
|
|
1349
|
+
return this.webExtensions.queryInstalled(this.getProductVersion());
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
if (this.localExtensions) {
|
|
1353
|
+
try {
|
|
1354
|
+
await this.localExtensions.queryInstalled(this.getProductVersion());
|
|
1355
|
+
} catch (error) {
|
|
1356
|
+
this.logService.error(error);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
if (this.remoteExtensions) {
|
|
1360
|
+
try {
|
|
1361
|
+
await this.remoteExtensions.queryInstalled(this.getProductVersion());
|
|
1362
|
+
} catch (error) {
|
|
1363
|
+
this.logService.error(error);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
if (this.webExtensions) {
|
|
1367
|
+
try {
|
|
1368
|
+
await this.webExtensions.queryInstalled(this.getProductVersion());
|
|
1369
|
+
} catch (error) {
|
|
1370
|
+
this.logService.error(error);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return this.local;
|
|
1374
|
+
}
|
|
1375
|
+
async queryGallery(arg1, arg2) {
|
|
1376
|
+
if (!this.galleryService.isEnabled()) {
|
|
1377
|
+
return singlePagePager([]);
|
|
1378
|
+
}
|
|
1379
|
+
const options = CancellationToken.isCancellationToken(arg1) ? {} : arg1;
|
|
1380
|
+
const token = CancellationToken.isCancellationToken(arg1) ? arg1 : arg2;
|
|
1381
|
+
options.text = options.text ? this.resolveQueryText(options.text) : options.text;
|
|
1382
|
+
options.includePreRelease = isUndefined(options.includePreRelease) ? this.extensionManagementService.preferPreReleases : options.includePreRelease;
|
|
1383
|
+
const extensionsControlManifest = await this.extensionManagementService.getExtensionsControlManifest();
|
|
1384
|
+
const pager = await this.galleryService.query(options, token);
|
|
1385
|
+
this.syncInstalledExtensionsWithGallery(pager.firstPage);
|
|
1386
|
+
return {
|
|
1387
|
+
firstPage: ( pager.firstPage.map(gallery => this.fromGallery(gallery, extensionsControlManifest))),
|
|
1388
|
+
total: pager.total,
|
|
1389
|
+
pageSize: pager.pageSize,
|
|
1390
|
+
getPage: async (pageIndex, token) => {
|
|
1391
|
+
const page = await pager.getPage(pageIndex, token);
|
|
1392
|
+
this.syncInstalledExtensionsWithGallery(page);
|
|
1393
|
+
return ( page.map(gallery => this.fromGallery(gallery, extensionsControlManifest)));
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
async getExtensions(extensionInfos, arg1, arg2) {
|
|
1398
|
+
if (!this.galleryService.isEnabled()) {
|
|
1399
|
+
return [];
|
|
1400
|
+
}
|
|
1401
|
+
extensionInfos.forEach(
|
|
1402
|
+
e => e.preRelease = e.preRelease ?? this.extensionManagementService.preferPreReleases
|
|
1403
|
+
);
|
|
1404
|
+
const extensionsControlManifest = await this.extensionManagementService.getExtensionsControlManifest();
|
|
1405
|
+
const galleryExtensions = await this.galleryService.getExtensions(extensionInfos, arg1, arg2);
|
|
1406
|
+
this.syncInstalledExtensionsWithGallery(galleryExtensions);
|
|
1407
|
+
return ( galleryExtensions.map(gallery => this.fromGallery(gallery, extensionsControlManifest)));
|
|
1408
|
+
}
|
|
1409
|
+
async getResourceExtensions(locations, isWorkspaceScoped) {
|
|
1410
|
+
const resourceExtensions = await this.extensionManagementService.getExtensions(locations);
|
|
1411
|
+
return ( resourceExtensions.map(
|
|
1412
|
+
resourceExtension => this.getInstalledExtensionMatchingLocation(resourceExtension.location) ?? this.instantiationService.createInstance(
|
|
1413
|
+
Extension,
|
|
1414
|
+
ext => this.getExtensionState(ext),
|
|
1415
|
+
ext => this.getRuntimeState(ext),
|
|
1416
|
+
undefined,
|
|
1417
|
+
undefined,
|
|
1418
|
+
undefined,
|
|
1419
|
+
{
|
|
1420
|
+
resourceExtension,
|
|
1421
|
+
isWorkspaceScoped
|
|
1422
|
+
}
|
|
1423
|
+
)
|
|
1424
|
+
));
|
|
1425
|
+
}
|
|
1426
|
+
onDidDismissedNotificationsValueChange() {
|
|
1427
|
+
if (this.dismissedNotificationsValue !== this.getDismissedNotificationsValue() ) {
|
|
1428
|
+
this._dismissedNotificationsValue = undefined;
|
|
1429
|
+
this.updateExtensionsNotificaiton();
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
updateExtensionsNotificaiton() {
|
|
1433
|
+
const computedNotificiations = this.computeExtensionsNotifications();
|
|
1434
|
+
const dismissedNotifications = [];
|
|
1435
|
+
let extensionsNotification;
|
|
1436
|
+
if (computedNotificiations.length) {
|
|
1437
|
+
for (const dismissedNotification of this.getDismissedNotifications()) {
|
|
1438
|
+
if (( computedNotificiations.some(e => e.key === dismissedNotification))) {
|
|
1439
|
+
dismissedNotifications.push(dismissedNotification);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
if (!dismissedNotifications.includes(computedNotificiations[0].key)) {
|
|
1443
|
+
extensionsNotification = {
|
|
1444
|
+
message: computedNotificiations[0].message,
|
|
1445
|
+
severity: computedNotificiations[0].severity,
|
|
1446
|
+
extensions: computedNotificiations[0].extensions,
|
|
1447
|
+
query: computedNotificiations[0].query,
|
|
1448
|
+
action: computedNotificiations[0].action,
|
|
1449
|
+
key: computedNotificiations[0].key,
|
|
1450
|
+
dismiss: () => {
|
|
1451
|
+
this.setDismissedNotifications([...this.getDismissedNotifications(), computedNotificiations[0].key]);
|
|
1452
|
+
this.updateExtensionsNotificaiton();
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
this.setDismissedNotifications(dismissedNotifications);
|
|
1458
|
+
if (this.extensionsNotification?.key !== extensionsNotification?.key) {
|
|
1459
|
+
this.extensionsNotification = extensionsNotification;
|
|
1460
|
+
this._onDidChangeExtensionsNotification.fire(this.extensionsNotification);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
computeExtensionsNotifications() {
|
|
1464
|
+
const computedNotificiations = [];
|
|
1465
|
+
const disallowedExtensions = this.local.filter(e => e.enablementState === EnablementState.DisabledByAllowlist);
|
|
1466
|
+
if (disallowedExtensions.length) {
|
|
1467
|
+
computedNotificiations.push({
|
|
1468
|
+
message: this.configurationService.inspect(AllowedExtensionsConfigKey).policy ? ( localize(
|
|
1469
|
+
9897,
|
|
1470
|
+
"Some extensions are disabled because they are not allowed by your system administrator."
|
|
1471
|
+
)) : ( localize(
|
|
1472
|
+
9898,
|
|
1473
|
+
"Some extensions are disabled because they are configured not to be allowed."
|
|
1474
|
+
)),
|
|
1475
|
+
severity: Severity$1.Warning,
|
|
1476
|
+
extensions: disallowedExtensions,
|
|
1477
|
+
key: "disallowedExtensions:" + ( disallowedExtensions.sort((a, b) => a.identifier.id.localeCompare(b.identifier.id)).map(e => e.identifier.id.toLowerCase())).join("-")
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
const invalidExtensions = this.local.filter(
|
|
1481
|
+
e => e.enablementState === EnablementState.DisabledByInvalidExtension && !e.isWorkspaceScoped
|
|
1482
|
+
);
|
|
1483
|
+
if (invalidExtensions.length) {
|
|
1484
|
+
if (( invalidExtensions.some(e => e.local && e.local.manifest.engines?.vscode && (!isEngineValid(
|
|
1485
|
+
e.local.manifest.engines.vscode,
|
|
1486
|
+
this.productService.version,
|
|
1487
|
+
this.productService.date
|
|
1488
|
+
) || areApiProposalsCompatible([...(e.local.manifest.enabledApiProposals ?? [])]))))) {
|
|
1489
|
+
computedNotificiations.push({
|
|
1490
|
+
message: ( localize(
|
|
1491
|
+
9899,
|
|
1492
|
+
"Some extensions are disabled due to version incompatibility. Review and update them."
|
|
1493
|
+
)),
|
|
1494
|
+
severity: Severity$1.Warning,
|
|
1495
|
+
extensions: invalidExtensions,
|
|
1496
|
+
key: "incompatibleExtensions:" + ( invalidExtensions.sort((a, b) => a.identifier.id.localeCompare(b.identifier.id)).map(e => `${e.identifier.id.toLowerCase()}@${e.local?.manifest.version}`)).join("-")
|
|
1497
|
+
});
|
|
1498
|
+
} else {
|
|
1499
|
+
computedNotificiations.push({
|
|
1500
|
+
message: ( localize(9900, "Invalid extensions detected. Review them.")),
|
|
1501
|
+
severity: Severity$1.Warning,
|
|
1502
|
+
extensions: invalidExtensions,
|
|
1503
|
+
key: "invalidExtensions:" + ( invalidExtensions.sort((a, b) => a.identifier.id.localeCompare(b.identifier.id)).map(e => `${e.identifier.id.toLowerCase()}@${e.local?.manifest.version}`)).join("-")
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
if (!this.configurationService.getValue(AutoRestartConfigurationKey)) {
|
|
1508
|
+
const restartRequiredExtensions = this.local.filter(
|
|
1509
|
+
e => e.runtimeState !== undefined && (e.runtimeState.action === ExtensionRuntimeActionType.RestartExtensions || e.runtimeState.action === ExtensionRuntimeActionType.ReloadWindow)
|
|
1510
|
+
);
|
|
1511
|
+
if (restartRequiredExtensions.length) {
|
|
1512
|
+
const needsReload = ( restartRequiredExtensions.some(e => e.runtimeState?.action === ExtensionRuntimeActionType.ReloadWindow));
|
|
1513
|
+
computedNotificiations.push({
|
|
1514
|
+
message: needsReload ? ( localize(9901, "Extensions require a window reload to take effect.")) : ( localize(9902, "Extensions require a restart to take effect.")),
|
|
1515
|
+
severity: Severity$1.Info,
|
|
1516
|
+
extensions: restartRequiredExtensions,
|
|
1517
|
+
query: "@restartrequired",
|
|
1518
|
+
action: {
|
|
1519
|
+
label: needsReload ? ( localize(9903, "Reload Window")) : ( localize(9904, "Restart Extensions")),
|
|
1520
|
+
run: () => {
|
|
1521
|
+
if (needsReload) {
|
|
1522
|
+
this.hostService.reload();
|
|
1523
|
+
} else {
|
|
1524
|
+
this.updateRunningExtensions();
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
},
|
|
1528
|
+
key: "restartRequired:" + ( restartRequiredExtensions.sort((a, b) => a.identifier.id.localeCompare(b.identifier.id)).map(e => e.identifier.id.toLowerCase())).join("-")
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
const deprecatedExtensions = this.local.filter(
|
|
1533
|
+
e => !!e.deprecationInfo && e.local && this.extensionEnablementService.isEnabled(e.local)
|
|
1534
|
+
);
|
|
1535
|
+
if (deprecatedExtensions.length) {
|
|
1536
|
+
computedNotificiations.push({
|
|
1537
|
+
message: ( localize(
|
|
1538
|
+
9905,
|
|
1539
|
+
"Deprecated extensions detected. Review them and migrate to alternatives."
|
|
1540
|
+
)),
|
|
1541
|
+
severity: Severity$1.Warning,
|
|
1542
|
+
extensions: deprecatedExtensions,
|
|
1543
|
+
key: "deprecatedExtensions:" + ( deprecatedExtensions.sort((a, b) => a.identifier.id.localeCompare(b.identifier.id)).map(e => e.identifier.id.toLowerCase())).join("-")
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
return computedNotificiations;
|
|
1547
|
+
}
|
|
1548
|
+
getExtensionsNotification() {
|
|
1549
|
+
return this.extensionsNotification;
|
|
1550
|
+
}
|
|
1551
|
+
resolveQueryText(text) {
|
|
1552
|
+
text = text.replace(/@web/g, `tag:"${WEB_EXTENSION_TAG}"`);
|
|
1553
|
+
const extensionRegex = /\bext:([^\s]+)\b/g;
|
|
1554
|
+
if (extensionRegex.test(text)) {
|
|
1555
|
+
text = text.replace(extensionRegex, (m, ext) => {
|
|
1556
|
+
const lookup = this.productService.extensionKeywords || {};
|
|
1557
|
+
const keywords = lookup[ext] || [];
|
|
1558
|
+
const languageId = this.languageService.guessLanguageIdByFilepathOrFirstLine(URI.file(`.${ext}`));
|
|
1559
|
+
const languageName = languageId && this.languageService.getLanguageName(languageId);
|
|
1560
|
+
const languageTag = languageName ? ` tag:"${languageName}"` : "";
|
|
1561
|
+
return `tag:"__ext_${ext}" tag:"__ext_.${ext}" ${( keywords.map(tag => `tag:"${tag}"`)).join(" ")}${languageTag} tag:"${ext}"`;
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
return text.substr(0, 350);
|
|
1565
|
+
}
|
|
1566
|
+
fromGallery(gallery, extensionsControlManifest) {
|
|
1567
|
+
let extension = this.getInstalledExtensionMatchingGallery(gallery);
|
|
1568
|
+
if (!extension) {
|
|
1569
|
+
extension = this.instantiationService.createInstance(
|
|
1570
|
+
Extension,
|
|
1571
|
+
ext => this.getExtensionState(ext),
|
|
1572
|
+
ext => this.getRuntimeState(ext),
|
|
1573
|
+
undefined,
|
|
1574
|
+
undefined,
|
|
1575
|
+
gallery,
|
|
1576
|
+
undefined
|
|
1577
|
+
);
|
|
1578
|
+
extension.setExtensionsControlManifest(extensionsControlManifest);
|
|
1579
|
+
}
|
|
1580
|
+
return extension;
|
|
1581
|
+
}
|
|
1582
|
+
getInstalledExtensionMatchingGallery(gallery) {
|
|
1583
|
+
for (const installed of this.local) {
|
|
1584
|
+
if (installed.identifier.uuid) {
|
|
1585
|
+
if (installed.identifier.uuid === gallery.identifier.uuid) {
|
|
1586
|
+
return installed;
|
|
1587
|
+
}
|
|
1588
|
+
} else if (installed.local?.source !== "resource") {
|
|
1589
|
+
if (areSameExtensions(installed.identifier, gallery.identifier)) {
|
|
1590
|
+
return installed;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
return null;
|
|
1595
|
+
}
|
|
1596
|
+
getInstalledExtensionMatchingLocation(location) {
|
|
1597
|
+
return this.local.find(
|
|
1598
|
+
e => e.local && this.uriIdentityService.extUri.isEqualOrParent(location, e.local?.location)
|
|
1599
|
+
) ?? null;
|
|
1600
|
+
}
|
|
1601
|
+
async open(extension, options) {
|
|
1602
|
+
if (typeof extension === "string") {
|
|
1603
|
+
const id = extension;
|
|
1604
|
+
extension = this.installed.find(e => areSameExtensions(e.identifier, {
|
|
1605
|
+
id
|
|
1606
|
+
})) ?? (await this.getExtensions([{
|
|
1607
|
+
id: extension
|
|
1608
|
+
}], CancellationToken.None))[0];
|
|
1609
|
+
}
|
|
1610
|
+
if (!extension) {
|
|
1611
|
+
throw ( new Error(`Extension not found. ${extension}`));
|
|
1612
|
+
}
|
|
1613
|
+
const useModal = this.configurationService.getValue("extensions.allowOpenInModalEditor");
|
|
1614
|
+
await this.editorService.openEditor(
|
|
1615
|
+
this.instantiationService.createInstance(ExtensionsInput, extension),
|
|
1616
|
+
options,
|
|
1617
|
+
options?.sideByside ? SIDE_GROUP : useModal ? MODAL_GROUP : ACTIVE_GROUP
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
async openSearch(searchValue, preserveFocus) {
|
|
1621
|
+
const viewPaneContainer = (await this.viewsService.openViewContainer(VIEWLET_ID, true))?.getViewPaneContainer();
|
|
1622
|
+
if (!viewPaneContainer) {
|
|
1623
|
+
this.logService.trace(
|
|
1624
|
+
"ExtensionsWorkbenchService#openSearch: extension view pane container was not available"
|
|
1625
|
+
);
|
|
1626
|
+
return;
|
|
1627
|
+
}
|
|
1628
|
+
viewPaneContainer.search(searchValue);
|
|
1629
|
+
if (!preserveFocus) {
|
|
1630
|
+
viewPaneContainer.focus();
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
getExtensionRuntimeStatus(extension) {
|
|
1634
|
+
const extensionsStatus = this.extensionService.getExtensionsStatus();
|
|
1635
|
+
for (const id of ( Object.keys(extensionsStatus))) {
|
|
1636
|
+
if (areSameExtensions({
|
|
1637
|
+
id
|
|
1638
|
+
}, extension.identifier)) {
|
|
1639
|
+
return extensionsStatus[id];
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
return undefined;
|
|
1643
|
+
}
|
|
1644
|
+
async updateRunningExtensions(
|
|
1645
|
+
message = ( localize(9906, "Changing extension enablement")),
|
|
1646
|
+
auto = false
|
|
1647
|
+
) {
|
|
1648
|
+
const toAdd = [];
|
|
1649
|
+
const toRemove = [];
|
|
1650
|
+
const extensionsToCheck = [...this.local];
|
|
1651
|
+
for (const extension of extensionsToCheck) {
|
|
1652
|
+
const runtimeState = extension.runtimeState;
|
|
1653
|
+
if (!runtimeState || runtimeState.action !== ExtensionRuntimeActionType.RestartExtensions) {
|
|
1654
|
+
continue;
|
|
1655
|
+
}
|
|
1656
|
+
if (extension.state === ExtensionState.Uninstalled) {
|
|
1657
|
+
toRemove.push(extension.identifier.id);
|
|
1658
|
+
continue;
|
|
1659
|
+
}
|
|
1660
|
+
if (!extension.local) {
|
|
1661
|
+
continue;
|
|
1662
|
+
}
|
|
1663
|
+
const isEnabled = this.extensionEnablementService.isEnabled(extension.local);
|
|
1664
|
+
if (isEnabled) {
|
|
1665
|
+
const runningExtension = this.extensionService.extensions.find(e => areSameExtensions({
|
|
1666
|
+
id: e.identifier.value,
|
|
1667
|
+
uuid: e.uuid
|
|
1668
|
+
}, extension.identifier));
|
|
1669
|
+
if (runningExtension) {
|
|
1670
|
+
toRemove.push(runningExtension.identifier.value);
|
|
1671
|
+
}
|
|
1672
|
+
toAdd.push(extension.local);
|
|
1673
|
+
} else {
|
|
1674
|
+
toRemove.push(extension.identifier.id);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
for (const extension of this.extensionService.extensions) {
|
|
1678
|
+
if (extension.isUnderDevelopment) {
|
|
1679
|
+
continue;
|
|
1680
|
+
}
|
|
1681
|
+
if (( extensionsToCheck.some(e => areSameExtensions({
|
|
1682
|
+
id: extension.identifier.value,
|
|
1683
|
+
uuid: extension.uuid
|
|
1684
|
+
}, e.local?.identifier ?? e.identifier)))) {
|
|
1685
|
+
continue;
|
|
1686
|
+
}
|
|
1687
|
+
toRemove.push(extension.identifier.value);
|
|
1688
|
+
}
|
|
1689
|
+
if (toAdd.length || toRemove.length) {
|
|
1690
|
+
if (await this.extensionService.stopExtensionHosts(message, auto)) {
|
|
1691
|
+
await this.extensionService.startExtensionHosts({
|
|
1692
|
+
toAdd,
|
|
1693
|
+
toRemove
|
|
1694
|
+
});
|
|
1695
|
+
if (auto) {
|
|
1696
|
+
this.notificationService.notify({
|
|
1697
|
+
severity: Severity$1.Info,
|
|
1698
|
+
message: ( localize(9907, "Extensions were auto restarted to enable updates.")),
|
|
1699
|
+
priority: NotificationPriority.SILENT
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
this.telemetryService.publicLog2("extensions:autorestart", {
|
|
1703
|
+
count: toAdd.length + toRemove.length,
|
|
1704
|
+
auto
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
getRuntimeState(extension) {
|
|
1710
|
+
const isUninstalled = extension.state === ExtensionState.Uninstalled;
|
|
1711
|
+
const runningExtension = this.extensionService.extensions.find(e => areSameExtensions({
|
|
1712
|
+
id: e.identifier.value
|
|
1713
|
+
}, extension.identifier));
|
|
1714
|
+
const reloadAction = this.extensionManagementServerService.remoteExtensionManagementServer ? ExtensionRuntimeActionType.ReloadWindow : ExtensionRuntimeActionType.RestartExtensions;
|
|
1715
|
+
const reloadActionLabel = reloadAction === ExtensionRuntimeActionType.ReloadWindow ? ( localize(9908, "reload window")) : ( localize(9909, "restart extensions"));
|
|
1716
|
+
if (isUninstalled) {
|
|
1717
|
+
const canRemoveRunningExtension = runningExtension && this.extensionService.canRemoveExtension(runningExtension);
|
|
1718
|
+
const isSameExtensionRunning = runningExtension && (!extension.server || extension.server === this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension))) && (!extension.resourceExtension || this.uriIdentityService.extUri.isEqual(extension.resourceExtension.location, runningExtension.extensionLocation));
|
|
1719
|
+
if (!canRemoveRunningExtension && isSameExtensionRunning && !runningExtension.isUnderDevelopment) {
|
|
1720
|
+
return {
|
|
1721
|
+
action: reloadAction,
|
|
1722
|
+
reason: ( localize(
|
|
1723
|
+
9910,
|
|
1724
|
+
"Please {0} to complete the uninstallation of this extension.",
|
|
1725
|
+
reloadActionLabel
|
|
1726
|
+
))
|
|
1727
|
+
};
|
|
1728
|
+
}
|
|
1729
|
+
return undefined;
|
|
1730
|
+
}
|
|
1731
|
+
if (extension.local) {
|
|
1732
|
+
const isSameExtensionRunning = runningExtension && extension.server === this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension));
|
|
1733
|
+
const isEnabled = this.extensionEnablementService.isEnabled(extension.local);
|
|
1734
|
+
if (runningExtension) {
|
|
1735
|
+
if (isEnabled) {
|
|
1736
|
+
if (this.extensionService.canAddExtension(toExtensionDescription(extension.local))) {
|
|
1737
|
+
return undefined;
|
|
1738
|
+
}
|
|
1739
|
+
const runningExtensionServer = this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension));
|
|
1740
|
+
if (isSameExtensionRunning) {
|
|
1741
|
+
if (!runningExtension.isUnderDevelopment && (extension.version !== runningExtension.version || extension.local.targetPlatform !== runningExtension.targetPlatform)) {
|
|
1742
|
+
const productCurrentVersion = this.getProductCurrentVersion();
|
|
1743
|
+
const productUpdateVersion = this.getProductUpdateVersion();
|
|
1744
|
+
if (productUpdateVersion && !isEngineValid(
|
|
1745
|
+
extension.local.manifest.engines.vscode,
|
|
1746
|
+
productCurrentVersion.version,
|
|
1747
|
+
productCurrentVersion.date
|
|
1748
|
+
) && isEngineValid(
|
|
1749
|
+
extension.local.manifest.engines.vscode,
|
|
1750
|
+
productUpdateVersion.version,
|
|
1751
|
+
productUpdateVersion.date
|
|
1752
|
+
)) {
|
|
1753
|
+
const state = this.updateService.state;
|
|
1754
|
+
if (state.type === StateType.AvailableForDownload) {
|
|
1755
|
+
return {
|
|
1756
|
+
action: ExtensionRuntimeActionType.DownloadUpdate,
|
|
1757
|
+
reason: ( localize(
|
|
1758
|
+
9911,
|
|
1759
|
+
"Please update {0} to enable the updated extension.",
|
|
1760
|
+
this.productService.nameLong
|
|
1761
|
+
))
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
if (state.type === StateType.Downloaded) {
|
|
1765
|
+
return {
|
|
1766
|
+
action: ExtensionRuntimeActionType.ApplyUpdate,
|
|
1767
|
+
reason: ( localize(
|
|
1768
|
+
9912,
|
|
1769
|
+
"Please update {0} to enable the updated extension.",
|
|
1770
|
+
this.productService.nameLong
|
|
1771
|
+
))
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
if (state.type === StateType.Ready) {
|
|
1775
|
+
return {
|
|
1776
|
+
action: ExtensionRuntimeActionType.QuitAndInstall,
|
|
1777
|
+
reason: ( localize(
|
|
1778
|
+
9913,
|
|
1779
|
+
"Please restart {0} to enable the updated extension.",
|
|
1780
|
+
this.productService.nameLong
|
|
1781
|
+
))
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
return undefined;
|
|
1785
|
+
}
|
|
1786
|
+
return {
|
|
1787
|
+
action: reloadAction,
|
|
1788
|
+
reason: ( localize(9914, "Please {0} to enable the updated extension.", reloadActionLabel))
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
if (this.extensionsServers.length > 1) {
|
|
1792
|
+
const extensionInOtherServer = this.installed.filter(
|
|
1793
|
+
e => areSameExtensions(e.identifier, extension.identifier) && e.server !== extension.server
|
|
1794
|
+
)[0];
|
|
1795
|
+
if (extensionInOtherServer) {
|
|
1796
|
+
if (runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer && this.extensionManifestPropertiesService.prefersExecuteOnUI(extension.local.manifest) && extensionInOtherServer.server === this.extensionManagementServerService.localExtensionManagementServer) {
|
|
1797
|
+
return {
|
|
1798
|
+
action: reloadAction,
|
|
1799
|
+
reason: ( localize(9915, "Please {0} to enable this extension locally.", reloadActionLabel))
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1802
|
+
if (runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer && this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(extension.local.manifest) && extensionInOtherServer.server === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
|
1803
|
+
return {
|
|
1804
|
+
action: reloadAction,
|
|
1805
|
+
reason: ( localize(
|
|
1806
|
+
9916,
|
|
1807
|
+
"Please {0} to enable this extension in {1}.",
|
|
1808
|
+
reloadActionLabel,
|
|
1809
|
+
this.extensionManagementServerService.remoteExtensionManagementServer?.label
|
|
1810
|
+
))
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
} else {
|
|
1816
|
+
if (extension.server === this.extensionManagementServerService.localExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
|
1817
|
+
if (this.extensionManifestPropertiesService.prefersExecuteOnUI(extension.local.manifest)) {
|
|
1818
|
+
return {
|
|
1819
|
+
action: reloadAction,
|
|
1820
|
+
reason: ( localize(9917, "Please {0} to enable this extension.", reloadActionLabel))
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
if (extension.server === this.extensionManagementServerService.remoteExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer) {
|
|
1825
|
+
if (this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(extension.local.manifest)) {
|
|
1826
|
+
return {
|
|
1827
|
+
action: reloadAction,
|
|
1828
|
+
reason: ( localize(9917, "Please {0} to enable this extension.", reloadActionLabel))
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
return undefined;
|
|
1834
|
+
} else {
|
|
1835
|
+
if (isSameExtensionRunning) {
|
|
1836
|
+
return {
|
|
1837
|
+
action: reloadAction,
|
|
1838
|
+
reason: ( localize(9918, "Please {0} to disable this extension.", reloadActionLabel))
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
return undefined;
|
|
1843
|
+
}
|
|
1844
|
+
else {
|
|
1845
|
+
if (isEnabled && !this.extensionService.canAddExtension(toExtensionDescription(extension.local))) {
|
|
1846
|
+
return {
|
|
1847
|
+
action: reloadAction,
|
|
1848
|
+
reason: ( localize(9917, "Please {0} to enable this extension.", reloadActionLabel))
|
|
1849
|
+
};
|
|
1850
|
+
}
|
|
1851
|
+
const otherServer = extension.server ? extension.server === this.extensionManagementServerService.localExtensionManagementServer ? this.extensionManagementServerService.remoteExtensionManagementServer : this.extensionManagementServerService.localExtensionManagementServer : null;
|
|
1852
|
+
if (otherServer && extension.enablementState === EnablementState.DisabledByExtensionKind) {
|
|
1853
|
+
const extensionInOtherServer = this.local.filter(
|
|
1854
|
+
e => areSameExtensions(e.identifier, extension.identifier) && e.server === otherServer
|
|
1855
|
+
)[0];
|
|
1856
|
+
if (extensionInOtherServer && extensionInOtherServer.local && this.extensionEnablementService.isEnabled(extensionInOtherServer.local)) {
|
|
1857
|
+
return {
|
|
1858
|
+
action: reloadAction,
|
|
1859
|
+
reason: ( localize(9917, "Please {0} to enable this extension.", reloadActionLabel))
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
return undefined;
|
|
1866
|
+
}
|
|
1867
|
+
getPrimaryExtension(extensions) {
|
|
1868
|
+
if (extensions.length === 1) {
|
|
1869
|
+
return extensions[0];
|
|
1870
|
+
}
|
|
1871
|
+
const enabledExtensions = extensions.filter(e => e.local && this.extensionEnablementService.isEnabled(e.local));
|
|
1872
|
+
if (enabledExtensions.length === 1) {
|
|
1873
|
+
return enabledExtensions[0];
|
|
1874
|
+
}
|
|
1875
|
+
const extensionsToChoose = enabledExtensions.length ? enabledExtensions : extensions;
|
|
1876
|
+
const manifest = extensionsToChoose.find(e => e.local && e.local.manifest)?.local?.manifest;
|
|
1877
|
+
if (!manifest) {
|
|
1878
|
+
return extensionsToChoose[0];
|
|
1879
|
+
}
|
|
1880
|
+
const extensionKinds = this.extensionManifestPropertiesService.getExtensionKind(manifest);
|
|
1881
|
+
let extension = extensionsToChoose.find(extension => {
|
|
1882
|
+
for (const extensionKind of extensionKinds) {
|
|
1883
|
+
switch (extensionKind) {
|
|
1884
|
+
case "ui":
|
|
1885
|
+
if (extension.server === this.extensionManagementServerService.localExtensionManagementServer) {
|
|
1886
|
+
return true;
|
|
1887
|
+
}
|
|
1888
|
+
return false;
|
|
1889
|
+
case "workspace":
|
|
1890
|
+
if (extension.server === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
|
1891
|
+
return true;
|
|
1892
|
+
}
|
|
1893
|
+
return false;
|
|
1894
|
+
case "web":
|
|
1895
|
+
if (extension.server === this.extensionManagementServerService.webExtensionManagementServer) {
|
|
1896
|
+
return true;
|
|
1897
|
+
}
|
|
1898
|
+
return false;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
return false;
|
|
1902
|
+
});
|
|
1903
|
+
if (!extension && this.extensionManagementServerService.localExtensionManagementServer) {
|
|
1904
|
+
extension = extensionsToChoose.find(extension => {
|
|
1905
|
+
for (const extensionKind of extensionKinds) {
|
|
1906
|
+
switch (extensionKind) {
|
|
1907
|
+
case "workspace":
|
|
1908
|
+
if (extension.server === this.extensionManagementServerService.localExtensionManagementServer) {
|
|
1909
|
+
return true;
|
|
1910
|
+
}
|
|
1911
|
+
return false;
|
|
1912
|
+
case "web":
|
|
1913
|
+
if (extension.server === this.extensionManagementServerService.localExtensionManagementServer) {
|
|
1914
|
+
return true;
|
|
1915
|
+
}
|
|
1916
|
+
return false;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
return false;
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
if (!extension && this.extensionManagementServerService.webExtensionManagementServer) {
|
|
1923
|
+
extension = extensionsToChoose.find(extension => {
|
|
1924
|
+
for (const extensionKind of extensionKinds) {
|
|
1925
|
+
switch (extensionKind) {
|
|
1926
|
+
case "web":
|
|
1927
|
+
if (extension.server === this.extensionManagementServerService.webExtensionManagementServer) {
|
|
1928
|
+
return true;
|
|
1929
|
+
}
|
|
1930
|
+
return false;
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
return false;
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
if (!extension && this.extensionManagementServerService.remoteExtensionManagementServer) {
|
|
1937
|
+
extension = extensionsToChoose.find(extension => {
|
|
1938
|
+
for (const extensionKind of extensionKinds) {
|
|
1939
|
+
switch (extensionKind) {
|
|
1940
|
+
case "web":
|
|
1941
|
+
if (extension.server === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
|
1942
|
+
return true;
|
|
1943
|
+
}
|
|
1944
|
+
return false;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
return false;
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
return extension || extensions[0];
|
|
1951
|
+
}
|
|
1952
|
+
getExtensionState(extension) {
|
|
1953
|
+
if (( this.installing.some(
|
|
1954
|
+
i => areSameExtensions(i.identifier, extension.identifier) && (!extension.server || i.server === extension.server)
|
|
1955
|
+
))) {
|
|
1956
|
+
return ExtensionState.Installing;
|
|
1957
|
+
}
|
|
1958
|
+
if (this.remoteExtensions) {
|
|
1959
|
+
const state = this.remoteExtensions.getExtensionState(extension);
|
|
1960
|
+
if (state !== ExtensionState.Uninstalled) {
|
|
1961
|
+
return state;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
if (this.webExtensions) {
|
|
1965
|
+
const state = this.webExtensions.getExtensionState(extension);
|
|
1966
|
+
if (state !== ExtensionState.Uninstalled) {
|
|
1967
|
+
return state;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
if (this.localExtensions) {
|
|
1971
|
+
return this.localExtensions.getExtensionState(extension);
|
|
1972
|
+
}
|
|
1973
|
+
return ExtensionState.Uninstalled;
|
|
1974
|
+
}
|
|
1975
|
+
async checkForUpdates(reason, onlyBuiltin) {
|
|
1976
|
+
if (reason) {
|
|
1977
|
+
this.logService.trace(`[Extensions]: Checking for updates. Reason: ${reason}`);
|
|
1978
|
+
} else {
|
|
1979
|
+
this.logService.trace(`[Extensions]: Checking for updates`);
|
|
1980
|
+
}
|
|
1981
|
+
if (!this.galleryService.isEnabled()) {
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
const extensions = [];
|
|
1985
|
+
if (this.localExtensions) {
|
|
1986
|
+
extensions.push(this.localExtensions);
|
|
1987
|
+
}
|
|
1988
|
+
if (this.remoteExtensions) {
|
|
1989
|
+
extensions.push(this.remoteExtensions);
|
|
1990
|
+
}
|
|
1991
|
+
if (this.webExtensions) {
|
|
1992
|
+
extensions.push(this.webExtensions);
|
|
1993
|
+
}
|
|
1994
|
+
if (!extensions.length) {
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
const infos = [];
|
|
1998
|
+
for (const installed of this.local) {
|
|
1999
|
+
if (onlyBuiltin && !installed.isBuiltin) {
|
|
2000
|
+
continue;
|
|
2001
|
+
}
|
|
2002
|
+
if (!installed.local?.forceAutoUpdate && installed.isBuiltin && !installed.local?.pinned && (installed.type === ExtensionType.System || !installed.local?.identifier.uuid)) {
|
|
2003
|
+
continue;
|
|
2004
|
+
}
|
|
2005
|
+
if (installed.local?.source === "resource") {
|
|
2006
|
+
continue;
|
|
2007
|
+
}
|
|
2008
|
+
infos.push({
|
|
2009
|
+
...installed.identifier,
|
|
2010
|
+
preRelease: !!installed.local?.preRelease,
|
|
2011
|
+
currentVersion: installed.isBuiltin ? installed.version : undefined
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
if (infos.length) {
|
|
2015
|
+
const targetPlatform = await extensions[0].server.extensionManagementService.getTargetPlatform();
|
|
2016
|
+
this.telemetryService.publicLog2("galleryService:checkingForUpdates", {
|
|
2017
|
+
count: infos.length
|
|
2018
|
+
});
|
|
2019
|
+
this.logService.trace(`Checking updates for extensions`, ( infos.map(e => e.id)).join(", "));
|
|
2020
|
+
const galleryExtensions = await this.galleryService.getExtensions(infos, {
|
|
2021
|
+
targetPlatform,
|
|
2022
|
+
compatible: true,
|
|
2023
|
+
productVersion: this.getProductVersion()
|
|
2024
|
+
}, CancellationToken.None);
|
|
2025
|
+
if (galleryExtensions.length) {
|
|
2026
|
+
await this.syncInstalledExtensionsWithGallery(galleryExtensions, infos);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
async updateAll() {
|
|
2031
|
+
const toUpdate = [];
|
|
2032
|
+
this.outdated.forEach(extension => {
|
|
2033
|
+
if (extension.gallery) {
|
|
2034
|
+
toUpdate.push({
|
|
2035
|
+
extension: extension.gallery,
|
|
2036
|
+
options: {
|
|
2037
|
+
operation: InstallOperation.Update,
|
|
2038
|
+
installPreReleaseVersion: extension.local?.isPreReleaseVersion,
|
|
2039
|
+
profileLocation: this.userDataProfileService.currentProfile.extensionsResource,
|
|
2040
|
+
isApplicationScoped: extension.local?.isApplicationScoped,
|
|
2041
|
+
context: {
|
|
2042
|
+
[EXTENSION_INSTALL_SKIP_PUBLISHER_TRUST_CONTEXT]: true
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
});
|
|
2048
|
+
return this.extensionManagementService.installGalleryExtensions(toUpdate);
|
|
2049
|
+
}
|
|
2050
|
+
async downloadVSIX(extensionId, versionKind) {
|
|
2051
|
+
let version;
|
|
2052
|
+
if (versionKind === "any") {
|
|
2053
|
+
version = await this.pickVersionToDownload(extensionId);
|
|
2054
|
+
if (!version) {
|
|
2055
|
+
return;
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
const extensionInfo = version ? {
|
|
2059
|
+
id: extensionId,
|
|
2060
|
+
version: version.version
|
|
2061
|
+
} : {
|
|
2062
|
+
id: extensionId,
|
|
2063
|
+
preRelease: versionKind === "prerelease"
|
|
2064
|
+
};
|
|
2065
|
+
const queryOptions = version ? {} : {
|
|
2066
|
+
compatible: true
|
|
2067
|
+
};
|
|
2068
|
+
let [galleryExtension] = await this.galleryService.getExtensions([extensionInfo], queryOptions, CancellationToken.None);
|
|
2069
|
+
if (!galleryExtension) {
|
|
2070
|
+
throw ( new Error(( localize(9919, "Extension '{0}' not found.", extensionId))));
|
|
2071
|
+
}
|
|
2072
|
+
let targetPlatform = galleryExtension.properties.targetPlatform;
|
|
2073
|
+
const options = [];
|
|
2074
|
+
for (const targetPlatform of version?.targetPlatforms ?? galleryExtension.allTargetPlatforms) {
|
|
2075
|
+
if (targetPlatform !== TargetPlatform.UNKNOWN && targetPlatform !== TargetPlatform.UNIVERSAL) {
|
|
2076
|
+
options.push({
|
|
2077
|
+
label: targetPlatform === TargetPlatform.UNDEFINED ? ( localize(9920, "All Platforms")) : TargetPlatformToString(targetPlatform),
|
|
2078
|
+
id: targetPlatform
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
if (options.length > 1) {
|
|
2083
|
+
const message = ( localize(9921, "Please select the platform for which you want to download the VSIX"));
|
|
2084
|
+
const option = await this.quickInputService.pick(options.sort((a, b) => a.label.localeCompare(b.label)), {
|
|
2085
|
+
placeHolder: message
|
|
2086
|
+
});
|
|
2087
|
+
if (!option) {
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2090
|
+
targetPlatform = option.id;
|
|
2091
|
+
}
|
|
2092
|
+
if (targetPlatform !== galleryExtension.properties.targetPlatform) {
|
|
2093
|
+
[galleryExtension] = await this.galleryService.getExtensions([extensionInfo], {
|
|
2094
|
+
...queryOptions,
|
|
2095
|
+
targetPlatform
|
|
2096
|
+
}, CancellationToken.None);
|
|
2097
|
+
}
|
|
2098
|
+
const result = await this.fileDialogService.showOpenDialog({
|
|
2099
|
+
title: ( localize(9922, "Select folder to download the VSIX")),
|
|
2100
|
+
canSelectFiles: false,
|
|
2101
|
+
canSelectFolders: true,
|
|
2102
|
+
canSelectMany: false,
|
|
2103
|
+
openLabel: ( localize(9923, "Download"))
|
|
2104
|
+
});
|
|
2105
|
+
if (!result?.[0]) {
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
this.progressService.withProgress({
|
|
2109
|
+
location: ProgressLocation.Notification
|
|
2110
|
+
}, async progress => {
|
|
2111
|
+
try {
|
|
2112
|
+
progress.report({
|
|
2113
|
+
message: ( localize(9924, "Downloading VSIX..."))
|
|
2114
|
+
});
|
|
2115
|
+
const name = `${galleryExtension.identifier.id}-${galleryExtension.version}${targetPlatform !== TargetPlatform.UNDEFINED && targetPlatform !== TargetPlatform.UNIVERSAL && targetPlatform !== TargetPlatform.UNKNOWN ? `-${targetPlatform}` : ""}.vsix`;
|
|
2116
|
+
await this.galleryService.download(
|
|
2117
|
+
galleryExtension,
|
|
2118
|
+
this.uriIdentityService.extUri.joinPath(result[0], name),
|
|
2119
|
+
InstallOperation.None
|
|
2120
|
+
);
|
|
2121
|
+
this.notificationService.info(( localize(9925, "Successfully downloaded the VSIX")));
|
|
2122
|
+
} catch (error) {
|
|
2123
|
+
this.notificationService.error(( localize(9926, "Error while downloading the VSIX: {0}", getErrorMessage(error))));
|
|
2124
|
+
}
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
async pickVersionToDownload(extensionId) {
|
|
2128
|
+
const allVersions = await this.galleryService.getAllVersions({
|
|
2129
|
+
id: extensionId
|
|
2130
|
+
});
|
|
2131
|
+
if (!allVersions.length) {
|
|
2132
|
+
await this.dialogService.info(( localize(9927, "This extension has no other versions.")));
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
const picks = ( allVersions.map((v, i) => {
|
|
2136
|
+
return {
|
|
2137
|
+
id: v.version,
|
|
2138
|
+
label: v.version,
|
|
2139
|
+
description: `${fromNow(( new Date(Date.parse(v.date))), true)}${v.isPreReleaseVersion ? ` (${( localize(9928, "pre-release"))})` : ""}`,
|
|
2140
|
+
ariaLabel: `${v.isPreReleaseVersion ? "Pre-Release version" : "Release version"} ${v.version}`,
|
|
2141
|
+
data: v
|
|
2142
|
+
};
|
|
2143
|
+
}));
|
|
2144
|
+
const pick = await this.quickInputService.pick(picks, {
|
|
2145
|
+
placeHolder: ( localize(9929, "Select Version to Download")),
|
|
2146
|
+
matchOnDetail: true
|
|
2147
|
+
});
|
|
2148
|
+
return pick?.data;
|
|
2149
|
+
}
|
|
2150
|
+
async syncInstalledExtensionsWithGallery(gallery, flagExtensionsMissingFromGallery) {
|
|
2151
|
+
const extensions = [];
|
|
2152
|
+
if (this.localExtensions) {
|
|
2153
|
+
extensions.push(this.localExtensions);
|
|
2154
|
+
}
|
|
2155
|
+
if (this.remoteExtensions) {
|
|
2156
|
+
extensions.push(this.remoteExtensions);
|
|
2157
|
+
}
|
|
2158
|
+
if (this.webExtensions) {
|
|
2159
|
+
extensions.push(this.webExtensions);
|
|
2160
|
+
}
|
|
2161
|
+
if (!extensions.length) {
|
|
2162
|
+
return;
|
|
2163
|
+
}
|
|
2164
|
+
await Promise.allSettled(( extensions.map(
|
|
2165
|
+
extensions => extensions.syncInstalledExtensionsWithGallery(gallery, this.getProductVersion(), flagExtensionsMissingFromGallery)
|
|
2166
|
+
)));
|
|
2167
|
+
if (this.outdated.length) {
|
|
2168
|
+
this.logService.info(`Auto updating outdated extensions.`, ( this.outdated.map(e => e.identifier.id)).join(", "));
|
|
2169
|
+
this.eventuallyAutoUpdateExtensions();
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
isAutoCheckUpdatesEnabled() {
|
|
2173
|
+
if (this.meteredConnectionService.isConnectionMetered) {
|
|
2174
|
+
return false;
|
|
2175
|
+
}
|
|
2176
|
+
return this.configurationService.getValue(AutoCheckUpdatesConfigurationKey);
|
|
2177
|
+
}
|
|
2178
|
+
eventuallyCheckForUpdates(immediate = false) {
|
|
2179
|
+
this.updatesCheckDelayer.cancel();
|
|
2180
|
+
this.updatesCheckDelayer.trigger(async () => {
|
|
2181
|
+
if (this.isAutoCheckUpdatesEnabled()) {
|
|
2182
|
+
await this.checkForUpdates();
|
|
2183
|
+
}
|
|
2184
|
+
this.eventuallyCheckForUpdates();
|
|
2185
|
+
}, immediate ? 0 : this.getUpdatesCheckInterval()).then(undefined, err => null);
|
|
2186
|
+
}
|
|
2187
|
+
getUpdatesCheckInterval() {
|
|
2188
|
+
if (this.productService.quality === "insider" && this.getProductUpdateVersion()) {
|
|
2189
|
+
return 1000 * 60 * 60 * 1;
|
|
2190
|
+
}
|
|
2191
|
+
return ExtensionsWorkbenchService_1.UpdatesCheckInterval;
|
|
2192
|
+
}
|
|
2193
|
+
eventuallyAutoUpdateExtensions() {
|
|
2194
|
+
this.autoUpdateDelayer.trigger(() => this.autoUpdateExtensions()).then(undefined, err => null);
|
|
2195
|
+
}
|
|
2196
|
+
async autoUpdateBuiltinExtensions() {
|
|
2197
|
+
if (this.meteredConnectionService.isConnectionMetered) {
|
|
2198
|
+
return;
|
|
2199
|
+
}
|
|
2200
|
+
await this.checkForUpdates(undefined, true);
|
|
2201
|
+
const toUpdate = this.outdated.filter(e => e.isBuiltin);
|
|
2202
|
+
await Promises.settled(( toUpdate.map(e => this.install(e, e.local?.preRelease ? {
|
|
2203
|
+
installPreReleaseVersion: true
|
|
2204
|
+
} : undefined))));
|
|
2205
|
+
}
|
|
2206
|
+
async syncPinnedBuiltinExtensions() {
|
|
2207
|
+
const infos = [];
|
|
2208
|
+
for (const installed of this.local) {
|
|
2209
|
+
if (installed.isBuiltin && installed.local?.pinned && installed.local?.identifier.uuid) {
|
|
2210
|
+
infos.push({
|
|
2211
|
+
...installed.identifier,
|
|
2212
|
+
version: installed.version
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
if (infos.length) {
|
|
2217
|
+
const galleryExtensions = await this.galleryService.getExtensions(infos, CancellationToken.None);
|
|
2218
|
+
if (galleryExtensions.length) {
|
|
2219
|
+
await this.syncInstalledExtensionsWithGallery(galleryExtensions);
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
async autoUpdateExtensions() {
|
|
2224
|
+
if (this.meteredConnectionService.isConnectionMetered) {
|
|
2225
|
+
this.logService.trace("[Extensions]: Skipping auto-update because connection is metered");
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
const toUpdate = [];
|
|
2229
|
+
const disabledAutoUpdate = [];
|
|
2230
|
+
const consentRequired = [];
|
|
2231
|
+
for (const extension of this.outdated) {
|
|
2232
|
+
if (!this.shouldAutoUpdateExtension(extension)) {
|
|
2233
|
+
disabledAutoUpdate.push(extension.identifier.id);
|
|
2234
|
+
continue;
|
|
2235
|
+
}
|
|
2236
|
+
if (await this.shouldRequireConsentToUpdate(extension)) {
|
|
2237
|
+
consentRequired.push(extension.identifier.id);
|
|
2238
|
+
continue;
|
|
2239
|
+
}
|
|
2240
|
+
toUpdate.push(extension);
|
|
2241
|
+
}
|
|
2242
|
+
if (disabledAutoUpdate.length) {
|
|
2243
|
+
this.logService.trace("Auto update disabled for extensions", disabledAutoUpdate.join(", "));
|
|
2244
|
+
}
|
|
2245
|
+
if (consentRequired.length) {
|
|
2246
|
+
this.logService.info("Auto update consent required for extensions", consentRequired.join(", "));
|
|
2247
|
+
}
|
|
2248
|
+
if (!toUpdate.length) {
|
|
2249
|
+
return;
|
|
2250
|
+
}
|
|
2251
|
+
const productVersion = this.getProductVersion();
|
|
2252
|
+
await Promises.settled(( toUpdate.map(e => this.install(e, e.local?.preRelease ? {
|
|
2253
|
+
installPreReleaseVersion: true,
|
|
2254
|
+
productVersion
|
|
2255
|
+
} : {
|
|
2256
|
+
productVersion
|
|
2257
|
+
}))));
|
|
2258
|
+
}
|
|
2259
|
+
getProductVersion() {
|
|
2260
|
+
return this.getProductUpdateVersion() ?? this.getProductCurrentVersion();
|
|
2261
|
+
}
|
|
2262
|
+
getProductCurrentVersion() {
|
|
2263
|
+
return {
|
|
2264
|
+
version: this.productService.version,
|
|
2265
|
+
date: this.productService.date
|
|
2266
|
+
};
|
|
2267
|
+
}
|
|
2268
|
+
getProductUpdateVersion() {
|
|
2269
|
+
switch (this.updateService.state.type) {
|
|
2270
|
+
case StateType.AvailableForDownload:
|
|
2271
|
+
case StateType.Downloaded:
|
|
2272
|
+
case StateType.Updating:
|
|
2273
|
+
case StateType.Ready:
|
|
2274
|
+
{
|
|
2275
|
+
const version = this.updateService.state.update.productVersion;
|
|
2276
|
+
if (version && semverExports.valid(version)) {
|
|
2277
|
+
return {
|
|
2278
|
+
version,
|
|
2279
|
+
date: this.updateService.state.update.timestamp ? ( new Date(this.updateService.state.update.timestamp)).toISOString() : undefined
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
return undefined;
|
|
2285
|
+
}
|
|
2286
|
+
shouldAutoUpdateExtension(extension) {
|
|
2287
|
+
if (extension.deprecationInfo?.disallowInstall) {
|
|
2288
|
+
return false;
|
|
2289
|
+
}
|
|
2290
|
+
if (extension.local?.forceAutoUpdate) {
|
|
2291
|
+
return true;
|
|
2292
|
+
}
|
|
2293
|
+
const autoUpdateValue = this.getAutoUpdateValue();
|
|
2294
|
+
if (autoUpdateValue === false) {
|
|
2295
|
+
const extensionsToAutoUpdate = this.getEnabledAutoUpdateExtensions();
|
|
2296
|
+
const extensionId = extension.identifier.id.toLowerCase();
|
|
2297
|
+
if (extensionsToAutoUpdate.includes(extensionId)) {
|
|
2298
|
+
return true;
|
|
2299
|
+
}
|
|
2300
|
+
if (this.isAutoUpdateEnabledForPublisher(extension.publisher) && !extensionsToAutoUpdate.includes(`-${extensionId}`)) {
|
|
2301
|
+
return true;
|
|
2302
|
+
}
|
|
2303
|
+
return false;
|
|
2304
|
+
}
|
|
2305
|
+
if (extension.pinned) {
|
|
2306
|
+
return false;
|
|
2307
|
+
}
|
|
2308
|
+
const disabledAutoUpdateExtensions = this.getDisabledAutoUpdateExtensions();
|
|
2309
|
+
if (disabledAutoUpdateExtensions.includes(extension.identifier.id.toLowerCase())) {
|
|
2310
|
+
return false;
|
|
2311
|
+
}
|
|
2312
|
+
if (autoUpdateValue === true) {
|
|
2313
|
+
return true;
|
|
2314
|
+
}
|
|
2315
|
+
if (autoUpdateValue === "onlyEnabledExtensions") {
|
|
2316
|
+
return extension.enablementState !== EnablementState.DisabledGlobally && extension.enablementState !== EnablementState.DisabledWorkspace;
|
|
2317
|
+
}
|
|
2318
|
+
return false;
|
|
2319
|
+
}
|
|
2320
|
+
async shouldRequireConsentToUpdate(extension) {
|
|
2321
|
+
if (!extension.outdated) {
|
|
2322
|
+
return;
|
|
2323
|
+
}
|
|
2324
|
+
if (!extension.gallery || !extension.local) {
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
if (extension.local.identifier.uuid && extension.local.identifier.uuid !== extension.gallery.identifier.uuid) {
|
|
2328
|
+
return localize(
|
|
2329
|
+
9930,
|
|
2330
|
+
"The marketplace metadata of this extension changed, likely due to a re-publish."
|
|
2331
|
+
);
|
|
2332
|
+
}
|
|
2333
|
+
if (!extension.local.manifest.engines.vscode || extension.local.manifest.main || extension.local.manifest.browser) {
|
|
2334
|
+
return;
|
|
2335
|
+
}
|
|
2336
|
+
if (isDefined(extension.gallery.properties?.executesCode)) {
|
|
2337
|
+
if (!extension.gallery.properties.executesCode) {
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
} else {
|
|
2341
|
+
const manifest = extension instanceof Extension ? await extension.getGalleryManifest() : await this.galleryService.getManifest(extension.gallery, CancellationToken.None);
|
|
2342
|
+
if (!manifest?.main && !manifest?.browser) {
|
|
2343
|
+
return;
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
return localize(
|
|
2347
|
+
9931,
|
|
2348
|
+
"The update for {0} extension introduces executable code, which is not present in the currently installed version.",
|
|
2349
|
+
extension.displayName
|
|
2350
|
+
);
|
|
2351
|
+
}
|
|
2352
|
+
isAutoUpdateEnabledFor(extensionOrPublisher) {
|
|
2353
|
+
if (isString(extensionOrPublisher)) {
|
|
2354
|
+
if (EXTENSION_IDENTIFIER_REGEX.test(extensionOrPublisher)) {
|
|
2355
|
+
throw ( new Error("Expected publisher string, found extension identifier"));
|
|
2356
|
+
}
|
|
2357
|
+
if (this.isAutoUpdateEnabled()) {
|
|
2358
|
+
return true;
|
|
2359
|
+
}
|
|
2360
|
+
return this.isAutoUpdateEnabledForPublisher(extensionOrPublisher);
|
|
2361
|
+
}
|
|
2362
|
+
return this.shouldAutoUpdateExtension(extensionOrPublisher);
|
|
2363
|
+
}
|
|
2364
|
+
isAutoUpdateEnabledForPublisher(publisher) {
|
|
2365
|
+
const publishersToAutoUpdate = this.getPublishersToAutoUpdate();
|
|
2366
|
+
return publishersToAutoUpdate.includes(publisher.toLowerCase());
|
|
2367
|
+
}
|
|
2368
|
+
async updateAutoUpdateEnablementFor(extensionOrPublisher, enable) {
|
|
2369
|
+
if (this.isAutoUpdateEnabled()) {
|
|
2370
|
+
if (isString(extensionOrPublisher)) {
|
|
2371
|
+
throw ( new Error("Expected extension, found publisher string"));
|
|
2372
|
+
}
|
|
2373
|
+
const disabledAutoUpdateExtensions = this.getDisabledAutoUpdateExtensions();
|
|
2374
|
+
const extensionId = extensionOrPublisher.identifier.id.toLowerCase();
|
|
2375
|
+
const extensionIndex = disabledAutoUpdateExtensions.indexOf(extensionId);
|
|
2376
|
+
if (enable) {
|
|
2377
|
+
if (extensionIndex !== -1) {
|
|
2378
|
+
disabledAutoUpdateExtensions.splice(extensionIndex, 1);
|
|
2379
|
+
}
|
|
2380
|
+
} else {
|
|
2381
|
+
if (extensionIndex === -1) {
|
|
2382
|
+
disabledAutoUpdateExtensions.push(extensionId);
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
this.setDisabledAutoUpdateExtensions(disabledAutoUpdateExtensions);
|
|
2386
|
+
if (enable && extensionOrPublisher.local && extensionOrPublisher.pinned) {
|
|
2387
|
+
await this.extensionManagementService.updateMetadata(extensionOrPublisher.local, {
|
|
2388
|
+
pinned: false
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
this._onChange.fire(extensionOrPublisher);
|
|
2392
|
+
} else {
|
|
2393
|
+
const enabledAutoUpdateExtensions = this.getEnabledAutoUpdateExtensions();
|
|
2394
|
+
if (isString(extensionOrPublisher)) {
|
|
2395
|
+
if (EXTENSION_IDENTIFIER_REGEX.test(extensionOrPublisher)) {
|
|
2396
|
+
throw ( new Error("Expected publisher string, found extension identifier"));
|
|
2397
|
+
}
|
|
2398
|
+
extensionOrPublisher = extensionOrPublisher.toLowerCase();
|
|
2399
|
+
if (this.isAutoUpdateEnabledFor(extensionOrPublisher) !== enable) {
|
|
2400
|
+
if (enable) {
|
|
2401
|
+
enabledAutoUpdateExtensions.push(extensionOrPublisher);
|
|
2402
|
+
} else {
|
|
2403
|
+
if (enabledAutoUpdateExtensions.includes(extensionOrPublisher)) {
|
|
2404
|
+
enabledAutoUpdateExtensions.splice(enabledAutoUpdateExtensions.indexOf(extensionOrPublisher), 1);
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
this.setEnabledAutoUpdateExtensions(enabledAutoUpdateExtensions);
|
|
2409
|
+
for (const e of this.installed) {
|
|
2410
|
+
if (e.publisher.toLowerCase() === extensionOrPublisher) {
|
|
2411
|
+
this._onChange.fire(e);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
} else {
|
|
2415
|
+
const extensionId = extensionOrPublisher.identifier.id.toLowerCase();
|
|
2416
|
+
const enableAutoUpdatesForPublisher = this.isAutoUpdateEnabledFor(extensionOrPublisher.publisher.toLowerCase());
|
|
2417
|
+
const enableAutoUpdatesForExtension = enabledAutoUpdateExtensions.includes(extensionId);
|
|
2418
|
+
const disableAutoUpdatesForExtension = enabledAutoUpdateExtensions.includes(`-${extensionId}`);
|
|
2419
|
+
if (enable) {
|
|
2420
|
+
if (disableAutoUpdatesForExtension) {
|
|
2421
|
+
enabledAutoUpdateExtensions.splice(enabledAutoUpdateExtensions.indexOf(`-${extensionId}`), 1);
|
|
2422
|
+
}
|
|
2423
|
+
if (enableAutoUpdatesForPublisher) {
|
|
2424
|
+
if (enableAutoUpdatesForExtension) {
|
|
2425
|
+
enabledAutoUpdateExtensions.splice(enabledAutoUpdateExtensions.indexOf(extensionId), 1);
|
|
2426
|
+
}
|
|
2427
|
+
} else {
|
|
2428
|
+
if (!enableAutoUpdatesForExtension) {
|
|
2429
|
+
enabledAutoUpdateExtensions.push(extensionId);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
else {
|
|
2434
|
+
if (enableAutoUpdatesForExtension) {
|
|
2435
|
+
enabledAutoUpdateExtensions.splice(enabledAutoUpdateExtensions.indexOf(extensionId), 1);
|
|
2436
|
+
}
|
|
2437
|
+
if (enableAutoUpdatesForPublisher) {
|
|
2438
|
+
if (!disableAutoUpdatesForExtension) {
|
|
2439
|
+
enabledAutoUpdateExtensions.push(`-${extensionId}`);
|
|
2440
|
+
}
|
|
2441
|
+
} else {
|
|
2442
|
+
if (disableAutoUpdatesForExtension) {
|
|
2443
|
+
enabledAutoUpdateExtensions.splice(enabledAutoUpdateExtensions.indexOf(`-${extensionId}`), 1);
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
this.setEnabledAutoUpdateExtensions(enabledAutoUpdateExtensions);
|
|
2448
|
+
this._onChange.fire(extensionOrPublisher);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
if (enable) {
|
|
2452
|
+
this.autoUpdateExtensions();
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
onDidSelectedExtensionToAutoUpdateValueChange() {
|
|
2456
|
+
if (this.enabledAuotUpdateExtensionsValue !== this.getEnabledAutoUpdateExtensionsValue() || this.disabledAutoUpdateExtensionsValue !== this.getDisabledAutoUpdateExtensionsValue() ) {
|
|
2457
|
+
const userExtensions = this.installed.filter(e => !e.isBuiltin);
|
|
2458
|
+
const groupBy = extensions => {
|
|
2459
|
+
const shouldAutoUpdate = [];
|
|
2460
|
+
const shouldNotAutoUpdate = [];
|
|
2461
|
+
for (const extension of extensions) {
|
|
2462
|
+
if (this.shouldAutoUpdateExtension(extension)) {
|
|
2463
|
+
shouldAutoUpdate.push(extension);
|
|
2464
|
+
} else {
|
|
2465
|
+
shouldNotAutoUpdate.push(extension);
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
return [shouldAutoUpdate, shouldNotAutoUpdate];
|
|
2469
|
+
};
|
|
2470
|
+
const [wasShouldAutoUpdate, wasShouldNotAutoUpdate] = groupBy(userExtensions);
|
|
2471
|
+
this._enabledAutoUpdateExtensionsValue = undefined;
|
|
2472
|
+
this._disabledAutoUpdateExtensionsValue = undefined;
|
|
2473
|
+
const [shouldAutoUpdate, shouldNotAutoUpdate] = groupBy(userExtensions);
|
|
2474
|
+
for (const e of wasShouldAutoUpdate ?? []) {
|
|
2475
|
+
if (shouldNotAutoUpdate?.includes(e)) {
|
|
2476
|
+
this._onChange.fire(e);
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
for (const e of wasShouldNotAutoUpdate ?? []) {
|
|
2480
|
+
if (shouldAutoUpdate?.includes(e)) {
|
|
2481
|
+
this._onChange.fire(e);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
async canInstall(extension) {
|
|
2487
|
+
if (!(extension instanceof Extension)) {
|
|
2488
|
+
return ( new MarkdownString()).appendText(( localize(9932, "The provided object is not an extension.")));
|
|
2489
|
+
}
|
|
2490
|
+
if (extension.isMalicious) {
|
|
2491
|
+
return ( new MarkdownString()).appendText(( localize(9933, "This extension is reported to be problematic.")));
|
|
2492
|
+
}
|
|
2493
|
+
if (extension.deprecationInfo?.disallowInstall) {
|
|
2494
|
+
return ( new MarkdownString()).appendText(( localize(9934, "This extension is disallowed to be installed.")));
|
|
2495
|
+
}
|
|
2496
|
+
if (extension.gallery) {
|
|
2497
|
+
if (!extension.gallery.isSigned && shouldRequireRepositorySignatureFor(
|
|
2498
|
+
extension.private,
|
|
2499
|
+
await this.extensionGalleryManifestService.getExtensionGalleryManifest()
|
|
2500
|
+
)) {
|
|
2501
|
+
return ( new MarkdownString()).appendText(( localize(9935, "This extension is not signed.")));
|
|
2502
|
+
}
|
|
2503
|
+
const localResult = this.localExtensions ? await this.localExtensions.canInstall(extension.gallery) : undefined;
|
|
2504
|
+
if (localResult === true) {
|
|
2505
|
+
return true;
|
|
2506
|
+
}
|
|
2507
|
+
const remoteResult = this.remoteExtensions ? await this.remoteExtensions.canInstall(extension.gallery) : undefined;
|
|
2508
|
+
if (remoteResult === true) {
|
|
2509
|
+
return true;
|
|
2510
|
+
}
|
|
2511
|
+
const webResult = this.webExtensions ? await this.webExtensions.canInstall(extension.gallery) : undefined;
|
|
2512
|
+
if (webResult === true) {
|
|
2513
|
+
return true;
|
|
2514
|
+
}
|
|
2515
|
+
return localResult ?? remoteResult ?? webResult ?? ( new MarkdownString()).appendText(( localize(
|
|
2516
|
+
9936,
|
|
2517
|
+
"Cannot install the '{0}' extension because it is not available in this setup.",
|
|
2518
|
+
extension.displayName ?? extension.identifier.id
|
|
2519
|
+
)));
|
|
2520
|
+
}
|
|
2521
|
+
if (extension.resourceExtension && (await this.extensionManagementService.canInstall(extension.resourceExtension)) === true) {
|
|
2522
|
+
return true;
|
|
2523
|
+
}
|
|
2524
|
+
return ( new MarkdownString()).appendText(( localize(
|
|
2525
|
+
9936,
|
|
2526
|
+
"Cannot install the '{0}' extension because it is not available in this setup.",
|
|
2527
|
+
extension.displayName ?? extension.identifier.id
|
|
2528
|
+
)));
|
|
2529
|
+
}
|
|
2530
|
+
async install(arg, installOptions = {}, progressLocation) {
|
|
2531
|
+
const extension = await this._install(arg, installOptions, progressLocation);
|
|
2532
|
+
if (!extension) {
|
|
2533
|
+
throw ( new Error(( localize(9937, "Unable to install extension"))));
|
|
2534
|
+
}
|
|
2535
|
+
if (installOptions.enable) {
|
|
2536
|
+
if (extension.enablementState === EnablementState.DisabledWorkspace || extension.enablementState === EnablementState.DisabledGlobally) {
|
|
2537
|
+
if (installOptions.justification) {
|
|
2538
|
+
const result = await this.dialogService.confirm({
|
|
2539
|
+
title: ( localize(9938, "Enable Extension")),
|
|
2540
|
+
message: ( localize(9939, "Would you like to enable '{0}' extension?", extension.displayName)),
|
|
2541
|
+
detail: isString(installOptions.justification) ? installOptions.justification : installOptions.justification.reason,
|
|
2542
|
+
primaryButton: isString(installOptions.justification) ? ( localize(9940, "&&Enable Extension")) : ( localize(9941, "&&Enable Extension and {0}", installOptions.justification.action))
|
|
2543
|
+
});
|
|
2544
|
+
if (!result.confirmed) {
|
|
2545
|
+
throw ( new CancellationError());
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
await this.setEnablement(
|
|
2549
|
+
extension,
|
|
2550
|
+
extension.enablementState === EnablementState.DisabledWorkspace ? EnablementState.EnabledWorkspace : EnablementState.EnabledGlobally
|
|
2551
|
+
);
|
|
2552
|
+
}
|
|
2553
|
+
await this.waitUntilExtensionIsEnabled(extension);
|
|
2554
|
+
}
|
|
2555
|
+
return extension;
|
|
2556
|
+
}
|
|
2557
|
+
async _install(arg, installOptions = {}, progressLocation) {
|
|
2558
|
+
let installable;
|
|
2559
|
+
let extension;
|
|
2560
|
+
let servers;
|
|
2561
|
+
if (arg instanceof URI) {
|
|
2562
|
+
installable = arg;
|
|
2563
|
+
} else {
|
|
2564
|
+
let installableInfo;
|
|
2565
|
+
let gallery;
|
|
2566
|
+
if (isString(arg)) {
|
|
2567
|
+
extension = this.local.find(e => areSameExtensions(e.identifier, {
|
|
2568
|
+
id: arg
|
|
2569
|
+
}));
|
|
2570
|
+
if (extension?.isBuiltin) {
|
|
2571
|
+
if (this.productService.builtInExtensionsEnabledWithAutoUpdates?.some(id => id.toLowerCase() === arg.toLowerCase())) {
|
|
2572
|
+
return extension;
|
|
2573
|
+
}
|
|
2574
|
+
} else {
|
|
2575
|
+
installableInfo = {
|
|
2576
|
+
id: arg,
|
|
2577
|
+
version: installOptions.version,
|
|
2578
|
+
preRelease: installOptions.installPreReleaseVersion ?? this.extensionManagementService.preferPreReleases
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
else if (arg.gallery) {
|
|
2583
|
+
extension = arg;
|
|
2584
|
+
gallery = arg.gallery;
|
|
2585
|
+
if (installOptions.version && installOptions.version !== gallery?.version) {
|
|
2586
|
+
installableInfo = {
|
|
2587
|
+
id: extension.identifier.id,
|
|
2588
|
+
version: installOptions.version
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
else if (arg.resourceExtension) {
|
|
2593
|
+
extension = arg;
|
|
2594
|
+
installable = arg.resourceExtension;
|
|
2595
|
+
}
|
|
2596
|
+
if (installableInfo) {
|
|
2597
|
+
const targetPlatform = extension?.server ? await extension.server.extensionManagementService.getTargetPlatform() : undefined;
|
|
2598
|
+
gallery = (await this.galleryService.getExtensions([installableInfo], {
|
|
2599
|
+
targetPlatform
|
|
2600
|
+
}, CancellationToken.None)).at(0);
|
|
2601
|
+
}
|
|
2602
|
+
if (!extension && gallery) {
|
|
2603
|
+
extension = this.instantiationService.createInstance(
|
|
2604
|
+
Extension,
|
|
2605
|
+
ext => this.getExtensionState(ext),
|
|
2606
|
+
ext => this.getRuntimeState(ext),
|
|
2607
|
+
undefined,
|
|
2608
|
+
undefined,
|
|
2609
|
+
gallery,
|
|
2610
|
+
undefined
|
|
2611
|
+
);
|
|
2612
|
+
extension.setExtensionsControlManifest(await this.extensionManagementService.getExtensionsControlManifest());
|
|
2613
|
+
}
|
|
2614
|
+
if (extension?.isMalicious) {
|
|
2615
|
+
throw ( new Error(( localize(9933, "This extension is reported to be problematic."))));
|
|
2616
|
+
}
|
|
2617
|
+
if (gallery) {
|
|
2618
|
+
if (installOptions.installEverywhere) {
|
|
2619
|
+
servers = [];
|
|
2620
|
+
const installableServers = await this.extensionManagementService.getInstallableServers(gallery);
|
|
2621
|
+
for (const extensionsServer of this.extensionsServers) {
|
|
2622
|
+
if (installableServers.includes(extensionsServer.server) && !extensionsServer.local.find(e => areSameExtensions(e.identifier, gallery.identifier))) {
|
|
2623
|
+
servers.push(extensionsServer.server);
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
else if (installOptions.enable && extension?.local) {
|
|
2628
|
+
servers = [];
|
|
2629
|
+
if (extension.enablementState === EnablementState.DisabledByExtensionKind) {
|
|
2630
|
+
const [installableServer] = await this.extensionManagementService.getInstallableServers(gallery);
|
|
2631
|
+
if (installableServer) {
|
|
2632
|
+
servers.push(installableServer);
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
if (!servers || servers.length) {
|
|
2638
|
+
if (!installable) {
|
|
2639
|
+
if (!gallery) {
|
|
2640
|
+
const id = isString(arg) ? arg : arg.identifier.id;
|
|
2641
|
+
const manifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();
|
|
2642
|
+
const reportIssueUri = manifest ? getExtensionGalleryManifestResourceUri(manifest, ExtensionGalleryResourceType.ContactSupportUri) : undefined;
|
|
2643
|
+
const reportIssueMessage = reportIssueUri ? ( localize(
|
|
2644
|
+
9942,
|
|
2645
|
+
"If this issue persists, please report it at {0}",
|
|
2646
|
+
(reportIssueUri.toString())
|
|
2647
|
+
)) : "";
|
|
2648
|
+
if (installOptions.version) {
|
|
2649
|
+
const message = ( localize(
|
|
2650
|
+
9943,
|
|
2651
|
+
"The extension '{0}' cannot be installed because the requested version '{1}' was not found.",
|
|
2652
|
+
id,
|
|
2653
|
+
installOptions.version
|
|
2654
|
+
));
|
|
2655
|
+
throw ( new ExtensionManagementError(
|
|
2656
|
+
reportIssueMessage ? `${message} ${reportIssueMessage}` : message,
|
|
2657
|
+
ExtensionManagementErrorCode.NotFound
|
|
2658
|
+
));
|
|
2659
|
+
} else {
|
|
2660
|
+
const message = ( localize(
|
|
2661
|
+
9944,
|
|
2662
|
+
"The extension '{0}' cannot be installed because it was not found.",
|
|
2663
|
+
id
|
|
2664
|
+
));
|
|
2665
|
+
throw ( new ExtensionManagementError(
|
|
2666
|
+
reportIssueMessage ? `${message} ${reportIssueMessage}` : message,
|
|
2667
|
+
ExtensionManagementErrorCode.NotFound
|
|
2668
|
+
));
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
installable = gallery;
|
|
2672
|
+
}
|
|
2673
|
+
if (installOptions.version) {
|
|
2674
|
+
installOptions.installGivenVersion = true;
|
|
2675
|
+
}
|
|
2676
|
+
if (extension?.isWorkspaceScoped) {
|
|
2677
|
+
installOptions.isWorkspaceScoped = true;
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
if (installable) {
|
|
2682
|
+
if (installOptions.justification) {
|
|
2683
|
+
const syncCheck = isUndefined(installOptions.isMachineScoped) && this.userDataSyncEnablementService.isEnabled() && this.userDataSyncEnablementService.isResourceEnabled(SyncResource.Extensions);
|
|
2684
|
+
const buttons = [];
|
|
2685
|
+
buttons.push({
|
|
2686
|
+
label: isString(installOptions.justification) || !installOptions.justification.action ? ( localize(9945, "&&Install Extension")) : ( localize(9946, "&&Install Extension and {0}", installOptions.justification.action)),
|
|
2687
|
+
run: () => true
|
|
2688
|
+
});
|
|
2689
|
+
if (!extension) {
|
|
2690
|
+
buttons.push({
|
|
2691
|
+
label: ( localize(9947, "Open Extension")),
|
|
2692
|
+
run: () => {
|
|
2693
|
+
this.open(extension);
|
|
2694
|
+
return false;
|
|
2695
|
+
}
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
const result = await this.dialogService.prompt({
|
|
2699
|
+
title: ( localize(9948, "Install Extension")),
|
|
2700
|
+
message: extension ? ( localize(
|
|
2701
|
+
9949,
|
|
2702
|
+
"Would you like to install '{0}' extension from '{1}'?",
|
|
2703
|
+
extension.displayName,
|
|
2704
|
+
extension.publisherDisplayName
|
|
2705
|
+
)) : ( localize(9950, "Would you like to install the extension?")),
|
|
2706
|
+
detail: isString(installOptions.justification) ? installOptions.justification : installOptions.justification.reason,
|
|
2707
|
+
cancelButton: true,
|
|
2708
|
+
buttons,
|
|
2709
|
+
checkbox: syncCheck ? {
|
|
2710
|
+
label: ( localize(9951, "Sync this extension")),
|
|
2711
|
+
checked: true
|
|
2712
|
+
} : undefined
|
|
2713
|
+
});
|
|
2714
|
+
if (!result.result) {
|
|
2715
|
+
throw ( new CancellationError());
|
|
2716
|
+
}
|
|
2717
|
+
if (syncCheck) {
|
|
2718
|
+
installOptions.isMachineScoped = !result.checkboxChecked;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
if (installable instanceof URI) {
|
|
2722
|
+
extension = await this.doInstall(
|
|
2723
|
+
undefined,
|
|
2724
|
+
() => this.installFromVSIX(installable, installOptions),
|
|
2725
|
+
progressLocation
|
|
2726
|
+
);
|
|
2727
|
+
} else if (extension) {
|
|
2728
|
+
if (extension.resourceExtension) {
|
|
2729
|
+
extension = await this.doInstall(
|
|
2730
|
+
extension,
|
|
2731
|
+
() => this.extensionManagementService.installResourceExtension(installable, installOptions),
|
|
2732
|
+
progressLocation
|
|
2733
|
+
);
|
|
2734
|
+
} else {
|
|
2735
|
+
extension = await this.doInstall(
|
|
2736
|
+
extension,
|
|
2737
|
+
() => this.installFromGallery(extension, installable, installOptions, servers),
|
|
2738
|
+
progressLocation
|
|
2739
|
+
);
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
return extension;
|
|
2744
|
+
}
|
|
2745
|
+
async installInServer(extension, server, installOptions) {
|
|
2746
|
+
await this.doInstall(extension, async () => {
|
|
2747
|
+
const local = extension.local;
|
|
2748
|
+
if (!local) {
|
|
2749
|
+
throw ( new Error("Extension not found"));
|
|
2750
|
+
}
|
|
2751
|
+
if (!extension.gallery) {
|
|
2752
|
+
extension = (await this.getExtensions([{
|
|
2753
|
+
...extension.identifier,
|
|
2754
|
+
preRelease: local.preRelease
|
|
2755
|
+
}], CancellationToken.None))[0] ?? extension;
|
|
2756
|
+
}
|
|
2757
|
+
if (extension.gallery) {
|
|
2758
|
+
return server.extensionManagementService.installFromGallery(extension.gallery, {
|
|
2759
|
+
installPreReleaseVersion: local.preRelease,
|
|
2760
|
+
...installOptions
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
const targetPlatform = await server.extensionManagementService.getTargetPlatform();
|
|
2764
|
+
if (!isTargetPlatformCompatible(local.targetPlatform, [local.targetPlatform], targetPlatform)) {
|
|
2765
|
+
throw ( new Error(( localize(
|
|
2766
|
+
9952,
|
|
2767
|
+
"Can't install '{0}' extension because it is not compatible.",
|
|
2768
|
+
extension.identifier.id
|
|
2769
|
+
))));
|
|
2770
|
+
}
|
|
2771
|
+
const vsix = await this.extensionManagementService.zip(local);
|
|
2772
|
+
try {
|
|
2773
|
+
return await server.extensionManagementService.install(vsix);
|
|
2774
|
+
} finally {
|
|
2775
|
+
try {
|
|
2776
|
+
await this.fileService.del(vsix);
|
|
2777
|
+
} catch (error) {
|
|
2778
|
+
this.logService.error(error);
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
});
|
|
2782
|
+
}
|
|
2783
|
+
canSetLanguage(extension) {
|
|
2784
|
+
if (!isWeb) {
|
|
2785
|
+
return false;
|
|
2786
|
+
}
|
|
2787
|
+
if (!extension.gallery) {
|
|
2788
|
+
return false;
|
|
2789
|
+
}
|
|
2790
|
+
const locale = getLocale(extension.gallery);
|
|
2791
|
+
if (!locale) {
|
|
2792
|
+
return false;
|
|
2793
|
+
}
|
|
2794
|
+
return true;
|
|
2795
|
+
}
|
|
2796
|
+
async setLanguage(extension) {
|
|
2797
|
+
if (!this.canSetLanguage(extension)) {
|
|
2798
|
+
throw ( new Error("Can not set language"));
|
|
2799
|
+
}
|
|
2800
|
+
const locale = getLocale(extension.gallery);
|
|
2801
|
+
if (locale === language) {
|
|
2802
|
+
return;
|
|
2803
|
+
}
|
|
2804
|
+
const localizedLanguageName = extension.gallery?.properties?.localizedLanguages?.[0];
|
|
2805
|
+
return this.localeService.setLocale({
|
|
2806
|
+
id: locale,
|
|
2807
|
+
galleryExtension: extension.gallery,
|
|
2808
|
+
extensionId: extension.identifier.id,
|
|
2809
|
+
label: localizedLanguageName ?? extension.displayName
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
setEnablement(extensions, enablementState) {
|
|
2813
|
+
extensions = Array.isArray(extensions) ? extensions : [extensions];
|
|
2814
|
+
return this.promptAndSetEnablement(extensions, enablementState);
|
|
2815
|
+
}
|
|
2816
|
+
async uninstall(e) {
|
|
2817
|
+
const extension = e.local ? e : this.local.find(local => areSameExtensions(local.identifier, e.identifier));
|
|
2818
|
+
if (!extension?.local) {
|
|
2819
|
+
throw ( new Error("Missing local"));
|
|
2820
|
+
}
|
|
2821
|
+
if (extension.local.isApplicationScoped && this.userDataProfilesService.profiles.length > 1) {
|
|
2822
|
+
const {
|
|
2823
|
+
confirmed
|
|
2824
|
+
} = await this.dialogService.confirm({
|
|
2825
|
+
title: ( localize(9953, "Uninstall Extension")),
|
|
2826
|
+
type: Severity$1.Info,
|
|
2827
|
+
message: ( localize(
|
|
2828
|
+
9954,
|
|
2829
|
+
"Would you like to Uninstall {0} from all profiles?",
|
|
2830
|
+
extension.displayName
|
|
2831
|
+
)),
|
|
2832
|
+
primaryButton: ( localize(9955, "Uninstall (All Profiles)"))
|
|
2833
|
+
});
|
|
2834
|
+
if (!confirmed) {
|
|
2835
|
+
throw ( new CancellationError());
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
const extensionsToUninstall = [{
|
|
2839
|
+
extension: extension.local
|
|
2840
|
+
}];
|
|
2841
|
+
if (this.productService.defaultChatAgent == null || !areSameExtensions(extension.identifier, {
|
|
2842
|
+
id: this.productService.defaultChatAgent.extensionId
|
|
2843
|
+
})) {
|
|
2844
|
+
for (const packExtension of this.getAllPackedExtensions(extension, this.local)) {
|
|
2845
|
+
if (packExtension.local && !( extensionsToUninstall.some(e => areSameExtensions(e.extension.identifier, packExtension.identifier)))) {
|
|
2846
|
+
extensionsToUninstall.push({
|
|
2847
|
+
extension: packExtension.local
|
|
2848
|
+
});
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
const dependents = [];
|
|
2853
|
+
let extensionsFromAllProfiles;
|
|
2854
|
+
for (const {
|
|
2855
|
+
extension
|
|
2856
|
+
} of extensionsToUninstall) {
|
|
2857
|
+
const installedExtensions = [];
|
|
2858
|
+
if (extension.isApplicationScoped && this.userDataProfilesService.profiles.length > 1) {
|
|
2859
|
+
if (!extensionsFromAllProfiles) {
|
|
2860
|
+
extensionsFromAllProfiles = [];
|
|
2861
|
+
await Promise.allSettled(( this.userDataProfilesService.profiles.map(async profile => {
|
|
2862
|
+
const installed = await this.extensionManagementService.getInstalled(ExtensionType.User, profile.extensionsResource);
|
|
2863
|
+
for (const local of installed) {
|
|
2864
|
+
extensionsFromAllProfiles?.push([local, profile.extensionsResource]);
|
|
2865
|
+
}
|
|
2866
|
+
})));
|
|
2867
|
+
}
|
|
2868
|
+
installedExtensions.push(...extensionsFromAllProfiles);
|
|
2869
|
+
} else {
|
|
2870
|
+
for (const {
|
|
2871
|
+
local
|
|
2872
|
+
} of this.local) {
|
|
2873
|
+
if (local) {
|
|
2874
|
+
installedExtensions.push([local, undefined]);
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
for (const [local, profileLocation] of installedExtensions) {
|
|
2879
|
+
if (areSameExtensions(local.identifier, extension.identifier)) {
|
|
2880
|
+
continue;
|
|
2881
|
+
}
|
|
2882
|
+
if (!local.manifest.extensionDependencies || local.manifest.extensionDependencies.length === 0) {
|
|
2883
|
+
continue;
|
|
2884
|
+
}
|
|
2885
|
+
if (extension.manifest.extensionPack?.some(id => areSameExtensions({
|
|
2886
|
+
id
|
|
2887
|
+
}, local.identifier))) {
|
|
2888
|
+
continue;
|
|
2889
|
+
}
|
|
2890
|
+
if (( dependents.some(d => d.manifest.extensionPack?.some(id => areSameExtensions({
|
|
2891
|
+
id
|
|
2892
|
+
}, local.identifier))))) {
|
|
2893
|
+
continue;
|
|
2894
|
+
}
|
|
2895
|
+
if (( local.manifest.extensionDependencies.some(dep => areSameExtensions(extension.identifier, {
|
|
2896
|
+
id: dep
|
|
2897
|
+
})))) {
|
|
2898
|
+
dependents.push(local);
|
|
2899
|
+
extensionsToUninstall.push({
|
|
2900
|
+
extension: local,
|
|
2901
|
+
options: {
|
|
2902
|
+
profileLocation
|
|
2903
|
+
}
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
if (dependents.length) {
|
|
2909
|
+
const {
|
|
2910
|
+
result
|
|
2911
|
+
} = await this.dialogService.prompt({
|
|
2912
|
+
title: ( localize(9956, "Uninstall Extension with Dependents")),
|
|
2913
|
+
type: Severity$1.Warning,
|
|
2914
|
+
message: this.getErrorMessageForUninstallingAnExtensionWithDependents(extension, dependents),
|
|
2915
|
+
buttons: [{
|
|
2916
|
+
label: ( localize(9957, "Uninstall All")),
|
|
2917
|
+
run: () => true
|
|
2918
|
+
}],
|
|
2919
|
+
cancelButton: {
|
|
2920
|
+
run: () => false
|
|
2921
|
+
}
|
|
2922
|
+
});
|
|
2923
|
+
if (!result) {
|
|
2924
|
+
throw ( new CancellationError());
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
return this.withProgress({
|
|
2928
|
+
location: ProgressLocation.Extensions,
|
|
2929
|
+
title: ( localize(9958, "Uninstalling extension...")),
|
|
2930
|
+
source: `${extension.identifier.id}`
|
|
2931
|
+
}, () => this.extensionManagementService.uninstallExtensions(extensionsToUninstall).then(() => undefined));
|
|
2932
|
+
}
|
|
2933
|
+
getAllPackedExtensions(extension, installed, checked = []) {
|
|
2934
|
+
if (( checked.some(e => areSameExtensions(e.identifier, extension.identifier)))) {
|
|
2935
|
+
return [];
|
|
2936
|
+
}
|
|
2937
|
+
checked.push(extension);
|
|
2938
|
+
const extensionsPack = extension.extensionPack ?? [];
|
|
2939
|
+
if (extensionsPack.length) {
|
|
2940
|
+
const packedExtensions = [];
|
|
2941
|
+
for (const i of installed) {
|
|
2942
|
+
if (!i.isBuiltin && ( extensionsPack.some(id => areSameExtensions({
|
|
2943
|
+
id
|
|
2944
|
+
}, i.identifier)))) {
|
|
2945
|
+
packedExtensions.push(i);
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
const packOfPackedExtensions = [];
|
|
2949
|
+
for (const packedExtension of packedExtensions) {
|
|
2950
|
+
packOfPackedExtensions.push(...this.getAllPackedExtensions(packedExtension, installed, checked));
|
|
2951
|
+
}
|
|
2952
|
+
return [...packedExtensions, ...packOfPackedExtensions];
|
|
2953
|
+
}
|
|
2954
|
+
return [];
|
|
2955
|
+
}
|
|
2956
|
+
getErrorMessageForUninstallingAnExtensionWithDependents(extension, dependents) {
|
|
2957
|
+
if (dependents.length === 1) {
|
|
2958
|
+
return localize(
|
|
2959
|
+
9959,
|
|
2960
|
+
"Cannot uninstall '{0}' extension alone. '{1}' extension depends on this. Do you want to uninstall all these extensions?",
|
|
2961
|
+
extension.displayName,
|
|
2962
|
+
dependents[0].manifest.displayName
|
|
2963
|
+
);
|
|
2964
|
+
}
|
|
2965
|
+
if (dependents.length === 2) {
|
|
2966
|
+
return localize(
|
|
2967
|
+
9960,
|
|
2968
|
+
"Cannot uninstall '{0}' extension alone. '{1}' and '{2}' extensions depend on this. Do you want to uninstall all these extensions?",
|
|
2969
|
+
extension.displayName,
|
|
2970
|
+
dependents[0].manifest.displayName,
|
|
2971
|
+
dependents[1].manifest.displayName
|
|
2972
|
+
);
|
|
2973
|
+
}
|
|
2974
|
+
return localize(
|
|
2975
|
+
9961,
|
|
2976
|
+
"Cannot uninstall '{0}' extension alone. '{1}', '{2}' and other extensions depend on this. Do you want to uninstall all these extensions?",
|
|
2977
|
+
extension.displayName,
|
|
2978
|
+
dependents[0].manifest.displayName,
|
|
2979
|
+
dependents[1].manifest.displayName
|
|
2980
|
+
);
|
|
2981
|
+
}
|
|
2982
|
+
isExtensionIgnoredToSync(extension) {
|
|
2983
|
+
return extension.local ? !this.isInstalledExtensionSynced(extension.local) : this.extensionsSyncManagementService.hasToNeverSyncExtension(extension.identifier.id);
|
|
2984
|
+
}
|
|
2985
|
+
async togglePreRelease(extension) {
|
|
2986
|
+
if (!extension.local) {
|
|
2987
|
+
return;
|
|
2988
|
+
}
|
|
2989
|
+
if (extension.preRelease !== extension.isPreReleaseVersion) {
|
|
2990
|
+
await this.extensionManagementService.updateMetadata(extension.local, {
|
|
2991
|
+
preRelease: !extension.preRelease
|
|
2992
|
+
});
|
|
2993
|
+
return;
|
|
2994
|
+
}
|
|
2995
|
+
await this.install(extension, {
|
|
2996
|
+
installPreReleaseVersion: !extension.preRelease,
|
|
2997
|
+
preRelease: !extension.preRelease
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
async toggleExtensionIgnoredToSync(extension) {
|
|
3001
|
+
const extensionsIncludingPackedExtensions = [extension, ...this.getAllPackedExtensions(extension, this.local)];
|
|
3002
|
+
for (const e of extensionsIncludingPackedExtensions) {
|
|
3003
|
+
const isIgnored = this.isExtensionIgnoredToSync(e);
|
|
3004
|
+
if (e.local && isIgnored && e.local.isMachineScoped) {
|
|
3005
|
+
await this.extensionManagementService.updateMetadata(e.local, {
|
|
3006
|
+
isMachineScoped: false
|
|
3007
|
+
});
|
|
3008
|
+
} else {
|
|
3009
|
+
await this.extensionsSyncManagementService.updateIgnoredExtensions(e.identifier.id, !isIgnored);
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
await this.userDataAutoSyncService.triggerSync(["IgnoredExtensionsUpdated"]);
|
|
3013
|
+
}
|
|
3014
|
+
async toggleApplyExtensionToAllProfiles(extension) {
|
|
3015
|
+
const extensionsIncludingPackedExtensions = [extension, ...this.getAllPackedExtensions(extension, this.local)];
|
|
3016
|
+
const allExtensionServers = this.getAllExtensionServers();
|
|
3017
|
+
await Promise.allSettled(( extensionsIncludingPackedExtensions.map(async e => {
|
|
3018
|
+
if (!e.local || isApplicationScopedExtension(e.local.manifest) || e.isBuiltin) {
|
|
3019
|
+
return;
|
|
3020
|
+
}
|
|
3021
|
+
const isApplicationScoped = e.local.isApplicationScoped;
|
|
3022
|
+
await Promise.all(( allExtensionServers.map(async extensionServer => {
|
|
3023
|
+
const local = extensionServer.local.find(local => areSameExtensions(e.identifier, local.identifier))?.local;
|
|
3024
|
+
if (local && local.isApplicationScoped === isApplicationScoped) {
|
|
3025
|
+
await this.extensionManagementService.toggleApplicationScope(local, this.userDataProfileService.currentProfile.extensionsResource);
|
|
3026
|
+
}
|
|
3027
|
+
})));
|
|
3028
|
+
})));
|
|
3029
|
+
}
|
|
3030
|
+
getAllExtensionServers() {
|
|
3031
|
+
const extensions = [];
|
|
3032
|
+
if (this.localExtensions) {
|
|
3033
|
+
extensions.push(this.localExtensions);
|
|
3034
|
+
}
|
|
3035
|
+
if (this.remoteExtensions) {
|
|
3036
|
+
extensions.push(this.remoteExtensions);
|
|
3037
|
+
}
|
|
3038
|
+
if (this.webExtensions) {
|
|
3039
|
+
extensions.push(this.webExtensions);
|
|
3040
|
+
}
|
|
3041
|
+
return extensions;
|
|
3042
|
+
}
|
|
3043
|
+
isInstalledExtensionSynced(extension) {
|
|
3044
|
+
if (extension.isMachineScoped) {
|
|
3045
|
+
return false;
|
|
3046
|
+
}
|
|
3047
|
+
if (this.extensionsSyncManagementService.hasToAlwaysSyncExtension(extension.identifier.id)) {
|
|
3048
|
+
return true;
|
|
3049
|
+
}
|
|
3050
|
+
return !this.extensionsSyncManagementService.hasToNeverSyncExtension(extension.identifier.id);
|
|
3051
|
+
}
|
|
3052
|
+
doInstall(extension, installTask, progressLocation) {
|
|
3053
|
+
const title = extension ? ( localize(9962, "Installing '{0}' extension...", extension.displayName)) : ( localize(9963, "Installing extension..."));
|
|
3054
|
+
return this.withProgress({
|
|
3055
|
+
location: progressLocation ?? ProgressLocation.Extensions,
|
|
3056
|
+
title
|
|
3057
|
+
}, async () => {
|
|
3058
|
+
try {
|
|
3059
|
+
if (extension) {
|
|
3060
|
+
this.installing.push(extension);
|
|
3061
|
+
this._onChange.fire(extension);
|
|
3062
|
+
}
|
|
3063
|
+
const local = await installTask();
|
|
3064
|
+
return await this.waitAndGetInstalledExtension(local.identifier);
|
|
3065
|
+
} finally {
|
|
3066
|
+
if (extension) {
|
|
3067
|
+
this.installing = this.installing.filter(e => e !== extension);
|
|
3068
|
+
this._onChange.fire(undefined);
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
});
|
|
3072
|
+
}
|
|
3073
|
+
async installFromVSIX(vsix, installOptions) {
|
|
3074
|
+
const manifest = await this.extensionManagementService.getManifest(vsix);
|
|
3075
|
+
const existingExtension = this.local.find(local => areSameExtensions(local.identifier, {
|
|
3076
|
+
id: getGalleryExtensionId(manifest.publisher, manifest.name)
|
|
3077
|
+
}));
|
|
3078
|
+
if (existingExtension) {
|
|
3079
|
+
installOptions = installOptions || {};
|
|
3080
|
+
if (existingExtension.latestVersion === manifest.version) {
|
|
3081
|
+
installOptions.pinned = installOptions.pinned ?? (existingExtension.local?.pinned || !this.shouldAutoUpdateExtension(existingExtension));
|
|
3082
|
+
} else {
|
|
3083
|
+
installOptions.installGivenVersion = true;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
return this.extensionManagementService.installVSIX(vsix, manifest, installOptions);
|
|
3087
|
+
}
|
|
3088
|
+
installFromGallery(extension, gallery, installOptions, servers) {
|
|
3089
|
+
installOptions = installOptions ?? {};
|
|
3090
|
+
installOptions.pinned = installOptions.pinned ?? (extension.local?.pinned || !this.shouldAutoUpdateExtension(extension));
|
|
3091
|
+
if (extension.local && !servers) {
|
|
3092
|
+
installOptions.productVersion = this.getProductVersion();
|
|
3093
|
+
installOptions.operation = InstallOperation.Update;
|
|
3094
|
+
return this.extensionManagementService.updateFromGallery(gallery, extension.local, installOptions);
|
|
3095
|
+
} else {
|
|
3096
|
+
return this.extensionManagementService.installFromGallery(gallery, installOptions, servers);
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
async waitAndGetInstalledExtension(identifier) {
|
|
3100
|
+
let installedExtension = this.local.find(local => areSameExtensions(local.identifier, identifier));
|
|
3101
|
+
if (!installedExtension) {
|
|
3102
|
+
await Event.toPromise(Event.filter(this.onChange, e => !!e && ( this.local.some(local => areSameExtensions(local.identifier, identifier)))));
|
|
3103
|
+
}
|
|
3104
|
+
installedExtension = this.local.find(local => areSameExtensions(local.identifier, identifier));
|
|
3105
|
+
if (!installedExtension) {
|
|
3106
|
+
throw ( new Error("Extension should have been installed"));
|
|
3107
|
+
}
|
|
3108
|
+
return installedExtension;
|
|
3109
|
+
}
|
|
3110
|
+
async waitUntilExtensionIsEnabled(extension) {
|
|
3111
|
+
if (this.extensionService.extensions.find(e => ExtensionIdentifier.equals(e.identifier, extension.identifier.id))) {
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
if (!extension.local || !this.extensionService.canAddExtension(toExtensionDescription(extension.local))) {
|
|
3115
|
+
return;
|
|
3116
|
+
}
|
|
3117
|
+
await ( new Promise((c, e) => {
|
|
3118
|
+
const disposable = this.extensionService.onDidChangeExtensions(() => {
|
|
3119
|
+
try {
|
|
3120
|
+
if (this.extensionService.extensions.find(e => ExtensionIdentifier.equals(e.identifier, extension.identifier.id))) {
|
|
3121
|
+
disposable.dispose();
|
|
3122
|
+
c();
|
|
3123
|
+
}
|
|
3124
|
+
} catch (error) {
|
|
3125
|
+
e(error);
|
|
3126
|
+
}
|
|
3127
|
+
});
|
|
3128
|
+
}));
|
|
3129
|
+
}
|
|
3130
|
+
promptAndSetEnablement(extensions, enablementState) {
|
|
3131
|
+
const enable = enablementState === EnablementState.EnabledGlobally || enablementState === EnablementState.EnabledWorkspace;
|
|
3132
|
+
if (enable) {
|
|
3133
|
+
const allDependenciesAndPackedExtensions = this.getExtensionsRecursively(extensions, this.local, enablementState, {
|
|
3134
|
+
dependencies: true,
|
|
3135
|
+
pack: true
|
|
3136
|
+
});
|
|
3137
|
+
return this.checkAndSetEnablement(extensions, allDependenciesAndPackedExtensions, enablementState);
|
|
3138
|
+
} else {
|
|
3139
|
+
const packedExtensions = this.getExtensionsRecursively(extensions, this.local, enablementState, {
|
|
3140
|
+
dependencies: false,
|
|
3141
|
+
pack: true
|
|
3142
|
+
});
|
|
3143
|
+
if (packedExtensions.length) {
|
|
3144
|
+
return this.checkAndSetEnablement(extensions, packedExtensions, enablementState);
|
|
3145
|
+
}
|
|
3146
|
+
return this.checkAndSetEnablement(extensions, [], enablementState);
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
async checkAndSetEnablement(extensions, otherExtensions, enablementState) {
|
|
3150
|
+
const allExtensions = [...extensions, ...otherExtensions];
|
|
3151
|
+
const enable = enablementState === EnablementState.EnabledGlobally || enablementState === EnablementState.EnabledWorkspace;
|
|
3152
|
+
if (!enable) {
|
|
3153
|
+
for (const extension of extensions) {
|
|
3154
|
+
const dependents = this.getDependentsAfterDisablement(extension, allExtensions, this.local);
|
|
3155
|
+
if (dependents.length) {
|
|
3156
|
+
const {
|
|
3157
|
+
result
|
|
3158
|
+
} = await this.dialogService.prompt({
|
|
3159
|
+
title: ( localize(9964, "Disable Extension with Dependents")),
|
|
3160
|
+
type: Severity$1.Warning,
|
|
3161
|
+
message: this.getDependentsErrorMessageForDisablement(extension, allExtensions, dependents),
|
|
3162
|
+
buttons: [{
|
|
3163
|
+
label: ( localize(9965, "Disable All")),
|
|
3164
|
+
run: () => true
|
|
3165
|
+
}],
|
|
3166
|
+
cancelButton: {
|
|
3167
|
+
run: () => false
|
|
3168
|
+
}
|
|
3169
|
+
});
|
|
3170
|
+
if (!result) {
|
|
3171
|
+
throw ( new CancellationError());
|
|
3172
|
+
}
|
|
3173
|
+
await this.checkAndSetEnablement(dependents, [extension], enablementState);
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
return this.doSetEnablement(allExtensions, enablementState);
|
|
3178
|
+
}
|
|
3179
|
+
getExtensionsRecursively(extensions, installed, enablementState, options, checked = []) {
|
|
3180
|
+
const toCheck = extensions.filter(e => checked.indexOf(e) === -1);
|
|
3181
|
+
if (toCheck.length) {
|
|
3182
|
+
for (const extension of toCheck) {
|
|
3183
|
+
checked.push(extension);
|
|
3184
|
+
}
|
|
3185
|
+
const extensionsToEanbleOrDisable = installed.filter(i => {
|
|
3186
|
+
if (checked.indexOf(i) !== -1) {
|
|
3187
|
+
return false;
|
|
3188
|
+
}
|
|
3189
|
+
const enable = enablementState === EnablementState.EnabledGlobally || enablementState === EnablementState.EnabledWorkspace;
|
|
3190
|
+
const isExtensionEnabled = i.enablementState === EnablementState.EnabledGlobally || i.enablementState === EnablementState.EnabledWorkspace;
|
|
3191
|
+
if (enable === isExtensionEnabled) {
|
|
3192
|
+
return false;
|
|
3193
|
+
}
|
|
3194
|
+
return (
|
|
3195
|
+
(enable || !i.isBuiltin) && (options.dependencies || options.pack) && ( extensions.some(extension => (options.dependencies && ( extension.dependencies.some(id => areSameExtensions({
|
|
3196
|
+
id
|
|
3197
|
+
}, i.identifier)))) || (options.pack && ( extension.extensionPack.some(id => areSameExtensions({
|
|
3198
|
+
id
|
|
3199
|
+
}, i.identifier))))))
|
|
3200
|
+
);
|
|
3201
|
+
});
|
|
3202
|
+
if (extensionsToEanbleOrDisable.length) {
|
|
3203
|
+
extensionsToEanbleOrDisable.push(
|
|
3204
|
+
...this.getExtensionsRecursively(extensionsToEanbleOrDisable, installed, enablementState, options, checked)
|
|
3205
|
+
);
|
|
3206
|
+
}
|
|
3207
|
+
return extensionsToEanbleOrDisable;
|
|
3208
|
+
}
|
|
3209
|
+
return [];
|
|
3210
|
+
}
|
|
3211
|
+
getDependentsAfterDisablement(extension, extensionsToDisable, installed) {
|
|
3212
|
+
return installed.filter(i => {
|
|
3213
|
+
if (i.dependencies.length === 0) {
|
|
3214
|
+
return false;
|
|
3215
|
+
}
|
|
3216
|
+
if (i === extension) {
|
|
3217
|
+
return false;
|
|
3218
|
+
}
|
|
3219
|
+
if (!this.extensionEnablementService.isEnabledEnablementState(i.enablementState)) {
|
|
3220
|
+
return false;
|
|
3221
|
+
}
|
|
3222
|
+
if (extensionsToDisable.indexOf(i) !== -1) {
|
|
3223
|
+
return false;
|
|
3224
|
+
}
|
|
3225
|
+
return ( i.dependencies.some(dep => ( [extension, ...extensionsToDisable].some(d => areSameExtensions(d.identifier, {
|
|
3226
|
+
id: dep
|
|
3227
|
+
})))));
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
3230
|
+
getDependentsErrorMessageForDisablement(extension, allDisabledExtensions, dependents) {
|
|
3231
|
+
for (const e of [extension, ...allDisabledExtensions]) {
|
|
3232
|
+
const dependentsOfTheExtension = dependents.filter(d => ( d.dependencies.some(id => areSameExtensions({
|
|
3233
|
+
id
|
|
3234
|
+
}, e.identifier))));
|
|
3235
|
+
if (dependentsOfTheExtension.length) {
|
|
3236
|
+
return this.getErrorMessageForDisablingAnExtensionWithDependents(e, dependentsOfTheExtension);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
return "";
|
|
3240
|
+
}
|
|
3241
|
+
getErrorMessageForDisablingAnExtensionWithDependents(extension, dependents) {
|
|
3242
|
+
if (dependents.length === 1) {
|
|
3243
|
+
return localize(
|
|
3244
|
+
9966,
|
|
3245
|
+
"Cannot disable '{0}' extension alone. '{1}' extension depends on this. Do you want to disable all these extensions?",
|
|
3246
|
+
extension.displayName,
|
|
3247
|
+
dependents[0].displayName
|
|
3248
|
+
);
|
|
3249
|
+
}
|
|
3250
|
+
if (dependents.length === 2) {
|
|
3251
|
+
return localize(
|
|
3252
|
+
9967,
|
|
3253
|
+
"Cannot disable '{0}' extension alone. '{1}' and '{2}' extensions depend on this. Do you want to disable all these extensions?",
|
|
3254
|
+
extension.displayName,
|
|
3255
|
+
dependents[0].displayName,
|
|
3256
|
+
dependents[1].displayName
|
|
3257
|
+
);
|
|
3258
|
+
}
|
|
3259
|
+
return localize(
|
|
3260
|
+
9968,
|
|
3261
|
+
"Cannot disable '{0}' extension alone. '{1}', '{2}' and other extensions depend on this. Do you want to disable all these extensions?",
|
|
3262
|
+
extension.displayName,
|
|
3263
|
+
dependents[0].displayName,
|
|
3264
|
+
dependents[1].displayName
|
|
3265
|
+
);
|
|
3266
|
+
}
|
|
3267
|
+
async doSetEnablement(extensions, enablementState) {
|
|
3268
|
+
return await this.extensionEnablementService.setEnablement(( extensions.map(e => e.local)), enablementState);
|
|
3269
|
+
}
|
|
3270
|
+
reportProgressFromOtherSources() {
|
|
3271
|
+
if (( this.installed.some(
|
|
3272
|
+
e => e.state === ExtensionState.Installing || e.state === ExtensionState.Uninstalling
|
|
3273
|
+
))) {
|
|
3274
|
+
if (!this._activityCallBack) {
|
|
3275
|
+
this.withProgress({
|
|
3276
|
+
location: ProgressLocation.Extensions
|
|
3277
|
+
}, () => ( new Promise(resolve => this._activityCallBack = resolve)));
|
|
3278
|
+
}
|
|
3279
|
+
} else {
|
|
3280
|
+
this._activityCallBack?.();
|
|
3281
|
+
this._activityCallBack = undefined;
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
withProgress(options, task) {
|
|
3285
|
+
return this.progressService.withProgress(options, async () => {
|
|
3286
|
+
const cancelableTask = createCancelablePromise(() => task());
|
|
3287
|
+
this.tasksInProgress.push(cancelableTask);
|
|
3288
|
+
try {
|
|
3289
|
+
return await cancelableTask;
|
|
3290
|
+
} finally {
|
|
3291
|
+
const index = this.tasksInProgress.indexOf(cancelableTask);
|
|
3292
|
+
if (index !== -1) {
|
|
3293
|
+
this.tasksInProgress.splice(index, 1);
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
});
|
|
3297
|
+
}
|
|
3298
|
+
onError(err) {
|
|
3299
|
+
if (isCancellationError(err)) {
|
|
3300
|
+
return;
|
|
3301
|
+
}
|
|
3302
|
+
const message = err && err.message || "";
|
|
3303
|
+
if (/getaddrinfo ENOTFOUND|getaddrinfo ENOENT|connect EACCES|connect ECONNREFUSED/.test(message)) {
|
|
3304
|
+
return;
|
|
3305
|
+
}
|
|
3306
|
+
this.notificationService.error(err);
|
|
3307
|
+
}
|
|
3308
|
+
handleURL(uri, options) {
|
|
3309
|
+
if (!/^extension/.test(uri.path)) {
|
|
3310
|
+
return Promise.resolve(false);
|
|
3311
|
+
}
|
|
3312
|
+
this.onOpenExtensionUrl(uri);
|
|
3313
|
+
return Promise.resolve(true);
|
|
3314
|
+
}
|
|
3315
|
+
onOpenExtensionUrl(uri) {
|
|
3316
|
+
const match = /^extension\/([^/]+)$/.exec(uri.path);
|
|
3317
|
+
if (!match) {
|
|
3318
|
+
return;
|
|
3319
|
+
}
|
|
3320
|
+
const extensionId = match[1];
|
|
3321
|
+
this.queryLocal().then(async local => {
|
|
3322
|
+
let extension = local.find(local => areSameExtensions(local.identifier, {
|
|
3323
|
+
id: extensionId
|
|
3324
|
+
}));
|
|
3325
|
+
if (!extension) {
|
|
3326
|
+
[extension] = await this.getExtensions([{
|
|
3327
|
+
id: extensionId
|
|
3328
|
+
}], {
|
|
3329
|
+
source: "uri"
|
|
3330
|
+
}, CancellationToken.None);
|
|
3331
|
+
}
|
|
3332
|
+
if (extension) {
|
|
3333
|
+
await this.hostService.focus(mainWindow);
|
|
3334
|
+
await this.open(extension);
|
|
3335
|
+
}
|
|
3336
|
+
}).then(undefined, error => this.onError(error));
|
|
3337
|
+
}
|
|
3338
|
+
getPublishersToAutoUpdate() {
|
|
3339
|
+
return this.getEnabledAutoUpdateExtensions().filter(id => !EXTENSION_IDENTIFIER_REGEX.test(id));
|
|
3340
|
+
}
|
|
3341
|
+
getEnabledAutoUpdateExtensions() {
|
|
3342
|
+
try {
|
|
3343
|
+
const parsedValue = JSON.parse(this.enabledAuotUpdateExtensionsValue);
|
|
3344
|
+
if (Array.isArray(parsedValue)) {
|
|
3345
|
+
return parsedValue;
|
|
3346
|
+
}
|
|
3347
|
+
} catch (e) {}
|
|
3348
|
+
return [];
|
|
3349
|
+
}
|
|
3350
|
+
setEnabledAutoUpdateExtensions(enabledAutoUpdateExtensions) {
|
|
3351
|
+
this.enabledAuotUpdateExtensionsValue = JSON.stringify(enabledAutoUpdateExtensions);
|
|
3352
|
+
}
|
|
3353
|
+
get enabledAuotUpdateExtensionsValue() {
|
|
3354
|
+
if (!this._enabledAutoUpdateExtensionsValue) {
|
|
3355
|
+
this._enabledAutoUpdateExtensionsValue = this.getEnabledAutoUpdateExtensionsValue();
|
|
3356
|
+
}
|
|
3357
|
+
return this._enabledAutoUpdateExtensionsValue;
|
|
3358
|
+
}
|
|
3359
|
+
set enabledAuotUpdateExtensionsValue(enabledAuotUpdateExtensionsValue) {
|
|
3360
|
+
if (this.enabledAuotUpdateExtensionsValue !== enabledAuotUpdateExtensionsValue) {
|
|
3361
|
+
this._enabledAutoUpdateExtensionsValue = enabledAuotUpdateExtensionsValue;
|
|
3362
|
+
this.setEnabledAutoUpdateExtensionsValue(enabledAuotUpdateExtensionsValue);
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
getEnabledAutoUpdateExtensionsValue() {
|
|
3366
|
+
return this.storageService.get(EXTENSIONS_AUTO_UPDATE_KEY, StorageScope.APPLICATION, "[]");
|
|
3367
|
+
}
|
|
3368
|
+
setEnabledAutoUpdateExtensionsValue(value) {
|
|
3369
|
+
this.storageService.store(
|
|
3370
|
+
EXTENSIONS_AUTO_UPDATE_KEY,
|
|
3371
|
+
value,
|
|
3372
|
+
StorageScope.APPLICATION,
|
|
3373
|
+
StorageTarget.USER
|
|
3374
|
+
);
|
|
3375
|
+
}
|
|
3376
|
+
getDisabledAutoUpdateExtensions() {
|
|
3377
|
+
try {
|
|
3378
|
+
const parsedValue = JSON.parse(this.disabledAutoUpdateExtensionsValue);
|
|
3379
|
+
if (Array.isArray(parsedValue)) {
|
|
3380
|
+
return parsedValue;
|
|
3381
|
+
}
|
|
3382
|
+
} catch (e) {}
|
|
3383
|
+
return [];
|
|
3384
|
+
}
|
|
3385
|
+
setDisabledAutoUpdateExtensions(disabledAutoUpdateExtensions) {
|
|
3386
|
+
this.disabledAutoUpdateExtensionsValue = JSON.stringify(disabledAutoUpdateExtensions);
|
|
3387
|
+
}
|
|
3388
|
+
get disabledAutoUpdateExtensionsValue() {
|
|
3389
|
+
if (!this._disabledAutoUpdateExtensionsValue) {
|
|
3390
|
+
this._disabledAutoUpdateExtensionsValue = this.getDisabledAutoUpdateExtensionsValue();
|
|
3391
|
+
}
|
|
3392
|
+
return this._disabledAutoUpdateExtensionsValue;
|
|
3393
|
+
}
|
|
3394
|
+
set disabledAutoUpdateExtensionsValue(disabledAutoUpdateExtensionsValue) {
|
|
3395
|
+
if (this.disabledAutoUpdateExtensionsValue !== disabledAutoUpdateExtensionsValue) {
|
|
3396
|
+
this._disabledAutoUpdateExtensionsValue = disabledAutoUpdateExtensionsValue;
|
|
3397
|
+
this.setDisabledAutoUpdateExtensionsValue(disabledAutoUpdateExtensionsValue);
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
getDisabledAutoUpdateExtensionsValue() {
|
|
3401
|
+
return this.storageService.get(EXTENSIONS_DONOT_AUTO_UPDATE_KEY, StorageScope.APPLICATION, "[]");
|
|
3402
|
+
}
|
|
3403
|
+
setDisabledAutoUpdateExtensionsValue(value) {
|
|
3404
|
+
this.storageService.store(
|
|
3405
|
+
EXTENSIONS_DONOT_AUTO_UPDATE_KEY,
|
|
3406
|
+
value,
|
|
3407
|
+
StorageScope.APPLICATION,
|
|
3408
|
+
StorageTarget.USER
|
|
3409
|
+
);
|
|
3410
|
+
}
|
|
3411
|
+
getDismissedNotifications() {
|
|
3412
|
+
try {
|
|
3413
|
+
const parsedValue = JSON.parse(this.dismissedNotificationsValue);
|
|
3414
|
+
if (Array.isArray(parsedValue)) {
|
|
3415
|
+
return parsedValue;
|
|
3416
|
+
}
|
|
3417
|
+
} catch (e) {}
|
|
3418
|
+
return [];
|
|
3419
|
+
}
|
|
3420
|
+
setDismissedNotifications(dismissedNotifications) {
|
|
3421
|
+
this.dismissedNotificationsValue = JSON.stringify(dismissedNotifications);
|
|
3422
|
+
}
|
|
3423
|
+
get dismissedNotificationsValue() {
|
|
3424
|
+
if (!this._dismissedNotificationsValue) {
|
|
3425
|
+
this._dismissedNotificationsValue = this.getDismissedNotificationsValue();
|
|
3426
|
+
}
|
|
3427
|
+
return this._dismissedNotificationsValue;
|
|
3428
|
+
}
|
|
3429
|
+
set dismissedNotificationsValue(dismissedNotificationsValue) {
|
|
3430
|
+
if (this.dismissedNotificationsValue !== dismissedNotificationsValue) {
|
|
3431
|
+
this._dismissedNotificationsValue = dismissedNotificationsValue;
|
|
3432
|
+
this.setDismissedNotificationsValue(dismissedNotificationsValue);
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
getDismissedNotificationsValue() {
|
|
3436
|
+
return this.storageService.get(EXTENSIONS_DISMISSED_NOTIFICATIONS_KEY, StorageScope.PROFILE, "[]");
|
|
3437
|
+
}
|
|
3438
|
+
setDismissedNotificationsValue(value) {
|
|
3439
|
+
this.storageService.store(
|
|
3440
|
+
EXTENSIONS_DISMISSED_NOTIFICATIONS_KEY,
|
|
3441
|
+
value,
|
|
3442
|
+
StorageScope.PROFILE,
|
|
3443
|
+
StorageTarget.USER
|
|
3444
|
+
);
|
|
3445
|
+
}
|
|
3446
|
+
};
|
|
3447
|
+
ExtensionsWorkbenchService = ExtensionsWorkbenchService_1 = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IEditorService)), ( __param(2, IWorkbenchExtensionManagementService)), ( __param(3, IExtensionGalleryService)), ( __param(4, IExtensionGalleryManifestService)), ( __param(5, IConfigurationService)), ( __param(6, ITelemetryService)), ( __param(7, INotificationService)), ( __param(8, IURLService)), ( __param(9, IWorkbenchExtensionEnablementService)), ( __param(10, IHostService)), ( __param(11, IProgressService)), ( __param(12, IExtensionManagementServerService)), ( __param(13, ILanguageService)), ( __param(14, IIgnoredExtensionsManagementService)), ( __param(15, IUserDataAutoSyncService)), ( __param(16, IProductService)), ( __param(17, IContextKeyService)), ( __param(18, IExtensionManifestPropertiesService)), ( __param(19, ILogService)), ( __param(20, IExtensionService)), ( __param(21, ILocaleService)), ( __param(22, ILifecycleService)), ( __param(23, IFileService)), ( __param(24, IUserDataProfileService)), ( __param(25, IUserDataProfilesService)), ( __param(26, IStorageService)), ( __param(27, IDialogService)), ( __param(28, IUserDataSyncEnablementService)), ( __param(29, IUpdateService)), ( __param(30, IUriIdentityService)), ( __param(31, IWorkspaceContextService)), ( __param(32, IViewsService)), ( __param(33, IFileDialogService)), ( __param(34, IQuickInputService)), ( __param(35, IAllowedExtensionsService)), ( __param(36, IMeteredConnectionService))], ExtensionsWorkbenchService));
|
|
3448
|
+
|
|
3449
|
+
export { Extension, ExtensionsWorkbenchService };
|