@codingame/monaco-vscode-api 1.85.0 → 1.85.2
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/README.md +31 -13
- package/contributions.js +1 -0
- package/missing-services.js +396 -68
- package/monaco-editor-treemending.patch +957 -950
- package/package.json +8 -7
- package/service-override/tools/editor.js +1 -1
- package/services.js +10 -6
- package/vscode/src/vs/base/browser/ui/tree/treeDefaults.js +14 -0
- package/vscode/src/vs/base/common/jsonFormatter.js +8 -1
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +128 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionEnablementService.js +140 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
- package/vscode/src/vs/platform/extensions/common/extensions.d.ts +1062 -93
- package/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.js +220 -0
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +58 -0
- package/vscode/src/vs/platform/quickinput/browser/quickPickPin.js +102 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +56 -1
- package/vscode/src/vs/platform/userDataSync/common/content.js +9 -0
- package/vscode/src/vs/platform/userDataSync/common/settingsMerge.js +514 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSync.js +154 -2
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js +43 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncMachines.js +177 -0
- package/vscode/src/vs/workbench/api/common/extHostApiCommands.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostWebview.js +2 -2
- package/vscode/src/vs/workbench/browser/actions/layoutActions.js +186 -4
- package/vscode/src/vs/workbench/browser/parts/views/checkbox.js +105 -0
- package/vscode/src/vs/workbench/browser/parts/views/media/views.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/views/treeView.js +1614 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +191 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +238 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +75 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +205 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +168 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +340 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1195 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +115 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +81 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +583 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +290 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +167 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +562 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatParserTypes.js +31 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProvider.js +24 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +193 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +22 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +52 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +258 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +25 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +388 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +61 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +49 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +647 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +300 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +60 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +249 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +333 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +99 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +55 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +2 -0
- package/vscode/src/vs/workbench/contrib/contextmenu/browser/contextmenu.contribution.js +20 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +855 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +410 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1591 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1485 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +125 -0
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +29 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +41 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +102 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +73 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +988 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget.js +431 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +417 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +806 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +915 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +19 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +129 -10
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +205 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +150 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +480 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +90 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +258 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +614 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +44 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +169 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +64 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.js +49 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +120 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.js +416 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +663 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +593 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +326 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +539 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +265 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +348 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.js +95 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +437 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2730 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +139 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +564 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +119 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +135 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +178 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +35 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +377 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +97 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +194 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +71 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +20 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +85 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +652 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +303 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +228 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatActions.js +302 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatController.js +438 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +45 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +435 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +95 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +107 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +430 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +54 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +1131 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +1591 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +341 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +2155 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.js +95 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +507 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +85 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +47 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +40 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +435 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +31 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +257 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +239 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.js +211 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +808 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +381 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +527 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +163 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +651 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +98 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +62 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +101 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +346 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +152 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookContextKeys.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +296 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +261 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.js +3 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKernelService.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKeymapService.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookLoggingService.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +16 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookRange.js +66 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWorkerService.js +4 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +130 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +847 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +89 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +1942 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/urlFinder.js +107 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsBase.js +49 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +387 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/search/common/constants.js +66 -0
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions.js +24 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets.js +95 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.js +6 -6
- package/vscode/src/vs/workbench/contrib/tasks/common/taskService.js +12 -2
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +712 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +130 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +2 -1
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/featuredExtensionService.js +159 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedExtensionPoint.js +375 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.js +563 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.js +932 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +20 -1
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +205 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +11 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +9 -9
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +1 -1
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingEditing.js +2 -2
- package/vscode/src/vs/workbench/services/languageStatus/common/languageStatusService.js +24 -1
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +15 -1
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorInput.js +41 -0
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.js +588 -0
- package/vscode/src/vs/workbench/services/preferences/common/preferencesEditorInput.js +43 -0
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +2 -2
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +190 -2
- package/vscode/src/vs/workbench/services/search/common/search.js +3 -3
- package/vscode/src/vs/workbench/services/terminal/common/embedderTerminalService.js +75 -1
- package/vscode/src/vs/workbench/services/timer/browser/timerService.js +240 -1
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +31 -1
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +25 -1
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +75 -1
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +74 -4
- package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +77 -0
- package/assets/break.mp3 +0 -0
- package/assets/chatRequestSent.mp3 +0 -0
- package/assets/chatResponsePending.mp3 +0 -0
- package/assets/chatResponseReceived1.mp3 +0 -0
- package/assets/chatResponseReceived2.mp3 +0 -0
- package/assets/chatResponseReceived3.mp3 +0 -0
- package/assets/chatResponseReceived4.mp3 +0 -0
- package/assets/clear.mp3 +0 -0
- package/assets/defaultIcon.png +0 -0
- package/assets/diffLineDeleted.mp3 +0 -0
- package/assets/diffLineInserted.mp3 +0 -0
- package/assets/diffLineModified.mp3 +0 -0
- package/assets/error.mp3 +0 -0
- package/assets/fake.html +0 -10
- package/assets/foldedAreas.mp3 +0 -0
- package/assets/format.mp3 +0 -0
- package/assets/index-no-csp.html +0 -1226
- package/assets/index.html +0 -1227
- package/assets/quickFixes.mp3 +0 -0
- package/assets/save.mp3 +0 -0
- package/assets/service-worker.js +0 -457
- package/assets/taskCompleted.mp3 +0 -0
- package/assets/taskFailed.mp3 +0 -0
- package/assets/terminalBell.mp3 +0 -0
- package/assets/warning.mp3 +0 -0
- package/assets/webWorkerExtensionHostIframe.html +0 -123
- package/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +0 -2
- package/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -5
- package/vscode/src/vs/base/parts/request/browser/request.js +0 -60
- package/vscode/src/vs/platform/request/browser/requestService.js +0 -28
- package/vscode/src/vs/platform/request/common/requestIpc.js +0 -17
- package/vscode/src/vs/platform/url/common/urlService.js +0 -17
- package/vscode/src/vs/workbench/services/configuration/common/jsonEditingService.js +0 -120
- package/vscode/src/vs/workbench/services/decorations/browser/decorationsService.js +0 -319
- package/vscode/src/vs/workbench/services/files/browser/elevatedFileService.js +0 -9
- package/vscode/src/vs/workbench/services/host/browser/browserHostService.js +0 -408
- package/vscode/src/vs/workbench/services/request/browser/requestService.js +0 -48
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js +0 -56
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +0 -639
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +0 -402
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +0 -62
- package/vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js +0 -38
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +0 -295
- package/vscode/src/vs/workbench/services/url/browser/urlService.js +0 -47
- package/vscode/src/vs/workbench/services/views/common/treeViewsService.js +0 -20
- package/vscode/src/vs/workbench/services/workspaces/common/canonicalUriService.js +0 -19
|
@@ -0,0 +1,1614 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { DataTransfers } from 'monaco-editor/esm/vs/base/browser/dnd.js';
|
|
3
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
4
|
+
import { renderMarkdownAsPlaintext } from 'monaco-editor/esm/vs/base/browser/markdownRenderer.js';
|
|
5
|
+
import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
|
|
6
|
+
import { ActionViewItem } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js';
|
|
7
|
+
import { CollapseAllAction } from '../../../../base/browser/ui/tree/treeDefaults.js';
|
|
8
|
+
import { ActionRunner } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
9
|
+
import { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
10
|
+
import { CancellationTokenSource, CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
11
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
12
|
+
import { isCancellationError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
13
|
+
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
14
|
+
import { createMatches } from 'monaco-editor/esm/vs/base/common/filters.js';
|
|
15
|
+
import { isMarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
16
|
+
import { Disposable, DisposableStore, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
17
|
+
import { Mimes } from 'monaco-editor/esm/vs/base/common/mime.js';
|
|
18
|
+
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
19
|
+
import { basename, dirname } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
20
|
+
import { isFalsyOrWhitespace } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
21
|
+
import { isString } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
22
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
23
|
+
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
24
|
+
import './media/views.css.js';
|
|
25
|
+
import { VSDataTransfer } from 'monaco-editor/esm/vs/base/common/dataTransfer.js';
|
|
26
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
27
|
+
import { createActionViewItem, createAndFillInContextMenuActions } from 'monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js';
|
|
28
|
+
import { MenuId, MenuRegistry, registerAction2, Action2, IMenuService } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
29
|
+
import { CommandsRegistry, ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
30
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
31
|
+
import { IContextKeyService, RawContextKey, ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
32
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
33
|
+
import { FileKind } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
34
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
35
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
36
|
+
import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
|
|
37
|
+
import { WorkbenchAsyncDataTree } from 'monaco-editor/esm/vs/platform/list/browser/listService.js';
|
|
38
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
39
|
+
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
40
|
+
import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
|
|
41
|
+
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
42
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
43
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
44
|
+
import { ColorScheme } from 'monaco-editor/esm/vs/platform/theme/common/theme.js';
|
|
45
|
+
import { FolderThemeIcon, FileThemeIcon, IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
46
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
47
|
+
import { fillEditorsDragData } from '../../dnd.js';
|
|
48
|
+
import { ResourceLabels } from '../../labels.js';
|
|
49
|
+
import { API_OPEN_EDITOR_COMMAND_ID, API_OPEN_DIFF_EDITOR_COMMAND_ID } from '../editor/editorCommands.js';
|
|
50
|
+
import { ViewPane } from './viewPane.js';
|
|
51
|
+
import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from '../../../common/theme.js';
|
|
52
|
+
import { ResolvableTreeItem, TreeItemCollapsibleState, Extensions, IViewDescriptorService } from '../../../common/views.js';
|
|
53
|
+
import { IActivityService, NumberBadge } from '../../../services/activity/common/activity.js';
|
|
54
|
+
import { IExtensionService } from '../../../services/extensions/common/extensions.js';
|
|
55
|
+
import { IHoverService } from '../../../services/hover/browser/hover.js';
|
|
56
|
+
import { ITreeViewsService } from '../../../services/views/browser/treeViewsService.js';
|
|
57
|
+
import { LocalSelectionTransfer, CodeDataTransfers } from 'monaco-editor/esm/vs/platform/dnd/browser/dnd.js';
|
|
58
|
+
import { toExternalVSDataTransfer } from 'monaco-editor/esm/vs/editor/browser/dnd.js';
|
|
59
|
+
import { TreeItemCheckbox, CheckboxStateHandler } from './checkbox.js';
|
|
60
|
+
import { setTimeout0 } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
61
|
+
import { TelemetryTrustedValue } from '../../../../platform/telemetry/common/telemetryUtils.js';
|
|
62
|
+
import { ITreeViewsDnDService } from 'monaco-editor/esm/vs/editor/common/services/treeViewsDndService.js';
|
|
63
|
+
import { DraggedTreeItemsIdentifier } from 'monaco-editor/esm/vs/editor/common/services/treeViewsDnd.js';
|
|
64
|
+
import { MarkdownRenderer } from 'monaco-editor/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.js';
|
|
65
|
+
var TreeRenderer_1;
|
|
66
|
+
let TreeViewPane = class TreeViewPane extends ViewPane {
|
|
67
|
+
constructor(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService) {
|
|
68
|
+
super({ ...options, titleMenuId: MenuId.ViewTitle, donotForwardArgs: false }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
69
|
+
const { treeView } = ( Registry.as(Extensions.ViewsRegistry)).getView(options.id);
|
|
70
|
+
this.treeView = treeView;
|
|
71
|
+
this._register(this.treeView.onDidChangeActions(() => this.updateActions(), this));
|
|
72
|
+
this._register(this.treeView.onDidChangeTitle((newTitle) => this.updateTitle(newTitle)));
|
|
73
|
+
this._register(this.treeView.onDidChangeDescription((newDescription) => this.updateTitleDescription(newDescription)));
|
|
74
|
+
this._register(toDisposable(() => {
|
|
75
|
+
if (this._container && this.treeView.container && (this._container === this.treeView.container)) {
|
|
76
|
+
this.treeView.setVisibility(false);
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
this._register(this.onDidChangeBodyVisibility(() => this.updateTreeVisibility()));
|
|
80
|
+
this._register(this.treeView.onDidChangeWelcomeState(() => this._onDidChangeViewWelcomeState.fire()));
|
|
81
|
+
if (options.title !== this.treeView.title) {
|
|
82
|
+
this.updateTitle(this.treeView.title);
|
|
83
|
+
}
|
|
84
|
+
if (options.titleDescription !== this.treeView.description) {
|
|
85
|
+
this.updateTitleDescription(this.treeView.description);
|
|
86
|
+
}
|
|
87
|
+
this._actionRunner = ( new MultipleSelectionActionRunner(notificationService, () => this.treeView.getSelection()));
|
|
88
|
+
this.updateTreeVisibility();
|
|
89
|
+
}
|
|
90
|
+
focus() {
|
|
91
|
+
super.focus();
|
|
92
|
+
this.treeView.focus();
|
|
93
|
+
}
|
|
94
|
+
renderBody(container) {
|
|
95
|
+
this._container = container;
|
|
96
|
+
super.renderBody(container);
|
|
97
|
+
this.renderTreeView(container);
|
|
98
|
+
}
|
|
99
|
+
shouldShowWelcome() {
|
|
100
|
+
return ((this.treeView.dataProvider === undefined) || !!this.treeView.dataProvider.isTreeEmpty) && ((this.treeView.message === undefined) || (this.treeView.message === ''));
|
|
101
|
+
}
|
|
102
|
+
layoutBody(height, width) {
|
|
103
|
+
super.layoutBody(height, width);
|
|
104
|
+
this.layoutTreeView(height, width);
|
|
105
|
+
}
|
|
106
|
+
getOptimalWidth() {
|
|
107
|
+
return this.treeView.getOptimalWidth();
|
|
108
|
+
}
|
|
109
|
+
renderTreeView(container) {
|
|
110
|
+
this.treeView.show(container);
|
|
111
|
+
}
|
|
112
|
+
layoutTreeView(height, width) {
|
|
113
|
+
this.treeView.layout(height, width);
|
|
114
|
+
}
|
|
115
|
+
updateTreeVisibility() {
|
|
116
|
+
this.treeView.setVisibility(this.isBodyVisible());
|
|
117
|
+
}
|
|
118
|
+
getActionRunner() {
|
|
119
|
+
return this._actionRunner;
|
|
120
|
+
}
|
|
121
|
+
getActionsContext() {
|
|
122
|
+
return { $treeViewId: this.id, $focusedTreeItem: true, $selectedTreeItems: true };
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
TreeViewPane = ( __decorate([
|
|
126
|
+
( __param(1, IKeybindingService)),
|
|
127
|
+
( __param(2, IContextMenuService)),
|
|
128
|
+
( __param(3, IConfigurationService)),
|
|
129
|
+
( __param(4, IContextKeyService)),
|
|
130
|
+
( __param(5, IViewDescriptorService)),
|
|
131
|
+
( __param(6, IInstantiationService)),
|
|
132
|
+
( __param(7, IOpenerService)),
|
|
133
|
+
( __param(8, IThemeService)),
|
|
134
|
+
( __param(9, ITelemetryService)),
|
|
135
|
+
( __param(10, INotificationService))
|
|
136
|
+
], TreeViewPane));
|
|
137
|
+
class Root {
|
|
138
|
+
constructor() {
|
|
139
|
+
this.label = { label: 'root' };
|
|
140
|
+
this.handle = '0';
|
|
141
|
+
this.parentHandle = undefined;
|
|
142
|
+
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
143
|
+
this.children = undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function isTreeCommandEnabled(treeCommand, contextKeyService) {
|
|
147
|
+
const command = CommandsRegistry.getCommand(treeCommand.originalId ? treeCommand.originalId : treeCommand.id);
|
|
148
|
+
if (command) {
|
|
149
|
+
const commandAction = MenuRegistry.getCommand(command.id);
|
|
150
|
+
const precondition = commandAction && commandAction.precondition;
|
|
151
|
+
if (precondition) {
|
|
152
|
+
return contextKeyService.contextMatchesRules(precondition);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
function isRenderedMessageValue(messageValue) {
|
|
158
|
+
return !!messageValue && typeof messageValue !== 'string' && 'element' in messageValue && 'dispose' in messageValue;
|
|
159
|
+
}
|
|
160
|
+
const noDataProviderMessage = ( localizeWithPath(
|
|
161
|
+
'vs/workbench/browser/parts/views/treeView',
|
|
162
|
+
'no-dataprovider',
|
|
163
|
+
"There is no data provider registered that can provide view data."
|
|
164
|
+
));
|
|
165
|
+
const RawCustomTreeViewContextKey = ( new RawContextKey('customTreeView', false));
|
|
166
|
+
class Tree extends WorkbenchAsyncDataTree {
|
|
167
|
+
}
|
|
168
|
+
let AbstractTreeView = class AbstractTreeView extends Disposable {
|
|
169
|
+
constructor(id, _title, themeService, instantiationService, commandService, configurationService, progressService, contextMenuService, keybindingService, notificationService, viewDescriptorService, hoverService, contextKeyService, activityService, logService) {
|
|
170
|
+
super();
|
|
171
|
+
this.id = id;
|
|
172
|
+
this._title = _title;
|
|
173
|
+
this.themeService = themeService;
|
|
174
|
+
this.instantiationService = instantiationService;
|
|
175
|
+
this.commandService = commandService;
|
|
176
|
+
this.configurationService = configurationService;
|
|
177
|
+
this.progressService = progressService;
|
|
178
|
+
this.contextMenuService = contextMenuService;
|
|
179
|
+
this.keybindingService = keybindingService;
|
|
180
|
+
this.notificationService = notificationService;
|
|
181
|
+
this.viewDescriptorService = viewDescriptorService;
|
|
182
|
+
this.hoverService = hoverService;
|
|
183
|
+
this.contextKeyService = contextKeyService;
|
|
184
|
+
this.activityService = activityService;
|
|
185
|
+
this.logService = logService;
|
|
186
|
+
this.isVisible = false;
|
|
187
|
+
this._hasIconForParentNode = false;
|
|
188
|
+
this._hasIconForLeafNode = false;
|
|
189
|
+
this.focused = false;
|
|
190
|
+
this._canSelectMany = false;
|
|
191
|
+
this._manuallyManageCheckboxes = false;
|
|
192
|
+
this.elementsToRefresh = [];
|
|
193
|
+
this.lastSelection = [];
|
|
194
|
+
this._onDidExpandItem = this._register(( new Emitter()));
|
|
195
|
+
this.onDidExpandItem = this._onDidExpandItem.event;
|
|
196
|
+
this._onDidCollapseItem = this._register(( new Emitter()));
|
|
197
|
+
this.onDidCollapseItem = this._onDidCollapseItem.event;
|
|
198
|
+
this._onDidChangeSelectionAndFocus = this._register(( new Emitter()));
|
|
199
|
+
this.onDidChangeSelectionAndFocus = this._onDidChangeSelectionAndFocus.event;
|
|
200
|
+
this._onDidChangeVisibility = this._register(( new Emitter()));
|
|
201
|
+
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
202
|
+
this._onDidChangeActions = this._register(( new Emitter()));
|
|
203
|
+
this.onDidChangeActions = this._onDidChangeActions.event;
|
|
204
|
+
this._onDidChangeWelcomeState = this._register(( new Emitter()));
|
|
205
|
+
this.onDidChangeWelcomeState = this._onDidChangeWelcomeState.event;
|
|
206
|
+
this._onDidChangeTitle = this._register(( new Emitter()));
|
|
207
|
+
this.onDidChangeTitle = this._onDidChangeTitle.event;
|
|
208
|
+
this._onDidChangeDescription = this._register(( new Emitter()));
|
|
209
|
+
this.onDidChangeDescription = this._onDidChangeDescription.event;
|
|
210
|
+
this._onDidChangeCheckboxState = this._register(( new Emitter()));
|
|
211
|
+
this.onDidChangeCheckboxState = this._onDidChangeCheckboxState.event;
|
|
212
|
+
this._onDidCompleteRefresh = this._register(( new Emitter()));
|
|
213
|
+
this._isInitialized = false;
|
|
214
|
+
this._height = 0;
|
|
215
|
+
this._width = 0;
|
|
216
|
+
this.refreshing = false;
|
|
217
|
+
this.root = ( new Root());
|
|
218
|
+
this.lastActive = this.root;
|
|
219
|
+
}
|
|
220
|
+
initialize() {
|
|
221
|
+
if (this._isInitialized) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
this._isInitialized = true;
|
|
225
|
+
this.contextKeyService.bufferChangeEvents(() => {
|
|
226
|
+
this.initializeShowCollapseAllAction();
|
|
227
|
+
this.initializeCollapseAllToggle();
|
|
228
|
+
this.initializeShowRefreshAction();
|
|
229
|
+
});
|
|
230
|
+
this.treeViewDnd = this.instantiationService.createInstance(CustomTreeViewDragAndDrop, this.id);
|
|
231
|
+
if (this._dragAndDropController) {
|
|
232
|
+
this.treeViewDnd.controller = this._dragAndDropController;
|
|
233
|
+
}
|
|
234
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
235
|
+
if (e.affectsConfiguration('explorer.decorations')) {
|
|
236
|
+
this.doRefresh([this.root]);
|
|
237
|
+
}
|
|
238
|
+
}));
|
|
239
|
+
this._register(this.viewDescriptorService.onDidChangeLocation(({ views, from, to }) => {
|
|
240
|
+
if (( views.some(v => v.id === this.id))) {
|
|
241
|
+
this.tree?.updateOptions({ overrideStyles: { listBackground: this.viewLocation === 1 ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND } });
|
|
242
|
+
}
|
|
243
|
+
}));
|
|
244
|
+
this.registerActions();
|
|
245
|
+
this.create();
|
|
246
|
+
}
|
|
247
|
+
get viewContainer() {
|
|
248
|
+
return this.viewDescriptorService.getViewContainerByViewId(this.id);
|
|
249
|
+
}
|
|
250
|
+
get viewLocation() {
|
|
251
|
+
return this.viewDescriptorService.getViewLocationById(this.id);
|
|
252
|
+
}
|
|
253
|
+
get dragAndDropController() {
|
|
254
|
+
return this._dragAndDropController;
|
|
255
|
+
}
|
|
256
|
+
set dragAndDropController(dnd) {
|
|
257
|
+
this._dragAndDropController = dnd;
|
|
258
|
+
if (this.treeViewDnd) {
|
|
259
|
+
this.treeViewDnd.controller = dnd;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
get dataProvider() {
|
|
263
|
+
return this._dataProvider;
|
|
264
|
+
}
|
|
265
|
+
set dataProvider(dataProvider) {
|
|
266
|
+
if (dataProvider) {
|
|
267
|
+
const self = this;
|
|
268
|
+
this._dataProvider = new (class {
|
|
269
|
+
constructor() {
|
|
270
|
+
this._isEmpty = true;
|
|
271
|
+
this._onDidChangeEmpty = ( new Emitter());
|
|
272
|
+
this.onDidChangeEmpty = this._onDidChangeEmpty.event;
|
|
273
|
+
}
|
|
274
|
+
get isTreeEmpty() {
|
|
275
|
+
return this._isEmpty;
|
|
276
|
+
}
|
|
277
|
+
async getChildren(node) {
|
|
278
|
+
let children;
|
|
279
|
+
const checkboxesUpdated = [];
|
|
280
|
+
if (node && node.children) {
|
|
281
|
+
children = node.children;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
node = node ?? self.root;
|
|
285
|
+
node.children = await (node instanceof Root ? dataProvider.getChildren() : dataProvider.getChildren(node));
|
|
286
|
+
children = node.children ?? [];
|
|
287
|
+
children.forEach(child => {
|
|
288
|
+
child.parent = node;
|
|
289
|
+
if (!self.manuallyManageCheckboxes && (node?.checkbox?.isChecked === true) && (child.checkbox?.isChecked === false)) {
|
|
290
|
+
child.checkbox.isChecked = true;
|
|
291
|
+
checkboxesUpdated.push(child);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
if (node instanceof Root) {
|
|
296
|
+
const oldEmpty = this._isEmpty;
|
|
297
|
+
this._isEmpty = children.length === 0;
|
|
298
|
+
if (oldEmpty !== this._isEmpty) {
|
|
299
|
+
this._onDidChangeEmpty.fire();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (checkboxesUpdated.length > 0) {
|
|
303
|
+
self._onDidChangeCheckboxState.fire(checkboxesUpdated);
|
|
304
|
+
}
|
|
305
|
+
return children;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
if (this._dataProvider.onDidChangeEmpty) {
|
|
309
|
+
this._register(this._dataProvider.onDidChangeEmpty(() => {
|
|
310
|
+
this.updateCollapseAllToggle();
|
|
311
|
+
this._onDidChangeWelcomeState.fire();
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
this.updateMessage();
|
|
315
|
+
this.refresh();
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
this._dataProvider = undefined;
|
|
319
|
+
this.updateMessage();
|
|
320
|
+
}
|
|
321
|
+
this._onDidChangeWelcomeState.fire();
|
|
322
|
+
}
|
|
323
|
+
get message() {
|
|
324
|
+
return this._message;
|
|
325
|
+
}
|
|
326
|
+
set message(message) {
|
|
327
|
+
this._message = message;
|
|
328
|
+
this.updateMessage();
|
|
329
|
+
this._onDidChangeWelcomeState.fire();
|
|
330
|
+
}
|
|
331
|
+
get title() {
|
|
332
|
+
return this._title;
|
|
333
|
+
}
|
|
334
|
+
set title(name) {
|
|
335
|
+
this._title = name;
|
|
336
|
+
this._onDidChangeTitle.fire(this._title);
|
|
337
|
+
}
|
|
338
|
+
get description() {
|
|
339
|
+
return this._description;
|
|
340
|
+
}
|
|
341
|
+
set description(description) {
|
|
342
|
+
this._description = description;
|
|
343
|
+
this._onDidChangeDescription.fire(this._description);
|
|
344
|
+
}
|
|
345
|
+
get badge() {
|
|
346
|
+
return this._badge;
|
|
347
|
+
}
|
|
348
|
+
set badge(badge) {
|
|
349
|
+
if (this._badge?.value === badge?.value &&
|
|
350
|
+
this._badge?.tooltip === badge?.tooltip) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (this._badgeActivity) {
|
|
354
|
+
this._badgeActivity.dispose();
|
|
355
|
+
this._badgeActivity = undefined;
|
|
356
|
+
}
|
|
357
|
+
this._badge = badge;
|
|
358
|
+
if (badge) {
|
|
359
|
+
const activity = {
|
|
360
|
+
badge: ( new NumberBadge(badge.value, () => badge.tooltip)),
|
|
361
|
+
priority: 50
|
|
362
|
+
};
|
|
363
|
+
this._badgeActivity = this.activityService.showViewActivity(this.id, activity);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
get canSelectMany() {
|
|
367
|
+
return this._canSelectMany;
|
|
368
|
+
}
|
|
369
|
+
set canSelectMany(canSelectMany) {
|
|
370
|
+
const oldCanSelectMany = this._canSelectMany;
|
|
371
|
+
this._canSelectMany = canSelectMany;
|
|
372
|
+
if (this._canSelectMany !== oldCanSelectMany) {
|
|
373
|
+
this.tree?.updateOptions({ multipleSelectionSupport: this.canSelectMany });
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
get manuallyManageCheckboxes() {
|
|
377
|
+
return this._manuallyManageCheckboxes;
|
|
378
|
+
}
|
|
379
|
+
set manuallyManageCheckboxes(manuallyManageCheckboxes) {
|
|
380
|
+
this._manuallyManageCheckboxes = manuallyManageCheckboxes;
|
|
381
|
+
}
|
|
382
|
+
get hasIconForParentNode() {
|
|
383
|
+
return this._hasIconForParentNode;
|
|
384
|
+
}
|
|
385
|
+
get hasIconForLeafNode() {
|
|
386
|
+
return this._hasIconForLeafNode;
|
|
387
|
+
}
|
|
388
|
+
get visible() {
|
|
389
|
+
return this.isVisible;
|
|
390
|
+
}
|
|
391
|
+
initializeShowCollapseAllAction(startingValue = false) {
|
|
392
|
+
if (!this.collapseAllContext) {
|
|
393
|
+
this.collapseAllContextKey = ( new RawContextKey(`treeView.${this.id}.enableCollapseAll`, startingValue, ( localizeWithPath(
|
|
394
|
+
'vs/workbench/browser/parts/views/treeView',
|
|
395
|
+
'treeView.enableCollapseAll',
|
|
396
|
+
"Whether the the tree view with id {0} enables collapse all.",
|
|
397
|
+
this.id
|
|
398
|
+
))));
|
|
399
|
+
this.collapseAllContext = this.collapseAllContextKey.bindTo(this.contextKeyService);
|
|
400
|
+
}
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
get showCollapseAllAction() {
|
|
404
|
+
this.initializeShowCollapseAllAction();
|
|
405
|
+
return !!this.collapseAllContext?.get();
|
|
406
|
+
}
|
|
407
|
+
set showCollapseAllAction(showCollapseAllAction) {
|
|
408
|
+
this.initializeShowCollapseAllAction(showCollapseAllAction);
|
|
409
|
+
this.collapseAllContext?.set(showCollapseAllAction);
|
|
410
|
+
}
|
|
411
|
+
initializeShowRefreshAction(startingValue = false) {
|
|
412
|
+
if (!this.refreshContext) {
|
|
413
|
+
this.refreshContextKey = ( new RawContextKey(`treeView.${this.id}.enableRefresh`, startingValue, ( localizeWithPath(
|
|
414
|
+
'vs/workbench/browser/parts/views/treeView',
|
|
415
|
+
'treeView.enableRefresh',
|
|
416
|
+
"Whether the tree view with id {0} enables refresh.",
|
|
417
|
+
this.id
|
|
418
|
+
))));
|
|
419
|
+
this.refreshContext = this.refreshContextKey.bindTo(this.contextKeyService);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
get showRefreshAction() {
|
|
423
|
+
this.initializeShowRefreshAction();
|
|
424
|
+
return !!this.refreshContext?.get();
|
|
425
|
+
}
|
|
426
|
+
set showRefreshAction(showRefreshAction) {
|
|
427
|
+
this.initializeShowRefreshAction(showRefreshAction);
|
|
428
|
+
this.refreshContext?.set(showRefreshAction);
|
|
429
|
+
}
|
|
430
|
+
registerActions() {
|
|
431
|
+
const that = this;
|
|
432
|
+
this._register(registerAction2(class extends Action2 {
|
|
433
|
+
constructor() {
|
|
434
|
+
super({
|
|
435
|
+
id: `workbench.actions.treeView.${that.id}.refresh`,
|
|
436
|
+
title: ( localizeWithPath('vs/workbench/browser/parts/views/treeView', 'refresh', "Refresh")),
|
|
437
|
+
menu: {
|
|
438
|
+
id: MenuId.ViewTitle,
|
|
439
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', that.id)), that.refreshContextKey)),
|
|
440
|
+
group: 'navigation',
|
|
441
|
+
order: Number.MAX_SAFE_INTEGER - 1,
|
|
442
|
+
},
|
|
443
|
+
icon: Codicon.refresh
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
async run() {
|
|
447
|
+
return that.refresh();
|
|
448
|
+
}
|
|
449
|
+
}));
|
|
450
|
+
this._register(registerAction2(class extends Action2 {
|
|
451
|
+
constructor() {
|
|
452
|
+
super({
|
|
453
|
+
id: `workbench.actions.treeView.${that.id}.collapseAll`,
|
|
454
|
+
title: ( localizeWithPath('vs/workbench/browser/parts/views/treeView', 'collapseAll', "Collapse All")),
|
|
455
|
+
menu: {
|
|
456
|
+
id: MenuId.ViewTitle,
|
|
457
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', that.id)), that.collapseAllContextKey)),
|
|
458
|
+
group: 'navigation',
|
|
459
|
+
order: Number.MAX_SAFE_INTEGER,
|
|
460
|
+
},
|
|
461
|
+
precondition: that.collapseAllToggleContextKey,
|
|
462
|
+
icon: Codicon.collapseAll
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
async run() {
|
|
466
|
+
if (that.tree) {
|
|
467
|
+
return ( new CollapseAllAction(that.tree, true)).run();
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}));
|
|
471
|
+
}
|
|
472
|
+
setVisibility(isVisible) {
|
|
473
|
+
this.initialize();
|
|
474
|
+
isVisible = !!isVisible;
|
|
475
|
+
if (this.isVisible === isVisible) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
this.isVisible = isVisible;
|
|
479
|
+
if (this.tree) {
|
|
480
|
+
if (this.isVisible) {
|
|
481
|
+
dom.show(this.tree.getHTMLElement());
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
dom.hide(this.tree.getHTMLElement());
|
|
485
|
+
}
|
|
486
|
+
if (this.isVisible && this.elementsToRefresh.length && this.dataProvider) {
|
|
487
|
+
this.doRefresh(this.elementsToRefresh);
|
|
488
|
+
this.elementsToRefresh = [];
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
setTimeout0(() => {
|
|
492
|
+
if (this.dataProvider) {
|
|
493
|
+
this._onDidChangeVisibility.fire(this.isVisible);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
if (this.visible) {
|
|
497
|
+
this.activate();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
focus(reveal = true, revealItem) {
|
|
501
|
+
if (this.tree && this.root.children && this.root.children.length > 0) {
|
|
502
|
+
const element = revealItem ?? this.tree.getSelection()[0];
|
|
503
|
+
if (element && reveal) {
|
|
504
|
+
this.tree.reveal(element, 0.5);
|
|
505
|
+
}
|
|
506
|
+
this.tree.domFocus();
|
|
507
|
+
}
|
|
508
|
+
else if (this.tree && this.treeContainer && !this.treeContainer.classList.contains('hide')) {
|
|
509
|
+
this.tree.domFocus();
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
this.domNode.focus();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
show(container) {
|
|
516
|
+
this._container = container;
|
|
517
|
+
dom.append(container, this.domNode);
|
|
518
|
+
}
|
|
519
|
+
create() {
|
|
520
|
+
this.domNode = dom.$('.tree-explorer-viewlet-tree-view');
|
|
521
|
+
this.messageElement = dom.append(this.domNode, dom.$('.message'));
|
|
522
|
+
this.updateMessage();
|
|
523
|
+
this.treeContainer = dom.append(this.domNode, dom.$('.customview-tree'));
|
|
524
|
+
this.treeContainer.classList.add('file-icon-themable-tree', 'show-file-icons');
|
|
525
|
+
const focusTracker = this._register(dom.trackFocus(this.domNode));
|
|
526
|
+
this._register(focusTracker.onDidFocus(() => this.focused = true));
|
|
527
|
+
this._register(focusTracker.onDidBlur(() => this.focused = false));
|
|
528
|
+
}
|
|
529
|
+
createTree() {
|
|
530
|
+
const actionViewItemProvider = createActionViewItem.bind(undefined, this.instantiationService);
|
|
531
|
+
const treeMenus = this._register(this.instantiationService.createInstance(TreeMenus, this.id));
|
|
532
|
+
this.treeLabels = this._register(this.instantiationService.createInstance(ResourceLabels, this));
|
|
533
|
+
const dataSource = this.instantiationService.createInstance(TreeDataSource, this, (task) => this.progressService.withProgress({ location: this.id }, () => task));
|
|
534
|
+
const aligner = ( new Aligner(this.themeService));
|
|
535
|
+
const checkboxStateHandler = this._register(( new CheckboxStateHandler()));
|
|
536
|
+
const renderer = this.instantiationService.createInstance(TreeRenderer, this.id, treeMenus, this.treeLabels, actionViewItemProvider, aligner, checkboxStateHandler, () => this.manuallyManageCheckboxes);
|
|
537
|
+
this._register(renderer.onDidChangeCheckboxState(e => this._onDidChangeCheckboxState.fire(e)));
|
|
538
|
+
const widgetAriaLabel = this._title;
|
|
539
|
+
this.tree = this._register(this.instantiationService.createInstance(Tree, this.id, this.treeContainer, ( new TreeViewDelegate()), [renderer], dataSource, {
|
|
540
|
+
identityProvider: ( new TreeViewIdentityProvider()),
|
|
541
|
+
accessibilityProvider: {
|
|
542
|
+
getAriaLabel(element) {
|
|
543
|
+
if (element.accessibilityInformation) {
|
|
544
|
+
return element.accessibilityInformation.label;
|
|
545
|
+
}
|
|
546
|
+
if (isString(element.tooltip)) {
|
|
547
|
+
return element.tooltip;
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
if (element.resourceUri && !element.label) {
|
|
551
|
+
return null;
|
|
552
|
+
}
|
|
553
|
+
let buildAriaLabel = '';
|
|
554
|
+
if (element.label) {
|
|
555
|
+
buildAriaLabel += element.label.label + ' ';
|
|
556
|
+
}
|
|
557
|
+
if (element.description) {
|
|
558
|
+
buildAriaLabel += element.description;
|
|
559
|
+
}
|
|
560
|
+
return buildAriaLabel;
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
getRole(element) {
|
|
564
|
+
return element.accessibilityInformation?.role ?? 'treeitem';
|
|
565
|
+
},
|
|
566
|
+
getWidgetAriaLabel() {
|
|
567
|
+
return widgetAriaLabel;
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
keyboardNavigationLabelProvider: {
|
|
571
|
+
getKeyboardNavigationLabel: (item) => {
|
|
572
|
+
return item.label ? item.label.label : (item.resourceUri ? basename(URI.revive(item.resourceUri)) : undefined);
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
expandOnlyOnTwistieClick: (e) => {
|
|
576
|
+
return !!e.command || !!e.checkbox || this.configurationService.getValue('workbench.tree.expandMode') === 'doubleClick';
|
|
577
|
+
},
|
|
578
|
+
collapseByDefault: (e) => {
|
|
579
|
+
return e.collapsibleState !== TreeItemCollapsibleState.Expanded;
|
|
580
|
+
},
|
|
581
|
+
multipleSelectionSupport: this.canSelectMany,
|
|
582
|
+
dnd: this.treeViewDnd,
|
|
583
|
+
overrideStyles: {
|
|
584
|
+
listBackground: this.viewLocation === 1 ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND
|
|
585
|
+
}
|
|
586
|
+
}));
|
|
587
|
+
treeMenus.setContextKeyService(this.tree.contextKeyService);
|
|
588
|
+
aligner.tree = this.tree;
|
|
589
|
+
const actionRunner = ( new MultipleSelectionActionRunner(this.notificationService, () => this.tree.getSelection()));
|
|
590
|
+
renderer.actionRunner = actionRunner;
|
|
591
|
+
this.tree.contextKeyService.createKey(this.id, true);
|
|
592
|
+
const customTreeKey = RawCustomTreeViewContextKey.bindTo(this.tree.contextKeyService);
|
|
593
|
+
customTreeKey.set(true);
|
|
594
|
+
this._register(this.tree.onContextMenu(e => this.onContextMenu(treeMenus, e, actionRunner)));
|
|
595
|
+
this._register(this.tree.onDidChangeSelection(e => {
|
|
596
|
+
this.lastSelection = e.elements;
|
|
597
|
+
this.lastActive = this.tree?.getFocus()[0] ?? this.lastActive;
|
|
598
|
+
this._onDidChangeSelectionAndFocus.fire({ selection: this.lastSelection, focus: this.lastActive });
|
|
599
|
+
}));
|
|
600
|
+
this._register(this.tree.onDidChangeFocus(e => {
|
|
601
|
+
if (e.elements.length && (e.elements[0] !== this.lastActive)) {
|
|
602
|
+
this.lastActive = e.elements[0];
|
|
603
|
+
this.lastSelection = this.tree?.getSelection() ?? this.lastSelection;
|
|
604
|
+
this._onDidChangeSelectionAndFocus.fire({ selection: this.lastSelection, focus: this.lastActive });
|
|
605
|
+
}
|
|
606
|
+
}));
|
|
607
|
+
this._register(this.tree.onDidChangeCollapseState(e => {
|
|
608
|
+
if (!e.node.element) {
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
const element = Array.isArray(e.node.element.element) ? e.node.element.element[0] : e.node.element.element;
|
|
612
|
+
if (e.node.collapsed) {
|
|
613
|
+
this._onDidCollapseItem.fire(element);
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
this._onDidExpandItem.fire(element);
|
|
617
|
+
}
|
|
618
|
+
}));
|
|
619
|
+
this.tree.setInput(this.root).then(() => this.updateContentAreas());
|
|
620
|
+
this._register(this.tree.onDidOpen(async (e) => {
|
|
621
|
+
if (!e.browserEvent) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
if (e.browserEvent.target && e.browserEvent.target.classList.contains(TreeItemCheckbox.checkboxClass)) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
const selection = this.tree.getSelection();
|
|
628
|
+
const command = await this.resolveCommand(selection.length === 1 ? selection[0] : undefined);
|
|
629
|
+
if (command && isTreeCommandEnabled(command, this.contextKeyService)) {
|
|
630
|
+
let args = command.arguments || [];
|
|
631
|
+
if (command.id === API_OPEN_EDITOR_COMMAND_ID || command.id === API_OPEN_DIFF_EDITOR_COMMAND_ID) {
|
|
632
|
+
args = [...args, e];
|
|
633
|
+
}
|
|
634
|
+
try {
|
|
635
|
+
await this.commandService.executeCommand(command.id, ...args);
|
|
636
|
+
}
|
|
637
|
+
catch (err) {
|
|
638
|
+
this.notificationService.error(err);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}));
|
|
642
|
+
this._register(treeMenus.onDidChange((changed) => {
|
|
643
|
+
if (this.tree?.hasNode(changed)) {
|
|
644
|
+
this.tree?.rerender(changed);
|
|
645
|
+
}
|
|
646
|
+
}));
|
|
647
|
+
}
|
|
648
|
+
async resolveCommand(element) {
|
|
649
|
+
let command = element?.command;
|
|
650
|
+
if (element && !command) {
|
|
651
|
+
if ((element instanceof ResolvableTreeItem) && element.hasResolve) {
|
|
652
|
+
await element.resolve(( new CancellationTokenSource()).token);
|
|
653
|
+
command = element.command;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
return command;
|
|
657
|
+
}
|
|
658
|
+
onContextMenu(treeMenus, treeEvent, actionRunner) {
|
|
659
|
+
this.hoverService.hideHover();
|
|
660
|
+
const node = treeEvent.element;
|
|
661
|
+
if (node === null) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
const event = treeEvent.browserEvent;
|
|
665
|
+
event.preventDefault();
|
|
666
|
+
event.stopPropagation();
|
|
667
|
+
this.tree.setFocus([node]);
|
|
668
|
+
const actions = treeMenus.getResourceContextActions(node);
|
|
669
|
+
if (!actions.length) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
this.contextMenuService.showContextMenu({
|
|
673
|
+
getAnchor: () => treeEvent.anchor,
|
|
674
|
+
getActions: () => actions,
|
|
675
|
+
getActionViewItem: (action) => {
|
|
676
|
+
const keybinding = this.keybindingService.lookupKeybinding(action.id);
|
|
677
|
+
if (keybinding) {
|
|
678
|
+
return ( new ActionViewItem(action, action, { label: true, keybinding: keybinding.getLabel() }));
|
|
679
|
+
}
|
|
680
|
+
return undefined;
|
|
681
|
+
},
|
|
682
|
+
onHide: (wasCancelled) => {
|
|
683
|
+
if (wasCancelled) {
|
|
684
|
+
this.tree.domFocus();
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
getActionsContext: () => ({ $treeViewId: this.id, $treeItemHandle: node.handle }),
|
|
688
|
+
actionRunner
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
updateMessage() {
|
|
692
|
+
if (this._message) {
|
|
693
|
+
this.showMessage(this._message);
|
|
694
|
+
}
|
|
695
|
+
else if (!this.dataProvider) {
|
|
696
|
+
this.showMessage(noDataProviderMessage);
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
this.hideMessage();
|
|
700
|
+
}
|
|
701
|
+
this.updateContentAreas();
|
|
702
|
+
}
|
|
703
|
+
showMessage(message) {
|
|
704
|
+
if (isRenderedMessageValue(this._messageValue)) {
|
|
705
|
+
this._messageValue.dispose();
|
|
706
|
+
}
|
|
707
|
+
if (isMarkdownString(message) && !this.markdownRenderer) {
|
|
708
|
+
this.markdownRenderer = this.instantiationService.createInstance(MarkdownRenderer, {});
|
|
709
|
+
}
|
|
710
|
+
this._messageValue = isMarkdownString(message) ? this.markdownRenderer.render(message) : message;
|
|
711
|
+
if (!this.messageElement) {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
this.messageElement.classList.remove('hide');
|
|
715
|
+
this.resetMessageElement();
|
|
716
|
+
if (typeof this._messageValue === 'string' && !isFalsyOrWhitespace(this._messageValue)) {
|
|
717
|
+
this.messageElement.textContent = this._messageValue;
|
|
718
|
+
}
|
|
719
|
+
else if (isRenderedMessageValue(this._messageValue)) {
|
|
720
|
+
this.messageElement.appendChild(this._messageValue.element);
|
|
721
|
+
}
|
|
722
|
+
this.layout(this._height, this._width);
|
|
723
|
+
}
|
|
724
|
+
hideMessage() {
|
|
725
|
+
this.resetMessageElement();
|
|
726
|
+
this.messageElement?.classList.add('hide');
|
|
727
|
+
this.layout(this._height, this._width);
|
|
728
|
+
}
|
|
729
|
+
resetMessageElement() {
|
|
730
|
+
if (this.messageElement) {
|
|
731
|
+
dom.clearNode(this.messageElement);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
layout(height, width) {
|
|
735
|
+
if (height && width && this.messageElement && this.treeContainer) {
|
|
736
|
+
this._height = height;
|
|
737
|
+
this._width = width;
|
|
738
|
+
const treeHeight = height - dom.getTotalHeight(this.messageElement);
|
|
739
|
+
this.treeContainer.style.height = treeHeight + 'px';
|
|
740
|
+
this.tree?.layout(treeHeight, width);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
getOptimalWidth() {
|
|
744
|
+
if (this.tree) {
|
|
745
|
+
const parentNode = this.tree.getHTMLElement();
|
|
746
|
+
const childNodes = [].slice.call(parentNode.querySelectorAll('.outline-item-label > a'));
|
|
747
|
+
return dom.getLargestChildWidth(parentNode, childNodes);
|
|
748
|
+
}
|
|
749
|
+
return 0;
|
|
750
|
+
}
|
|
751
|
+
async refresh(elements) {
|
|
752
|
+
if (this.dataProvider && this.tree) {
|
|
753
|
+
if (this.refreshing) {
|
|
754
|
+
await Event.toPromise(this._onDidCompleteRefresh.event);
|
|
755
|
+
}
|
|
756
|
+
if (!elements) {
|
|
757
|
+
elements = [this.root];
|
|
758
|
+
this.elementsToRefresh = [];
|
|
759
|
+
}
|
|
760
|
+
for (const element of elements) {
|
|
761
|
+
element.children = undefined;
|
|
762
|
+
}
|
|
763
|
+
if (this.isVisible) {
|
|
764
|
+
return this.doRefresh(elements);
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
if (this.elementsToRefresh.length) {
|
|
768
|
+
const seen = ( new Set());
|
|
769
|
+
this.elementsToRefresh.forEach(element => seen.add(element.handle));
|
|
770
|
+
for (const element of elements) {
|
|
771
|
+
if (!( seen.has(element.handle))) {
|
|
772
|
+
this.elementsToRefresh.push(element);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
else {
|
|
777
|
+
this.elementsToRefresh.push(...elements);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
return undefined;
|
|
782
|
+
}
|
|
783
|
+
async expand(itemOrItems) {
|
|
784
|
+
const tree = this.tree;
|
|
785
|
+
if (!tree) {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
try {
|
|
789
|
+
itemOrItems = Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems];
|
|
790
|
+
for (const element of itemOrItems) {
|
|
791
|
+
await tree.expand(element, false);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
catch (e) {
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
isCollapsed(item) {
|
|
798
|
+
return !!this.tree?.isCollapsed(item);
|
|
799
|
+
}
|
|
800
|
+
setSelection(items) {
|
|
801
|
+
this.tree?.setSelection(items);
|
|
802
|
+
}
|
|
803
|
+
getSelection() {
|
|
804
|
+
return this.tree?.getSelection() ?? [];
|
|
805
|
+
}
|
|
806
|
+
setFocus(item) {
|
|
807
|
+
if (this.tree) {
|
|
808
|
+
if (item) {
|
|
809
|
+
this.focus(true, item);
|
|
810
|
+
this.tree.setFocus([item]);
|
|
811
|
+
}
|
|
812
|
+
else if (this.tree.getFocus().length === 0) {
|
|
813
|
+
this.tree.setFocus([]);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
async reveal(item) {
|
|
818
|
+
if (this.tree) {
|
|
819
|
+
return this.tree.reveal(item);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
async doRefresh(elements) {
|
|
823
|
+
const tree = this.tree;
|
|
824
|
+
if (tree && this.visible) {
|
|
825
|
+
this.refreshing = true;
|
|
826
|
+
const oldSelection = tree.getSelection();
|
|
827
|
+
try {
|
|
828
|
+
await Promise.all(( elements.map(element => tree.updateChildren(element, true, true))));
|
|
829
|
+
}
|
|
830
|
+
catch (e) {
|
|
831
|
+
this.logService.error(e);
|
|
832
|
+
}
|
|
833
|
+
const newSelection = tree.getSelection();
|
|
834
|
+
if (oldSelection.length !== newSelection.length || ( oldSelection.some((value, index) => value.handle !== newSelection[index].handle))) {
|
|
835
|
+
this.lastSelection = newSelection;
|
|
836
|
+
this._onDidChangeSelectionAndFocus.fire({ selection: this.lastSelection, focus: this.lastActive });
|
|
837
|
+
}
|
|
838
|
+
this.refreshing = false;
|
|
839
|
+
this._onDidCompleteRefresh.fire();
|
|
840
|
+
this.updateContentAreas();
|
|
841
|
+
if (this.focused) {
|
|
842
|
+
this.focus(false);
|
|
843
|
+
}
|
|
844
|
+
this.updateCollapseAllToggle();
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
initializeCollapseAllToggle() {
|
|
848
|
+
if (!this.collapseAllToggleContext) {
|
|
849
|
+
this.collapseAllToggleContextKey = ( new RawContextKey(`treeView.${this.id}.toggleCollapseAll`, false, ( localizeWithPath(
|
|
850
|
+
'vs/workbench/browser/parts/views/treeView',
|
|
851
|
+
'treeView.toggleCollapseAll',
|
|
852
|
+
"Whether collapse all is toggled for the tree view with id {0}.",
|
|
853
|
+
this.id
|
|
854
|
+
))));
|
|
855
|
+
this.collapseAllToggleContext = this.collapseAllToggleContextKey.bindTo(this.contextKeyService);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
updateCollapseAllToggle() {
|
|
859
|
+
if (this.showCollapseAllAction) {
|
|
860
|
+
this.initializeCollapseAllToggle();
|
|
861
|
+
this.collapseAllToggleContext?.set(!!this.root.children && (this.root.children.length > 0) &&
|
|
862
|
+
( this.root.children.some(value => value.collapsibleState !== TreeItemCollapsibleState.None)));
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
updateContentAreas() {
|
|
866
|
+
const isTreeEmpty = !this.root.children || this.root.children.length === 0;
|
|
867
|
+
if (this._messageValue && isTreeEmpty && !this.refreshing && this.treeContainer) {
|
|
868
|
+
if (!this.dragAndDropController) {
|
|
869
|
+
this.treeContainer.classList.add('hide');
|
|
870
|
+
}
|
|
871
|
+
this.domNode.setAttribute('tabindex', '0');
|
|
872
|
+
}
|
|
873
|
+
else if (this.treeContainer) {
|
|
874
|
+
this.treeContainer.classList.remove('hide');
|
|
875
|
+
if (this.domNode === dom.getActiveElement()) {
|
|
876
|
+
this.focus();
|
|
877
|
+
}
|
|
878
|
+
this.domNode.removeAttribute('tabindex');
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
get container() {
|
|
882
|
+
return this._container;
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
AbstractTreeView = ( __decorate([
|
|
886
|
+
( __param(2, IThemeService)),
|
|
887
|
+
( __param(3, IInstantiationService)),
|
|
888
|
+
( __param(4, ICommandService)),
|
|
889
|
+
( __param(5, IConfigurationService)),
|
|
890
|
+
( __param(6, IProgressService)),
|
|
891
|
+
( __param(7, IContextMenuService)),
|
|
892
|
+
( __param(8, IKeybindingService)),
|
|
893
|
+
( __param(9, INotificationService)),
|
|
894
|
+
( __param(10, IViewDescriptorService)),
|
|
895
|
+
( __param(11, IHoverService)),
|
|
896
|
+
( __param(12, IContextKeyService)),
|
|
897
|
+
( __param(13, IActivityService)),
|
|
898
|
+
( __param(14, ILogService))
|
|
899
|
+
], AbstractTreeView));
|
|
900
|
+
class TreeViewIdentityProvider {
|
|
901
|
+
getId(element) {
|
|
902
|
+
return element.handle;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
class TreeViewDelegate {
|
|
906
|
+
getHeight(element) {
|
|
907
|
+
return TreeRenderer.ITEM_HEIGHT;
|
|
908
|
+
}
|
|
909
|
+
getTemplateId(element) {
|
|
910
|
+
return TreeRenderer.TREE_TEMPLATE_ID;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
class TreeDataSource {
|
|
914
|
+
constructor(treeView, withProgress) {
|
|
915
|
+
this.treeView = treeView;
|
|
916
|
+
this.withProgress = withProgress;
|
|
917
|
+
}
|
|
918
|
+
hasChildren(element) {
|
|
919
|
+
return !!this.treeView.dataProvider && (element.collapsibleState !== TreeItemCollapsibleState.None);
|
|
920
|
+
}
|
|
921
|
+
async getChildren(element) {
|
|
922
|
+
let result = [];
|
|
923
|
+
if (this.treeView.dataProvider) {
|
|
924
|
+
try {
|
|
925
|
+
result = (await this.withProgress(this.treeView.dataProvider.getChildren(element))) ?? [];
|
|
926
|
+
}
|
|
927
|
+
catch (e) {
|
|
928
|
+
if (!e.message.startsWith('Bad progress location:')) {
|
|
929
|
+
throw e;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
return result;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
let TreeRenderer = class TreeRenderer extends Disposable {
|
|
937
|
+
static { TreeRenderer_1 = this; }
|
|
938
|
+
static { this.ITEM_HEIGHT = 22; }
|
|
939
|
+
static { this.TREE_TEMPLATE_ID = 'treeExplorer'; }
|
|
940
|
+
constructor(treeViewId, menus, labels, actionViewItemProvider, aligner, checkboxStateHandler, manuallyManageCheckboxes, themeService, configurationService, labelService, hoverService, treeViewsService, contextKeyService) {
|
|
941
|
+
super();
|
|
942
|
+
this.treeViewId = treeViewId;
|
|
943
|
+
this.menus = menus;
|
|
944
|
+
this.labels = labels;
|
|
945
|
+
this.actionViewItemProvider = actionViewItemProvider;
|
|
946
|
+
this.aligner = aligner;
|
|
947
|
+
this.checkboxStateHandler = checkboxStateHandler;
|
|
948
|
+
this.manuallyManageCheckboxes = manuallyManageCheckboxes;
|
|
949
|
+
this.themeService = themeService;
|
|
950
|
+
this.configurationService = configurationService;
|
|
951
|
+
this.labelService = labelService;
|
|
952
|
+
this.hoverService = hoverService;
|
|
953
|
+
this.treeViewsService = treeViewsService;
|
|
954
|
+
this.contextKeyService = contextKeyService;
|
|
955
|
+
this._onDidChangeCheckboxState = this._register(( new Emitter()));
|
|
956
|
+
this.onDidChangeCheckboxState = this._onDidChangeCheckboxState.event;
|
|
957
|
+
this._hasCheckbox = false;
|
|
958
|
+
this._renderedElements = ( new Map());
|
|
959
|
+
this._hoverDelegate = {
|
|
960
|
+
showHover: (options) => this.hoverService.showHover(options),
|
|
961
|
+
delay: this.configurationService.getValue('workbench.hover.delay')
|
|
962
|
+
};
|
|
963
|
+
this._register(this.themeService.onDidFileIconThemeChange(() => this.rerender()));
|
|
964
|
+
this._register(this.themeService.onDidColorThemeChange(() => this.rerender()));
|
|
965
|
+
this._register(checkboxStateHandler.onDidChangeCheckboxState(items => {
|
|
966
|
+
this.updateCheckboxes(items);
|
|
967
|
+
}));
|
|
968
|
+
}
|
|
969
|
+
get templateId() {
|
|
970
|
+
return TreeRenderer_1.TREE_TEMPLATE_ID;
|
|
971
|
+
}
|
|
972
|
+
set actionRunner(actionRunner) {
|
|
973
|
+
this._actionRunner = actionRunner;
|
|
974
|
+
}
|
|
975
|
+
renderTemplate(container) {
|
|
976
|
+
container.classList.add('custom-view-tree-node-item');
|
|
977
|
+
const checkboxContainer = dom.append(container, dom.$(''));
|
|
978
|
+
const resourceLabel = this.labels.create(container, { supportHighlights: true, hoverDelegate: this._hoverDelegate });
|
|
979
|
+
const icon = dom.prepend(resourceLabel.element, dom.$('.custom-view-tree-node-item-icon'));
|
|
980
|
+
const actionsContainer = dom.append(resourceLabel.element, dom.$('.actions'));
|
|
981
|
+
const actionBar = ( new ActionBar(actionsContainer, {
|
|
982
|
+
actionViewItemProvider: this.actionViewItemProvider
|
|
983
|
+
}));
|
|
984
|
+
return { resourceLabel, icon, checkboxContainer, actionBar, container, elementDisposable: ( new DisposableStore()) };
|
|
985
|
+
}
|
|
986
|
+
getHover(label, resource, node) {
|
|
987
|
+
if (!(node instanceof ResolvableTreeItem) || !node.hasResolve) {
|
|
988
|
+
if (resource && !node.tooltip) {
|
|
989
|
+
return undefined;
|
|
990
|
+
}
|
|
991
|
+
else if (node.tooltip === undefined) {
|
|
992
|
+
return label;
|
|
993
|
+
}
|
|
994
|
+
else if (!isString(node.tooltip)) {
|
|
995
|
+
return { markdown: node.tooltip, markdownNotSupportedFallback: resource ? undefined : renderMarkdownAsPlaintext(node.tooltip) };
|
|
996
|
+
}
|
|
997
|
+
else if (node.tooltip !== '') {
|
|
998
|
+
return node.tooltip;
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
return undefined;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return {
|
|
1005
|
+
markdown: typeof node.tooltip === 'string' ? node.tooltip :
|
|
1006
|
+
(token) => {
|
|
1007
|
+
return ( new Promise((resolve) => {
|
|
1008
|
+
node.resolve(token).then(() => resolve(node.tooltip));
|
|
1009
|
+
}));
|
|
1010
|
+
},
|
|
1011
|
+
markdownNotSupportedFallback: resource ? undefined : (label ?? '')
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
renderElement(element, index, templateData) {
|
|
1015
|
+
const node = element.element;
|
|
1016
|
+
const resource = node.resourceUri ? URI.revive(node.resourceUri) : null;
|
|
1017
|
+
const treeItemLabel = node.label ? node.label : (resource ? { label: basename(resource) } : undefined);
|
|
1018
|
+
const description = isString(node.description) ? node.description : resource && node.description === true ? this.labelService.getUriLabel(dirname(resource), { relative: true }) : undefined;
|
|
1019
|
+
const label = treeItemLabel ? treeItemLabel.label : undefined;
|
|
1020
|
+
const matches = (treeItemLabel && treeItemLabel.highlights && label) ? ( treeItemLabel.highlights.map(([start, end]) => {
|
|
1021
|
+
if (start < 0) {
|
|
1022
|
+
start = label.length + start;
|
|
1023
|
+
}
|
|
1024
|
+
if (end < 0) {
|
|
1025
|
+
end = label.length + end;
|
|
1026
|
+
}
|
|
1027
|
+
if ((start >= label.length) || (end > label.length)) {
|
|
1028
|
+
return ({ start: 0, end: 0 });
|
|
1029
|
+
}
|
|
1030
|
+
if (start > end) {
|
|
1031
|
+
const swap = start;
|
|
1032
|
+
start = end;
|
|
1033
|
+
end = swap;
|
|
1034
|
+
}
|
|
1035
|
+
return ({ start, end });
|
|
1036
|
+
})) : undefined;
|
|
1037
|
+
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
|
|
1038
|
+
const iconUrl = icon ? URI.revive(icon) : undefined;
|
|
1039
|
+
const title = this.getHover(label, resource, node);
|
|
1040
|
+
templateData.actionBar.clear();
|
|
1041
|
+
templateData.icon.style.color = '';
|
|
1042
|
+
let commandEnabled = true;
|
|
1043
|
+
if (node.command) {
|
|
1044
|
+
commandEnabled = isTreeCommandEnabled(node.command, this.contextKeyService);
|
|
1045
|
+
}
|
|
1046
|
+
this.renderCheckbox(node, templateData);
|
|
1047
|
+
if (resource) {
|
|
1048
|
+
const fileDecorations = this.configurationService.getValue('explorer.decorations');
|
|
1049
|
+
const labelResource = resource ? resource : ( URI.parse('missing:_icon_resource'));
|
|
1050
|
+
templateData.resourceLabel.setResource({ name: label, description, resource: labelResource }, {
|
|
1051
|
+
fileKind: this.getFileKind(node),
|
|
1052
|
+
title,
|
|
1053
|
+
hideIcon: this.shouldHideResourceLabelIcon(iconUrl, node.themeIcon),
|
|
1054
|
+
fileDecorations,
|
|
1055
|
+
extraClasses: ['custom-view-tree-node-item-resourceLabel'],
|
|
1056
|
+
matches: matches ? matches : createMatches(element.filterData),
|
|
1057
|
+
strikethrough: treeItemLabel?.strikethrough,
|
|
1058
|
+
disabledCommand: !commandEnabled,
|
|
1059
|
+
labelEscapeNewLines: true,
|
|
1060
|
+
forceLabel: !!node.label
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
else {
|
|
1064
|
+
templateData.resourceLabel.setResource({ name: label, description }, {
|
|
1065
|
+
title,
|
|
1066
|
+
hideIcon: true,
|
|
1067
|
+
extraClasses: ['custom-view-tree-node-item-resourceLabel'],
|
|
1068
|
+
matches: matches ? matches : createMatches(element.filterData),
|
|
1069
|
+
strikethrough: treeItemLabel?.strikethrough,
|
|
1070
|
+
disabledCommand: !commandEnabled,
|
|
1071
|
+
labelEscapeNewLines: true
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
if (iconUrl) {
|
|
1075
|
+
templateData.icon.className = 'custom-view-tree-node-item-icon';
|
|
1076
|
+
templateData.icon.style.backgroundImage = dom.asCSSUrl(iconUrl);
|
|
1077
|
+
}
|
|
1078
|
+
else {
|
|
1079
|
+
let iconClass;
|
|
1080
|
+
if (this.shouldShowThemeIcon(!!resource, node.themeIcon)) {
|
|
1081
|
+
iconClass = ThemeIcon.asClassName(node.themeIcon);
|
|
1082
|
+
if (node.themeIcon.color) {
|
|
1083
|
+
templateData.icon.style.color = this.themeService.getColorTheme().getColor(node.themeIcon.color.id)?.toString() ?? '';
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
templateData.icon.className = iconClass ? `custom-view-tree-node-item-icon ${iconClass}` : '';
|
|
1087
|
+
templateData.icon.style.backgroundImage = '';
|
|
1088
|
+
}
|
|
1089
|
+
if (!commandEnabled) {
|
|
1090
|
+
templateData.icon.className = templateData.icon.className + ' disabled';
|
|
1091
|
+
if (templateData.container.parentElement) {
|
|
1092
|
+
templateData.container.parentElement.className = templateData.container.parentElement.className + ' disabled';
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
templateData.actionBar.context = { $treeViewId: this.treeViewId, $treeItemHandle: node.handle };
|
|
1096
|
+
const menuActions = this.menus.getResourceActions(node, templateData.elementDisposable);
|
|
1097
|
+
templateData.actionBar.push(menuActions.actions, { icon: true, label: false });
|
|
1098
|
+
if (this._actionRunner) {
|
|
1099
|
+
templateData.actionBar.actionRunner = this._actionRunner;
|
|
1100
|
+
}
|
|
1101
|
+
this.setAlignment(templateData.container, node);
|
|
1102
|
+
this.treeViewsService.addRenderedTreeItemElement(node, templateData.container);
|
|
1103
|
+
const renderedItems = this._renderedElements.get(element.element.handle) ?? [];
|
|
1104
|
+
this._renderedElements.set(element.element.handle, [...renderedItems, { original: element, rendered: templateData }]);
|
|
1105
|
+
}
|
|
1106
|
+
rerender() {
|
|
1107
|
+
const keys = ( new Set(( this._renderedElements.keys())));
|
|
1108
|
+
for (const key of keys) {
|
|
1109
|
+
const values = this._renderedElements.get(key) ?? [];
|
|
1110
|
+
for (const value of values) {
|
|
1111
|
+
this.disposeElement(value.original, 0, value.rendered);
|
|
1112
|
+
this.renderElement(value.original, 0, value.rendered);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
renderCheckbox(node, templateData) {
|
|
1117
|
+
if (node.checkbox) {
|
|
1118
|
+
if (!this._hasCheckbox) {
|
|
1119
|
+
this._hasCheckbox = true;
|
|
1120
|
+
this.rerender();
|
|
1121
|
+
}
|
|
1122
|
+
if (!templateData.checkbox) {
|
|
1123
|
+
const checkbox = ( new TreeItemCheckbox(
|
|
1124
|
+
templateData.checkboxContainer,
|
|
1125
|
+
this.checkboxStateHandler,
|
|
1126
|
+
this._hoverDelegate
|
|
1127
|
+
));
|
|
1128
|
+
templateData.checkbox = checkbox;
|
|
1129
|
+
}
|
|
1130
|
+
templateData.checkbox.render(node);
|
|
1131
|
+
}
|
|
1132
|
+
else if (templateData.checkbox) {
|
|
1133
|
+
templateData.checkbox.dispose();
|
|
1134
|
+
templateData.checkbox = undefined;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
setAlignment(container, treeItem) {
|
|
1138
|
+
container.parentElement.classList.toggle('align-icon-with-twisty', !this._hasCheckbox && this.aligner.alignIconWithTwisty(treeItem));
|
|
1139
|
+
}
|
|
1140
|
+
shouldHideResourceLabelIcon(iconUrl, icon) {
|
|
1141
|
+
return (!!iconUrl || (!!icon && !this.isFileKindThemeIcon(icon)));
|
|
1142
|
+
}
|
|
1143
|
+
shouldShowThemeIcon(hasResource, icon) {
|
|
1144
|
+
if (!icon) {
|
|
1145
|
+
return false;
|
|
1146
|
+
}
|
|
1147
|
+
return !(hasResource && this.isFileKindThemeIcon(icon));
|
|
1148
|
+
}
|
|
1149
|
+
isFolderThemeIcon(icon) {
|
|
1150
|
+
return icon?.id === FolderThemeIcon.id;
|
|
1151
|
+
}
|
|
1152
|
+
isFileKindThemeIcon(icon) {
|
|
1153
|
+
if (icon) {
|
|
1154
|
+
return icon.id === FileThemeIcon.id || this.isFolderThemeIcon(icon);
|
|
1155
|
+
}
|
|
1156
|
+
else {
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
getFileKind(node) {
|
|
1161
|
+
if (node.themeIcon) {
|
|
1162
|
+
switch (node.themeIcon.id) {
|
|
1163
|
+
case FileThemeIcon.id:
|
|
1164
|
+
return FileKind.FILE;
|
|
1165
|
+
case FolderThemeIcon.id:
|
|
1166
|
+
return FileKind.FOLDER;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
return node.collapsibleState === TreeItemCollapsibleState.Collapsed || node.collapsibleState === TreeItemCollapsibleState.Expanded ? FileKind.FOLDER : FileKind.FILE;
|
|
1170
|
+
}
|
|
1171
|
+
updateCheckboxes(items) {
|
|
1172
|
+
const additionalItems = [];
|
|
1173
|
+
if (!this.manuallyManageCheckboxes()) {
|
|
1174
|
+
for (const item of items) {
|
|
1175
|
+
if (item.checkbox !== undefined) {
|
|
1176
|
+
function checkChildren(currentItem) {
|
|
1177
|
+
for (const child of (currentItem.children ?? [])) {
|
|
1178
|
+
if ((child.checkbox !== undefined) && (currentItem.checkbox !== undefined) && (child.checkbox.isChecked !== currentItem.checkbox.isChecked)) {
|
|
1179
|
+
child.checkbox.isChecked = currentItem.checkbox.isChecked;
|
|
1180
|
+
additionalItems.push(child);
|
|
1181
|
+
checkChildren(child);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
checkChildren(item);
|
|
1186
|
+
const visitedParents = ( new Set());
|
|
1187
|
+
function checkParents(currentItem) {
|
|
1188
|
+
if (currentItem.parent && (currentItem.parent.checkbox !== undefined) && currentItem.parent.children) {
|
|
1189
|
+
if (( visitedParents.has(currentItem.parent))) {
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
visitedParents.add(currentItem.parent);
|
|
1194
|
+
}
|
|
1195
|
+
let someUnchecked = false;
|
|
1196
|
+
let someChecked = false;
|
|
1197
|
+
for (const child of currentItem.parent.children) {
|
|
1198
|
+
if (someUnchecked && someChecked) {
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
if (child.checkbox !== undefined) {
|
|
1202
|
+
if (child.checkbox.isChecked) {
|
|
1203
|
+
someChecked = true;
|
|
1204
|
+
}
|
|
1205
|
+
else {
|
|
1206
|
+
someUnchecked = true;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
if (someChecked && !someUnchecked && (currentItem.parent.checkbox.isChecked !== true)) {
|
|
1211
|
+
currentItem.parent.checkbox.isChecked = true;
|
|
1212
|
+
additionalItems.push(currentItem.parent);
|
|
1213
|
+
checkParents(currentItem.parent);
|
|
1214
|
+
}
|
|
1215
|
+
else if (someUnchecked && (currentItem.parent.checkbox.isChecked !== false)) {
|
|
1216
|
+
currentItem.parent.checkbox.isChecked = false;
|
|
1217
|
+
additionalItems.push(currentItem.parent);
|
|
1218
|
+
checkParents(currentItem.parent);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
checkParents(item);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
items = items.concat(additionalItems);
|
|
1227
|
+
items.forEach(item => {
|
|
1228
|
+
const renderedItems = this._renderedElements.get(item.handle);
|
|
1229
|
+
if (renderedItems) {
|
|
1230
|
+
renderedItems.forEach(renderedItems => renderedItems.rendered.checkbox?.render(item));
|
|
1231
|
+
}
|
|
1232
|
+
});
|
|
1233
|
+
this._onDidChangeCheckboxState.fire(items);
|
|
1234
|
+
}
|
|
1235
|
+
disposeElement(resource, index, templateData) {
|
|
1236
|
+
templateData.elementDisposable.clear();
|
|
1237
|
+
const itemRenders = this._renderedElements.get(resource.element.handle) ?? [];
|
|
1238
|
+
const renderedIndex = itemRenders.findIndex(renderedItem => templateData === renderedItem.rendered);
|
|
1239
|
+
if (renderedIndex < 0) {
|
|
1240
|
+
throw new Error('Disposing unknown element');
|
|
1241
|
+
}
|
|
1242
|
+
if (itemRenders.length === 1) {
|
|
1243
|
+
this._renderedElements.delete(resource.element.handle);
|
|
1244
|
+
}
|
|
1245
|
+
else {
|
|
1246
|
+
itemRenders.splice(renderedIndex, 1);
|
|
1247
|
+
}
|
|
1248
|
+
this.treeViewsService.removeRenderedTreeItemElement(resource.element);
|
|
1249
|
+
templateData.checkbox?.dispose();
|
|
1250
|
+
templateData.checkbox = undefined;
|
|
1251
|
+
}
|
|
1252
|
+
disposeTemplate(templateData) {
|
|
1253
|
+
templateData.resourceLabel.dispose();
|
|
1254
|
+
templateData.actionBar.dispose();
|
|
1255
|
+
templateData.elementDisposable.dispose();
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
TreeRenderer = TreeRenderer_1 = ( __decorate([
|
|
1259
|
+
( __param(7, IThemeService)),
|
|
1260
|
+
( __param(8, IConfigurationService)),
|
|
1261
|
+
( __param(9, ILabelService)),
|
|
1262
|
+
( __param(10, IHoverService)),
|
|
1263
|
+
( __param(11, ITreeViewsService)),
|
|
1264
|
+
( __param(12, IContextKeyService))
|
|
1265
|
+
], TreeRenderer));
|
|
1266
|
+
class Aligner extends Disposable {
|
|
1267
|
+
constructor(themeService) {
|
|
1268
|
+
super();
|
|
1269
|
+
this.themeService = themeService;
|
|
1270
|
+
}
|
|
1271
|
+
set tree(tree) {
|
|
1272
|
+
this._tree = tree;
|
|
1273
|
+
}
|
|
1274
|
+
alignIconWithTwisty(treeItem) {
|
|
1275
|
+
if (treeItem.collapsibleState !== TreeItemCollapsibleState.None) {
|
|
1276
|
+
return false;
|
|
1277
|
+
}
|
|
1278
|
+
if (!this.hasIcon(treeItem)) {
|
|
1279
|
+
return false;
|
|
1280
|
+
}
|
|
1281
|
+
if (this._tree) {
|
|
1282
|
+
const parent = this._tree.getParentElement(treeItem) || this._tree.getInput();
|
|
1283
|
+
if (this.hasIcon(parent)) {
|
|
1284
|
+
return !!parent.children && ( parent.children.some(
|
|
1285
|
+
c => c.collapsibleState !== TreeItemCollapsibleState.None && !this.hasIcon(c)
|
|
1286
|
+
));
|
|
1287
|
+
}
|
|
1288
|
+
return !!parent.children && parent.children.every(c => c.collapsibleState === TreeItemCollapsibleState.None || !this.hasIcon(c));
|
|
1289
|
+
}
|
|
1290
|
+
else {
|
|
1291
|
+
return false;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
hasIcon(node) {
|
|
1295
|
+
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
|
|
1296
|
+
if (icon) {
|
|
1297
|
+
return true;
|
|
1298
|
+
}
|
|
1299
|
+
if (node.resourceUri || node.themeIcon) {
|
|
1300
|
+
const fileIconTheme = this.themeService.getFileIconTheme();
|
|
1301
|
+
const isFolder = node.themeIcon ? node.themeIcon.id === FolderThemeIcon.id : node.collapsibleState !== TreeItemCollapsibleState.None;
|
|
1302
|
+
if (isFolder) {
|
|
1303
|
+
return fileIconTheme.hasFileIcons && fileIconTheme.hasFolderIcons;
|
|
1304
|
+
}
|
|
1305
|
+
return fileIconTheme.hasFileIcons;
|
|
1306
|
+
}
|
|
1307
|
+
return false;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
class MultipleSelectionActionRunner extends ActionRunner {
|
|
1311
|
+
constructor(notificationService, getSelectedResources) {
|
|
1312
|
+
super();
|
|
1313
|
+
this.getSelectedResources = getSelectedResources;
|
|
1314
|
+
this._register(this.onDidRun(e => {
|
|
1315
|
+
if (e.error && !isCancellationError(e.error)) {
|
|
1316
|
+
notificationService.error(( localizeWithPath(
|
|
1317
|
+
'vs/workbench/browser/parts/views/treeView',
|
|
1318
|
+
'command-error',
|
|
1319
|
+
'Error running command {1}: {0}. This is likely caused by the extension that contributes {1}.',
|
|
1320
|
+
e.error.message,
|
|
1321
|
+
e.action.id
|
|
1322
|
+
)));
|
|
1323
|
+
}
|
|
1324
|
+
}));
|
|
1325
|
+
}
|
|
1326
|
+
async runAction(action, context) {
|
|
1327
|
+
const selection = this.getSelectedResources();
|
|
1328
|
+
let selectionHandleArgs = undefined;
|
|
1329
|
+
let actionInSelected = false;
|
|
1330
|
+
if (selection.length > 1) {
|
|
1331
|
+
selectionHandleArgs = ( selection.map(selected => {
|
|
1332
|
+
if ((selected.handle === context.$treeItemHandle) || context.$selectedTreeItems) {
|
|
1333
|
+
actionInSelected = true;
|
|
1334
|
+
}
|
|
1335
|
+
return { $treeViewId: context.$treeViewId, $treeItemHandle: selected.handle };
|
|
1336
|
+
}));
|
|
1337
|
+
}
|
|
1338
|
+
if (!actionInSelected) {
|
|
1339
|
+
selectionHandleArgs = undefined;
|
|
1340
|
+
}
|
|
1341
|
+
await action.run(context, selectionHandleArgs);
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
let TreeMenus = class TreeMenus {
|
|
1345
|
+
constructor(id, menuService) {
|
|
1346
|
+
this.id = id;
|
|
1347
|
+
this.menuService = menuService;
|
|
1348
|
+
this._onDidChange = ( new Emitter());
|
|
1349
|
+
this.onDidChange = this._onDidChange.event;
|
|
1350
|
+
}
|
|
1351
|
+
getResourceActions(element, disposableStore) {
|
|
1352
|
+
const actions = this.getActions(MenuId.ViewItemContext, element, disposableStore);
|
|
1353
|
+
return { menu: actions.menu, actions: actions.primary };
|
|
1354
|
+
}
|
|
1355
|
+
getResourceContextActions(element) {
|
|
1356
|
+
return this.getActions(MenuId.ViewItemContext, element).secondary;
|
|
1357
|
+
}
|
|
1358
|
+
setContextKeyService(service) {
|
|
1359
|
+
this.contextKeyService = service;
|
|
1360
|
+
}
|
|
1361
|
+
getActions(menuId, element, listen) {
|
|
1362
|
+
if (!this.contextKeyService) {
|
|
1363
|
+
return { primary: [], secondary: [] };
|
|
1364
|
+
}
|
|
1365
|
+
const contextKeyService = this.contextKeyService.createOverlay([
|
|
1366
|
+
['view', this.id],
|
|
1367
|
+
['viewItem', element.contextValue]
|
|
1368
|
+
]);
|
|
1369
|
+
const menu = this.menuService.createMenu(menuId, contextKeyService);
|
|
1370
|
+
const primary = [];
|
|
1371
|
+
const secondary = [];
|
|
1372
|
+
const result = { primary, secondary, menu };
|
|
1373
|
+
createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, result, 'inline');
|
|
1374
|
+
if (listen) {
|
|
1375
|
+
listen.add(menu.onDidChange(() => this._onDidChange.fire(element)));
|
|
1376
|
+
listen.add(menu);
|
|
1377
|
+
}
|
|
1378
|
+
else {
|
|
1379
|
+
menu.dispose();
|
|
1380
|
+
}
|
|
1381
|
+
return result;
|
|
1382
|
+
}
|
|
1383
|
+
dispose() {
|
|
1384
|
+
this.contextKeyService = undefined;
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
TreeMenus = ( __decorate([
|
|
1388
|
+
( __param(1, IMenuService))
|
|
1389
|
+
], TreeMenus));
|
|
1390
|
+
let CustomTreeView = class CustomTreeView extends AbstractTreeView {
|
|
1391
|
+
constructor(id, title, extensionId, themeService, instantiationService, commandService, configurationService, progressService, contextMenuService, keybindingService, notificationService, viewDescriptorService, contextKeyService, hoverService, extensionService, activityService, telemetryService, logService) {
|
|
1392
|
+
super(id, title, themeService, instantiationService, commandService, configurationService, progressService, contextMenuService, keybindingService, notificationService, viewDescriptorService, hoverService, contextKeyService, activityService, logService);
|
|
1393
|
+
this.extensionId = extensionId;
|
|
1394
|
+
this.extensionService = extensionService;
|
|
1395
|
+
this.telemetryService = telemetryService;
|
|
1396
|
+
this.activated = false;
|
|
1397
|
+
}
|
|
1398
|
+
activate() {
|
|
1399
|
+
if (!this.activated) {
|
|
1400
|
+
this.telemetryService.publicLog2('Extension:ViewActivate', {
|
|
1401
|
+
extensionId: ( new TelemetryTrustedValue(this.extensionId)),
|
|
1402
|
+
id: this.id,
|
|
1403
|
+
});
|
|
1404
|
+
this.createTree();
|
|
1405
|
+
this.progressService.withProgress({ location: this.id }, () => this.extensionService.activateByEvent(`onView:${this.id}`))
|
|
1406
|
+
.then(() => timeout(2000))
|
|
1407
|
+
.then(() => {
|
|
1408
|
+
this.updateMessage();
|
|
1409
|
+
});
|
|
1410
|
+
this.activated = true;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
CustomTreeView = ( __decorate([
|
|
1415
|
+
( __param(3, IThemeService)),
|
|
1416
|
+
( __param(4, IInstantiationService)),
|
|
1417
|
+
( __param(5, ICommandService)),
|
|
1418
|
+
( __param(6, IConfigurationService)),
|
|
1419
|
+
( __param(7, IProgressService)),
|
|
1420
|
+
( __param(8, IContextMenuService)),
|
|
1421
|
+
( __param(9, IKeybindingService)),
|
|
1422
|
+
( __param(10, INotificationService)),
|
|
1423
|
+
( __param(11, IViewDescriptorService)),
|
|
1424
|
+
( __param(12, IContextKeyService)),
|
|
1425
|
+
( __param(13, IHoverService)),
|
|
1426
|
+
( __param(14, IExtensionService)),
|
|
1427
|
+
( __param(15, IActivityService)),
|
|
1428
|
+
( __param(16, ITelemetryService)),
|
|
1429
|
+
( __param(17, ILogService))
|
|
1430
|
+
], CustomTreeView));
|
|
1431
|
+
class TreeView extends AbstractTreeView {
|
|
1432
|
+
constructor() {
|
|
1433
|
+
super(...arguments);
|
|
1434
|
+
this.activated = false;
|
|
1435
|
+
}
|
|
1436
|
+
activate() {
|
|
1437
|
+
if (!this.activated) {
|
|
1438
|
+
this.createTree();
|
|
1439
|
+
this.activated = true;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
let CustomTreeViewDragAndDrop = class CustomTreeViewDragAndDrop {
|
|
1444
|
+
constructor(treeId, labelService, instantiationService, treeViewsDragAndDropService, logService) {
|
|
1445
|
+
this.treeId = treeId;
|
|
1446
|
+
this.labelService = labelService;
|
|
1447
|
+
this.instantiationService = instantiationService;
|
|
1448
|
+
this.treeViewsDragAndDropService = treeViewsDragAndDropService;
|
|
1449
|
+
this.logService = logService;
|
|
1450
|
+
this.treeItemsTransfer = LocalSelectionTransfer.getInstance();
|
|
1451
|
+
this.treeMimeType = `application/vnd.code.tree.${treeId.toLowerCase()}`;
|
|
1452
|
+
}
|
|
1453
|
+
set controller(controller) {
|
|
1454
|
+
this.dndController = controller;
|
|
1455
|
+
}
|
|
1456
|
+
handleDragAndLog(dndController, itemHandles, uuid, dragCancellationToken) {
|
|
1457
|
+
return dndController.handleDrag(itemHandles, uuid, dragCancellationToken).then(additionalDataTransfer => {
|
|
1458
|
+
if (additionalDataTransfer) {
|
|
1459
|
+
const unlistedTypes = [];
|
|
1460
|
+
for (const item of additionalDataTransfer) {
|
|
1461
|
+
if ((item[0] !== this.treeMimeType) && (dndController.dragMimeTypes.findIndex(value => value === item[0]) < 0)) {
|
|
1462
|
+
unlistedTypes.push(item[0]);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
if (unlistedTypes.length) {
|
|
1466
|
+
this.logService.warn(`Drag and drop controller for tree ${this.treeId} adds the following data transfer types but does not declare them in dragMimeTypes: ${unlistedTypes.join(', ')}`);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
return additionalDataTransfer;
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
addExtensionProvidedTransferTypes(originalEvent, itemHandles) {
|
|
1473
|
+
if (!originalEvent.dataTransfer || !this.dndController) {
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
const uuid = generateUuid();
|
|
1477
|
+
this.dragCancellationToken = ( new CancellationTokenSource());
|
|
1478
|
+
this.treeViewsDragAndDropService.addDragOperationTransfer(uuid, this.handleDragAndLog(this.dndController, itemHandles, uuid, this.dragCancellationToken.token));
|
|
1479
|
+
this.treeItemsTransfer.setData([( new DraggedTreeItemsIdentifier(uuid))], DraggedTreeItemsIdentifier.prototype);
|
|
1480
|
+
originalEvent.dataTransfer.clearData(Mimes.text);
|
|
1481
|
+
if (this.dndController.dragMimeTypes.find((element) => element === Mimes.uriList)) {
|
|
1482
|
+
originalEvent.dataTransfer?.setData(DataTransfers.RESOURCES, '');
|
|
1483
|
+
}
|
|
1484
|
+
this.dndController.dragMimeTypes.forEach(supportedType => {
|
|
1485
|
+
originalEvent.dataTransfer?.setData(supportedType, '');
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
addResourceInfoToTransfer(originalEvent, resources) {
|
|
1489
|
+
if (resources.length && originalEvent.dataTransfer) {
|
|
1490
|
+
this.instantiationService.invokeFunction(accessor => fillEditorsDragData(accessor, resources, originalEvent));
|
|
1491
|
+
const fileResources = ( resources.filter(s => s.scheme === Schemas.file).map(r => r.fsPath));
|
|
1492
|
+
if (fileResources.length) {
|
|
1493
|
+
originalEvent.dataTransfer.setData(CodeDataTransfers.FILES, JSON.stringify(fileResources));
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
onDragStart(data, originalEvent) {
|
|
1498
|
+
if (originalEvent.dataTransfer) {
|
|
1499
|
+
const treeItemsData = data.getData();
|
|
1500
|
+
const resources = [];
|
|
1501
|
+
const sourceInfo = {
|
|
1502
|
+
id: this.treeId,
|
|
1503
|
+
itemHandles: []
|
|
1504
|
+
};
|
|
1505
|
+
treeItemsData.forEach(item => {
|
|
1506
|
+
sourceInfo.itemHandles.push(item.handle);
|
|
1507
|
+
if (item.resourceUri) {
|
|
1508
|
+
resources.push(URI.revive(item.resourceUri));
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
this.addResourceInfoToTransfer(originalEvent, resources);
|
|
1512
|
+
this.addExtensionProvidedTransferTypes(originalEvent, sourceInfo.itemHandles);
|
|
1513
|
+
originalEvent.dataTransfer.setData(this.treeMimeType, JSON.stringify(sourceInfo));
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
debugLog(types) {
|
|
1517
|
+
if (types.size) {
|
|
1518
|
+
this.logService.debug(`TreeView dragged mime types: ${Array.from(types).join(', ')}`);
|
|
1519
|
+
}
|
|
1520
|
+
else {
|
|
1521
|
+
this.logService.debug(`TreeView dragged with no supported mime types.`);
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
onDragOver(data, targetElement, targetIndex, originalEvent) {
|
|
1525
|
+
const dataTransfer = toExternalVSDataTransfer(originalEvent.dataTransfer);
|
|
1526
|
+
const types = ( new Set(Array.from(dataTransfer, x => x[0])));
|
|
1527
|
+
if (originalEvent.dataTransfer) {
|
|
1528
|
+
for (const item of originalEvent.dataTransfer.items) {
|
|
1529
|
+
if (item.kind === 'file' || item.type === DataTransfers.RESOURCES.toLowerCase()) {
|
|
1530
|
+
types.add(Mimes.uriList);
|
|
1531
|
+
break;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
this.debugLog(types);
|
|
1536
|
+
const dndController = this.dndController;
|
|
1537
|
+
if (!dndController || !originalEvent.dataTransfer || (dndController.dropMimeTypes.length === 0)) {
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
const dragContainersSupportedType = ( Array.from(types).some((value, index) => {
|
|
1541
|
+
if (value === this.treeMimeType) {
|
|
1542
|
+
return true;
|
|
1543
|
+
}
|
|
1544
|
+
else {
|
|
1545
|
+
return dndController.dropMimeTypes.indexOf(value) >= 0;
|
|
1546
|
+
}
|
|
1547
|
+
}));
|
|
1548
|
+
if (dragContainersSupportedType) {
|
|
1549
|
+
return { accept: true, bubble: 0 , autoExpand: true };
|
|
1550
|
+
}
|
|
1551
|
+
return false;
|
|
1552
|
+
}
|
|
1553
|
+
getDragURI(element) {
|
|
1554
|
+
if (!this.dndController) {
|
|
1555
|
+
return null;
|
|
1556
|
+
}
|
|
1557
|
+
return element.resourceUri ? ( URI.revive(element.resourceUri).toString()) : element.handle;
|
|
1558
|
+
}
|
|
1559
|
+
getDragLabel(elements) {
|
|
1560
|
+
if (!this.dndController) {
|
|
1561
|
+
return undefined;
|
|
1562
|
+
}
|
|
1563
|
+
if (elements.length > 1) {
|
|
1564
|
+
return String(elements.length);
|
|
1565
|
+
}
|
|
1566
|
+
const element = elements[0];
|
|
1567
|
+
return element.label ? element.label.label : (element.resourceUri ? this.labelService.getUriLabel(URI.revive(element.resourceUri)) : undefined);
|
|
1568
|
+
}
|
|
1569
|
+
async drop(data, targetNode, targetIndex, originalEvent) {
|
|
1570
|
+
const dndController = this.dndController;
|
|
1571
|
+
if (!originalEvent.dataTransfer || !dndController) {
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
let treeSourceInfo;
|
|
1575
|
+
let willDropUuid;
|
|
1576
|
+
if (this.treeItemsTransfer.hasData(DraggedTreeItemsIdentifier.prototype)) {
|
|
1577
|
+
willDropUuid = this.treeItemsTransfer.getData(DraggedTreeItemsIdentifier.prototype)[0].identifier;
|
|
1578
|
+
}
|
|
1579
|
+
const originalDataTransfer = toExternalVSDataTransfer(originalEvent.dataTransfer, true);
|
|
1580
|
+
const outDataTransfer = ( new VSDataTransfer());
|
|
1581
|
+
for (const [type, item] of originalDataTransfer) {
|
|
1582
|
+
if (type === this.treeMimeType || dndController.dropMimeTypes.includes(type) || (item.asFile() && dndController.dropMimeTypes.includes(DataTransfers.FILES.toLowerCase()))) {
|
|
1583
|
+
outDataTransfer.append(type, item);
|
|
1584
|
+
if (type === this.treeMimeType) {
|
|
1585
|
+
try {
|
|
1586
|
+
treeSourceInfo = JSON.parse(await item.asString());
|
|
1587
|
+
}
|
|
1588
|
+
catch {
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
const additionalDataTransfer = await this.treeViewsDragAndDropService.removeDragOperationTransfer(willDropUuid);
|
|
1594
|
+
if (additionalDataTransfer) {
|
|
1595
|
+
for (const [type, item] of additionalDataTransfer) {
|
|
1596
|
+
outDataTransfer.append(type, item);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
return dndController.handleDrop(outDataTransfer, targetNode, CancellationToken.None, willDropUuid, treeSourceInfo?.id, treeSourceInfo?.itemHandles);
|
|
1600
|
+
}
|
|
1601
|
+
onDragEnd(originalEvent) {
|
|
1602
|
+
if (originalEvent.dataTransfer?.dropEffect === 'none') {
|
|
1603
|
+
this.dragCancellationToken?.cancel();
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
dispose() { }
|
|
1607
|
+
};
|
|
1608
|
+
CustomTreeViewDragAndDrop = ( __decorate([
|
|
1609
|
+
( __param(1, ILabelService)),
|
|
1610
|
+
( __param(2, IInstantiationService)),
|
|
1611
|
+
( __param(3, ITreeViewsDnDService)),
|
|
1612
|
+
( __param(4, ILogService))
|
|
1613
|
+
], CustomTreeViewDragAndDrop));
|
|
1614
|
+
export { CustomTreeView, CustomTreeViewDragAndDrop, RawCustomTreeViewContextKey, TreeView, TreeViewPane };
|