monaco-editor11 1.1.1 → 1.1.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/dist/index.d.ts +0 -7
- package/dist/monaco-editor11.es.js +0 -49
- package/dist/monaco-editor11.umd.js +1 -1
- package/dist/workers/_.contribution.js +120 -0
- package/dist/workers/abap.contribution.js +8 -0
- package/dist/workers/abap.js +1397 -0
- package/dist/workers/abstractCodeEditorService.js +129 -0
- package/dist/workers/abstractKeybindingService.js +286 -0
- package/dist/workers/abstractScrollbar.js +214 -0
- package/dist/workers/abstractSyntaxTokenBackend.js +128 -0
- package/dist/workers/abstractText.js +89 -0
- package/dist/workers/abstractTree.js +2027 -0
- package/dist/workers/accessibility.js +11 -0
- package/dist/workers/accessibilityService.js +111 -0
- package/dist/workers/accessibilitySignalService.js +331 -0
- package/dist/workers/accessibleDiffViewer.js +588 -0
- package/dist/workers/accessibleViewRegistry.js +25 -0
- package/dist/workers/action.js +15 -0
- package/dist/workers/actionCommonCategories.js +16 -0
- package/dist/workers/actionList.js +344 -0
- package/dist/workers/actionViewItemService.js +29 -0
- package/dist/workers/actionViewItems.js +376 -0
- package/dist/workers/actionWidget.js +236 -0
- package/dist/workers/actionbar.js +462 -0
- package/dist/workers/actions.js +483 -0
- package/dist/workers/anchorSelect.js +160 -0
- package/dist/workers/animation.js +74 -0
- package/dist/workers/apex.contribution.js +9 -0
- package/dist/workers/apex.js +329 -0
- package/dist/workers/aria.js +84 -0
- package/dist/workers/arrays.js +529 -0
- package/dist/workers/arraysFind.js +177 -0
- package/dist/workers/assert.js +79 -0
- package/dist/workers/ast.js +485 -0
- package/dist/workers/async.js +938 -0
- package/dist/workers/asyncDataTree.js +946 -0
- package/dist/workers/autoIndent.js +390 -0
- package/dist/workers/autorun.js +89 -0
- package/dist/workers/autorunImpl.js +215 -0
- package/dist/workers/azcli.contribution.js +8 -0
- package/dist/workers/azcli.js +67 -0
- package/dist/workers/bannerController.js +118 -0
- package/dist/workers/base.js +19 -0
- package/dist/workers/baseColors.js +31 -0
- package/dist/workers/baseObservable.js +106 -0
- package/dist/workers/baseRenderStrategy.js +19 -0
- package/dist/workers/baseResolvedKeybinding.js +56 -0
- package/dist/workers/bat.contribution.js +8 -0
- package/dist/workers/bat.js +99 -0
- package/dist/workers/beforeEditPositionMapper.js +110 -0
- package/dist/workers/bicep.contribution.js +8 -0
- package/dist/workers/bicep.js +108 -0
- package/dist/workers/blockCommentCommand.js +149 -0
- package/dist/workers/blockDecorations.js +97 -0
- package/dist/workers/bracketMatching.js +359 -0
- package/dist/workers/bracketPairsImpl.js +717 -0
- package/dist/workers/bracketPairsTree.js +343 -0
- package/dist/workers/bracketSelections.js +149 -0
- package/dist/workers/brackets.js +108 -0
- package/dist/workers/browser.js +57 -0
- package/dist/workers/buffer.js +81 -0
- package/dist/workers/bufferDirtyTracker.js +45 -0
- package/dist/workers/bulkEditService.js +76 -0
- package/dist/workers/button.js +226 -0
- package/dist/workers/cache.js +61 -0
- package/dist/workers/cameligo.contribution.js +8 -0
- package/dist/workers/cameligo.js +173 -0
- package/dist/workers/canIUse.js +23 -0
- package/dist/workers/cancellation.js +116 -0
- package/dist/workers/caretOperations.js +48 -0
- package/dist/workers/changeRecorder.js +78 -0
- package/dist/workers/changeTracker.js +80 -0
- package/dist/workers/charWidthReader.js +104 -0
- package/dist/workers/characterClassifier.js +59 -0
- package/dist/workers/characterPair.js +40 -0
- package/dist/workers/chartsColors.js +18 -0
- package/dist/workers/clickLinkGesture.js +161 -0
- package/dist/workers/clipboard.js +308 -0
- package/dist/workers/clipboardService.js +9 -0
- package/dist/workers/clipboardUtils.js +85 -0
- package/dist/workers/clojure.contribution.js +8 -0
- package/dist/workers/clojure.js +760 -0
- package/dist/workers/codeAction.js +306 -0
- package/dist/workers/codeActionCommands.js +230 -0
- package/dist/workers/codeActionContributions.js +55 -0
- package/dist/workers/codeActionController.js +372 -0
- package/dist/workers/codeActionKeybindingResolver.js +90 -0
- package/dist/workers/codeActionMenu.js +68 -0
- package/dist/workers/codeActionModel.js +334 -0
- package/dist/workers/codeEditorContributions.js +132 -0
- package/dist/workers/codeEditorService.js +9 -0
- package/dist/workers/codeEditorWidget.js +1856 -0
- package/dist/workers/codeLensCache.js +112 -0
- package/dist/workers/codelens.js +114 -0
- package/dist/workers/codelensController.js +469 -0
- package/dist/workers/codelensWidget.js +265 -0
- package/dist/workers/codicons.js +50 -0
- package/dist/workers/codiconsLibrary.js +642 -0
- package/dist/workers/codiconsUtil.js +22 -0
- package/dist/workers/coffee.contribution.js +9 -0
- package/dist/workers/coffee.js +231 -0
- package/dist/workers/collections.js +98 -0
- package/dist/workers/color.js +94 -0
- package/dist/workers/colorDetector.js +245 -0
- package/dist/workers/colorPickerBody.js +71 -0
- package/dist/workers/colorPickerCloseButton.js +34 -0
- package/dist/workers/colorPickerContribution.js +50 -0
- package/dist/workers/colorPickerHeader.js +79 -0
- package/dist/workers/colorPickerInsertButton.js +27 -0
- package/dist/workers/colorPickerModel.js +74 -0
- package/dist/workers/colorPickerParticipantUtils.js +52 -0
- package/dist/workers/colorPickerSaturationBox.js +106 -0
- package/dist/workers/colorPickerStrip.js +98 -0
- package/dist/workers/colorPickerWidget.js +32 -0
- package/dist/workers/colorUtils.js +199 -0
- package/dist/workers/colorizedBracketPairsDecorationProvider.js +97 -0
- package/dist/workers/colorizer.js +120 -0
- package/dist/workers/colors.js +20 -0
- package/dist/workers/columnRange.js +35 -0
- package/dist/workers/combineTextEditInfos.js +124 -0
- package/dist/workers/commandIds.js +12 -0
- package/dist/workers/commands.js +329 -0
- package/dist/workers/commandsQuickAccess.js +40 -0
- package/dist/workers/comment.js +147 -0
- package/dist/workers/common.js +20 -0
- package/dist/workers/comparers.js +87 -0
- package/dist/workers/completionModel.js +227 -0
- package/dist/workers/compressedObjectTreeModel.js +385 -0
- package/dist/workers/computeGhostText.js +182 -0
- package/dist/workers/computeMovedLines.js +249 -0
- package/dist/workers/concat23Trees.js +192 -0
- package/dist/workers/configuration.js +92 -0
- package/dist/workers/configurationModels.js +614 -0
- package/dist/workers/configurationRegistry.js +400 -0
- package/dist/workers/configurations.js +46 -0
- package/dist/workers/consoleObservableLogger.js +83 -0
- package/dist/workers/constObservable.js +35 -0
- package/dist/workers/contentHoverComputer.js +71 -0
- package/dist/workers/contentHoverController.js +320 -0
- package/dist/workers/contentHoverRendered.js +336 -0
- package/dist/workers/contentHoverStatusBar.js +52 -0
- package/dist/workers/contentHoverTypes.js +29 -0
- package/dist/workers/contentHoverWidget.js +394 -0
- package/dist/workers/contentHoverWidgetWrapper.js +362 -0
- package/dist/workers/contentSegmenter.js +52 -0
- package/dist/workers/contentWidgets.js +495 -0
- package/dist/workers/contextKeyService.js +468 -0
- package/dist/workers/contextMenuHandler.js +126 -0
- package/dist/workers/contextMenuService.js +103 -0
- package/dist/workers/contextScopedHistoryWidget.js +106 -0
- package/dist/workers/contextViewService.js +73 -0
- package/dist/workers/contextkey.js +1551 -0
- package/dist/workers/contextkeys.js +21 -0
- package/dist/workers/contextmenu.js +334 -0
- package/dist/workers/contextview.js +298 -0
- package/dist/workers/contiguousMultilineTokens.js +32 -0
- package/dist/workers/contiguousMultilineTokensBuilder.js +23 -0
- package/dist/workers/contiguousTokensEditing.js +128 -0
- package/dist/workers/contiguousTokensStore.js +207 -0
- package/dist/workers/contribution.js +36 -0
- package/dist/workers/coordinatesConverter.js +51 -0
- package/dist/workers/copyLinesCommand.js +73 -0
- package/dist/workers/copyPasteContribution.js +114 -0
- package/dist/workers/copyPasteController.js +585 -0
- package/dist/workers/copySelection.js +47 -0
- package/dist/workers/coreCommands.js +1731 -0
- package/dist/workers/countBadge.js +52 -0
- package/dist/workers/cpp.contribution.js +14 -0
- package/dist/workers/cpp.js +388 -0
- package/dist/workers/csharp.contribution.js +8 -0
- package/dist/workers/csharp.js +325 -0
- package/dist/workers/csp.contribution.js +8 -0
- package/dist/workers/csp.js +52 -0
- package/dist/workers/css.contribution.js +9 -0
- package/dist/workers/css.js +184 -0
- package/dist/workers/cssMode.js +198 -0
- package/dist/workers/cssValue.js +69 -0
- package/dist/workers/cssWorker.js +183 -0
- package/dist/workers/currentLineHighlight.js +205 -0
- package/dist/workers/cursor.js +899 -0
- package/dist/workers/cursorAtomicMoveOperations.js +145 -0
- package/dist/workers/cursorCollection.js +194 -0
- package/dist/workers/cursorColumnSelection.js +93 -0
- package/dist/workers/cursorColumns.js +112 -0
- package/dist/workers/cursorCommon.js +250 -0
- package/dist/workers/cursorContext.js +15 -0
- package/dist/workers/cursorDeleteOperations.js +231 -0
- package/dist/workers/cursorMoveCommands.js +676 -0
- package/dist/workers/cursorMoveOperations.js +290 -0
- package/dist/workers/cursorTypeEditOperations.js +968 -0
- package/dist/workers/cursorTypeOperations.js +173 -0
- package/dist/workers/cursorUndo.js +133 -0
- package/dist/workers/cursorUtils.js +75 -0
- package/dist/workers/cursorWordOperations.js +720 -0
- package/dist/workers/cypher.contribution.js +8 -0
- package/dist/workers/cypher.js +262 -0
- package/dist/workers/dart.contribution.js +9 -0
- package/dist/workers/dart.js +280 -0
- package/dist/workers/dataChannel.js +12 -0
- package/dist/workers/dataTransfer.js +80 -0
- package/dist/workers/dataTree.js +20 -0
- package/dist/workers/date.js +57 -0
- package/dist/workers/debugLocation.js +66 -0
- package/dist/workers/debugName.js +110 -0
- package/dist/workers/debuggerRpc.js +67 -0
- package/dist/workers/decorationCssRuleExtractor.js +73 -0
- package/dist/workers/decorationStyleCache.js +40 -0
- package/dist/workers/decorations.js +196 -0
- package/dist/workers/decorationsOverviewRuler.js +416 -0
- package/dist/workers/decorators.js +33 -0
- package/dist/workers/defaultDocumentColorProvider.js +55 -0
- package/dist/workers/defaultDocumentColorsComputer.js +138 -0
- package/dist/workers/defaultLinesDiffComputer.js +188 -0
- package/dist/workers/defaultProviders.js +230 -0
- package/dist/workers/defaultStyles.js +194 -0
- package/dist/workers/delegatingEditorImpl.js +111 -0
- package/dist/workers/derived.js +80 -0
- package/dist/workers/derivedImpl.js +353 -0
- package/dist/workers/descriptors.js +13 -0
- package/dist/workers/devToolsLogger.js +442 -0
- package/dist/workers/dialogs.js +5 -0
- package/dist/workers/diff.js +902 -0
- package/dist/workers/diffAlgorithm.js +139 -0
- package/dist/workers/diffChange.js +34 -0
- package/dist/workers/diffEditor.contribution.js +83 -0
- package/dist/workers/diffEditor.js +38 -0
- package/dist/workers/diffEditorDecorations.js +115 -0
- package/dist/workers/diffEditorEditors.js +190 -0
- package/dist/workers/diffEditorItemTemplate.js +272 -0
- package/dist/workers/diffEditorOptions.js +152 -0
- package/dist/workers/diffEditorSash.js +86 -0
- package/dist/workers/diffEditorViewModel.js +608 -0
- package/dist/workers/diffEditorViewZones.js +525 -0
- package/dist/workers/diffEditorWidget.js +590 -0
- package/dist/workers/diffProviderFactoryService.js +142 -0
- package/dist/workers/dnd.js +198 -0
- package/dist/workers/dockerfile.contribution.js +9 -0
- package/dist/workers/dockerfile.js +129 -0
- package/dist/workers/documentSemanticTokens.js +362 -0
- package/dist/workers/documentSymbols.js +24 -0
- package/dist/workers/dom.js +1454 -0
- package/dist/workers/domFontInfo.js +28 -0
- package/dist/workers/domLineBreaksComputer.js +301 -0
- package/dist/workers/domReadingContext.js +43 -0
- package/dist/workers/domSanitize.js +312 -0
- package/dist/workers/domStylesheets.js +145 -0
- package/dist/workers/dompurify.js +1347 -0
- package/dist/workers/dragAndDropCommand.js +65 -0
- package/dist/workers/dragScrolling.js +174 -0
- package/dist/workers/dropIntoEditorContribution.js +41 -0
- package/dist/workers/dropIntoEditorController.js +173 -0
- package/dist/workers/dropdown.js +141 -0
- package/dist/workers/dropdownActionViewItem.js +109 -0
- package/dist/workers/dynamicProgrammingDiffing.js +101 -0
- package/dist/workers/dynamicViewOverlay.js +10 -0
- package/dist/workers/ecl.contribution.js +8 -0
- package/dist/workers/ecl.js +455 -0
- package/dist/workers/edcore.main.js +74 -0
- package/dist/workers/edit.js +83 -0
- package/dist/workers/editContext.js +10 -0
- package/dist/workers/editContextFactory.js +16 -0
- package/dist/workers/editOperation.js +36 -0
- package/dist/workers/editStack.js +363 -0
- package/dist/workers/editor.all.js +65 -0
- package/dist/workers/editor.api.js +2 -0
- package/dist/workers/editor.api2.js +60 -0
- package/dist/workers/editor.js +15 -0
- package/dist/workers/editor.main.js +170 -0
- package/dist/workers/editor.worker.start.js +44 -0
- package/dist/workers/editorAction.js +26 -0
- package/dist/workers/editorBaseApi.js +43 -0
- package/dist/workers/editorBrowser.js +53 -0
- package/dist/workers/editorColorRegistry.js +102 -0
- package/dist/workers/editorColors.js +128 -0
- package/dist/workers/editorCommon.js +13 -0
- package/dist/workers/editorConfiguration.js +292 -0
- package/dist/workers/editorConfigurationSchema.js +338 -0
- package/dist/workers/editorContextKeys.js +84 -0
- package/dist/workers/editorDom.js +299 -0
- package/dist/workers/editorExtensions.js +489 -0
- package/dist/workers/editorFeatures.js +17 -0
- package/dist/workers/editorGutter.js +117 -0
- package/dist/workers/editorMarkdownCodeBlockRenderer.js +85 -0
- package/dist/workers/editorNavigationQuickAccess.js +152 -0
- package/dist/workers/editorOptions.js +3440 -0
- package/dist/workers/editorScrollbar.js +151 -0
- package/dist/workers/editorState.js +115 -0
- package/dist/workers/editorTheme.js +23 -0
- package/dist/workers/editorWebWorker.js +299 -0
- package/dist/workers/editorWorker.js +9 -0
- package/dist/workers/editorWorkerHost.js +15 -0
- package/dist/workers/editorWorkerService.js +366 -0
- package/dist/workers/editorZoom.js +26 -0
- package/dist/workers/electricCharacter.js +55 -0
- package/dist/workers/elementSizeObserver.js +107 -0
- package/dist/workers/elixir.contribution.js +8 -0
- package/dist/workers/elixir.js +568 -0
- package/dist/workers/embeddedCodeEditorWidget.js +66 -0
- package/dist/workers/encodedTokenAttributes.js +79 -0
- package/dist/workers/enterAction.js +53 -0
- package/dist/workers/environment.js +5 -0
- package/dist/workers/eolCounter.js +44 -0
- package/dist/workers/equals.js +84 -0
- package/dist/workers/errorMessage.js +71 -0
- package/dist/workers/errors.js +163 -0
- package/dist/workers/event.js +1197 -0
- package/dist/workers/extensions.js +18 -0
- package/dist/workers/extpath.js +147 -0
- package/dist/workers/fastDomNode.js +255 -0
- package/dist/workers/files.js +19 -0
- package/dist/workers/filters.js +742 -0
- package/dist/workers/findController.js +970 -0
- package/dist/workers/findDecorations.js +311 -0
- package/dist/workers/findInput.js +294 -0
- package/dist/workers/findInputToggles.js +52 -0
- package/dist/workers/findModel.js +497 -0
- package/dist/workers/findOptionsWidget.js +155 -0
- package/dist/workers/findSectionHeaders.js +128 -0
- package/dist/workers/findState.js +244 -0
- package/dist/workers/findWidget.js +1168 -0
- package/dist/workers/findWidgetSearchHistory.js +85 -0
- package/dist/workers/fixBrackets.js +67 -0
- package/dist/workers/fixedArray.js +70 -0
- package/dist/workers/floatingMenu.contribution.js +9 -0
- package/dist/workers/floatingMenu.js +94 -0
- package/dist/workers/flow9.contribution.js +8 -0
- package/dist/workers/flow9.js +141 -0
- package/dist/workers/folding.js +1136 -0
- package/dist/workers/foldingDecorations.js +158 -0
- package/dist/workers/foldingModel.js +532 -0
- package/dist/workers/foldingRanges.js +354 -0
- package/dist/workers/fontInfo.js +172 -0
- package/dist/workers/fontInfoFromSettings.js +29 -0
- package/dist/workers/fontMeasurements.js +206 -0
- package/dist/workers/fontZoom.js +47 -0
- package/dist/workers/fonts.js +17 -0
- package/dist/workers/format.js +367 -0
- package/dist/workers/formatActions.js +263 -0
- package/dist/workers/formattedTextRenderer.js +160 -0
- package/dist/workers/formattingEdit.js +57 -0
- package/dist/workers/forwardingTelemetryService.js +60 -0
- package/dist/workers/freemarker2.contribution.js +52 -0
- package/dist/workers/freemarker2.js +1062 -0
- package/dist/workers/fsharp.contribution.js +8 -0
- package/dist/workers/fsharp.js +216 -0
- package/dist/workers/fullFileRenderStrategy.js +414 -0
- package/dist/workers/fullFileRenderStrategy.wgsl.js +93 -0
- package/dist/workers/functional.js +24 -0
- package/dist/workers/fuzzyScorer.js +143 -0
- package/dist/workers/getHover.js +56 -0
- package/dist/workers/getIconClasses.js +106 -0
- package/dist/workers/getLinks.js +157 -0
- package/dist/workers/getPositionOffsetTransformerFromTextModel.js +24 -0
- package/dist/workers/getSemanticTokens.js +211 -0
- package/dist/workers/ghostText.js +111 -0
- package/dist/workers/ghostTextView.js +449 -0
- package/dist/workers/glob.js +581 -0
- package/dist/workers/globalPointerMoveMonitor.js +83 -0
- package/dist/workers/glyphHoverComputer.js +40 -0
- package/dist/workers/glyphHoverController.js +171 -0
- package/dist/workers/glyphHoverWidget.js +184 -0
- package/dist/workers/glyphLanesModel.js +61 -0
- package/dist/workers/glyphMargin.js +403 -0
- package/dist/workers/glyphRasterizer.js +276 -0
- package/dist/workers/go.contribution.js +8 -0
- package/dist/workers/go.js +217 -0
- package/dist/workers/goToCommands.js +694 -0
- package/dist/workers/goToDefinitionAtPosition.js +267 -0
- package/dist/workers/goToSymbol.js +128 -0
- package/dist/workers/gotoError.js +272 -0
- package/dist/workers/gotoErrorWidget.js +352 -0
- package/dist/workers/gotoLineQuickAccess.js +183 -0
- package/dist/workers/gotoSymbolQuickAccess.js +395 -0
- package/dist/workers/gpuActions.js +126 -0
- package/dist/workers/gpuDisposable.js +48 -0
- package/dist/workers/gpuMark.js +80 -0
- package/dist/workers/gpuUtils.js +58 -0
- package/dist/workers/graph.js +74 -0
- package/dist/workers/graphql.contribution.js +9 -0
- package/dist/workers/graphql.js +150 -0
- package/dist/workers/guidesTextModelPart.js +405 -0
- package/dist/workers/gutterFeature.js +238 -0
- package/dist/workers/gutterIndicatorMenu.js +252 -0
- package/dist/workers/gutterIndicatorView.js +456 -0
- package/dist/workers/handlebars.contribution.js +9 -0
- package/dist/workers/handlebars.js +485 -0
- package/dist/workers/hash.js +256 -0
- package/dist/workers/hcl.contribution.js +8 -0
- package/dist/workers/hcl.js +182 -0
- package/dist/workers/helpQuickAccess.js +77 -0
- package/dist/workers/heuristicSequenceOptimizations.js +374 -0
- package/dist/workers/hiddenRangeModel.js +126 -0
- package/dist/workers/hideUnchangedRegionsFeature.js +433 -0
- package/dist/workers/hierarchicalKind.js +26 -0
- package/dist/workers/highlightDecorations.js +111 -0
- package/dist/workers/highlightedLabel.js +129 -0
- package/dist/workers/history.js +85 -0
- package/dist/workers/historyWidgetKeybindingHint.js +9 -0
- package/dist/workers/horizontalScrollbar.js +91 -0
- package/dist/workers/hotReloadHelpers.js +17 -0
- package/dist/workers/hover.js +11 -0
- package/dist/workers/hoverAccessibleViews.js +8 -0
- package/dist/workers/hoverActionIds.js +23 -0
- package/dist/workers/hoverActions.js +424 -0
- package/dist/workers/hoverColorPicker.js +14 -0
- package/dist/workers/hoverColorPickerContribution.js +44 -0
- package/dist/workers/hoverColorPickerParticipant.js +151 -0
- package/dist/workers/hoverContribution.js +56 -0
- package/dist/workers/hoverCopyButton.js +54 -0
- package/dist/workers/hoverDelegate2.js +39 -0
- package/dist/workers/hoverDelegateFactory.js +34 -0
- package/dist/workers/hoverOperation.js +168 -0
- package/dist/workers/hoverParticipant.js +161 -0
- package/dist/workers/hoverService.js +542 -0
- package/dist/workers/hoverTypes.js +64 -0
- package/dist/workers/hoverUtils.js +18 -0
- package/dist/workers/hoverWidget.js +93 -0
- package/dist/workers/html.contribution.js +9 -0
- package/dist/workers/html.js +374 -0
- package/dist/workers/htmlContent.js +164 -0
- package/dist/workers/htmlMode.js +213 -0
- package/dist/workers/htmlWorker.js +126 -0
- package/dist/workers/iPadShowKeyboard.js +74 -0
- package/dist/workers/iconLabel.js +291 -0
- package/dist/workers/iconLabels.js +33 -0
- package/dist/workers/iconRegistry.js +183 -0
- package/dist/workers/iconsStyleSheet.js +75 -0
- package/dist/workers/idGenerator.js +16 -0
- package/dist/workers/iframe.js +87 -0
- package/dist/workers/ime.js +33 -0
- package/dist/workers/inPlaceReplace.js +151 -0
- package/dist/workers/inPlaceReplaceCommand.js +27 -0
- package/dist/workers/indentGuides.js +254 -0
- package/dist/workers/indentRangeProvider.js +166 -0
- package/dist/workers/indentRules.js +63 -0
- package/dist/workers/indentUtils.js +33 -0
- package/dist/workers/indentation.js +100 -0
- package/dist/workers/indentationGuesser.js +178 -0
- package/dist/workers/indentationLineProcessor.js +193 -0
- package/dist/workers/index.js +21 -0
- package/dist/workers/indexTreeModel.js +538 -0
- package/dist/workers/ini.contribution.js +9 -0
- package/dist/workers/ini.js +70 -0
- package/dist/workers/initialize.js +11 -0
- package/dist/workers/inlayHints.js +147 -0
- package/dist/workers/inlayHintsContribution.js +11 -0
- package/dist/workers/inlayHintsController.js +686 -0
- package/dist/workers/inlayHintsHover.js +162 -0
- package/dist/workers/inlayHintsLocations.js +96 -0
- package/dist/workers/inlineCompletionContextKeys.js +23 -0
- package/dist/workers/inlineCompletions.contribution.js +31 -0
- package/dist/workers/inlineCompletionsAccessibleView.js +4 -0
- package/dist/workers/inlineCompletionsController.js +427 -0
- package/dist/workers/inlineCompletionsHintsWidget.js +356 -0
- package/dist/workers/inlineCompletionsModel.js +1048 -0
- package/dist/workers/inlineCompletionsService.js +170 -0
- package/dist/workers/inlineCompletionsSource.js +548 -0
- package/dist/workers/inlineCompletionsView.js +86 -0
- package/dist/workers/inlineDecorations.js +26 -0
- package/dist/workers/inlineDiffDeletedCodeMargin.js +138 -0
- package/dist/workers/inlineEdit.js +17 -0
- package/dist/workers/inlineEditWithChanges.js +30 -0
- package/dist/workers/inlineEditsCollapsedView.js +132 -0
- package/dist/workers/inlineEditsCustomView.js +256 -0
- package/dist/workers/inlineEditsDeletionView.js +178 -0
- package/dist/workers/inlineEditsInsertionView.js +267 -0
- package/dist/workers/inlineEditsLineReplacementView.js +329 -0
- package/dist/workers/inlineEditsModel.js +59 -0
- package/dist/workers/inlineEditsNewUsers.js +174 -0
- package/dist/workers/inlineEditsSideBySideView.js +517 -0
- package/dist/workers/inlineEditsView.js +561 -0
- package/dist/workers/inlineEditsViewInterface.js +21 -0
- package/dist/workers/inlineEditsViewProducer.js +119 -0
- package/dist/workers/inlineEditsWordReplacementView.js +211 -0
- package/dist/workers/inlineProgress.js +139 -0
- package/dist/workers/inlineSuggestionItem.js +497 -0
- package/dist/workers/inplaceReplaceSupport.js +87 -0
- package/dist/workers/inputBox.js +510 -0
- package/dist/workers/inputColors.js +66 -0
- package/dist/workers/inputMode.js +22 -0
- package/dist/workers/insertFinalNewLine.js +32 -0
- package/dist/workers/insertFinalNewLineCommand.js +39 -0
- package/dist/workers/inspectTokens.js +240 -0
- package/dist/workers/instantiation.js +44 -0
- package/dist/workers/instantiationService.js +403 -0
- package/dist/workers/intervalTree.js +1002 -0
- package/dist/workers/iterator.js +186 -0
- package/dist/workers/java.contribution.js +9 -0
- package/dist/workers/java.js +231 -0
- package/dist/workers/javascript.contribution.js +11 -0
- package/dist/workers/javascript.js +70 -0
- package/dist/workers/jsonContributionRegistry.js +42 -0
- package/dist/workers/jsonMode.js +224 -0
- package/dist/workers/jsonWorker.js +187 -0
- package/dist/workers/julia.contribution.js +8 -0
- package/dist/workers/julia.js +510 -0
- package/dist/workers/keyCodes.js +351 -0
- package/dist/workers/keybinding.js +9 -0
- package/dist/workers/keybindingCancellation.js +81 -0
- package/dist/workers/keybindingLabel.js +122 -0
- package/dist/workers/keybindingLabels.js +139 -0
- package/dist/workers/keybindingResolver.js +304 -0
- package/dist/workers/keybindings.js +104 -0
- package/dist/workers/keybindingsRegistry.js +111 -0
- package/dist/workers/keyboardEvent.js +125 -0
- package/dist/workers/korean.js +321 -0
- package/dist/workers/kotlin.contribution.js +9 -0
- package/dist/workers/kotlin.js +251 -0
- package/dist/workers/label.js +5 -0
- package/dist/workers/labels.js +15 -0
- package/dist/workers/language.js +9 -0
- package/dist/workers/languageBracketsConfiguration.js +133 -0
- package/dist/workers/languageConfiguration.js +138 -0
- package/dist/workers/languageConfigurationRegistry.js +361 -0
- package/dist/workers/languageFeatureDebounce.js +137 -0
- package/dist/workers/languageFeatureRegistry.js +180 -0
- package/dist/workers/languageFeatures.js +9 -0
- package/dist/workers/languageFeaturesService.js +47 -0
- package/dist/workers/languageSelector.js +112 -0
- package/dist/workers/languageService.js +92 -0
- package/dist/workers/languages.js +522 -0
- package/dist/workers/languagesAssociations.js +193 -0
- package/dist/workers/languagesRegistry.js +237 -0
- package/dist/workers/layoutService.js +9 -0
- package/dist/workers/lazy.js +49 -0
- package/dist/workers/lazyObservableValue.js +125 -0
- package/dist/workers/legacyLinesDiffComputer.js +468 -0
- package/dist/workers/length.js +129 -0
- package/dist/workers/less.contribution.js +9 -0
- package/dist/workers/less.js +160 -0
- package/dist/workers/lexon.contribution.js +8 -0
- package/dist/workers/lexon.js +156 -0
- package/dist/workers/lib.index.js +103 -0
- package/dist/workers/lib.js +1107 -0
- package/dist/workers/lifecycle.js +311 -0
- package/dist/workers/lightBulbWidget.js +427 -0
- package/dist/workers/lineCommentCommand.js +328 -0
- package/dist/workers/lineDecorations.js +208 -0
- package/dist/workers/lineEdit.js +75 -0
- package/dist/workers/lineHeights.js +370 -0
- package/dist/workers/lineNumbers.js +184 -0
- package/dist/workers/linePart.js +25 -0
- package/dist/workers/lineRange.js +312 -0
- package/dist/workers/lineSelection.js +36 -0
- package/dist/workers/lineSequence.js +36 -0
- package/dist/workers/lineTokens.js +405 -0
- package/dist/workers/linesDecorations.js +104 -0
- package/dist/workers/linesDiffComputer.js +29 -0
- package/dist/workers/linesDiffComputers.js +13 -0
- package/dist/workers/linesLayout.js +765 -0
- package/dist/workers/linesOperations.js +1187 -0
- package/dist/workers/linesSliceCharSequence.js +205 -0
- package/dist/workers/link.js +95 -0
- package/dist/workers/linkComputer.js +269 -0
- package/dist/workers/linkedEditing.js +381 -0
- package/dist/workers/linkedList.js +126 -0
- package/dist/workers/linkedText.js +48 -0
- package/dist/workers/links.js +376 -0
- package/dist/workers/liquid.contribution.js +9 -0
- package/dist/workers/liquid.js +306 -0
- package/dist/workers/list.js +11 -0
- package/dist/workers/listColors.js +51 -0
- package/dist/workers/listPaging.js +128 -0
- package/dist/workers/listService.js +1025 -0
- package/dist/workers/listView.js +1173 -0
- package/dist/workers/listWidget.js +1535 -0
- package/dist/workers/log.js +271 -0
- package/dist/workers/logService.js +40 -0
- package/dist/workers/logging.js +86 -0
- package/dist/workers/longLinesHelper.js +23 -0
- package/dist/workers/lspLanguageFeatures.js +716 -0
- package/dist/workers/lua.contribution.js +8 -0
- package/dist/workers/lua.js +161 -0
- package/dist/workers/m3.contribution.js +8 -0
- package/dist/workers/m3.js +209 -0
- package/dist/workers/map.js +670 -0
- package/dist/workers/margin.js +71 -0
- package/dist/workers/marginDecorations.js +84 -0
- package/dist/workers/markdown.contribution.js +8 -0
- package/dist/workers/markdown.js +228 -0
- package/dist/workers/markdownHoverParticipant.js +419 -0
- package/dist/workers/markdownRenderer.js +73 -0
- package/dist/workers/marked.js +2478 -0
- package/dist/workers/markerDecorations.js +9 -0
- package/dist/workers/markerDecorationsService.js +248 -0
- package/dist/workers/markerHoverParticipant.js +270 -0
- package/dist/workers/markerNavigationService.js +223 -0
- package/dist/workers/markerService.js +330 -0
- package/dist/workers/markers.js +127 -0
- package/dist/workers/marshalling.js +62 -0
- package/dist/workers/mdx.contribution.js +8 -0
- package/dist/workers/mdx.js +230 -0
- package/dist/workers/menu.js +1147 -0
- package/dist/workers/menuColors.js +19 -0
- package/dist/workers/menuEntryActionViewItem.js +519 -0
- package/dist/workers/menuService.js +436 -0
- package/dist/workers/messageController.js +186 -0
- package/dist/workers/middleScroll.contribution.js +8 -0
- package/dist/workers/middleScrollController.js +128 -0
- package/dist/workers/migrateOptions.js +220 -0
- package/dist/workers/mime.js +11 -0
- package/dist/workers/minimap.js +1662 -0
- package/dist/workers/minimapCharRenderer.js +90 -0
- package/dist/workers/minimapCharRendererFactory.js +136 -0
- package/dist/workers/minimapCharSheet.js +25 -0
- package/dist/workers/minimapColors.js +23 -0
- package/dist/workers/minimapPreBaked.js +52 -0
- package/dist/workers/minimapTokensColorTracker.js +58 -0
- package/dist/workers/mips.contribution.js +9 -0
- package/dist/workers/mips.js +197 -0
- package/dist/workers/mirrorTextModel.js +117 -0
- package/dist/workers/miscColors.js +32 -0
- package/dist/workers/model.js +9 -0
- package/dist/workers/modelLineProjection.js +350 -0
- package/dist/workers/modelLineProjectionData.js +297 -0
- package/dist/workers/modelService.js +413 -0
- package/dist/workers/modesRegistry.js +75 -0
- package/dist/workers/monaco.contribution.js +302 -0
- package/dist/workers/monarchCommon.js +147 -0
- package/dist/workers/monarchCompile.js +546 -0
- package/dist/workers/monarchLexer.js +764 -0
- package/dist/workers/monospaceLineBreaksComputer.js +473 -0
- package/dist/workers/mouseCursor.js +9 -0
- package/dist/workers/mouseEvent.js +153 -0
- package/dist/workers/mouseHandler.js +539 -0
- package/dist/workers/mouseTarget.js +978 -0
- package/dist/workers/moveCaretCommand.js +49 -0
- package/dist/workers/moveLinesCommand.js +394 -0
- package/dist/workers/movedBlocksLinesFeature.js +277 -0
- package/dist/workers/msdax.contribution.js +8 -0
- package/dist/workers/msdax.js +374 -0
- package/dist/workers/multiDiffEditorWidget.js +43 -0
- package/dist/workers/multiDiffEditorWidgetImpl.js +427 -0
- package/dist/workers/multicursor.js +1004 -0
- package/dist/workers/myersDiffAlgorithm.js +159 -0
- package/dist/workers/mysql.contribution.js +8 -0
- package/dist/workers/mysql.js +877 -0
- package/dist/workers/nativeEditContext.js +518 -0
- package/dist/workers/nativeEditContextRegistry.js +23 -0
- package/dist/workers/nativeEditContextUtils.js +85 -0
- package/dist/workers/navigator.js +36 -0
- package/dist/workers/network.js +267 -0
- package/dist/workers/nls.js +76 -0
- package/dist/workers/nls.messages.js +18 -0
- package/dist/workers/nodeReader.js +127 -0
- package/dist/workers/normalization.js +41 -0
- package/dist/workers/notification.js +9 -0
- package/dist/workers/nullTokenize.js +29 -0
- package/dist/workers/numbers.js +45 -0
- package/dist/workers/objectCollectionBuffer.js +102 -0
- package/dist/workers/objectPool.js +47 -0
- package/dist/workers/objectTree.js +204 -0
- package/dist/workers/objectTreeModel.js +220 -0
- package/dist/workers/objective-c.contribution.js +8 -0
- package/dist/workers/objective-c.js +182 -0
- package/dist/workers/objects.js +152 -0
- package/dist/workers/observableCodeEditor.js +373 -0
- package/dist/workers/observableFromEvent.js +123 -0
- package/dist/workers/observableSignal.js +47 -0
- package/dist/workers/observableSignalFromEvent.js +41 -0
- package/dist/workers/observableValue.js +105 -0
- package/dist/workers/observableValueOpts.js +20 -0
- package/dist/workers/offsetRange.js +225 -0
- package/dist/workers/onEnter.js +109 -0
- package/dist/workers/oneCursor.js +117 -0
- package/dist/workers/opener.js +43 -0
- package/dist/workers/openerService.js +222 -0
- package/dist/workers/originalEditorInlineDiffView.js +215 -0
- package/dist/workers/outlineModel.js +265 -0
- package/dist/workers/overlayWidgets.js +181 -0
- package/dist/workers/overviewRuler.js +134 -0
- package/dist/workers/overviewRulerFeature.js +168 -0
- package/dist/workers/overviewZoneManager.js +176 -0
- package/dist/workers/parameterHints.js +126 -0
- package/dist/workers/parameterHintsModel.js +258 -0
- package/dist/workers/parameterHintsWidget.js +318 -0
- package/dist/workers/parser.js +121 -0
- package/dist/workers/pascal.contribution.js +9 -0
- package/dist/workers/pascal.js +250 -0
- package/dist/workers/pascaligo.contribution.js +8 -0
- package/dist/workers/pascaligo.js +163 -0
- package/dist/workers/path.js +1451 -0
- package/dist/workers/peekView.js +246 -0
- package/dist/workers/performance.js +222 -0
- package/dist/workers/perl.contribution.js +8 -0
- package/dist/workers/perl.js +625 -0
- package/dist/workers/pgsql.contribution.js +8 -0
- package/dist/workers/pgsql.js +850 -0
- package/dist/workers/php.contribution.js +9 -0
- package/dist/workers/php.js +499 -0
- package/dist/workers/pickerQuickAccess.js +271 -0
- package/dist/workers/pieceTreeBase.js +1473 -0
- package/dist/workers/pieceTreeTextBuffer.js +461 -0
- package/dist/workers/pieceTreeTextBufferBuilder.js +140 -0
- package/dist/workers/pixelRatio.js +88 -0
- package/dist/workers/pla.contribution.js +7 -0
- package/dist/workers/pla.js +136 -0
- package/dist/workers/placeholderText.contribution.js +14 -0
- package/dist/workers/placeholderTextContribution.js +77 -0
- package/dist/workers/platform.js +32 -0
- package/dist/workers/platformObservableUtils.js +31 -0
- package/dist/workers/point.js +50 -0
- package/dist/workers/pointerHandler.js +132 -0
- package/dist/workers/position.js +142 -0
- package/dist/workers/positionToOffset.js +17 -0
- package/dist/workers/positionToOffsetImpl.js +98 -0
- package/dist/workers/postEditWidget.js +220 -0
- package/dist/workers/postiats.contribution.js +8 -0
- package/dist/workers/postiats.js +906 -0
- package/dist/workers/powerquery.contribution.js +8 -0
- package/dist/workers/powerquery.js +889 -0
- package/dist/workers/powershell.contribution.js +8 -0
- package/dist/workers/powershell.js +238 -0
- package/dist/workers/prefixSumComputer.js +226 -0
- package/dist/workers/process.js +61 -0
- package/dist/workers/product.js +70 -0
- package/dist/workers/productService.js +9 -0
- package/dist/workers/progress.js +16 -0
- package/dist/workers/progressbar.js +105 -0
- package/dist/workers/promise.js +56 -0
- package/dist/workers/protobuf.contribution.js +8 -0
- package/dist/workers/protobuf.js +419 -0
- package/dist/workers/provideInlineCompletions.js +372 -0
- package/dist/workers/provideSignatureHelp.js +59 -0
- package/dist/workers/pug.contribution.js +8 -0
- package/dist/workers/pug.js +401 -0
- package/dist/workers/python.contribution.js +9 -0
- package/dist/workers/python.js +366 -0
- package/dist/workers/qsharp.contribution.js +8 -0
- package/dist/workers/qsharp.js +300 -0
- package/dist/workers/quickAccess.js +56 -0
- package/dist/workers/quickInput.js +108 -0
- package/dist/workers/quickInputActions.js +189 -0
- package/dist/workers/quickInputBox.js +104 -0
- package/dist/workers/quickInputController.js +901 -0
- package/dist/workers/quickInputDelegate.js +19 -0
- package/dist/workers/quickInputList.js +1391 -0
- package/dist/workers/quickInputService.js +197 -0
- package/dist/workers/quickInputTree.js +37 -0
- package/dist/workers/quickInputTreeAccessibilityProvider.js +39 -0
- package/dist/workers/quickInputTreeController.js +181 -0
- package/dist/workers/quickInputTreeFilter.js +42 -0
- package/dist/workers/quickInputTreeRenderer.js +141 -0
- package/dist/workers/quickInputTreeSorter.js +48 -0
- package/dist/workers/quickInputUtils.js +89 -0
- package/dist/workers/quickpickColors.js +21 -0
- package/dist/workers/r.contribution.js +8 -0
- package/dist/workers/r.js +242 -0
- package/dist/workers/range.js +421 -0
- package/dist/workers/rangeMap.js +161 -0
- package/dist/workers/rangeMapping.js +229 -0
- package/dist/workers/rangeSingleLine.js +17 -0
- package/dist/workers/rangeUtil.js +117 -0
- package/dist/workers/razor.contribution.js +9 -0
- package/dist/workers/razor.js +616 -0
- package/dist/workers/rbTreeBase.js +362 -0
- package/dist/workers/rect.js +163 -0
- package/dist/workers/rectangleRenderer.js +214 -0
- package/dist/workers/rectangleRenderer.wgsl.js +68 -0
- package/dist/workers/redis.contribution.js +8 -0
- package/dist/workers/redis.js +301 -0
- package/dist/workers/redshift.contribution.js +8 -0
- package/dist/workers/redshift.js +808 -0
- package/dist/workers/reducer.js +46 -0
- package/dist/workers/referencesController.js +382 -0
- package/dist/workers/referencesModel.js +241 -0
- package/dist/workers/referencesTree.js +200 -0
- package/dist/workers/referencesWidget.js +525 -0
- package/dist/workers/registrations.contribution.js +82 -0
- package/dist/workers/rename.js +458 -0
- package/dist/workers/renameWidget.js +741 -0
- package/dist/workers/renderLines.js +185 -0
- package/dist/workers/renderingContext.js +118 -0
- package/dist/workers/replaceAllCommand.js +54 -0
- package/dist/workers/replaceCommand.js +158 -0
- package/dist/workers/replaceInput.js +176 -0
- package/dist/workers/replacePattern.js +289 -0
- package/dist/workers/replaceWidgetHistory.js +85 -0
- package/dist/workers/resizable.js +150 -0
- package/dist/workers/resizableContentWidget.js +92 -0
- package/dist/workers/resolvedKeybindingItem.js +35 -0
- package/dist/workers/resolverService.js +5 -0
- package/dist/workers/resources.js +231 -0
- package/dist/workers/restructuredtext.contribution.js +8 -0
- package/dist/workers/restructuredtext.js +173 -0
- package/dist/workers/revertButtonsFeature.js +149 -0
- package/dist/workers/rgba.js +35 -0
- package/dist/workers/richEditBrackets.js +356 -0
- package/dist/workers/rowCache.js +110 -0
- package/dist/workers/rpc.js +57 -0
- package/dist/workers/ruby.contribution.js +9 -0
- package/dist/workers/ruby.js +510 -0
- package/dist/workers/rulers.js +82 -0
- package/dist/workers/rulersGpu.js +66 -0
- package/dist/workers/runOnChange.js +61 -0
- package/dist/workers/rust.contribution.js +8 -0
- package/dist/workers/rust.js +342 -0
- package/dist/workers/sash.js +451 -0
- package/dist/workers/sb.contribution.js +8 -0
- package/dist/workers/sb.js +114 -0
- package/dist/workers/scala.contribution.js +9 -0
- package/dist/workers/scala.js +369 -0
- package/dist/workers/scanner.js +287 -0
- package/dist/workers/scheme.contribution.js +8 -0
- package/dist/workers/scheme.js +107 -0
- package/dist/workers/screenReaderContentRich.js +337 -0
- package/dist/workers/screenReaderContentSimple.js +194 -0
- package/dist/workers/screenReaderSupport.js +175 -0
- package/dist/workers/screenReaderUtils.js +111 -0
- package/dist/workers/scrollDecoration.js +70 -0
- package/dist/workers/scrollable.js +323 -0
- package/dist/workers/scrollableElement.js +603 -0
- package/dist/workers/scrollbarArrow.js +78 -0
- package/dist/workers/scrollbarState.js +163 -0
- package/dist/workers/scrollbarVisibilityController.js +93 -0
- package/dist/workers/scss.contribution.js +9 -0
- package/dist/workers/scss.js +259 -0
- package/dist/workers/search.js +52 -0
- package/dist/workers/searchColors.js +13 -0
- package/dist/workers/sectionHeaders.js +179 -0
- package/dist/workers/selectBox.js +47 -0
- package/dist/workers/selectBoxCustom.js +858 -0
- package/dist/workers/selectBoxNative.js +142 -0
- package/dist/workers/selection.js +145 -0
- package/dist/workers/selections.js +338 -0
- package/dist/workers/semanticTokensConfig.js +14 -0
- package/dist/workers/semanticTokensDto.js +82 -0
- package/dist/workers/semanticTokensProviderStyling.js +263 -0
- package/dist/workers/semanticTokensStyling.js +9 -0
- package/dist/workers/semanticTokensStylingService.js +47 -0
- package/dist/workers/serviceCollection.js +22 -0
- package/dist/workers/severity.js +52 -0
- package/dist/workers/severityIcon.js +29 -0
- package/dist/workers/shell.contribution.js +8 -0
- package/dist/workers/shell.js +220 -0
- package/dist/workers/shiftCommand.js +241 -0
- package/dist/workers/singleTextEditHelpers.js +32 -0
- package/dist/workers/smallImmutableSet.js +108 -0
- package/dist/workers/smartSelect.js +281 -0
- package/dist/workers/snippetController2.js +297 -0
- package/dist/workers/snippetParser.js +890 -0
- package/dist/workers/snippetSession.js +650 -0
- package/dist/workers/snippetVariables.js +323 -0
- package/dist/workers/solidity.contribution.js +8 -0
- package/dist/workers/solidity.js +1366 -0
- package/dist/workers/sophia.contribution.js +8 -0
- package/dist/workers/sophia.js +198 -0
- package/dist/workers/sortLinesCommand.js +81 -0
- package/dist/workers/sparql.contribution.js +8 -0
- package/dist/workers/sparql.js +200 -0
- package/dist/workers/sparseMultilineTokens.js +548 -0
- package/dist/workers/sparseTokensStore.js +210 -0
- package/dist/workers/splice.js +14 -0
- package/dist/workers/splitview.js +829 -0
- package/dist/workers/sql.contribution.js +8 -0
- package/dist/workers/sql.js +852 -0
- package/dist/workers/st.contribution.js +8 -0
- package/dist/workers/st.js +415 -0
- package/dist/workers/stableEditorScroll.js +52 -0
- package/dist/workers/standaloneCodeEditor.js +335 -0
- package/dist/workers/standaloneCodeEditorService.js +96 -0
- package/dist/workers/standaloneColorPickerActions.js +81 -0
- package/dist/workers/standaloneColorPickerController.js +62 -0
- package/dist/workers/standaloneColorPickerParticipant.js +117 -0
- package/dist/workers/standaloneColorPickerWidget.js +215 -0
- package/dist/workers/standaloneCommandsQuickAccess.js +82 -0
- package/dist/workers/standaloneEditor.js +519 -0
- package/dist/workers/standaloneEnums.js +1017 -0
- package/dist/workers/standaloneGotoLineQuickAccess.js +67 -0
- package/dist/workers/standaloneGotoSymbolQuickAccess.js +77 -0
- package/dist/workers/standaloneHelpQuickAccess.js +14 -0
- package/dist/workers/standaloneLanguages.js +621 -0
- package/dist/workers/standaloneLayoutService.js +74 -0
- package/dist/workers/standaloneQuickInputService.js +150 -0
- package/dist/workers/standaloneReferenceSearch.js +38 -0
- package/dist/workers/standaloneServices.js +787 -0
- package/dist/workers/standaloneStrings.js +42 -0
- package/dist/workers/standaloneTheme.js +9 -0
- package/dist/workers/standaloneThemeService.js +367 -0
- package/dist/workers/standaloneTreeSitterLibraryService.js +23 -0
- package/dist/workers/standaloneWebWorker.js +55 -0
- package/dist/workers/stickyScrollActions.js +132 -0
- package/dist/workers/stickyScrollContribution.js +16 -0
- package/dist/workers/stickyScrollController.js +566 -0
- package/dist/workers/stickyScrollElement.js +39 -0
- package/dist/workers/stickyScrollModelProvider.js +338 -0
- package/dist/workers/stickyScrollProvider.js +197 -0
- package/dist/workers/stickyScrollWidget.js +474 -0
- package/dist/workers/stopwatch.js +30 -0
- package/dist/workers/storage.js +200 -0
- package/dist/workers/stringBuilder.js +122 -0
- package/dist/workers/stringEdit.js +165 -0
- package/dist/workers/strings.js +834 -0
- package/dist/workers/structuredLogger.js +56 -0
- package/dist/workers/suggest.js +322 -0
- package/dist/workers/suggestAlternatives.js +95 -0
- package/dist/workers/suggestCommitCharacters.js +59 -0
- package/dist/workers/suggestController.js +941 -0
- package/dist/workers/suggestInlineCompletions.js +193 -0
- package/dist/workers/suggestMemory.js +254 -0
- package/dist/workers/suggestModel.js +667 -0
- package/dist/workers/suggestOvertypingCapturer.js +62 -0
- package/dist/workers/suggestWidget.js +890 -0
- package/dist/workers/suggestWidgetAdapter.js +210 -0
- package/dist/workers/suggestWidgetDetails.js +393 -0
- package/dist/workers/suggestWidgetRenderer.js +208 -0
- package/dist/workers/suggestWidgetStatus.js +74 -0
- package/dist/workers/supports.js +58 -0
- package/dist/workers/surroundSelectionCommand.js +44 -0
- package/dist/workers/swift.contribution.js +9 -0
- package/dist/workers/swift.js +311 -0
- package/dist/workers/symbolIcons.js +101 -0
- package/dist/workers/symbolNavigation.js +178 -0
- package/dist/workers/symbols.js +10 -0
- package/dist/workers/syntaxRangeProvider.js +177 -0
- package/dist/workers/systemverilog.contribution.js +14 -0
- package/dist/workers/systemverilog.js +575 -0
- package/dist/workers/tabFocus.js +29 -0
- package/dist/workers/tableWidget.js +181 -0
- package/dist/workers/taskQueue.js +116 -0
- package/dist/workers/tcl.contribution.js +8 -0
- package/dist/workers/tcl.js +231 -0
- package/dist/workers/telemetry.js +9 -0
- package/dist/workers/ternarySearchTree.js +674 -0
- package/dist/workers/textAreaEditContext.js +720 -0
- package/dist/workers/textAreaEditContextInput.js +588 -0
- package/dist/workers/textAreaEditContextState.js +160 -0
- package/dist/workers/textChange.js +248 -0
- package/dist/workers/textEdit.js +269 -0
- package/dist/workers/textLength.js +87 -0
- package/dist/workers/textModel.js +2031 -0
- package/dist/workers/textModelBracketPairs.js +45 -0
- package/dist/workers/textModelDefaults.js +18 -0
- package/dist/workers/textModelEditSource.js +166 -0
- package/dist/workers/textModelEvents.js +216 -0
- package/dist/workers/textModelGuides.js +40 -0
- package/dist/workers/textModelPart.js +23 -0
- package/dist/workers/textModelSearch.js +455 -0
- package/dist/workers/textModelStringEdit.js +11 -0
- package/dist/workers/textModelSync.impl.js +307 -0
- package/dist/workers/textModelText.js +26 -0
- package/dist/workers/textModelTokens.js +436 -0
- package/dist/workers/textResourceConfiguration.js +6 -0
- package/dist/workers/textToHtmlTokenizer.js +139 -0
- package/dist/workers/textualHighlightProvider.js +78 -0
- package/dist/workers/textureAtlas.js +179 -0
- package/dist/workers/textureAtlasPage.js +110 -0
- package/dist/workers/textureAtlasShelfAllocator.js +129 -0
- package/dist/workers/textureAtlasSlabAllocator.js +346 -0
- package/dist/workers/tfIdf.js +179 -0
- package/dist/workers/themables.js +100 -0
- package/dist/workers/theme.js +110 -0
- package/dist/workers/themeService.js +67 -0
- package/dist/workers/themes.js +242 -0
- package/dist/workers/toggle.js +242 -0
- package/dist/workers/toggleHighContrast.js +35 -0
- package/dist/workers/toggleTabFocusMode.js +42 -0
- package/dist/workers/tokenStore.js +407 -0
- package/dist/workers/tokenWithTextArray.js +73 -0
- package/dist/workers/tokenization.js +29 -0
- package/dist/workers/tokenizationRegistry.js +123 -0
- package/dist/workers/tokenizationTextModelPart.js +275 -0
- package/dist/workers/tokenizer.js +301 -0
- package/dist/workers/tokenizerSyntaxTokenBackend.js +261 -0
- package/dist/workers/toolbar.js +244 -0
- package/dist/workers/touch.js +270 -0
- package/dist/workers/transaction.js +109 -0
- package/dist/workers/transpose.js +65 -0
- package/dist/workers/tree.js +45 -0
- package/dist/workers/treeSitterLibraryService.js +9 -0
- package/dist/workers/treeSitterSyntaxTokenBackend.js +167 -0
- package/dist/workers/treeSitterThemeService.js +9 -0
- package/dist/workers/treeSitterTokenizationImpl.js +713 -0
- package/dist/workers/treeSitterTree.js +395 -0
- package/dist/workers/treeViewsDnd.js +24 -0
- package/dist/workers/treeViewsDndService.js +12 -0
- package/dist/workers/triggerInlineEditCommandsRegistry.js +18 -0
- package/dist/workers/trimTrailingWhitespaceCommand.js +98 -0
- package/dist/workers/trustedTypes.js +29 -0
- package/dist/workers/tsMode.js +212 -0
- package/dist/workers/tsWorker.js +352 -0
- package/dist/workers/twig.contribution.js +9 -0
- package/dist/workers/twig.js +391 -0
- package/dist/workers/types.js +144 -0
- package/dist/workers/typescript.contribution.js +11 -0
- package/dist/workers/typescript.js +408 -0
- package/dist/workers/typescriptServices.js +210154 -0
- package/dist/workers/typescriptServicesMetadata.js +3 -0
- package/dist/workers/typespec.contribution.js +8 -0
- package/dist/workers/typespec.js +126 -0
- package/dist/workers/typingSpeed.js +165 -0
- package/dist/workers/uint.js +24 -0
- package/dist/workers/undoRedo.js +43 -0
- package/dist/workers/undoRedoService.js +1076 -0
- package/dist/workers/unicodeHighlighter.js +673 -0
- package/dist/workers/unicodeTextModelHighlighter.js +188 -0
- package/dist/workers/unusualLineTerminators.js +113 -0
- package/dist/workers/updatableHoverWidget.js +107 -0
- package/dist/workers/uri.js +606 -0
- package/dist/workers/usLayoutResolvedKeybinding.js +175 -0
- package/dist/workers/utils.js +209 -0
- package/dist/workers/utilsCancellation.js +63 -0
- package/dist/workers/uuid.js +53 -0
- package/dist/workers/validation.js +159 -0
- package/dist/workers/vb.contribution.js +8 -0
- package/dist/workers/vb.js +371 -0
- package/dist/workers/verticalScrollbar.js +94 -0
- package/dist/workers/view.js +720 -0
- package/dist/workers/viewContext.js +22 -0
- package/dist/workers/viewController.js +274 -0
- package/dist/workers/viewCursor.js +218 -0
- package/dist/workers/viewCursors.js +339 -0
- package/dist/workers/viewEventHandler.js +186 -0
- package/dist/workers/viewEvents.js +180 -0
- package/dist/workers/viewGpuContext.js +241 -0
- package/dist/workers/viewLayer.js +478 -0
- package/dist/workers/viewLayout.js +368 -0
- package/dist/workers/viewLine.js +544 -0
- package/dist/workers/viewLineOptions.js +43 -0
- package/dist/workers/viewLineRenderer.js +948 -0
- package/dist/workers/viewLines.js +721 -0
- package/dist/workers/viewLinesGpu.js +571 -0
- package/dist/workers/viewLinesViewportData.js +30 -0
- package/dist/workers/viewModel.js +98 -0
- package/dist/workers/viewModelDecoration.js +55 -0
- package/dist/workers/viewModelDecorations.js +132 -0
- package/dist/workers/viewModelEventDispatcher.js +398 -0
- package/dist/workers/viewModelImpl.js +1163 -0
- package/dist/workers/viewModelLines.js +938 -0
- package/dist/workers/viewOverlays.js +204 -0
- package/dist/workers/viewPart.js +49 -0
- package/dist/workers/viewUserInputEvents.js +91 -0
- package/dist/workers/viewZones.js +335 -0
- package/dist/workers/viewportRenderStrategy.js +316 -0
- package/dist/workers/viewportSemanticTokens.js +166 -0
- package/dist/workers/webWorker.js +396 -0
- package/dist/workers/webWorkerBootstrap.js +20 -0
- package/dist/workers/webWorkerFactory.js +171 -0
- package/dist/workers/wgsl.contribution.js +8 -0
- package/dist/workers/wgsl.js +452 -0
- package/dist/workers/whitespace.js +277 -0
- package/dist/workers/widget.js +44 -0
- package/dist/workers/window.js +60 -0
- package/dist/workers/wordCharacterClassifier.js +87 -0
- package/dist/workers/wordContextKey.js +69 -0
- package/dist/workers/wordDistance.js +64 -0
- package/dist/workers/wordHelper.js +127 -0
- package/dist/workers/wordHighlighter.js +796 -0
- package/dist/workers/wordOperations.js +442 -0
- package/dist/workers/wordPartOperations.js +145 -0
- package/dist/workers/wordSelections.js +82 -0
- package/dist/workers/workerManager.js +147 -0
- package/dist/workers/workers.js +141 -0
- package/dist/workers/workspace.js +84 -0
- package/dist/workers/workspaceTrust.js +9 -0
- package/dist/workers/wrapInHotClass.js +41 -0
- package/dist/workers/wrapInReloadableClass.js +35 -0
- package/dist/workers/xml.contribution.js +28 -0
- package/dist/workers/xml.js +160 -0
- package/dist/workers/yaml.contribution.js +9 -0
- package/dist/workers/yaml.js +271 -0
- package/dist/workers/zoneWidget.js +406 -0
- package/package.json +2 -2
- package/dist/assets/css.worker-C7FogG4G.js +0 -93
- package/dist/assets/editor.worker-iXcRX1Tq.js +0 -26
- package/dist/assets/html.worker-C8VxctEJ.js +0 -470
- package/dist/assets/json.worker-CMC9kgPL.js +0 -58
- package/dist/assets/ts.worker-CtTJ3hNN.js +0 -67731
|
@@ -0,0 +1,2027 @@
|
|
|
1
|
+
import { isEditableElement, isKeyboardEvent, hasParentWithClass, append, $, clearNode, addDisposableListener } from '../../dom.js';
|
|
2
|
+
import { createStyleSheet } from '../../domStylesheets.js';
|
|
3
|
+
import { asCssValueWithDefault } from '../../cssValue.js';
|
|
4
|
+
import { Event, EventBufferer, Emitter, Relay } from '../../../common/event.js';
|
|
5
|
+
import { StandardKeyboardEvent } from '../../keyboardEvent.js';
|
|
6
|
+
import '../../browser.js';
|
|
7
|
+
import '../../dnd.js';
|
|
8
|
+
import '../../touch.js';
|
|
9
|
+
import '../hover/hoverDelegateFactory.js';
|
|
10
|
+
import '../../../common/platform.js';
|
|
11
|
+
import { DisposableStore, dispose, Disposable, toDisposable } from '../../../common/lifecycle.js';
|
|
12
|
+
import '../selectBox/selectBox.css';
|
|
13
|
+
import '../selectBox/selectBoxCustom.js';
|
|
14
|
+
import { equals, distinct, range } from '../../../common/arrays.js';
|
|
15
|
+
import '../../../common/actions.js';
|
|
16
|
+
import '../actionbar/actionbar.css';
|
|
17
|
+
import { localize } from '../../../../nls.js';
|
|
18
|
+
import '../findinput/findInput.js';
|
|
19
|
+
import { alert } from '../aria/aria.js';
|
|
20
|
+
import '../scrollbar/scrollableElement.js';
|
|
21
|
+
import '../inputbox/inputBox.css';
|
|
22
|
+
import { ElementsDragAndDropData } from '../list/listView.js';
|
|
23
|
+
import { isStickyScrollContainer, List, MouseController, isButton, isMonacoEditor, isStickyScrollElement, isMonacoCustomToggle, isActionItem } from '../list/listWidget.js';
|
|
24
|
+
import '../toggle/toggle.js';
|
|
25
|
+
import { isFilterResult, getVisibleState } from './indexTreeModel.js';
|
|
26
|
+
import { TreeMouseEventTarget } from './tree.js';
|
|
27
|
+
import { Delayer, disposableTimeout } from '../../../common/async.js';
|
|
28
|
+
import { Codicon } from '../../../common/codicons.js';
|
|
29
|
+
import { ThemeIcon } from '../../../common/themables.js';
|
|
30
|
+
import { SetMap } from '../../../common/map.js';
|
|
31
|
+
import { FuzzyScore, fuzzyScore } from '../../../common/filters.js';
|
|
32
|
+
import { clamp } from '../../../common/numbers.js';
|
|
33
|
+
import './media/tree.css';
|
|
34
|
+
import '../../../common/observableInternal/index.js';
|
|
35
|
+
import { constObservable } from '../../../common/observableInternal/observables/constObservable.js';
|
|
36
|
+
import { autorun } from '../../../common/observableInternal/reactions/autorun.js';
|
|
37
|
+
|
|
38
|
+
/*---------------------------------------------------------------------------------------------
|
|
39
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
40
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
41
|
+
*--------------------------------------------------------------------------------------------*/
|
|
42
|
+
class TreeElementsDragAndDropData extends ElementsDragAndDropData {
|
|
43
|
+
constructor(data) {
|
|
44
|
+
super(data.elements.map(node => node.element));
|
|
45
|
+
this.data = data;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function asTreeDragAndDropData(data) {
|
|
49
|
+
if (data instanceof ElementsDragAndDropData) {
|
|
50
|
+
return new TreeElementsDragAndDropData(data);
|
|
51
|
+
}
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
class TreeNodeListDragAndDrop {
|
|
55
|
+
constructor(modelProvider, dnd) {
|
|
56
|
+
this.modelProvider = modelProvider;
|
|
57
|
+
this.dnd = dnd;
|
|
58
|
+
this.autoExpandDisposable = Disposable.None;
|
|
59
|
+
this.disposables = new DisposableStore();
|
|
60
|
+
}
|
|
61
|
+
getDragURI(node) {
|
|
62
|
+
return this.dnd.getDragURI(node.element);
|
|
63
|
+
}
|
|
64
|
+
getDragLabel(nodes, originalEvent) {
|
|
65
|
+
if (this.dnd.getDragLabel) {
|
|
66
|
+
return this.dnd.getDragLabel(nodes.map(node => node.element), originalEvent);
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
onDragStart(data, originalEvent) {
|
|
71
|
+
this.dnd.onDragStart?.(asTreeDragAndDropData(data), originalEvent);
|
|
72
|
+
}
|
|
73
|
+
onDragOver(data, targetNode, targetIndex, targetSector, originalEvent, raw = true) {
|
|
74
|
+
const result = this.dnd.onDragOver(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent);
|
|
75
|
+
const didChangeAutoExpandNode = this.autoExpandNode !== targetNode;
|
|
76
|
+
if (didChangeAutoExpandNode) {
|
|
77
|
+
this.autoExpandDisposable.dispose();
|
|
78
|
+
this.autoExpandNode = targetNode;
|
|
79
|
+
}
|
|
80
|
+
if (typeof targetNode === 'undefined') {
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
if (didChangeAutoExpandNode && typeof result !== 'boolean' && result.autoExpand) {
|
|
84
|
+
this.autoExpandDisposable = disposableTimeout(() => {
|
|
85
|
+
const model = this.modelProvider();
|
|
86
|
+
const ref = model.getNodeLocation(targetNode);
|
|
87
|
+
if (model.isCollapsed(ref)) {
|
|
88
|
+
model.setCollapsed(ref, false);
|
|
89
|
+
}
|
|
90
|
+
this.autoExpandNode = undefined;
|
|
91
|
+
}, 500, this.disposables);
|
|
92
|
+
}
|
|
93
|
+
if (typeof result === 'boolean' || !result.accept || typeof result.bubble === 'undefined' || result.feedback) {
|
|
94
|
+
if (!raw) {
|
|
95
|
+
const accept = typeof result === 'boolean' ? result : result.accept;
|
|
96
|
+
const effect = typeof result === 'boolean' ? undefined : result.effect;
|
|
97
|
+
return { accept, effect, feedback: [targetIndex] };
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
if (result.bubble === 1 /* TreeDragOverBubble.Up */) {
|
|
102
|
+
const model = this.modelProvider();
|
|
103
|
+
const ref = model.getNodeLocation(targetNode);
|
|
104
|
+
const parentRef = model.getParentNodeLocation(ref);
|
|
105
|
+
const parentNode = model.getNode(parentRef);
|
|
106
|
+
const parentIndex = parentRef && model.getListIndex(parentRef);
|
|
107
|
+
return this.onDragOver(data, parentNode, parentIndex, targetSector, originalEvent, false);
|
|
108
|
+
}
|
|
109
|
+
const model = this.modelProvider();
|
|
110
|
+
const ref = model.getNodeLocation(targetNode);
|
|
111
|
+
const start = model.getListIndex(ref);
|
|
112
|
+
const length = model.getListRenderCount(ref);
|
|
113
|
+
return { ...result, feedback: range(start, start + length) };
|
|
114
|
+
}
|
|
115
|
+
drop(data, targetNode, targetIndex, targetSector, originalEvent) {
|
|
116
|
+
this.autoExpandDisposable.dispose();
|
|
117
|
+
this.autoExpandNode = undefined;
|
|
118
|
+
this.dnd.drop(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent);
|
|
119
|
+
}
|
|
120
|
+
onDragEnd(originalEvent) {
|
|
121
|
+
this.dnd.onDragEnd?.(originalEvent);
|
|
122
|
+
}
|
|
123
|
+
dispose() {
|
|
124
|
+
this.disposables.dispose();
|
|
125
|
+
this.dnd.dispose();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function asListOptions(modelProvider, disposableStore, options) {
|
|
129
|
+
return options && {
|
|
130
|
+
...options,
|
|
131
|
+
identityProvider: options.identityProvider && {
|
|
132
|
+
getId(el) {
|
|
133
|
+
return options.identityProvider.getId(el.element);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
dnd: options.dnd && disposableStore.add(new TreeNodeListDragAndDrop(modelProvider, options.dnd)),
|
|
137
|
+
multipleSelectionController: options.multipleSelectionController && {
|
|
138
|
+
isSelectionSingleChangeEvent(e) {
|
|
139
|
+
// eslint-disable-next-line local/code-no-dangerous-type-assertions
|
|
140
|
+
return options.multipleSelectionController.isSelectionSingleChangeEvent({ ...e, element: e.element });
|
|
141
|
+
},
|
|
142
|
+
isSelectionRangeChangeEvent(e) {
|
|
143
|
+
// eslint-disable-next-line local/code-no-dangerous-type-assertions
|
|
144
|
+
return options.multipleSelectionController.isSelectionRangeChangeEvent({ ...e, element: e.element });
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
accessibilityProvider: options.accessibilityProvider && {
|
|
148
|
+
...options.accessibilityProvider,
|
|
149
|
+
getSetSize(node) {
|
|
150
|
+
const model = modelProvider();
|
|
151
|
+
const ref = model.getNodeLocation(node);
|
|
152
|
+
const parentRef = model.getParentNodeLocation(ref);
|
|
153
|
+
const parentNode = model.getNode(parentRef);
|
|
154
|
+
return parentNode.visibleChildrenCount;
|
|
155
|
+
},
|
|
156
|
+
getPosInSet(node) {
|
|
157
|
+
return node.visibleChildIndex + 1;
|
|
158
|
+
},
|
|
159
|
+
isChecked: options.accessibilityProvider && options.accessibilityProvider.isChecked ? (node) => {
|
|
160
|
+
return options.accessibilityProvider.isChecked(node.element);
|
|
161
|
+
} : undefined,
|
|
162
|
+
getRole: options.accessibilityProvider && options.accessibilityProvider.getRole ? (node) => {
|
|
163
|
+
return options.accessibilityProvider.getRole(node.element);
|
|
164
|
+
} : () => 'treeitem',
|
|
165
|
+
getAriaLabel(e) {
|
|
166
|
+
return options.accessibilityProvider.getAriaLabel(e.element);
|
|
167
|
+
},
|
|
168
|
+
getWidgetAriaLabel() {
|
|
169
|
+
return options.accessibilityProvider.getWidgetAriaLabel();
|
|
170
|
+
},
|
|
171
|
+
getWidgetRole: options.accessibilityProvider && options.accessibilityProvider.getWidgetRole ? () => options.accessibilityProvider.getWidgetRole() : () => 'tree',
|
|
172
|
+
getAriaLevel: options.accessibilityProvider && options.accessibilityProvider.getAriaLevel ? (node) => options.accessibilityProvider.getAriaLevel(node.element) : (node) => {
|
|
173
|
+
return node.depth;
|
|
174
|
+
},
|
|
175
|
+
getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (node => {
|
|
176
|
+
return options.accessibilityProvider.getActiveDescendantId(node.element);
|
|
177
|
+
})
|
|
178
|
+
},
|
|
179
|
+
keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && {
|
|
180
|
+
...options.keyboardNavigationLabelProvider,
|
|
181
|
+
getKeyboardNavigationLabel(node) {
|
|
182
|
+
return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(node.element);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
class ComposedTreeDelegate {
|
|
188
|
+
constructor(delegate) {
|
|
189
|
+
this.delegate = delegate;
|
|
190
|
+
}
|
|
191
|
+
getHeight(element) {
|
|
192
|
+
return this.delegate.getHeight(element.element);
|
|
193
|
+
}
|
|
194
|
+
getTemplateId(element) {
|
|
195
|
+
return this.delegate.getTemplateId(element.element);
|
|
196
|
+
}
|
|
197
|
+
hasDynamicHeight(element) {
|
|
198
|
+
return !!this.delegate.hasDynamicHeight && this.delegate.hasDynamicHeight(element.element);
|
|
199
|
+
}
|
|
200
|
+
setDynamicHeight(element, height) {
|
|
201
|
+
this.delegate.setDynamicHeight?.(element.element, height);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
var RenderIndentGuides;
|
|
205
|
+
(function (RenderIndentGuides) {
|
|
206
|
+
RenderIndentGuides["None"] = "none";
|
|
207
|
+
RenderIndentGuides["OnHover"] = "onHover";
|
|
208
|
+
RenderIndentGuides["Always"] = "always";
|
|
209
|
+
})(RenderIndentGuides || (RenderIndentGuides = {}));
|
|
210
|
+
class EventCollection {
|
|
211
|
+
get elements() {
|
|
212
|
+
return this._elements;
|
|
213
|
+
}
|
|
214
|
+
constructor(onDidChange, _elements = []) {
|
|
215
|
+
this._elements = _elements;
|
|
216
|
+
this.disposables = new DisposableStore();
|
|
217
|
+
this.onDidChange = Event.forEach(onDidChange, elements => this._elements = elements, this.disposables);
|
|
218
|
+
}
|
|
219
|
+
dispose() {
|
|
220
|
+
this.disposables.dispose();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
class TreeRenderer {
|
|
224
|
+
static { this.DefaultIndent = 8; }
|
|
225
|
+
constructor(renderer, model, onDidChangeCollapseState, activeNodes, renderedIndentGuides, options = {}) {
|
|
226
|
+
this.renderer = renderer;
|
|
227
|
+
this.model = model;
|
|
228
|
+
this.activeNodes = activeNodes;
|
|
229
|
+
this.renderedIndentGuides = renderedIndentGuides;
|
|
230
|
+
this.renderedElements = new Map();
|
|
231
|
+
this.renderedNodes = new Map();
|
|
232
|
+
this.indent = TreeRenderer.DefaultIndent;
|
|
233
|
+
this.hideTwistiesOfChildlessElements = false;
|
|
234
|
+
this.shouldRenderIndentGuides = false;
|
|
235
|
+
this.activeIndentNodes = new Set();
|
|
236
|
+
this.indentGuidesDisposable = Disposable.None;
|
|
237
|
+
this.disposables = new DisposableStore();
|
|
238
|
+
this.templateId = renderer.templateId;
|
|
239
|
+
this.updateOptions(options);
|
|
240
|
+
Event.map(onDidChangeCollapseState, e => e.node)(this.onDidChangeNodeTwistieState, this, this.disposables);
|
|
241
|
+
renderer.onDidChangeTwistieState?.(this.onDidChangeTwistieState, this, this.disposables);
|
|
242
|
+
}
|
|
243
|
+
updateOptions(options = {}) {
|
|
244
|
+
if (typeof options.indent !== 'undefined') {
|
|
245
|
+
const indent = clamp(options.indent, 0, 40);
|
|
246
|
+
if (indent !== this.indent) {
|
|
247
|
+
this.indent = indent;
|
|
248
|
+
for (const [node, templateData] of this.renderedNodes) {
|
|
249
|
+
templateData.indentSize = TreeRenderer.DefaultIndent + (node.depth - 1) * this.indent;
|
|
250
|
+
this.renderTreeElement(node, templateData);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (typeof options.renderIndentGuides !== 'undefined') {
|
|
255
|
+
const shouldRenderIndentGuides = options.renderIndentGuides !== RenderIndentGuides.None;
|
|
256
|
+
if (shouldRenderIndentGuides !== this.shouldRenderIndentGuides) {
|
|
257
|
+
this.shouldRenderIndentGuides = shouldRenderIndentGuides;
|
|
258
|
+
for (const [node, templateData] of this.renderedNodes) {
|
|
259
|
+
this._renderIndentGuides(node, templateData);
|
|
260
|
+
}
|
|
261
|
+
this.indentGuidesDisposable.dispose();
|
|
262
|
+
if (shouldRenderIndentGuides) {
|
|
263
|
+
const disposables = new DisposableStore();
|
|
264
|
+
this.activeNodes.onDidChange(this._onDidChangeActiveNodes, this, disposables);
|
|
265
|
+
this.indentGuidesDisposable = disposables;
|
|
266
|
+
this._onDidChangeActiveNodes(this.activeNodes.elements);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (typeof options.hideTwistiesOfChildlessElements !== 'undefined') {
|
|
271
|
+
this.hideTwistiesOfChildlessElements = options.hideTwistiesOfChildlessElements;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
renderTemplate(container) {
|
|
275
|
+
const el = append(container, $('.monaco-tl-row'));
|
|
276
|
+
const indent = append(el, $('.monaco-tl-indent'));
|
|
277
|
+
const twistie = append(el, $('.monaco-tl-twistie'));
|
|
278
|
+
const contents = append(el, $('.monaco-tl-contents'));
|
|
279
|
+
const templateData = this.renderer.renderTemplate(contents);
|
|
280
|
+
return { container, indent, twistie, indentGuidesDisposable: Disposable.None, indentSize: 0, templateData };
|
|
281
|
+
}
|
|
282
|
+
renderElement(node, index, templateData, details) {
|
|
283
|
+
templateData.indentSize = TreeRenderer.DefaultIndent + (node.depth - 1) * this.indent;
|
|
284
|
+
this.renderedNodes.set(node, templateData);
|
|
285
|
+
this.renderedElements.set(node.element, node);
|
|
286
|
+
this.renderTreeElement(node, templateData);
|
|
287
|
+
this.renderer.renderElement(node, index, templateData.templateData, { ...details, indent: templateData.indentSize });
|
|
288
|
+
}
|
|
289
|
+
disposeElement(node, index, templateData, details) {
|
|
290
|
+
templateData.indentGuidesDisposable.dispose();
|
|
291
|
+
this.renderer.disposeElement?.(node, index, templateData.templateData, { ...details, indent: templateData.indentSize });
|
|
292
|
+
if (typeof details?.height === 'number') {
|
|
293
|
+
this.renderedNodes.delete(node);
|
|
294
|
+
this.renderedElements.delete(node.element);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
disposeTemplate(templateData) {
|
|
298
|
+
this.renderer.disposeTemplate(templateData.templateData);
|
|
299
|
+
}
|
|
300
|
+
onDidChangeTwistieState(element) {
|
|
301
|
+
const node = this.renderedElements.get(element);
|
|
302
|
+
if (!node) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
this.onDidChangeNodeTwistieState(node);
|
|
306
|
+
}
|
|
307
|
+
onDidChangeNodeTwistieState(node) {
|
|
308
|
+
const templateData = this.renderedNodes.get(node);
|
|
309
|
+
if (!templateData) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this._onDidChangeActiveNodes(this.activeNodes.elements);
|
|
313
|
+
this.renderTreeElement(node, templateData);
|
|
314
|
+
}
|
|
315
|
+
renderTreeElement(node, templateData) {
|
|
316
|
+
templateData.twistie.style.paddingLeft = `${templateData.indentSize}px`;
|
|
317
|
+
templateData.indent.style.width = `${templateData.indentSize + this.indent - 16}px`;
|
|
318
|
+
if (node.collapsible) {
|
|
319
|
+
templateData.container.setAttribute('aria-expanded', String(!node.collapsed));
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
templateData.container.removeAttribute('aria-expanded');
|
|
323
|
+
}
|
|
324
|
+
templateData.twistie.classList.remove(...ThemeIcon.asClassNameArray(Codicon.treeItemExpanded));
|
|
325
|
+
let twistieRendered = false;
|
|
326
|
+
if (this.renderer.renderTwistie) {
|
|
327
|
+
twistieRendered = this.renderer.renderTwistie(node.element, templateData.twistie);
|
|
328
|
+
}
|
|
329
|
+
if (node.collapsible && (!this.hideTwistiesOfChildlessElements || node.visibleChildrenCount > 0)) {
|
|
330
|
+
if (!twistieRendered) {
|
|
331
|
+
templateData.twistie.classList.add(...ThemeIcon.asClassNameArray(Codicon.treeItemExpanded));
|
|
332
|
+
}
|
|
333
|
+
templateData.twistie.classList.add('collapsible');
|
|
334
|
+
templateData.twistie.classList.toggle('collapsed', node.collapsed);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
templateData.twistie.classList.remove('collapsible', 'collapsed');
|
|
338
|
+
}
|
|
339
|
+
this._renderIndentGuides(node, templateData);
|
|
340
|
+
}
|
|
341
|
+
_renderIndentGuides(node, templateData) {
|
|
342
|
+
clearNode(templateData.indent);
|
|
343
|
+
templateData.indentGuidesDisposable.dispose();
|
|
344
|
+
if (!this.shouldRenderIndentGuides) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const disposableStore = new DisposableStore();
|
|
348
|
+
while (true) {
|
|
349
|
+
const ref = this.model.getNodeLocation(node);
|
|
350
|
+
const parentRef = this.model.getParentNodeLocation(ref);
|
|
351
|
+
if (!parentRef) {
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
const parent = this.model.getNode(parentRef);
|
|
355
|
+
const guide = $('.indent-guide', { style: `width: ${this.indent}px` });
|
|
356
|
+
if (this.activeIndentNodes.has(parent)) {
|
|
357
|
+
guide.classList.add('active');
|
|
358
|
+
}
|
|
359
|
+
if (templateData.indent.childElementCount === 0) {
|
|
360
|
+
templateData.indent.appendChild(guide);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
templateData.indent.insertBefore(guide, templateData.indent.firstElementChild);
|
|
364
|
+
}
|
|
365
|
+
this.renderedIndentGuides.add(parent, guide);
|
|
366
|
+
disposableStore.add(toDisposable(() => this.renderedIndentGuides.delete(parent, guide)));
|
|
367
|
+
node = parent;
|
|
368
|
+
}
|
|
369
|
+
templateData.indentGuidesDisposable = disposableStore;
|
|
370
|
+
}
|
|
371
|
+
_onDidChangeActiveNodes(nodes) {
|
|
372
|
+
if (!this.shouldRenderIndentGuides) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
const set = new Set();
|
|
376
|
+
nodes.forEach(node => {
|
|
377
|
+
const ref = this.model.getNodeLocation(node);
|
|
378
|
+
try {
|
|
379
|
+
const parentRef = this.model.getParentNodeLocation(ref);
|
|
380
|
+
if (node.collapsible && node.children.length > 0 && !node.collapsed) {
|
|
381
|
+
set.add(node);
|
|
382
|
+
}
|
|
383
|
+
else if (parentRef) {
|
|
384
|
+
set.add(this.model.getNode(parentRef));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
catch {
|
|
388
|
+
// noop
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
this.activeIndentNodes.forEach(node => {
|
|
392
|
+
if (!set.has(node)) {
|
|
393
|
+
this.renderedIndentGuides.forEach(node, line => line.classList.remove('active'));
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
set.forEach(node => {
|
|
397
|
+
if (!this.activeIndentNodes.has(node)) {
|
|
398
|
+
this.renderedIndentGuides.forEach(node, line => line.classList.add('active'));
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
this.activeIndentNodes = set;
|
|
402
|
+
}
|
|
403
|
+
dispose() {
|
|
404
|
+
this.renderedNodes.clear();
|
|
405
|
+
this.renderedElements.clear();
|
|
406
|
+
this.indentGuidesDisposable.dispose();
|
|
407
|
+
dispose(this.disposables);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function contiguousFuzzyScore(patternLower, wordLower) {
|
|
411
|
+
const index = wordLower.toLowerCase().indexOf(patternLower);
|
|
412
|
+
let score;
|
|
413
|
+
if (index > -1) {
|
|
414
|
+
score = [Number.MAX_SAFE_INTEGER, 0];
|
|
415
|
+
for (let i = patternLower.length; i > 0; i--) {
|
|
416
|
+
score.push(index + i - 1);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return score;
|
|
420
|
+
}
|
|
421
|
+
class FindFilter {
|
|
422
|
+
get totalCount() { return this._totalCount; }
|
|
423
|
+
get matchCount() { return this._matchCount; }
|
|
424
|
+
set findMatchType(type) { this._findMatchType = type; }
|
|
425
|
+
get findMatchType() { return this._findMatchType; }
|
|
426
|
+
set findMode(mode) { this._findMode = mode; }
|
|
427
|
+
get findMode() { return this._findMode; }
|
|
428
|
+
constructor(_keyboardNavigationLabelProvider, _filter, _defaultFindVisibility) {
|
|
429
|
+
this._keyboardNavigationLabelProvider = _keyboardNavigationLabelProvider;
|
|
430
|
+
this._filter = _filter;
|
|
431
|
+
this._defaultFindVisibility = _defaultFindVisibility;
|
|
432
|
+
this._totalCount = 0;
|
|
433
|
+
this._matchCount = 0;
|
|
434
|
+
this._findMatchType = TreeFindMatchType.Fuzzy;
|
|
435
|
+
this._findMode = TreeFindMode.Highlight;
|
|
436
|
+
this._pattern = '';
|
|
437
|
+
this._lowercasePattern = '';
|
|
438
|
+
this.disposables = new DisposableStore();
|
|
439
|
+
}
|
|
440
|
+
filter(element, parentVisibility) {
|
|
441
|
+
let visibility = 1 /* TreeVisibility.Visible */;
|
|
442
|
+
if (this._filter) {
|
|
443
|
+
const result = this._filter.filter(element, parentVisibility);
|
|
444
|
+
if (typeof result === 'boolean') {
|
|
445
|
+
visibility = result ? 1 /* TreeVisibility.Visible */ : 0 /* TreeVisibility.Hidden */;
|
|
446
|
+
}
|
|
447
|
+
else if (isFilterResult(result)) {
|
|
448
|
+
visibility = getVisibleState(result.visibility);
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
visibility = result;
|
|
452
|
+
}
|
|
453
|
+
if (visibility === 0 /* TreeVisibility.Hidden */) {
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
this._totalCount++;
|
|
458
|
+
if (!this._pattern) {
|
|
459
|
+
this._matchCount++;
|
|
460
|
+
return { data: FuzzyScore.Default, visibility };
|
|
461
|
+
}
|
|
462
|
+
const label = this._keyboardNavigationLabelProvider.getKeyboardNavigationLabel(element);
|
|
463
|
+
const labels = Array.isArray(label) ? label : [label];
|
|
464
|
+
for (const l of labels) {
|
|
465
|
+
const labelStr = l && l.toString();
|
|
466
|
+
if (typeof labelStr === 'undefined') {
|
|
467
|
+
return { data: FuzzyScore.Default, visibility };
|
|
468
|
+
}
|
|
469
|
+
let score;
|
|
470
|
+
if (this._findMatchType === TreeFindMatchType.Contiguous) {
|
|
471
|
+
score = contiguousFuzzyScore(this._lowercasePattern, labelStr.toLowerCase());
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
score = fuzzyScore(this._pattern, this._lowercasePattern, 0, labelStr, labelStr.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true });
|
|
475
|
+
}
|
|
476
|
+
if (score) {
|
|
477
|
+
this._matchCount++;
|
|
478
|
+
return labels.length === 1 ?
|
|
479
|
+
{ data: score, visibility } :
|
|
480
|
+
{ data: { label: labelStr, score: score }, visibility };
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (this._findMode === TreeFindMode.Filter) {
|
|
484
|
+
if (typeof this._defaultFindVisibility === 'number') {
|
|
485
|
+
return this._defaultFindVisibility;
|
|
486
|
+
}
|
|
487
|
+
else if (this._defaultFindVisibility) {
|
|
488
|
+
return this._defaultFindVisibility(element);
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
return 2 /* TreeVisibility.Recurse */;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
return { data: FuzzyScore.Default, visibility };
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
reset() {
|
|
499
|
+
this._totalCount = 0;
|
|
500
|
+
this._matchCount = 0;
|
|
501
|
+
}
|
|
502
|
+
dispose() {
|
|
503
|
+
dispose(this.disposables);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
class FindToggles {
|
|
507
|
+
constructor(startStates) {
|
|
508
|
+
this.stateMap = new Map(startStates.map(state => [state.id, { ...state }]));
|
|
509
|
+
}
|
|
510
|
+
get(id) {
|
|
511
|
+
const state = this.stateMap.get(id);
|
|
512
|
+
if (state === undefined) {
|
|
513
|
+
throw new Error(`No state found for toggle id ${id}`);
|
|
514
|
+
}
|
|
515
|
+
return state.isChecked;
|
|
516
|
+
}
|
|
517
|
+
set(id, value) {
|
|
518
|
+
const state = this.stateMap.get(id);
|
|
519
|
+
if (state === undefined) {
|
|
520
|
+
throw new Error(`No state found for toggle id ${id}`);
|
|
521
|
+
}
|
|
522
|
+
if (state.isChecked === value) {
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
state.isChecked = value;
|
|
526
|
+
return true;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
var TreeFindMode;
|
|
530
|
+
(function (TreeFindMode) {
|
|
531
|
+
TreeFindMode[TreeFindMode["Highlight"] = 0] = "Highlight";
|
|
532
|
+
TreeFindMode[TreeFindMode["Filter"] = 1] = "Filter";
|
|
533
|
+
})(TreeFindMode || (TreeFindMode = {}));
|
|
534
|
+
var TreeFindMatchType;
|
|
535
|
+
(function (TreeFindMatchType) {
|
|
536
|
+
TreeFindMatchType[TreeFindMatchType["Fuzzy"] = 0] = "Fuzzy";
|
|
537
|
+
TreeFindMatchType[TreeFindMatchType["Contiguous"] = 1] = "Contiguous";
|
|
538
|
+
})(TreeFindMatchType || (TreeFindMatchType = {}));
|
|
539
|
+
var DefaultTreeToggles;
|
|
540
|
+
(function (DefaultTreeToggles) {
|
|
541
|
+
DefaultTreeToggles["Mode"] = "mode";
|
|
542
|
+
DefaultTreeToggles["MatchType"] = "matchType";
|
|
543
|
+
})(DefaultTreeToggles || (DefaultTreeToggles = {}));
|
|
544
|
+
class AbstractFindController {
|
|
545
|
+
get pattern() { return this._pattern; }
|
|
546
|
+
get placeholder() { return this._placeholder; }
|
|
547
|
+
set placeholder(value) {
|
|
548
|
+
this._placeholder = value;
|
|
549
|
+
this.widget?.setPlaceHolder(value);
|
|
550
|
+
}
|
|
551
|
+
constructor(tree, filter, contextViewProvider, options = {}) {
|
|
552
|
+
this.tree = tree;
|
|
553
|
+
this.filter = filter;
|
|
554
|
+
this.contextViewProvider = contextViewProvider;
|
|
555
|
+
this.options = options;
|
|
556
|
+
this._pattern = '';
|
|
557
|
+
this._onDidChangePattern = new Emitter();
|
|
558
|
+
this._onDidChangeOpenState = new Emitter();
|
|
559
|
+
this.onDidChangeOpenState = this._onDidChangeOpenState.event;
|
|
560
|
+
this.enabledDisposables = new DisposableStore();
|
|
561
|
+
this.disposables = new DisposableStore();
|
|
562
|
+
this.toggles = new FindToggles(options.toggles ?? []);
|
|
563
|
+
this._placeholder = options.placeholder ?? localize(20, "Type to search");
|
|
564
|
+
}
|
|
565
|
+
isOpened() {
|
|
566
|
+
return !!this.widget;
|
|
567
|
+
}
|
|
568
|
+
updateToggleState(id, checked) {
|
|
569
|
+
this.toggles.set(id, checked);
|
|
570
|
+
this.widget?.setToggleState(id, checked);
|
|
571
|
+
}
|
|
572
|
+
renderMessage(showNotFound, warningMessage) {
|
|
573
|
+
if (showNotFound) {
|
|
574
|
+
if (this.tree.options.showNotFoundMessage ?? true) {
|
|
575
|
+
this.widget?.showMessage({ type: 2 /* MessageType.WARNING */, content: warningMessage ?? localize(21, "No results found.") });
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
this.widget?.showMessage({ type: 2 /* MessageType.WARNING */ });
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
this.widget?.clearMessage();
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
alertResults(results) {
|
|
586
|
+
if (!results) {
|
|
587
|
+
alert(localize(22, "No results"));
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
alert(localize(23, "{0} results", results));
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
dispose() {
|
|
594
|
+
this._history = undefined;
|
|
595
|
+
this._onDidChangePattern.dispose();
|
|
596
|
+
this.enabledDisposables.dispose();
|
|
597
|
+
this.disposables.dispose();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
class FindController extends AbstractFindController {
|
|
601
|
+
get mode() { return this.toggles.get(DefaultTreeToggles.Mode) ? TreeFindMode.Filter : TreeFindMode.Highlight; }
|
|
602
|
+
set mode(mode) {
|
|
603
|
+
if (mode === this.mode) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
const isFilterMode = mode === TreeFindMode.Filter;
|
|
607
|
+
this.updateToggleState(DefaultTreeToggles.Mode, isFilterMode);
|
|
608
|
+
this.placeholder = isFilterMode ? localize(24, "Type to filter") : localize(25, "Type to search");
|
|
609
|
+
this.filter.findMode = mode;
|
|
610
|
+
this.tree.refilter();
|
|
611
|
+
this.render();
|
|
612
|
+
this._onDidChangeMode.fire(mode);
|
|
613
|
+
}
|
|
614
|
+
get matchType() { return this.toggles.get(DefaultTreeToggles.MatchType) ? TreeFindMatchType.Fuzzy : TreeFindMatchType.Contiguous; }
|
|
615
|
+
set matchType(matchType) {
|
|
616
|
+
if (matchType === this.matchType) {
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
this.updateToggleState(DefaultTreeToggles.MatchType, matchType === TreeFindMatchType.Fuzzy);
|
|
620
|
+
this.filter.findMatchType = matchType;
|
|
621
|
+
this.tree.refilter();
|
|
622
|
+
this.render();
|
|
623
|
+
this._onDidChangeMatchType.fire(matchType);
|
|
624
|
+
}
|
|
625
|
+
constructor(tree, filter, contextViewProvider, options = {}) {
|
|
626
|
+
const defaultFindMode = options.defaultFindMode ?? TreeFindMode.Highlight;
|
|
627
|
+
const defaultFindMatchType = options.defaultFindMatchType ?? TreeFindMatchType.Fuzzy;
|
|
628
|
+
const toggleContributions = [{
|
|
629
|
+
id: DefaultTreeToggles.Mode,
|
|
630
|
+
icon: Codicon.listFilter,
|
|
631
|
+
title: localize(26, "Filter"),
|
|
632
|
+
isChecked: defaultFindMode === TreeFindMode.Filter,
|
|
633
|
+
}, {
|
|
634
|
+
id: DefaultTreeToggles.MatchType,
|
|
635
|
+
icon: Codicon.searchFuzzy,
|
|
636
|
+
title: localize(27, "Fuzzy Match"),
|
|
637
|
+
isChecked: defaultFindMatchType === TreeFindMatchType.Fuzzy,
|
|
638
|
+
}];
|
|
639
|
+
filter.findMatchType = defaultFindMatchType;
|
|
640
|
+
filter.findMode = defaultFindMode;
|
|
641
|
+
super(tree, filter, contextViewProvider, { ...options, toggles: toggleContributions });
|
|
642
|
+
this.filter = filter;
|
|
643
|
+
this._onDidChangeMode = new Emitter();
|
|
644
|
+
this.onDidChangeMode = this._onDidChangeMode.event;
|
|
645
|
+
this._onDidChangeMatchType = new Emitter();
|
|
646
|
+
this.onDidChangeMatchType = this._onDidChangeMatchType.event;
|
|
647
|
+
this.disposables.add(this.tree.onDidChangeModel(() => {
|
|
648
|
+
if (!this.isOpened()) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
if (this.pattern.length !== 0) {
|
|
652
|
+
this.tree.refilter();
|
|
653
|
+
}
|
|
654
|
+
this.render();
|
|
655
|
+
}));
|
|
656
|
+
this.disposables.add(this.tree.onWillRefilter(() => this.filter.reset()));
|
|
657
|
+
}
|
|
658
|
+
updateOptions(optionsUpdate = {}) {
|
|
659
|
+
if (optionsUpdate.defaultFindMode !== undefined) {
|
|
660
|
+
this.mode = optionsUpdate.defaultFindMode;
|
|
661
|
+
}
|
|
662
|
+
if (optionsUpdate.defaultFindMatchType !== undefined) {
|
|
663
|
+
this.matchType = optionsUpdate.defaultFindMatchType;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
shouldAllowFocus(node) {
|
|
667
|
+
if (!this.isOpened() || !this.pattern) {
|
|
668
|
+
return true;
|
|
669
|
+
}
|
|
670
|
+
if (this.filter.totalCount > 0 && this.filter.matchCount <= 1) {
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
return !FuzzyScore.isDefault(node.filterData);
|
|
674
|
+
}
|
|
675
|
+
render() {
|
|
676
|
+
const noMatches = this.filter.matchCount === 0 && this.filter.totalCount > 0;
|
|
677
|
+
const showNotFound = noMatches && this.pattern.length > 0;
|
|
678
|
+
this.renderMessage(showNotFound);
|
|
679
|
+
if (this.pattern.length) {
|
|
680
|
+
this.alertResults(this.filter.matchCount);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
function stickyScrollNodeStateEquals(node1, node2) {
|
|
685
|
+
return node1.position === node2.position && stickyScrollNodeEquals(node1, node2);
|
|
686
|
+
}
|
|
687
|
+
function stickyScrollNodeEquals(node1, node2) {
|
|
688
|
+
return node1.node.element === node2.node.element &&
|
|
689
|
+
node1.startIndex === node2.startIndex &&
|
|
690
|
+
node1.height === node2.height &&
|
|
691
|
+
node1.endIndex === node2.endIndex;
|
|
692
|
+
}
|
|
693
|
+
class StickyScrollState {
|
|
694
|
+
constructor(stickyNodes = []) {
|
|
695
|
+
this.stickyNodes = stickyNodes;
|
|
696
|
+
}
|
|
697
|
+
get count() { return this.stickyNodes.length; }
|
|
698
|
+
equal(state) {
|
|
699
|
+
return equals(this.stickyNodes, state.stickyNodes, stickyScrollNodeStateEquals);
|
|
700
|
+
}
|
|
701
|
+
contains(element) {
|
|
702
|
+
return this.stickyNodes.some(node => node.node.element === element.element);
|
|
703
|
+
}
|
|
704
|
+
lastNodePartiallyVisible() {
|
|
705
|
+
if (this.count === 0) {
|
|
706
|
+
return false;
|
|
707
|
+
}
|
|
708
|
+
const lastStickyNode = this.stickyNodes[this.count - 1];
|
|
709
|
+
if (this.count === 1) {
|
|
710
|
+
return lastStickyNode.position !== 0;
|
|
711
|
+
}
|
|
712
|
+
const secondLastStickyNode = this.stickyNodes[this.count - 2];
|
|
713
|
+
return secondLastStickyNode.position + secondLastStickyNode.height !== lastStickyNode.position;
|
|
714
|
+
}
|
|
715
|
+
animationStateChanged(previousState) {
|
|
716
|
+
if (!equals(this.stickyNodes, previousState.stickyNodes, stickyScrollNodeEquals)) {
|
|
717
|
+
return false;
|
|
718
|
+
}
|
|
719
|
+
if (this.count === 0) {
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
const lastStickyNode = this.stickyNodes[this.count - 1];
|
|
723
|
+
const previousLastStickyNode = previousState.stickyNodes[previousState.count - 1];
|
|
724
|
+
return lastStickyNode.position !== previousLastStickyNode.position;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
class DefaultStickyScrollDelegate {
|
|
728
|
+
constrainStickyScrollNodes(stickyNodes, stickyScrollMaxItemCount, maxWidgetHeight) {
|
|
729
|
+
for (let i = 0; i < stickyNodes.length; i++) {
|
|
730
|
+
const stickyNode = stickyNodes[i];
|
|
731
|
+
const stickyNodeBottom = stickyNode.position + stickyNode.height;
|
|
732
|
+
if (stickyNodeBottom > maxWidgetHeight || i >= stickyScrollMaxItemCount) {
|
|
733
|
+
return stickyNodes.slice(0, i);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return stickyNodes;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
class StickyScrollController extends Disposable {
|
|
740
|
+
constructor(tree, model, view, renderers, treeDelegate, options = {}) {
|
|
741
|
+
super();
|
|
742
|
+
this.tree = tree;
|
|
743
|
+
this.model = model;
|
|
744
|
+
this.view = view;
|
|
745
|
+
this.treeDelegate = treeDelegate;
|
|
746
|
+
this.maxWidgetViewRatio = 0.4;
|
|
747
|
+
const stickyScrollOptions = this.validateStickySettings(options);
|
|
748
|
+
this.stickyScrollMaxItemCount = stickyScrollOptions.stickyScrollMaxItemCount;
|
|
749
|
+
this.stickyScrollDelegate = options.stickyScrollDelegate ?? new DefaultStickyScrollDelegate();
|
|
750
|
+
this.paddingTop = options.paddingTop ?? 0;
|
|
751
|
+
this._widget = this._register(new StickyScrollWidget(view.getScrollableElement(), view, tree, renderers, treeDelegate, options.accessibilityProvider));
|
|
752
|
+
this.onDidChangeHasFocus = this._widget.onDidChangeHasFocus;
|
|
753
|
+
this.onContextMenu = this._widget.onContextMenu;
|
|
754
|
+
this._register(view.onDidScroll(() => this.update()));
|
|
755
|
+
this._register(view.onDidChangeContentHeight(() => this.update()));
|
|
756
|
+
this._register(tree.onDidChangeCollapseState(() => this.update()));
|
|
757
|
+
this._register(model.onDidSpliceRenderedNodes((e) => {
|
|
758
|
+
const state = this._widget.state;
|
|
759
|
+
if (!state) {
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
// If a sticky node is removed, recompute the state
|
|
763
|
+
const hasRemovedStickyNode = e.deleteCount > 0 && state.stickyNodes.some(stickyNode => !this.model.has(this.model.getNodeLocation(stickyNode.node)));
|
|
764
|
+
if (hasRemovedStickyNode) {
|
|
765
|
+
this.update();
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
// If a sticky node is updated, rerender the widget
|
|
769
|
+
const shouldRerenderStickyNodes = state.stickyNodes.some(stickyNode => {
|
|
770
|
+
const listIndex = this.model.getListIndex(this.model.getNodeLocation(stickyNode.node));
|
|
771
|
+
return listIndex >= e.start && listIndex < e.start + e.deleteCount && state.contains(stickyNode.node);
|
|
772
|
+
});
|
|
773
|
+
if (shouldRerenderStickyNodes) {
|
|
774
|
+
this._widget.rerender();
|
|
775
|
+
}
|
|
776
|
+
}));
|
|
777
|
+
this.update();
|
|
778
|
+
}
|
|
779
|
+
get height() {
|
|
780
|
+
return this._widget.height;
|
|
781
|
+
}
|
|
782
|
+
getNodeAtHeight(height) {
|
|
783
|
+
let index;
|
|
784
|
+
if (height === 0) {
|
|
785
|
+
index = this.view.firstVisibleIndex;
|
|
786
|
+
}
|
|
787
|
+
else {
|
|
788
|
+
index = this.view.indexAt(height + this.view.scrollTop);
|
|
789
|
+
}
|
|
790
|
+
if (index < 0 || index >= this.view.length) {
|
|
791
|
+
return undefined;
|
|
792
|
+
}
|
|
793
|
+
return this.view.element(index);
|
|
794
|
+
}
|
|
795
|
+
update() {
|
|
796
|
+
const firstVisibleNode = this.getNodeAtHeight(this.paddingTop);
|
|
797
|
+
// Don't render anything if there are no elements
|
|
798
|
+
if (!firstVisibleNode || this.tree.scrollTop <= this.paddingTop) {
|
|
799
|
+
this._widget.setState(undefined);
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
const stickyState = this.findStickyState(firstVisibleNode);
|
|
803
|
+
this._widget.setState(stickyState);
|
|
804
|
+
}
|
|
805
|
+
findStickyState(firstVisibleNode) {
|
|
806
|
+
const stickyNodes = [];
|
|
807
|
+
let firstVisibleNodeUnderWidget = firstVisibleNode;
|
|
808
|
+
let stickyNodesHeight = 0;
|
|
809
|
+
let nextStickyNode = this.getNextStickyNode(firstVisibleNodeUnderWidget, undefined, stickyNodesHeight);
|
|
810
|
+
while (nextStickyNode) {
|
|
811
|
+
stickyNodes.push(nextStickyNode);
|
|
812
|
+
stickyNodesHeight += nextStickyNode.height;
|
|
813
|
+
if (stickyNodes.length <= this.stickyScrollMaxItemCount) {
|
|
814
|
+
firstVisibleNodeUnderWidget = this.getNextVisibleNode(nextStickyNode);
|
|
815
|
+
if (!firstVisibleNodeUnderWidget) {
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
nextStickyNode = this.getNextStickyNode(firstVisibleNodeUnderWidget, nextStickyNode.node, stickyNodesHeight);
|
|
820
|
+
}
|
|
821
|
+
const contrainedStickyNodes = this.constrainStickyNodes(stickyNodes);
|
|
822
|
+
return contrainedStickyNodes.length ? new StickyScrollState(contrainedStickyNodes) : undefined;
|
|
823
|
+
}
|
|
824
|
+
getNextVisibleNode(previousStickyNode) {
|
|
825
|
+
return this.getNodeAtHeight(previousStickyNode.position + previousStickyNode.height);
|
|
826
|
+
}
|
|
827
|
+
getNextStickyNode(firstVisibleNodeUnderWidget, previousStickyNode, stickyNodesHeight) {
|
|
828
|
+
const nextStickyNode = this.getAncestorUnderPrevious(firstVisibleNodeUnderWidget, previousStickyNode);
|
|
829
|
+
if (!nextStickyNode) {
|
|
830
|
+
return undefined;
|
|
831
|
+
}
|
|
832
|
+
if (nextStickyNode === firstVisibleNodeUnderWidget) {
|
|
833
|
+
if (!this.nodeIsUncollapsedParent(firstVisibleNodeUnderWidget)) {
|
|
834
|
+
return undefined;
|
|
835
|
+
}
|
|
836
|
+
if (this.nodeTopAlignsWithStickyNodesBottom(firstVisibleNodeUnderWidget, stickyNodesHeight)) {
|
|
837
|
+
return undefined;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return this.createStickyScrollNode(nextStickyNode, stickyNodesHeight);
|
|
841
|
+
}
|
|
842
|
+
nodeTopAlignsWithStickyNodesBottom(node, stickyNodesHeight) {
|
|
843
|
+
const nodeIndex = this.getNodeIndex(node);
|
|
844
|
+
const elementTop = this.view.getElementTop(nodeIndex);
|
|
845
|
+
const stickyPosition = stickyNodesHeight;
|
|
846
|
+
return this.view.scrollTop === elementTop - stickyPosition;
|
|
847
|
+
}
|
|
848
|
+
createStickyScrollNode(node, currentStickyNodesHeight) {
|
|
849
|
+
const height = this.treeDelegate.getHeight(node);
|
|
850
|
+
const { startIndex, endIndex } = this.getNodeRange(node);
|
|
851
|
+
const position = this.calculateStickyNodePosition(endIndex, currentStickyNodesHeight, height);
|
|
852
|
+
return { node, position, height, startIndex, endIndex };
|
|
853
|
+
}
|
|
854
|
+
getAncestorUnderPrevious(node, previousAncestor = undefined) {
|
|
855
|
+
let currentAncestor = node;
|
|
856
|
+
let parentOfcurrentAncestor = this.getParentNode(currentAncestor);
|
|
857
|
+
while (parentOfcurrentAncestor) {
|
|
858
|
+
if (parentOfcurrentAncestor === previousAncestor) {
|
|
859
|
+
return currentAncestor;
|
|
860
|
+
}
|
|
861
|
+
currentAncestor = parentOfcurrentAncestor;
|
|
862
|
+
parentOfcurrentAncestor = this.getParentNode(currentAncestor);
|
|
863
|
+
}
|
|
864
|
+
if (previousAncestor === undefined) {
|
|
865
|
+
return currentAncestor;
|
|
866
|
+
}
|
|
867
|
+
return undefined;
|
|
868
|
+
}
|
|
869
|
+
calculateStickyNodePosition(lastDescendantIndex, stickyRowPositionTop, stickyNodeHeight) {
|
|
870
|
+
let lastChildRelativeTop = this.view.getRelativeTop(lastDescendantIndex);
|
|
871
|
+
// If the last descendant is only partially visible at the top of the view, getRelativeTop() returns null
|
|
872
|
+
// In that case, utilize the next node's relative top to calculate the sticky node's position
|
|
873
|
+
if (lastChildRelativeTop === null && this.view.firstVisibleIndex === lastDescendantIndex && lastDescendantIndex + 1 < this.view.length) {
|
|
874
|
+
const nodeHeight = this.treeDelegate.getHeight(this.view.element(lastDescendantIndex));
|
|
875
|
+
const nextNodeRelativeTop = this.view.getRelativeTop(lastDescendantIndex + 1);
|
|
876
|
+
lastChildRelativeTop = nextNodeRelativeTop ? nextNodeRelativeTop - nodeHeight / this.view.renderHeight : null;
|
|
877
|
+
}
|
|
878
|
+
if (lastChildRelativeTop === null) {
|
|
879
|
+
return stickyRowPositionTop;
|
|
880
|
+
}
|
|
881
|
+
const lastChildNode = this.view.element(lastDescendantIndex);
|
|
882
|
+
const lastChildHeight = this.treeDelegate.getHeight(lastChildNode);
|
|
883
|
+
const topOfLastChild = lastChildRelativeTop * this.view.renderHeight;
|
|
884
|
+
const bottomOfLastChild = topOfLastChild + lastChildHeight;
|
|
885
|
+
if (stickyRowPositionTop + stickyNodeHeight > bottomOfLastChild && stickyRowPositionTop <= bottomOfLastChild) {
|
|
886
|
+
return bottomOfLastChild - stickyNodeHeight;
|
|
887
|
+
}
|
|
888
|
+
return stickyRowPositionTop;
|
|
889
|
+
}
|
|
890
|
+
constrainStickyNodes(stickyNodes) {
|
|
891
|
+
if (stickyNodes.length === 0) {
|
|
892
|
+
return [];
|
|
893
|
+
}
|
|
894
|
+
// Check if sticky nodes need to be constrained
|
|
895
|
+
const maximumStickyWidgetHeight = this.view.renderHeight * this.maxWidgetViewRatio;
|
|
896
|
+
const lastStickyNode = stickyNodes[stickyNodes.length - 1];
|
|
897
|
+
if (stickyNodes.length <= this.stickyScrollMaxItemCount && lastStickyNode.position + lastStickyNode.height <= maximumStickyWidgetHeight) {
|
|
898
|
+
return stickyNodes;
|
|
899
|
+
}
|
|
900
|
+
// constrain sticky nodes
|
|
901
|
+
const constrainedStickyNodes = this.stickyScrollDelegate.constrainStickyScrollNodes(stickyNodes, this.stickyScrollMaxItemCount, maximumStickyWidgetHeight);
|
|
902
|
+
if (!constrainedStickyNodes.length) {
|
|
903
|
+
return [];
|
|
904
|
+
}
|
|
905
|
+
// Validate constraints
|
|
906
|
+
const lastConstrainedStickyNode = constrainedStickyNodes[constrainedStickyNodes.length - 1];
|
|
907
|
+
if (constrainedStickyNodes.length > this.stickyScrollMaxItemCount || lastConstrainedStickyNode.position + lastConstrainedStickyNode.height > maximumStickyWidgetHeight) {
|
|
908
|
+
throw new Error('stickyScrollDelegate violates constraints');
|
|
909
|
+
}
|
|
910
|
+
return constrainedStickyNodes;
|
|
911
|
+
}
|
|
912
|
+
getParentNode(node) {
|
|
913
|
+
const nodeLocation = this.model.getNodeLocation(node);
|
|
914
|
+
const parentLocation = this.model.getParentNodeLocation(nodeLocation);
|
|
915
|
+
return parentLocation ? this.model.getNode(parentLocation) : undefined;
|
|
916
|
+
}
|
|
917
|
+
nodeIsUncollapsedParent(node) {
|
|
918
|
+
const nodeLocation = this.model.getNodeLocation(node);
|
|
919
|
+
return this.model.getListRenderCount(nodeLocation) > 1;
|
|
920
|
+
}
|
|
921
|
+
getNodeIndex(node) {
|
|
922
|
+
const nodeLocation = this.model.getNodeLocation(node);
|
|
923
|
+
const nodeIndex = this.model.getListIndex(nodeLocation);
|
|
924
|
+
return nodeIndex;
|
|
925
|
+
}
|
|
926
|
+
getNodeRange(node) {
|
|
927
|
+
const nodeLocation = this.model.getNodeLocation(node);
|
|
928
|
+
const startIndex = this.model.getListIndex(nodeLocation);
|
|
929
|
+
if (startIndex < 0) {
|
|
930
|
+
throw new Error('Node not found in tree');
|
|
931
|
+
}
|
|
932
|
+
const renderCount = this.model.getListRenderCount(nodeLocation);
|
|
933
|
+
const endIndex = startIndex + renderCount - 1;
|
|
934
|
+
return { startIndex, endIndex };
|
|
935
|
+
}
|
|
936
|
+
nodePositionTopBelowWidget(node) {
|
|
937
|
+
const ancestors = [];
|
|
938
|
+
let currentAncestor = this.getParentNode(node);
|
|
939
|
+
while (currentAncestor) {
|
|
940
|
+
ancestors.push(currentAncestor);
|
|
941
|
+
currentAncestor = this.getParentNode(currentAncestor);
|
|
942
|
+
}
|
|
943
|
+
let widgetHeight = 0;
|
|
944
|
+
for (let i = 0; i < ancestors.length && i < this.stickyScrollMaxItemCount; i++) {
|
|
945
|
+
widgetHeight += this.treeDelegate.getHeight(ancestors[i]);
|
|
946
|
+
}
|
|
947
|
+
return widgetHeight;
|
|
948
|
+
}
|
|
949
|
+
domFocus() {
|
|
950
|
+
this._widget.domFocus();
|
|
951
|
+
}
|
|
952
|
+
// Whether sticky scroll was the last focused part in the tree or not
|
|
953
|
+
focusedLast() {
|
|
954
|
+
return this._widget.focusedLast();
|
|
955
|
+
}
|
|
956
|
+
updateOptions(optionsUpdate = {}) {
|
|
957
|
+
if (optionsUpdate.paddingTop !== undefined) {
|
|
958
|
+
this.paddingTop = optionsUpdate.paddingTop;
|
|
959
|
+
}
|
|
960
|
+
if (optionsUpdate.stickyScrollMaxItemCount !== undefined) {
|
|
961
|
+
const validatedOptions = this.validateStickySettings(optionsUpdate);
|
|
962
|
+
if (this.stickyScrollMaxItemCount !== validatedOptions.stickyScrollMaxItemCount) {
|
|
963
|
+
this.stickyScrollMaxItemCount = validatedOptions.stickyScrollMaxItemCount;
|
|
964
|
+
this.update();
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
validateStickySettings(options) {
|
|
969
|
+
let stickyScrollMaxItemCount = 7;
|
|
970
|
+
if (typeof options.stickyScrollMaxItemCount === 'number') {
|
|
971
|
+
stickyScrollMaxItemCount = Math.max(options.stickyScrollMaxItemCount, 1);
|
|
972
|
+
}
|
|
973
|
+
return { stickyScrollMaxItemCount };
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
class StickyScrollWidget {
|
|
977
|
+
get state() { return this._previousState; }
|
|
978
|
+
constructor(container, view, tree, treeRenderers, treeDelegate, accessibilityProvider) {
|
|
979
|
+
this.view = view;
|
|
980
|
+
this.tree = tree;
|
|
981
|
+
this.treeRenderers = treeRenderers;
|
|
982
|
+
this.treeDelegate = treeDelegate;
|
|
983
|
+
this.accessibilityProvider = accessibilityProvider;
|
|
984
|
+
this._previousElements = [];
|
|
985
|
+
this._previousStateDisposables = new DisposableStore();
|
|
986
|
+
this._rootDomNode = $('.monaco-tree-sticky-container.empty');
|
|
987
|
+
container.appendChild(this._rootDomNode);
|
|
988
|
+
const shadow = $('.monaco-tree-sticky-container-shadow');
|
|
989
|
+
this._rootDomNode.appendChild(shadow);
|
|
990
|
+
this.stickyScrollFocus = new StickyScrollFocus(this._rootDomNode, view);
|
|
991
|
+
this.onDidChangeHasFocus = this.stickyScrollFocus.onDidChangeHasFocus;
|
|
992
|
+
this.onContextMenu = this.stickyScrollFocus.onContextMenu;
|
|
993
|
+
}
|
|
994
|
+
get height() {
|
|
995
|
+
if (!this._previousState) {
|
|
996
|
+
return 0;
|
|
997
|
+
}
|
|
998
|
+
const lastElement = this._previousState.stickyNodes[this._previousState.count - 1];
|
|
999
|
+
return lastElement.position + lastElement.height;
|
|
1000
|
+
}
|
|
1001
|
+
setState(state) {
|
|
1002
|
+
const wasVisible = !!this._previousState && this._previousState.count > 0;
|
|
1003
|
+
const isVisible = !!state && state.count > 0;
|
|
1004
|
+
// If state has not changed, do nothing
|
|
1005
|
+
if ((!wasVisible && !isVisible) || (wasVisible && isVisible && this._previousState.equal(state))) {
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
// Update visibility of the widget if changed
|
|
1009
|
+
if (wasVisible !== isVisible) {
|
|
1010
|
+
this.setVisible(isVisible);
|
|
1011
|
+
}
|
|
1012
|
+
if (!isVisible) {
|
|
1013
|
+
this._previousState = undefined;
|
|
1014
|
+
this._previousElements = [];
|
|
1015
|
+
this._previousStateDisposables.clear();
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
const lastStickyNode = state.stickyNodes[state.count - 1];
|
|
1019
|
+
// If the new state is only a change in the last node's position, update the position of the last element
|
|
1020
|
+
if (this._previousState && state.animationStateChanged(this._previousState)) {
|
|
1021
|
+
this._previousElements[this._previousState.count - 1].style.top = `${lastStickyNode.position}px`;
|
|
1022
|
+
}
|
|
1023
|
+
// create new dom elements
|
|
1024
|
+
else {
|
|
1025
|
+
this.renderState(state);
|
|
1026
|
+
}
|
|
1027
|
+
this._previousState = state;
|
|
1028
|
+
// Set the height of the widget to the bottom of the last sticky node
|
|
1029
|
+
this._rootDomNode.style.height = `${lastStickyNode.position + lastStickyNode.height}px`;
|
|
1030
|
+
}
|
|
1031
|
+
renderState(state) {
|
|
1032
|
+
this._previousStateDisposables.clear();
|
|
1033
|
+
const elements = Array(state.count);
|
|
1034
|
+
for (let stickyIndex = state.count - 1; stickyIndex >= 0; stickyIndex--) {
|
|
1035
|
+
const stickyNode = state.stickyNodes[stickyIndex];
|
|
1036
|
+
const { element, disposable } = this.createElement(stickyNode, stickyIndex, state.count);
|
|
1037
|
+
elements[stickyIndex] = element;
|
|
1038
|
+
this._rootDomNode.appendChild(element);
|
|
1039
|
+
this._previousStateDisposables.add(disposable);
|
|
1040
|
+
}
|
|
1041
|
+
this.stickyScrollFocus.updateElements(elements, state);
|
|
1042
|
+
this._previousElements = elements;
|
|
1043
|
+
}
|
|
1044
|
+
rerender() {
|
|
1045
|
+
if (this._previousState) {
|
|
1046
|
+
this.renderState(this._previousState);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
createElement(stickyNode, stickyIndex, stickyNodesTotal) {
|
|
1050
|
+
const nodeIndex = stickyNode.startIndex;
|
|
1051
|
+
// Sticky element container
|
|
1052
|
+
const stickyElement = document.createElement('div');
|
|
1053
|
+
stickyElement.style.top = `${stickyNode.position}px`;
|
|
1054
|
+
if (this.tree.options.setRowHeight !== false) {
|
|
1055
|
+
stickyElement.style.height = `${stickyNode.height}px`;
|
|
1056
|
+
}
|
|
1057
|
+
if (this.tree.options.setRowLineHeight !== false) {
|
|
1058
|
+
stickyElement.style.lineHeight = `${stickyNode.height}px`;
|
|
1059
|
+
}
|
|
1060
|
+
stickyElement.classList.add('monaco-tree-sticky-row');
|
|
1061
|
+
stickyElement.classList.add('monaco-list-row');
|
|
1062
|
+
stickyElement.setAttribute('data-index', `${nodeIndex}`);
|
|
1063
|
+
stickyElement.setAttribute('data-parity', nodeIndex % 2 === 0 ? 'even' : 'odd');
|
|
1064
|
+
stickyElement.setAttribute('id', this.view.getElementID(nodeIndex));
|
|
1065
|
+
const accessibilityDisposable = this.setAccessibilityAttributes(stickyElement, stickyNode.node.element, stickyIndex, stickyNodesTotal);
|
|
1066
|
+
// Get the renderer for the node
|
|
1067
|
+
const nodeTemplateId = this.treeDelegate.getTemplateId(stickyNode.node);
|
|
1068
|
+
const renderer = this.treeRenderers.find((renderer) => renderer.templateId === nodeTemplateId);
|
|
1069
|
+
if (!renderer) {
|
|
1070
|
+
throw new Error(`No renderer found for template id ${nodeTemplateId}`);
|
|
1071
|
+
}
|
|
1072
|
+
// To make sure we do not influence the original node, we create a copy of the node
|
|
1073
|
+
// We need to check if it is already a unique instance of the node by the delegate
|
|
1074
|
+
let nodeCopy = stickyNode.node;
|
|
1075
|
+
if (nodeCopy === this.tree.getNode(this.tree.getNodeLocation(stickyNode.node))) {
|
|
1076
|
+
nodeCopy = new Proxy(stickyNode.node, {});
|
|
1077
|
+
}
|
|
1078
|
+
// Render the element
|
|
1079
|
+
const templateData = renderer.renderTemplate(stickyElement);
|
|
1080
|
+
renderer.renderElement(nodeCopy, stickyNode.startIndex, templateData, { height: stickyNode.height });
|
|
1081
|
+
// Remove the element from the DOM when state is disposed
|
|
1082
|
+
const disposable = toDisposable(() => {
|
|
1083
|
+
accessibilityDisposable.dispose();
|
|
1084
|
+
renderer.disposeElement(nodeCopy, stickyNode.startIndex, templateData, { height: stickyNode.height });
|
|
1085
|
+
renderer.disposeTemplate(templateData);
|
|
1086
|
+
stickyElement.remove();
|
|
1087
|
+
});
|
|
1088
|
+
return { element: stickyElement, disposable };
|
|
1089
|
+
}
|
|
1090
|
+
setAccessibilityAttributes(container, element, stickyIndex, stickyNodesTotal) {
|
|
1091
|
+
if (!this.accessibilityProvider) {
|
|
1092
|
+
return Disposable.None;
|
|
1093
|
+
}
|
|
1094
|
+
if (this.accessibilityProvider.getSetSize) {
|
|
1095
|
+
container.setAttribute('aria-setsize', String(this.accessibilityProvider.getSetSize(element, stickyIndex, stickyNodesTotal)));
|
|
1096
|
+
}
|
|
1097
|
+
if (this.accessibilityProvider.getPosInSet) {
|
|
1098
|
+
container.setAttribute('aria-posinset', String(this.accessibilityProvider.getPosInSet(element, stickyIndex)));
|
|
1099
|
+
}
|
|
1100
|
+
if (this.accessibilityProvider.getRole) {
|
|
1101
|
+
container.setAttribute('role', this.accessibilityProvider.getRole(element) ?? 'treeitem');
|
|
1102
|
+
}
|
|
1103
|
+
const ariaLabel = this.accessibilityProvider.getAriaLabel(element);
|
|
1104
|
+
const observable = (ariaLabel && typeof ariaLabel !== 'string') ? ariaLabel : constObservable(ariaLabel);
|
|
1105
|
+
const result = autorun(reader => {
|
|
1106
|
+
const value = reader.readObservable(observable);
|
|
1107
|
+
if (value) {
|
|
1108
|
+
container.setAttribute('aria-label', value);
|
|
1109
|
+
}
|
|
1110
|
+
else {
|
|
1111
|
+
container.removeAttribute('aria-label');
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
if (typeof ariaLabel === 'string') ;
|
|
1115
|
+
else if (ariaLabel) {
|
|
1116
|
+
container.setAttribute('aria-label', ariaLabel.get());
|
|
1117
|
+
}
|
|
1118
|
+
const ariaLevel = this.accessibilityProvider.getAriaLevel && this.accessibilityProvider.getAriaLevel(element);
|
|
1119
|
+
if (typeof ariaLevel === 'number') {
|
|
1120
|
+
container.setAttribute('aria-level', `${ariaLevel}`);
|
|
1121
|
+
}
|
|
1122
|
+
// Sticky Scroll elements can not be selected
|
|
1123
|
+
container.setAttribute('aria-selected', String(false));
|
|
1124
|
+
return result;
|
|
1125
|
+
}
|
|
1126
|
+
setVisible(visible) {
|
|
1127
|
+
this._rootDomNode.classList.toggle('empty', !visible);
|
|
1128
|
+
if (!visible) {
|
|
1129
|
+
this.stickyScrollFocus.updateElements([], undefined);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
domFocus() {
|
|
1133
|
+
this.stickyScrollFocus.domFocus();
|
|
1134
|
+
}
|
|
1135
|
+
focusedLast() {
|
|
1136
|
+
return this.stickyScrollFocus.focusedLast();
|
|
1137
|
+
}
|
|
1138
|
+
dispose() {
|
|
1139
|
+
this.stickyScrollFocus.dispose();
|
|
1140
|
+
this._previousStateDisposables.dispose();
|
|
1141
|
+
this._rootDomNode.remove();
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
class StickyScrollFocus extends Disposable {
|
|
1145
|
+
get domHasFocus() { return this._domHasFocus; }
|
|
1146
|
+
set domHasFocus(hasFocus) {
|
|
1147
|
+
if (hasFocus !== this._domHasFocus) {
|
|
1148
|
+
this._onDidChangeHasFocus.fire(hasFocus);
|
|
1149
|
+
this._domHasFocus = hasFocus;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
constructor(container, view) {
|
|
1153
|
+
super();
|
|
1154
|
+
this.container = container;
|
|
1155
|
+
this.view = view;
|
|
1156
|
+
this.focusedIndex = -1;
|
|
1157
|
+
this.elements = [];
|
|
1158
|
+
this._onDidChangeHasFocus = new Emitter();
|
|
1159
|
+
this.onDidChangeHasFocus = this._onDidChangeHasFocus.event;
|
|
1160
|
+
this._onContextMenu = new Emitter();
|
|
1161
|
+
this.onContextMenu = this._onContextMenu.event;
|
|
1162
|
+
this._domHasFocus = false;
|
|
1163
|
+
this._register(addDisposableListener(this.container, 'focus', () => this.onFocus()));
|
|
1164
|
+
this._register(addDisposableListener(this.container, 'blur', () => this.onBlur()));
|
|
1165
|
+
this._register(this.view.onDidFocus(() => this.toggleStickyScrollFocused(false)));
|
|
1166
|
+
this._register(this.view.onKeyDown((e) => this.onKeyDown(e)));
|
|
1167
|
+
this._register(this.view.onMouseDown((e) => this.onMouseDown(e)));
|
|
1168
|
+
this._register(this.view.onContextMenu((e) => this.handleContextMenu(e)));
|
|
1169
|
+
}
|
|
1170
|
+
handleContextMenu(e) {
|
|
1171
|
+
const target = e.browserEvent.target;
|
|
1172
|
+
if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) {
|
|
1173
|
+
if (this.focusedLast()) {
|
|
1174
|
+
this.view.domFocus();
|
|
1175
|
+
}
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
// The list handles the context menu triggered by a mouse event
|
|
1179
|
+
// In that case only set the focus of the element clicked and leave the rest to the list to handle
|
|
1180
|
+
if (!isKeyboardEvent(e.browserEvent)) {
|
|
1181
|
+
if (!this.state) {
|
|
1182
|
+
throw new Error('Context menu should not be triggered when state is undefined');
|
|
1183
|
+
}
|
|
1184
|
+
const stickyIndex = this.state.stickyNodes.findIndex(stickyNode => stickyNode.node.element === e.element?.element);
|
|
1185
|
+
if (stickyIndex === -1) {
|
|
1186
|
+
throw new Error('Context menu should not be triggered when element is not in sticky scroll widget');
|
|
1187
|
+
}
|
|
1188
|
+
this.container.focus();
|
|
1189
|
+
this.setFocus(stickyIndex);
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
if (!this.state || this.focusedIndex < 0) {
|
|
1193
|
+
throw new Error('Context menu key should not be triggered when focus is not in sticky scroll widget');
|
|
1194
|
+
}
|
|
1195
|
+
const stickyNode = this.state.stickyNodes[this.focusedIndex];
|
|
1196
|
+
const element = stickyNode.node.element;
|
|
1197
|
+
const anchor = this.elements[this.focusedIndex];
|
|
1198
|
+
this._onContextMenu.fire({ element, anchor, browserEvent: e.browserEvent, isStickyScroll: true });
|
|
1199
|
+
}
|
|
1200
|
+
onKeyDown(e) {
|
|
1201
|
+
// Sticky Scroll Navigation
|
|
1202
|
+
if (this.domHasFocus && this.state) {
|
|
1203
|
+
// Move up
|
|
1204
|
+
if (e.key === 'ArrowUp') {
|
|
1205
|
+
this.setFocusedElement(Math.max(0, this.focusedIndex - 1));
|
|
1206
|
+
e.preventDefault();
|
|
1207
|
+
e.stopPropagation();
|
|
1208
|
+
}
|
|
1209
|
+
// Move down, if last sticky node is focused, move focus into first child of last sticky node
|
|
1210
|
+
else if (e.key === 'ArrowDown' || e.key === 'ArrowRight') {
|
|
1211
|
+
if (this.focusedIndex >= this.state.count - 1) {
|
|
1212
|
+
const nodeIndexToFocus = this.state.stickyNodes[this.state.count - 1].startIndex + 1;
|
|
1213
|
+
this.view.domFocus();
|
|
1214
|
+
this.view.setFocus([nodeIndexToFocus]);
|
|
1215
|
+
this.scrollNodeUnderWidget(nodeIndexToFocus, this.state);
|
|
1216
|
+
}
|
|
1217
|
+
else {
|
|
1218
|
+
this.setFocusedElement(this.focusedIndex + 1);
|
|
1219
|
+
}
|
|
1220
|
+
e.preventDefault();
|
|
1221
|
+
e.stopPropagation();
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
onMouseDown(e) {
|
|
1226
|
+
const target = e.browserEvent.target;
|
|
1227
|
+
if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
e.browserEvent.preventDefault();
|
|
1231
|
+
e.browserEvent.stopPropagation();
|
|
1232
|
+
}
|
|
1233
|
+
updateElements(elements, state) {
|
|
1234
|
+
if (state && state.count === 0) {
|
|
1235
|
+
throw new Error('Sticky scroll state must be undefined when there are no sticky nodes');
|
|
1236
|
+
}
|
|
1237
|
+
if (state && state.count !== elements.length) {
|
|
1238
|
+
throw new Error('Sticky scroll focus received illigel state');
|
|
1239
|
+
}
|
|
1240
|
+
const previousIndex = this.focusedIndex;
|
|
1241
|
+
this.removeFocus();
|
|
1242
|
+
this.elements = elements;
|
|
1243
|
+
this.state = state;
|
|
1244
|
+
if (state) {
|
|
1245
|
+
const newFocusedIndex = clamp(previousIndex, 0, state.count - 1);
|
|
1246
|
+
this.setFocus(newFocusedIndex);
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
if (this.domHasFocus) {
|
|
1250
|
+
this.view.domFocus();
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
// must come last as it calls blur()
|
|
1254
|
+
this.container.tabIndex = state ? 0 : -1;
|
|
1255
|
+
}
|
|
1256
|
+
setFocusedElement(stickyIndex) {
|
|
1257
|
+
// doesn't imply that the widget has (or will have) focus
|
|
1258
|
+
const state = this.state;
|
|
1259
|
+
if (!state) {
|
|
1260
|
+
throw new Error('Cannot set focus when state is undefined');
|
|
1261
|
+
}
|
|
1262
|
+
this.setFocus(stickyIndex);
|
|
1263
|
+
if (stickyIndex < state.count - 1) {
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
// If the last sticky node is not fully visible, scroll it into view
|
|
1267
|
+
if (state.lastNodePartiallyVisible()) {
|
|
1268
|
+
const lastStickyNode = state.stickyNodes[stickyIndex];
|
|
1269
|
+
this.scrollNodeUnderWidget(lastStickyNode.endIndex + 1, state);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
scrollNodeUnderWidget(nodeIndex, state) {
|
|
1273
|
+
const lastStickyNode = state.stickyNodes[state.count - 1];
|
|
1274
|
+
const secondLastStickyNode = state.count > 1 ? state.stickyNodes[state.count - 2] : undefined;
|
|
1275
|
+
const elementScrollTop = this.view.getElementTop(nodeIndex);
|
|
1276
|
+
const elementTargetViewTop = secondLastStickyNode ? secondLastStickyNode.position + secondLastStickyNode.height + lastStickyNode.height : lastStickyNode.height;
|
|
1277
|
+
this.view.scrollTop = elementScrollTop - elementTargetViewTop;
|
|
1278
|
+
}
|
|
1279
|
+
domFocus() {
|
|
1280
|
+
if (!this.state) {
|
|
1281
|
+
throw new Error('Cannot focus when state is undefined');
|
|
1282
|
+
}
|
|
1283
|
+
this.container.focus();
|
|
1284
|
+
}
|
|
1285
|
+
focusedLast() {
|
|
1286
|
+
if (!this.state) {
|
|
1287
|
+
return false;
|
|
1288
|
+
}
|
|
1289
|
+
return this.view.getHTMLElement().classList.contains('sticky-scroll-focused');
|
|
1290
|
+
}
|
|
1291
|
+
removeFocus() {
|
|
1292
|
+
if (this.focusedIndex === -1) {
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1295
|
+
this.toggleElementFocus(this.elements[this.focusedIndex], false);
|
|
1296
|
+
this.focusedIndex = -1;
|
|
1297
|
+
}
|
|
1298
|
+
setFocus(newFocusIndex) {
|
|
1299
|
+
if (0 > newFocusIndex) {
|
|
1300
|
+
throw new Error('addFocus() can not remove focus');
|
|
1301
|
+
}
|
|
1302
|
+
if (!this.state && newFocusIndex >= 0) {
|
|
1303
|
+
throw new Error('Cannot set focus index when state is undefined');
|
|
1304
|
+
}
|
|
1305
|
+
if (this.state && newFocusIndex >= this.state.count) {
|
|
1306
|
+
throw new Error('Cannot set focus index to an index that does not exist');
|
|
1307
|
+
}
|
|
1308
|
+
const oldIndex = this.focusedIndex;
|
|
1309
|
+
if (oldIndex >= 0) {
|
|
1310
|
+
this.toggleElementFocus(this.elements[oldIndex], false);
|
|
1311
|
+
}
|
|
1312
|
+
if (newFocusIndex >= 0) {
|
|
1313
|
+
this.toggleElementFocus(this.elements[newFocusIndex], true);
|
|
1314
|
+
}
|
|
1315
|
+
this.focusedIndex = newFocusIndex;
|
|
1316
|
+
}
|
|
1317
|
+
toggleElementFocus(element, focused) {
|
|
1318
|
+
this.toggleElementActiveFocus(element, focused && this.domHasFocus);
|
|
1319
|
+
this.toggleElementPassiveFocus(element, focused);
|
|
1320
|
+
}
|
|
1321
|
+
toggleCurrentElementActiveFocus(focused) {
|
|
1322
|
+
if (this.focusedIndex === -1) {
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
this.toggleElementActiveFocus(this.elements[this.focusedIndex], focused);
|
|
1326
|
+
}
|
|
1327
|
+
toggleElementActiveFocus(element, focused) {
|
|
1328
|
+
// active focus is set when sticky scroll has focus
|
|
1329
|
+
element.classList.toggle('focused', focused);
|
|
1330
|
+
}
|
|
1331
|
+
toggleElementPassiveFocus(element, focused) {
|
|
1332
|
+
// passive focus allows to show focus when sticky scroll does not have focus
|
|
1333
|
+
// for example when the context menu has focus
|
|
1334
|
+
element.classList.toggle('passive-focused', focused);
|
|
1335
|
+
}
|
|
1336
|
+
toggleStickyScrollFocused(focused) {
|
|
1337
|
+
// Weather the last focus in the view was sticky scroll and not the list
|
|
1338
|
+
// Is only removed when the focus is back in the tree an no longer in sticky scroll
|
|
1339
|
+
this.view.getHTMLElement().classList.toggle('sticky-scroll-focused', focused);
|
|
1340
|
+
}
|
|
1341
|
+
onFocus() {
|
|
1342
|
+
if (!this.state || this.elements.length === 0) {
|
|
1343
|
+
throw new Error('Cannot focus when state is undefined or elements are empty');
|
|
1344
|
+
}
|
|
1345
|
+
this.domHasFocus = true;
|
|
1346
|
+
this.toggleStickyScrollFocused(true);
|
|
1347
|
+
this.toggleCurrentElementActiveFocus(true);
|
|
1348
|
+
if (this.focusedIndex === -1) {
|
|
1349
|
+
this.setFocus(0);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
onBlur() {
|
|
1353
|
+
this.domHasFocus = false;
|
|
1354
|
+
this.toggleCurrentElementActiveFocus(false);
|
|
1355
|
+
}
|
|
1356
|
+
dispose() {
|
|
1357
|
+
this.toggleStickyScrollFocused(false);
|
|
1358
|
+
this._onDidChangeHasFocus.fire(false);
|
|
1359
|
+
super.dispose();
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
function asTreeMouseEvent(event) {
|
|
1363
|
+
let target = TreeMouseEventTarget.Unknown;
|
|
1364
|
+
if (hasParentWithClass(event.browserEvent.target, 'monaco-tl-twistie', 'monaco-tl-row')) {
|
|
1365
|
+
target = TreeMouseEventTarget.Twistie;
|
|
1366
|
+
}
|
|
1367
|
+
else if (hasParentWithClass(event.browserEvent.target, 'monaco-tl-contents', 'monaco-tl-row')) {
|
|
1368
|
+
target = TreeMouseEventTarget.Element;
|
|
1369
|
+
}
|
|
1370
|
+
else if (hasParentWithClass(event.browserEvent.target, 'monaco-tree-type-filter', 'monaco-list')) {
|
|
1371
|
+
target = TreeMouseEventTarget.Filter;
|
|
1372
|
+
}
|
|
1373
|
+
return {
|
|
1374
|
+
browserEvent: event.browserEvent,
|
|
1375
|
+
element: event.element ? event.element.element : null,
|
|
1376
|
+
target
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
function asTreeContextMenuEvent(event) {
|
|
1380
|
+
const isStickyScroll = isStickyScrollContainer(event.browserEvent.target);
|
|
1381
|
+
return {
|
|
1382
|
+
element: event.element ? event.element.element : null,
|
|
1383
|
+
browserEvent: event.browserEvent,
|
|
1384
|
+
anchor: event.anchor,
|
|
1385
|
+
isStickyScroll
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
function dfs(node, fn) {
|
|
1389
|
+
fn(node);
|
|
1390
|
+
node.children.forEach(child => dfs(child, fn));
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* The trait concept needs to exist at the tree level, because collapsed
|
|
1394
|
+
* tree nodes will not be known by the list.
|
|
1395
|
+
*/
|
|
1396
|
+
class Trait {
|
|
1397
|
+
get nodeSet() {
|
|
1398
|
+
if (!this._nodeSet) {
|
|
1399
|
+
this._nodeSet = this.createNodeSet();
|
|
1400
|
+
}
|
|
1401
|
+
return this._nodeSet;
|
|
1402
|
+
}
|
|
1403
|
+
constructor(getFirstViewElementWithTrait, identityProvider) {
|
|
1404
|
+
this.getFirstViewElementWithTrait = getFirstViewElementWithTrait;
|
|
1405
|
+
this.identityProvider = identityProvider;
|
|
1406
|
+
this.nodes = [];
|
|
1407
|
+
this._onDidChange = new Emitter();
|
|
1408
|
+
this.onDidChange = this._onDidChange.event;
|
|
1409
|
+
}
|
|
1410
|
+
set(nodes, browserEvent) {
|
|
1411
|
+
const event = browserEvent;
|
|
1412
|
+
if (!(event?.__forceEvent) && equals(this.nodes, nodes)) {
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
this._set(nodes, false, browserEvent);
|
|
1416
|
+
}
|
|
1417
|
+
_set(nodes, silent, browserEvent) {
|
|
1418
|
+
this.nodes = [...nodes];
|
|
1419
|
+
this.elements = undefined;
|
|
1420
|
+
this._nodeSet = undefined;
|
|
1421
|
+
if (!silent) {
|
|
1422
|
+
const that = this;
|
|
1423
|
+
this._onDidChange.fire({ get elements() { return that.get(); }, browserEvent });
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
get() {
|
|
1427
|
+
if (!this.elements) {
|
|
1428
|
+
this.elements = this.nodes.map(node => node.element);
|
|
1429
|
+
}
|
|
1430
|
+
return [...this.elements];
|
|
1431
|
+
}
|
|
1432
|
+
getNodes() {
|
|
1433
|
+
return this.nodes;
|
|
1434
|
+
}
|
|
1435
|
+
has(node) {
|
|
1436
|
+
return this.nodeSet.has(node);
|
|
1437
|
+
}
|
|
1438
|
+
onDidModelSplice({ insertedNodes, deletedNodes }) {
|
|
1439
|
+
if (!this.identityProvider) {
|
|
1440
|
+
const set = this.createNodeSet();
|
|
1441
|
+
const visit = (node) => set.delete(node);
|
|
1442
|
+
deletedNodes.forEach(node => dfs(node, visit));
|
|
1443
|
+
this.set([...set.values()]);
|
|
1444
|
+
return;
|
|
1445
|
+
}
|
|
1446
|
+
const deletedNodesIdSet = new Set();
|
|
1447
|
+
const deletedNodesVisitor = (node) => deletedNodesIdSet.add(this.identityProvider.getId(node.element).toString());
|
|
1448
|
+
deletedNodes.forEach(node => dfs(node, deletedNodesVisitor));
|
|
1449
|
+
const insertedNodesMap = new Map();
|
|
1450
|
+
const insertedNodesVisitor = (node) => insertedNodesMap.set(this.identityProvider.getId(node.element).toString(), node);
|
|
1451
|
+
insertedNodes.forEach(node => dfs(node, insertedNodesVisitor));
|
|
1452
|
+
const nodes = [];
|
|
1453
|
+
for (const node of this.nodes) {
|
|
1454
|
+
const id = this.identityProvider.getId(node.element).toString();
|
|
1455
|
+
const wasDeleted = deletedNodesIdSet.has(id);
|
|
1456
|
+
if (!wasDeleted) {
|
|
1457
|
+
nodes.push(node);
|
|
1458
|
+
}
|
|
1459
|
+
else {
|
|
1460
|
+
const insertedNode = insertedNodesMap.get(id);
|
|
1461
|
+
if (insertedNode && insertedNode.visible) {
|
|
1462
|
+
nodes.push(insertedNode);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
if (this.nodes.length > 0 && nodes.length === 0) {
|
|
1467
|
+
const node = this.getFirstViewElementWithTrait();
|
|
1468
|
+
if (node) {
|
|
1469
|
+
nodes.push(node);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
this._set(nodes, true);
|
|
1473
|
+
}
|
|
1474
|
+
createNodeSet() {
|
|
1475
|
+
const set = new Set();
|
|
1476
|
+
for (const node of this.nodes) {
|
|
1477
|
+
set.add(node);
|
|
1478
|
+
}
|
|
1479
|
+
return set;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
class TreeNodeListMouseController extends MouseController {
|
|
1483
|
+
constructor(list, tree, stickyScrollProvider) {
|
|
1484
|
+
super(list);
|
|
1485
|
+
this.tree = tree;
|
|
1486
|
+
this.stickyScrollProvider = stickyScrollProvider;
|
|
1487
|
+
}
|
|
1488
|
+
onViewPointer(e) {
|
|
1489
|
+
if (isButton(e.browserEvent.target) ||
|
|
1490
|
+
isEditableElement(e.browserEvent.target) ||
|
|
1491
|
+
isMonacoEditor(e.browserEvent.target)) {
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
if (e.browserEvent.isHandledByList) {
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
const node = e.element;
|
|
1498
|
+
if (!node) {
|
|
1499
|
+
return super.onViewPointer(e);
|
|
1500
|
+
}
|
|
1501
|
+
if (this.isSelectionRangeChangeEvent(e) || this.isSelectionSingleChangeEvent(e)) {
|
|
1502
|
+
return super.onViewPointer(e);
|
|
1503
|
+
}
|
|
1504
|
+
const target = e.browserEvent.target;
|
|
1505
|
+
const onTwistie = target.classList.contains('monaco-tl-twistie')
|
|
1506
|
+
|| (target.classList.contains('monaco-icon-label') && target.classList.contains('folder-icon') && e.browserEvent.offsetX < 16);
|
|
1507
|
+
const isStickyElement = isStickyScrollElement(e.browserEvent.target);
|
|
1508
|
+
let expandOnlyOnTwistieClick = false;
|
|
1509
|
+
if (isStickyElement) {
|
|
1510
|
+
expandOnlyOnTwistieClick = true;
|
|
1511
|
+
}
|
|
1512
|
+
else if (typeof this.tree.expandOnlyOnTwistieClick === 'function') {
|
|
1513
|
+
expandOnlyOnTwistieClick = this.tree.expandOnlyOnTwistieClick(node.element);
|
|
1514
|
+
}
|
|
1515
|
+
else {
|
|
1516
|
+
expandOnlyOnTwistieClick = !!this.tree.expandOnlyOnTwistieClick;
|
|
1517
|
+
}
|
|
1518
|
+
if (!isStickyElement) {
|
|
1519
|
+
if (expandOnlyOnTwistieClick && !onTwistie && e.browserEvent.detail !== 2) {
|
|
1520
|
+
return super.onViewPointer(e);
|
|
1521
|
+
}
|
|
1522
|
+
if (!this.tree.expandOnDoubleClick && e.browserEvent.detail === 2) {
|
|
1523
|
+
return super.onViewPointer(e);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
else {
|
|
1527
|
+
this.handleStickyScrollMouseEvent(e, node);
|
|
1528
|
+
}
|
|
1529
|
+
if (node.collapsible && (!isStickyElement || onTwistie)) {
|
|
1530
|
+
const location = this.tree.getNodeLocation(node);
|
|
1531
|
+
const recursive = e.browserEvent.altKey;
|
|
1532
|
+
this.tree.setFocus([location]);
|
|
1533
|
+
this.tree.toggleCollapsed(location, recursive);
|
|
1534
|
+
if (onTwistie) {
|
|
1535
|
+
// Do not set this before calling a handler on the super class, because it will reject it as handled
|
|
1536
|
+
e.browserEvent.isHandledByList = true;
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
if (!isStickyElement) {
|
|
1541
|
+
super.onViewPointer(e);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
handleStickyScrollMouseEvent(e, node) {
|
|
1545
|
+
if (isMonacoCustomToggle(e.browserEvent.target) || isActionItem(e.browserEvent.target)) {
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1548
|
+
const stickyScrollController = this.stickyScrollProvider();
|
|
1549
|
+
if (!stickyScrollController) {
|
|
1550
|
+
throw new Error('Sticky scroll controller not found');
|
|
1551
|
+
}
|
|
1552
|
+
const nodeIndex = this.list.indexOf(node);
|
|
1553
|
+
const elementScrollTop = this.list.getElementTop(nodeIndex);
|
|
1554
|
+
const elementTargetViewTop = stickyScrollController.nodePositionTopBelowWidget(node);
|
|
1555
|
+
this.tree.scrollTop = elementScrollTop - elementTargetViewTop;
|
|
1556
|
+
this.list.domFocus();
|
|
1557
|
+
this.list.setFocus([nodeIndex]);
|
|
1558
|
+
this.list.setSelection([nodeIndex]);
|
|
1559
|
+
}
|
|
1560
|
+
onDoubleClick(e) {
|
|
1561
|
+
const onTwistie = e.browserEvent.target.classList.contains('monaco-tl-twistie');
|
|
1562
|
+
if (onTwistie || !this.tree.expandOnDoubleClick) {
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1565
|
+
if (e.browserEvent.isHandledByList) {
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
super.onDoubleClick(e);
|
|
1569
|
+
}
|
|
1570
|
+
// to make sure dom focus is not stolen (for example with context menu)
|
|
1571
|
+
onMouseDown(e) {
|
|
1572
|
+
const target = e.browserEvent.target;
|
|
1573
|
+
if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) {
|
|
1574
|
+
super.onMouseDown(e);
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
onContextMenu(e) {
|
|
1579
|
+
const target = e.browserEvent.target;
|
|
1580
|
+
if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) {
|
|
1581
|
+
super.onContextMenu(e);
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* We use this List subclass to restore selection and focus as nodes
|
|
1588
|
+
* get rendered in the list, possibly due to a node expand() call.
|
|
1589
|
+
*/
|
|
1590
|
+
class TreeNodeList extends List {
|
|
1591
|
+
constructor(user, container, virtualDelegate, renderers, focusTrait, selectionTrait, anchorTrait, options) {
|
|
1592
|
+
super(user, container, virtualDelegate, renderers, options);
|
|
1593
|
+
this.focusTrait = focusTrait;
|
|
1594
|
+
this.selectionTrait = selectionTrait;
|
|
1595
|
+
this.anchorTrait = anchorTrait;
|
|
1596
|
+
}
|
|
1597
|
+
createMouseController(options) {
|
|
1598
|
+
return new TreeNodeListMouseController(this, options.tree, options.stickyScrollProvider);
|
|
1599
|
+
}
|
|
1600
|
+
splice(start, deleteCount, elements = []) {
|
|
1601
|
+
super.splice(start, deleteCount, elements);
|
|
1602
|
+
if (elements.length === 0) {
|
|
1603
|
+
return;
|
|
1604
|
+
}
|
|
1605
|
+
const additionalFocus = [];
|
|
1606
|
+
const additionalSelection = [];
|
|
1607
|
+
let anchor;
|
|
1608
|
+
elements.forEach((node, index) => {
|
|
1609
|
+
if (this.focusTrait.has(node)) {
|
|
1610
|
+
additionalFocus.push(start + index);
|
|
1611
|
+
}
|
|
1612
|
+
if (this.selectionTrait.has(node)) {
|
|
1613
|
+
additionalSelection.push(start + index);
|
|
1614
|
+
}
|
|
1615
|
+
if (this.anchorTrait.has(node)) {
|
|
1616
|
+
anchor = start + index;
|
|
1617
|
+
}
|
|
1618
|
+
});
|
|
1619
|
+
if (additionalFocus.length > 0) {
|
|
1620
|
+
super.setFocus(distinct([...super.getFocus(), ...additionalFocus]));
|
|
1621
|
+
}
|
|
1622
|
+
if (additionalSelection.length > 0) {
|
|
1623
|
+
super.setSelection(distinct([...super.getSelection(), ...additionalSelection]));
|
|
1624
|
+
}
|
|
1625
|
+
if (typeof anchor === 'number') {
|
|
1626
|
+
super.setAnchor(anchor);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
setFocus(indexes, browserEvent, fromAPI = false) {
|
|
1630
|
+
super.setFocus(indexes, browserEvent);
|
|
1631
|
+
if (!fromAPI) {
|
|
1632
|
+
this.focusTrait.set(indexes.map(i => this.element(i)), browserEvent);
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
setSelection(indexes, browserEvent, fromAPI = false) {
|
|
1636
|
+
super.setSelection(indexes, browserEvent);
|
|
1637
|
+
if (!fromAPI) {
|
|
1638
|
+
this.selectionTrait.set(indexes.map(i => this.element(i)), browserEvent);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
setAnchor(index, fromAPI = false) {
|
|
1642
|
+
super.setAnchor(index);
|
|
1643
|
+
if (!fromAPI) {
|
|
1644
|
+
if (typeof index === 'undefined') {
|
|
1645
|
+
this.anchorTrait.set([]);
|
|
1646
|
+
}
|
|
1647
|
+
else {
|
|
1648
|
+
this.anchorTrait.set([this.element(index)]);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
class AbstractTree {
|
|
1654
|
+
get onDidScroll() { return this.view.onDidScroll; }
|
|
1655
|
+
get onDidChangeFocus() { return this.eventBufferer.wrapEvent(this.focus.onDidChange); }
|
|
1656
|
+
get onDidChangeSelection() { return this.eventBufferer.wrapEvent(this.selection.onDidChange); }
|
|
1657
|
+
get onMouseDblClick() { return Event.filter(Event.map(this.view.onMouseDblClick, asTreeMouseEvent), e => e.target !== TreeMouseEventTarget.Filter); }
|
|
1658
|
+
get onMouseOver() { return Event.map(this.view.onMouseOver, asTreeMouseEvent); }
|
|
1659
|
+
get onMouseOut() { return Event.map(this.view.onMouseOut, asTreeMouseEvent); }
|
|
1660
|
+
get onContextMenu() { return Event.any(Event.filter(Event.map(this.view.onContextMenu, asTreeContextMenuEvent), e => !e.isStickyScroll), this.stickyScrollController?.onContextMenu ?? Event.None); }
|
|
1661
|
+
get onPointer() { return Event.map(this.view.onPointer, asTreeMouseEvent); }
|
|
1662
|
+
get onKeyDown() { return this.view.onKeyDown; }
|
|
1663
|
+
get onDidFocus() { return this.view.onDidFocus; }
|
|
1664
|
+
get onDidChangeModel() { return Event.any(this.onDidChangeModelRelay.event, this.onDidSwapModel.event); }
|
|
1665
|
+
get onDidChangeCollapseState() { return this.onDidChangeCollapseStateRelay.event; }
|
|
1666
|
+
get expandOnDoubleClick() { return typeof this._options.expandOnDoubleClick === 'undefined' ? true : this._options.expandOnDoubleClick; }
|
|
1667
|
+
get expandOnlyOnTwistieClick() { return typeof this._options.expandOnlyOnTwistieClick === 'undefined' ? true : this._options.expandOnlyOnTwistieClick; }
|
|
1668
|
+
get onDidDispose() { return this.view.onDidDispose; }
|
|
1669
|
+
constructor(_user, container, delegate, renderers, _options = {}) {
|
|
1670
|
+
this._user = _user;
|
|
1671
|
+
this._options = _options;
|
|
1672
|
+
this.eventBufferer = new EventBufferer();
|
|
1673
|
+
this.onDidChangeFindOpenState = Event.None;
|
|
1674
|
+
this.onDidChangeStickyScrollFocused = Event.None;
|
|
1675
|
+
this.disposables = new DisposableStore();
|
|
1676
|
+
this.onDidSwapModel = this.disposables.add(new Emitter());
|
|
1677
|
+
this.onDidChangeModelRelay = this.disposables.add(new Relay());
|
|
1678
|
+
this.onDidSpliceModelRelay = this.disposables.add(new Relay());
|
|
1679
|
+
this.onDidChangeCollapseStateRelay = this.disposables.add(new Relay());
|
|
1680
|
+
this.onDidChangeRenderNodeCountRelay = this.disposables.add(new Relay());
|
|
1681
|
+
this.onDidChangeActiveNodesRelay = this.disposables.add(new Relay());
|
|
1682
|
+
this._onWillRefilter = new Emitter();
|
|
1683
|
+
this.onWillRefilter = this._onWillRefilter.event;
|
|
1684
|
+
this._onDidUpdateOptions = new Emitter();
|
|
1685
|
+
this.modelDisposables = new DisposableStore();
|
|
1686
|
+
if (_options.keyboardNavigationLabelProvider && (_options.findWidgetEnabled ?? true)) {
|
|
1687
|
+
this.findFilter = new FindFilter(_options.keyboardNavigationLabelProvider, _options.filter, _options.defaultFindVisibility);
|
|
1688
|
+
_options = { ..._options, filter: this.findFilter }; // TODO need typescript help here
|
|
1689
|
+
this.disposables.add(this.findFilter);
|
|
1690
|
+
}
|
|
1691
|
+
this.model = this.createModel(_user, _options);
|
|
1692
|
+
this.treeDelegate = new ComposedTreeDelegate(delegate);
|
|
1693
|
+
const activeNodes = this.disposables.add(new EventCollection(this.onDidChangeActiveNodesRelay.event));
|
|
1694
|
+
const renderedIndentGuides = new SetMap();
|
|
1695
|
+
this.renderers = renderers.map(r => new TreeRenderer(r, this.model, this.onDidChangeCollapseStateRelay.event, activeNodes, renderedIndentGuides, _options));
|
|
1696
|
+
for (const r of this.renderers) {
|
|
1697
|
+
this.disposables.add(r);
|
|
1698
|
+
}
|
|
1699
|
+
this.focus = new Trait(() => this.view.getFocusedElements()[0], _options.identityProvider);
|
|
1700
|
+
this.selection = new Trait(() => this.view.getSelectedElements()[0], _options.identityProvider);
|
|
1701
|
+
this.anchor = new Trait(() => this.view.getAnchorElement(), _options.identityProvider);
|
|
1702
|
+
this.view = new TreeNodeList(_user, container, this.treeDelegate, this.renderers, this.focus, this.selection, this.anchor, { ...asListOptions(() => this.model, this.disposables, _options), tree: this, stickyScrollProvider: () => this.stickyScrollController });
|
|
1703
|
+
this.setupModel(this.model); // model needs to be setup after the traits have been created
|
|
1704
|
+
if (_options.keyboardSupport !== false) {
|
|
1705
|
+
const onKeyDown = Event.chain(this.view.onKeyDown, $ => $.filter(e => !isEditableElement(e.target))
|
|
1706
|
+
.map(e => new StandardKeyboardEvent(e)));
|
|
1707
|
+
Event.chain(onKeyDown, $ => $.filter(e => e.keyCode === 15 /* KeyCode.LeftArrow */))(this.onLeftArrow, this, this.disposables);
|
|
1708
|
+
Event.chain(onKeyDown, $ => $.filter(e => e.keyCode === 17 /* KeyCode.RightArrow */))(this.onRightArrow, this, this.disposables);
|
|
1709
|
+
Event.chain(onKeyDown, $ => $.filter(e => e.keyCode === 10 /* KeyCode.Space */))(this.onSpace, this, this.disposables);
|
|
1710
|
+
}
|
|
1711
|
+
if ((_options.findWidgetEnabled ?? true) && _options.keyboardNavigationLabelProvider && _options.contextViewProvider) {
|
|
1712
|
+
const findOptions = {
|
|
1713
|
+
styles: _options.findWidgetStyles,
|
|
1714
|
+
defaultFindMode: _options.defaultFindMode,
|
|
1715
|
+
defaultFindMatchType: _options.defaultFindMatchType,
|
|
1716
|
+
showNotFoundMessage: _options.showNotFoundMessage,
|
|
1717
|
+
};
|
|
1718
|
+
this.findController = this.disposables.add(new FindController(this, this.findFilter, _options.contextViewProvider, findOptions));
|
|
1719
|
+
this.focusNavigationFilter = node => this.findController.shouldAllowFocus(node);
|
|
1720
|
+
this.onDidChangeFindOpenState = this.findController.onDidChangeOpenState;
|
|
1721
|
+
this.onDidChangeFindMode = this.findController.onDidChangeMode;
|
|
1722
|
+
this.onDidChangeFindMatchType = this.findController.onDidChangeMatchType;
|
|
1723
|
+
}
|
|
1724
|
+
else {
|
|
1725
|
+
this.onDidChangeFindMode = Event.None;
|
|
1726
|
+
this.onDidChangeFindMatchType = Event.None;
|
|
1727
|
+
}
|
|
1728
|
+
if (_options.enableStickyScroll) {
|
|
1729
|
+
this.stickyScrollController = new StickyScrollController(this, this.model, this.view, this.renderers, this.treeDelegate, _options);
|
|
1730
|
+
this.onDidChangeStickyScrollFocused = this.stickyScrollController.onDidChangeHasFocus;
|
|
1731
|
+
}
|
|
1732
|
+
this.styleElement = createStyleSheet(this.view.getHTMLElement());
|
|
1733
|
+
this.getHTMLElement().classList.toggle('always', this._options.renderIndentGuides === RenderIndentGuides.Always);
|
|
1734
|
+
}
|
|
1735
|
+
updateOptions(optionsUpdate = {}) {
|
|
1736
|
+
this._options = { ...this._options, ...optionsUpdate };
|
|
1737
|
+
for (const renderer of this.renderers) {
|
|
1738
|
+
renderer.updateOptions(optionsUpdate);
|
|
1739
|
+
}
|
|
1740
|
+
this.view.updateOptions(this._options);
|
|
1741
|
+
this.findController?.updateOptions(optionsUpdate);
|
|
1742
|
+
this.updateStickyScroll(optionsUpdate);
|
|
1743
|
+
this._onDidUpdateOptions.fire(this._options);
|
|
1744
|
+
this.getHTMLElement().classList.toggle('always', this._options.renderIndentGuides === RenderIndentGuides.Always);
|
|
1745
|
+
}
|
|
1746
|
+
get options() {
|
|
1747
|
+
return this._options;
|
|
1748
|
+
}
|
|
1749
|
+
updateStickyScroll(optionsUpdate) {
|
|
1750
|
+
if (!this.stickyScrollController && this._options.enableStickyScroll) {
|
|
1751
|
+
this.stickyScrollController = new StickyScrollController(this, this.model, this.view, this.renderers, this.treeDelegate, this._options);
|
|
1752
|
+
this.onDidChangeStickyScrollFocused = this.stickyScrollController.onDidChangeHasFocus;
|
|
1753
|
+
}
|
|
1754
|
+
else if (this.stickyScrollController && !this._options.enableStickyScroll) {
|
|
1755
|
+
this.onDidChangeStickyScrollFocused = Event.None;
|
|
1756
|
+
this.stickyScrollController.dispose();
|
|
1757
|
+
this.stickyScrollController = undefined;
|
|
1758
|
+
}
|
|
1759
|
+
this.stickyScrollController?.updateOptions(optionsUpdate);
|
|
1760
|
+
}
|
|
1761
|
+
// Widget
|
|
1762
|
+
getHTMLElement() {
|
|
1763
|
+
return this.view.getHTMLElement();
|
|
1764
|
+
}
|
|
1765
|
+
get onDidChangeContentHeight() {
|
|
1766
|
+
return this.view.onDidChangeContentHeight;
|
|
1767
|
+
}
|
|
1768
|
+
get scrollTop() {
|
|
1769
|
+
return this.view.scrollTop;
|
|
1770
|
+
}
|
|
1771
|
+
set scrollTop(scrollTop) {
|
|
1772
|
+
this.view.scrollTop = scrollTop;
|
|
1773
|
+
}
|
|
1774
|
+
get scrollHeight() {
|
|
1775
|
+
return this.view.scrollHeight;
|
|
1776
|
+
}
|
|
1777
|
+
get renderHeight() {
|
|
1778
|
+
return this.view.renderHeight;
|
|
1779
|
+
}
|
|
1780
|
+
get ariaLabel() {
|
|
1781
|
+
return this.view.ariaLabel;
|
|
1782
|
+
}
|
|
1783
|
+
set ariaLabel(value) {
|
|
1784
|
+
this.view.ariaLabel = value;
|
|
1785
|
+
}
|
|
1786
|
+
domFocus() {
|
|
1787
|
+
if (this.stickyScrollController?.focusedLast()) {
|
|
1788
|
+
this.stickyScrollController.domFocus();
|
|
1789
|
+
}
|
|
1790
|
+
else {
|
|
1791
|
+
this.view.domFocus();
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
layout(height, width) {
|
|
1795
|
+
this.view.layout(height, width);
|
|
1796
|
+
}
|
|
1797
|
+
style(styles) {
|
|
1798
|
+
const suffix = `.${this.view.domId}`;
|
|
1799
|
+
const content = [];
|
|
1800
|
+
if (styles.treeIndentGuidesStroke) {
|
|
1801
|
+
content.push(`.monaco-list${suffix}:hover .monaco-tl-indent > .indent-guide, .monaco-list${suffix}.always .monaco-tl-indent > .indent-guide { opacity: 1; border-color: ${styles.treeInactiveIndentGuidesStroke}; }`);
|
|
1802
|
+
content.push(`.monaco-list${suffix} .monaco-tl-indent > .indent-guide.active { opacity: 1; border-color: ${styles.treeIndentGuidesStroke}; }`);
|
|
1803
|
+
}
|
|
1804
|
+
// Sticky Scroll Background
|
|
1805
|
+
const stickyScrollBackground = styles.treeStickyScrollBackground ?? styles.listBackground;
|
|
1806
|
+
if (stickyScrollBackground) {
|
|
1807
|
+
content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${stickyScrollBackground}; }`);
|
|
1808
|
+
content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${stickyScrollBackground}; }`);
|
|
1809
|
+
}
|
|
1810
|
+
// Sticky Scroll Border
|
|
1811
|
+
if (styles.treeStickyScrollBorder) {
|
|
1812
|
+
content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${styles.treeStickyScrollBorder}; }`);
|
|
1813
|
+
}
|
|
1814
|
+
// Sticky Scroll Shadow
|
|
1815
|
+
if (styles.treeStickyScrollShadow) {
|
|
1816
|
+
content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${styles.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`);
|
|
1817
|
+
}
|
|
1818
|
+
// Sticky Scroll Focus
|
|
1819
|
+
if (styles.listFocusForeground) {
|
|
1820
|
+
content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${styles.listFocusForeground}; }`);
|
|
1821
|
+
content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`);
|
|
1822
|
+
}
|
|
1823
|
+
// Sticky Scroll Focus Outlines
|
|
1824
|
+
const focusAndSelectionOutline = asCssValueWithDefault(styles.listFocusAndSelectionOutline, asCssValueWithDefault(styles.listSelectionOutline, styles.listFocusOutline ?? ''));
|
|
1825
|
+
if (focusAndSelectionOutline) { // default: listFocusOutline
|
|
1826
|
+
content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${focusAndSelectionOutline}; outline-offset: -1px;}`);
|
|
1827
|
+
content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`);
|
|
1828
|
+
}
|
|
1829
|
+
if (styles.listFocusOutline) { // default: set
|
|
1830
|
+
content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }`);
|
|
1831
|
+
content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`);
|
|
1832
|
+
content.push(`.context-menu-visible .monaco-list${suffix}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }`);
|
|
1833
|
+
content.push(`.context-menu-visible .monaco-list${suffix}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`);
|
|
1834
|
+
content.push(`.context-menu-visible .monaco-list${suffix}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`);
|
|
1835
|
+
}
|
|
1836
|
+
this.styleElement.textContent = content.join('\n');
|
|
1837
|
+
this.view.style(styles);
|
|
1838
|
+
}
|
|
1839
|
+
// Tree navigation
|
|
1840
|
+
getParentElement(location) {
|
|
1841
|
+
const parentRef = this.model.getParentNodeLocation(location);
|
|
1842
|
+
const parentNode = this.model.getNode(parentRef);
|
|
1843
|
+
return parentNode.element;
|
|
1844
|
+
}
|
|
1845
|
+
getFirstElementChild(location) {
|
|
1846
|
+
return this.model.getFirstElementChild(location);
|
|
1847
|
+
}
|
|
1848
|
+
// Tree
|
|
1849
|
+
getNode(location) {
|
|
1850
|
+
return this.model.getNode(location);
|
|
1851
|
+
}
|
|
1852
|
+
getNodeLocation(node) {
|
|
1853
|
+
return this.model.getNodeLocation(node);
|
|
1854
|
+
}
|
|
1855
|
+
collapse(location, recursive = false) {
|
|
1856
|
+
return this.model.setCollapsed(location, true, recursive);
|
|
1857
|
+
}
|
|
1858
|
+
expand(location, recursive = false) {
|
|
1859
|
+
return this.model.setCollapsed(location, false, recursive);
|
|
1860
|
+
}
|
|
1861
|
+
toggleCollapsed(location, recursive = false) {
|
|
1862
|
+
return this.model.setCollapsed(location, undefined, recursive);
|
|
1863
|
+
}
|
|
1864
|
+
isCollapsible(location) {
|
|
1865
|
+
return this.model.isCollapsible(location);
|
|
1866
|
+
}
|
|
1867
|
+
setCollapsible(location, collapsible) {
|
|
1868
|
+
return this.model.setCollapsible(location, collapsible);
|
|
1869
|
+
}
|
|
1870
|
+
isCollapsed(location) {
|
|
1871
|
+
return this.model.isCollapsed(location);
|
|
1872
|
+
}
|
|
1873
|
+
refilter() {
|
|
1874
|
+
this._onWillRefilter.fire(undefined);
|
|
1875
|
+
this.model.refilter();
|
|
1876
|
+
}
|
|
1877
|
+
setSelection(elements, browserEvent) {
|
|
1878
|
+
this.eventBufferer.bufferEvents(() => {
|
|
1879
|
+
const nodes = elements.map(e => this.model.getNode(e));
|
|
1880
|
+
this.selection.set(nodes, browserEvent);
|
|
1881
|
+
const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i > -1);
|
|
1882
|
+
this.view.setSelection(indexes, browserEvent, true);
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
getSelection() {
|
|
1886
|
+
return this.selection.get();
|
|
1887
|
+
}
|
|
1888
|
+
setFocus(elements, browserEvent) {
|
|
1889
|
+
this.eventBufferer.bufferEvents(() => {
|
|
1890
|
+
const nodes = elements.map(e => this.model.getNode(e));
|
|
1891
|
+
this.focus.set(nodes, browserEvent);
|
|
1892
|
+
const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i > -1);
|
|
1893
|
+
this.view.setFocus(indexes, browserEvent, true);
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
focusNext(n = 1, loop = false, browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) {
|
|
1897
|
+
this.view.focusNext(n, loop, browserEvent, filter);
|
|
1898
|
+
}
|
|
1899
|
+
focusPrevious(n = 1, loop = false, browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) {
|
|
1900
|
+
this.view.focusPrevious(n, loop, browserEvent, filter);
|
|
1901
|
+
}
|
|
1902
|
+
focusNextPage(browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) {
|
|
1903
|
+
return this.view.focusNextPage(browserEvent, filter);
|
|
1904
|
+
}
|
|
1905
|
+
focusPreviousPage(browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) {
|
|
1906
|
+
return this.view.focusPreviousPage(browserEvent, filter, () => this.stickyScrollController?.height ?? 0);
|
|
1907
|
+
}
|
|
1908
|
+
focusLast(browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) {
|
|
1909
|
+
this.view.focusLast(browserEvent, filter);
|
|
1910
|
+
}
|
|
1911
|
+
focusFirst(browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) {
|
|
1912
|
+
this.view.focusFirst(browserEvent, filter);
|
|
1913
|
+
}
|
|
1914
|
+
getFocus() {
|
|
1915
|
+
return this.focus.get();
|
|
1916
|
+
}
|
|
1917
|
+
reveal(location, relativeTop) {
|
|
1918
|
+
this.model.expandTo(location);
|
|
1919
|
+
const index = this.model.getListIndex(location);
|
|
1920
|
+
if (index === -1) {
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1923
|
+
if (!this.stickyScrollController) {
|
|
1924
|
+
this.view.reveal(index, relativeTop);
|
|
1925
|
+
}
|
|
1926
|
+
else {
|
|
1927
|
+
const paddingTop = this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(location));
|
|
1928
|
+
this.view.reveal(index, relativeTop, paddingTop);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
// List
|
|
1932
|
+
onLeftArrow(e) {
|
|
1933
|
+
e.preventDefault();
|
|
1934
|
+
e.stopPropagation();
|
|
1935
|
+
const nodes = this.view.getFocusedElements();
|
|
1936
|
+
if (nodes.length === 0) {
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
const node = nodes[0];
|
|
1940
|
+
const location = this.model.getNodeLocation(node);
|
|
1941
|
+
const didChange = this.model.setCollapsed(location, true);
|
|
1942
|
+
if (!didChange) {
|
|
1943
|
+
const parentLocation = this.model.getParentNodeLocation(location);
|
|
1944
|
+
if (!parentLocation) {
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
const parentListIndex = this.model.getListIndex(parentLocation);
|
|
1948
|
+
this.view.reveal(parentListIndex);
|
|
1949
|
+
this.view.setFocus([parentListIndex]);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
onRightArrow(e) {
|
|
1953
|
+
e.preventDefault();
|
|
1954
|
+
e.stopPropagation();
|
|
1955
|
+
const nodes = this.view.getFocusedElements();
|
|
1956
|
+
if (nodes.length === 0) {
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1959
|
+
const node = nodes[0];
|
|
1960
|
+
const location = this.model.getNodeLocation(node);
|
|
1961
|
+
const didChange = this.model.setCollapsed(location, false);
|
|
1962
|
+
if (!didChange) {
|
|
1963
|
+
if (!node.children.some(child => child.visible)) {
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
const [focusedIndex] = this.view.getFocus();
|
|
1967
|
+
const firstChildIndex = focusedIndex + 1;
|
|
1968
|
+
this.view.reveal(firstChildIndex);
|
|
1969
|
+
this.view.setFocus([firstChildIndex]);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
onSpace(e) {
|
|
1973
|
+
e.preventDefault();
|
|
1974
|
+
e.stopPropagation();
|
|
1975
|
+
const nodes = this.view.getFocusedElements();
|
|
1976
|
+
if (nodes.length === 0) {
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
const node = nodes[0];
|
|
1980
|
+
const location = this.model.getNodeLocation(node);
|
|
1981
|
+
const recursive = e.browserEvent.altKey;
|
|
1982
|
+
this.model.setCollapsed(location, undefined, recursive);
|
|
1983
|
+
}
|
|
1984
|
+
setupModel(model) {
|
|
1985
|
+
this.modelDisposables.clear();
|
|
1986
|
+
this.modelDisposables.add(model.onDidSpliceRenderedNodes(({ start, deleteCount, elements }) => this.view.splice(start, deleteCount, elements)));
|
|
1987
|
+
const onDidModelSplice = Event.forEach(model.onDidSpliceModel, e => {
|
|
1988
|
+
this.eventBufferer.bufferEvents(() => {
|
|
1989
|
+
this.focus.onDidModelSplice(e);
|
|
1990
|
+
this.selection.onDidModelSplice(e);
|
|
1991
|
+
});
|
|
1992
|
+
}, this.modelDisposables);
|
|
1993
|
+
// Make sure the `forEach` always runs
|
|
1994
|
+
onDidModelSplice(() => null, null, this.modelDisposables);
|
|
1995
|
+
// Active nodes can change when the model changes or when focus or selection change.
|
|
1996
|
+
// We debounce it with 0 delay since these events may fire in the same stack and we only
|
|
1997
|
+
// want to run this once. It also doesn't matter if it runs on the next tick since it's only
|
|
1998
|
+
// a nice to have UI feature.
|
|
1999
|
+
const activeNodesEmitter = this.modelDisposables.add(new Emitter());
|
|
2000
|
+
const activeNodesDebounce = this.modelDisposables.add(new Delayer(0));
|
|
2001
|
+
this.modelDisposables.add(Event.any(onDidModelSplice, this.focus.onDidChange, this.selection.onDidChange)(() => {
|
|
2002
|
+
activeNodesDebounce.trigger(() => {
|
|
2003
|
+
const set = new Set();
|
|
2004
|
+
for (const node of this.focus.getNodes()) {
|
|
2005
|
+
set.add(node);
|
|
2006
|
+
}
|
|
2007
|
+
for (const node of this.selection.getNodes()) {
|
|
2008
|
+
set.add(node);
|
|
2009
|
+
}
|
|
2010
|
+
activeNodesEmitter.fire([...set.values()]);
|
|
2011
|
+
});
|
|
2012
|
+
}));
|
|
2013
|
+
this.onDidChangeActiveNodesRelay.input = activeNodesEmitter.event;
|
|
2014
|
+
this.onDidChangeModelRelay.input = Event.signal(model.onDidSpliceModel);
|
|
2015
|
+
this.onDidChangeCollapseStateRelay.input = model.onDidChangeCollapseState;
|
|
2016
|
+
this.onDidChangeRenderNodeCountRelay.input = model.onDidChangeRenderNodeCount;
|
|
2017
|
+
this.onDidSpliceModelRelay.input = model.onDidSpliceModel;
|
|
2018
|
+
}
|
|
2019
|
+
dispose() {
|
|
2020
|
+
dispose(this.disposables);
|
|
2021
|
+
this.stickyScrollController?.dispose();
|
|
2022
|
+
this.view.dispose();
|
|
2023
|
+
this.modelDisposables.dispose();
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
export { AbstractFindController, AbstractTree, ComposedTreeDelegate, FindController, FindFilter, FindToggles, RenderIndentGuides, TreeFindMatchType, TreeFindMode, TreeRenderer, contiguousFuzzyScore };
|