@codingame/monaco-vscode-api 1.79.1 → 1.79.2-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/api.js +10 -8
- package/dist/composite.d.ts +65 -0
- package/dist/configurationRegistry.d.ts +212 -0
- package/dist/contextkey.d.ts +1 -1
- package/dist/default-extensions/json.js +1 -0
- package/dist/default-extensions/theme-defaults.js +2 -2
- package/dist/editorBrowser.d.ts +272 -3
- package/dist/event.d.ts +6 -1
- package/dist/{extension-tools-0c4c1ad7.js → extension-tools-3c2bf0a4.js} +698 -507
- package/dist/extensions.d.ts +3 -2
- package/dist/extensions.d2.ts +6 -17
- package/dist/extensionsRegistry.d.ts +15 -9
- package/dist/files.d.ts +71 -7
- package/dist/jsonSchema.d.ts +1 -1
- package/dist/keybinding.d.ts +2 -2
- package/dist/languageFeatures.d.ts +703 -61
- package/dist/monaco.d.ts +5 -4
- package/dist/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +2 -0
- package/dist/override/vs/workbench/contrib/notebook/browser/notebookEditor.js +2 -0
- package/dist/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2 -0
- package/dist/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +2 -1
- package/dist/platform.d.ts +11 -0
- package/dist/rollup-extension-directory-plugin.js +1 -1
- package/dist/rollup-vsix-plugin.js +1 -1
- package/dist/service-override/configuration.d.ts +5 -206
- package/dist/service-override/files.d.ts +2 -2
- package/dist/service-override/files.js +1 -1
- package/dist/service-override/markers.d.ts +7 -0
- package/dist/service-override/markers.js +6 -0
- package/dist/service-override/output.d.ts +7 -0
- package/dist/service-override/output.js +22 -0
- package/dist/service-override/preferences.js +7 -1
- package/dist/service-override/quickaccess.js +0 -9
- package/dist/service-override/search.d.ts +7 -0
- package/dist/service-override/search.js +19 -0
- package/dist/service-override/terminal.d.ts +607 -0
- package/dist/service-override/terminal.js +98 -0
- package/dist/service-override/tools/editor.js +1 -1
- package/dist/service-override/views.d.ts +561 -335
- package/dist/service-override/views.js +51 -11
- package/dist/services.d.ts +2627 -108
- package/dist/services.js +3 -0
- package/dist/severity.d.ts +16 -0
- package/dist/uri.d.ts +22 -11
- package/dist/views.d.ts +270 -0
- package/dist/vscode/vs/base/common/processes.js +24 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/decorations.js +20 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/delegatingEditorImpl.js +106 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorSash.js +59 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.contribution.js +41 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.js +369 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffModel.js +247 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/lineAlignment.js +179 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/overviewRulerPart.js +121 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/style.css.js +4 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.js +184 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/utils.js +88 -0
- package/dist/vscode/vs/platform/extensionManagement/common/extensionManagement.js +38 -1
- package/dist/vscode/vs/platform/extensionManagement/common/extensionManagementUtil.js +5 -1
- package/dist/vscode/vs/platform/extensionResourceLoader/common/extensionResourceLoader.js +13 -5
- package/dist/vscode/vs/platform/files/common/fileService.js +43 -5
- package/dist/vscode/vs/platform/files/common/files.js +3 -1
- package/dist/vscode/vs/platform/languagePacks/common/languagePacks.js +4 -1
- package/dist/vscode/vs/platform/log/common/bufferLog.js +34 -0
- package/dist/vscode/vs/platform/log/common/fileLog.js +105 -0
- package/dist/vscode/vs/platform/quickinput/browser/quickPickPin.js +1 -1
- package/dist/vscode/vs/platform/remote/common/remoteAuthorityResolver.js +20 -1
- package/dist/vscode/vs/platform/request/browser/requestService.js +1 -1
- package/dist/vscode/vs/platform/request/common/request.js +3 -3
- package/dist/vscode/vs/platform/storage/common/storage.js +3 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/bufferMarkCapability.js +39 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +565 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/cwdDetectionCapability.js +27 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +22 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.js +46 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/terminalCapabilityStore.js +80 -0
- package/dist/vscode/vs/platform/terminal/common/environmentVariable.js +7 -0
- package/dist/vscode/vs/platform/terminal/common/environmentVariableCollection.js +196 -0
- package/dist/vscode/vs/platform/terminal/common/environmentVariableShared.js +23 -0
- package/dist/vscode/vs/platform/terminal/common/terminal.js +21 -1
- package/dist/vscode/vs/platform/terminal/common/terminalDataBuffering.js +45 -0
- package/dist/vscode/vs/platform/terminal/common/terminalEnvironment.js +37 -0
- package/dist/vscode/vs/platform/terminal/common/terminalPlatformConfiguration.js +622 -0
- package/dist/vscode/vs/platform/terminal/common/terminalProfiles.js +107 -0
- package/dist/vscode/vs/platform/terminal/common/terminalRecorder.js +66 -0
- package/dist/vscode/vs/platform/terminal/common/terminalStrings.js +16 -0
- package/dist/vscode/vs/platform/terminal/common/xterm/shellIntegrationAddon.js +321 -0
- package/dist/vscode/vs/platform/userDataSync/common/settingsMerge.js +39 -1
- package/dist/vscode/vs/platform/userDataSync/common/userDataSync.js +19 -0
- package/dist/vscode/vs/platform/workspace/common/canonicalUri.js +3 -0
- package/dist/vscode/vs/platform/workspace/common/virtualWorkspace.js +4 -1
- package/dist/vscode/vs/platform/workspaces/common/workspaces.js +2 -2
- package/dist/vscode/vs/workbench/api/browser/mainThreadCommands.js +2 -3
- package/dist/vscode/vs/workbench/api/browser/mainThreadEditorTabs.js +473 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadLanguageFeatures.js +45 -38
- package/dist/vscode/vs/workbench/api/browser/mainThreadSearch.js +146 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadStatusBar.js +33 -52
- package/dist/vscode/vs/workbench/api/browser/mainThreadTerminalService.js +395 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadTheming.js +22 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadTreeViews.js +10 -5
- package/dist/vscode/vs/workbench/api/browser/mainThreadWindow.js +11 -4
- package/dist/vscode/vs/workbench/api/browser/mainThreadWorkspace.js +34 -11
- package/dist/vscode/vs/workbench/api/browser/statusBarExtensionPoint.js +81 -0
- package/dist/vscode/vs/workbench/api/common/extHost.protocol.js +7 -2
- package/dist/vscode/vs/workbench/api/common/extHostDebugService.js +4 -13
- package/dist/vscode/vs/workbench/api/common/extHostExtensionService.js +30 -15
- package/dist/vscode/vs/workbench/api/common/extHostFileSystemConsumer.js +20 -6
- package/dist/vscode/vs/workbench/api/common/extHostLanguageFeatures.js +41 -8
- package/dist/vscode/vs/workbench/api/common/extHostManagedSockets.js +3 -0
- package/dist/vscode/vs/workbench/api/common/extHostSearch.js +109 -0
- package/dist/vscode/vs/workbench/api/common/extHostStatusBar.js +33 -6
- package/dist/vscode/vs/workbench/api/common/extHostTerminalService.js +879 -1
- package/dist/vscode/vs/workbench/api/common/extHostTheming.js +38 -0
- package/dist/vscode/vs/workbench/api/common/extHostTreeViews.js +8 -5
- package/dist/vscode/vs/workbench/api/common/extHostTypeConverters.js +15 -17
- package/dist/vscode/vs/workbench/api/common/extHostTypes.js +117 -4
- package/dist/vscode/vs/workbench/api/common/extHostWindow.js +28 -6
- package/dist/vscode/vs/workbench/api/common/extHostWorkspace.js +28 -0
- package/dist/vscode/vs/workbench/api/common/shared/dataTransferCache.js +11 -14
- package/dist/vscode/vs/workbench/api/node/extHostTerminalService.js +22 -0
- package/dist/vscode/vs/workbench/browser/actions/layoutActions.js +2 -1
- package/dist/vscode/vs/workbench/browser/actions/windowActions.js +2 -2
- package/dist/vscode/vs/workbench/browser/dnd.js +56 -2
- package/dist/vscode/vs/workbench/browser/parts/compositePart.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/dialogs/dialogHandler.js +2 -2
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.contribution.js +1 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.js +1 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorCommands.js +9 -10
- package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupView.js +15 -9
- package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupWatermark.js +13 -17
- package/dist/vscode/vs/workbench/browser/parts/editor/editorStatus.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editorsObserver.js +2 -2
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorgroupview.css.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/noTabsTitleControl.js +3 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/tabsTitleControl.js +60 -11
- package/dist/vscode/vs/workbench/browser/parts/editor/textDiffEditor.js +16 -10
- package/dist/vscode/vs/workbench/browser/parts/editor/textResourceEditor.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/statusbar/media/statusbarpart.css.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/views/checkbox.js +10 -0
- package/dist/vscode/vs/workbench/browser/parts/views/treeView.js +78 -14
- package/dist/vscode/vs/workbench/browser/parts/views/viewPaneContainer.js +1 -1
- package/dist/vscode/vs/workbench/browser/workbench.contribution.js +65 -6
- package/dist/vscode/vs/workbench/common/configuration.js +8 -1
- package/dist/vscode/vs/workbench/common/contextkeys.js +9 -1
- package/dist/vscode/vs/workbench/common/editor/editorGroupModel.js +5 -1
- package/dist/vscode/vs/workbench/common/editor/resourceEditorInput.js +6 -3
- package/dist/vscode/vs/workbench/common/editor/textResourceEditorInput.js +9 -6
- package/dist/vscode/vs/workbench/common/editor.js +1 -5
- package/dist/vscode/vs/workbench/common/resources.js +111 -34
- package/dist/vscode/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +1 -1
- package/dist/vscode/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +1 -1
- package/dist/vscode/vs/workbench/contrib/chat/browser/chat.js +3 -0
- package/dist/vscode/vs/workbench/contrib/chat/common/chatService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js +6 -4
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +250 -0
- package/dist/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput.js +290 -0
- package/dist/vscode/vs/workbench/contrib/customEditor/common/customEditor.js +3 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugActionViewItems.js +1 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugCommands.js +2 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +20 -20
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugEditorActions.js +5 -3
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugEditorContribution.js +5 -2
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugHover.js +33 -6
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugSession.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugTaskRunner.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/repl.js +3 -3
- package/dist/vscode/vs/workbench/contrib/debug/common/debugModel.js +29 -17
- package/dist/vscode/vs/workbench/contrib/debug/common/debugStorage.js +11 -10
- package/dist/vscode/vs/workbench/contrib/debug/common/debugger.js +10 -6
- package/dist/vscode/vs/workbench/contrib/extensions/browser/extensionsActions.js +2514 -0
- package/dist/vscode/vs/workbench/contrib/extensions/browser/extensionsIcons.js +82 -0
- package/dist/vscode/vs/workbench/contrib/extensions/browser/media/extensionActions.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/extensions/common/extensions.js +6 -1
- package/dist/vscode/vs/workbench/contrib/extensions/common/extensionsFileTemplate.js +16 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput.js +2 -3
- package/dist/vscode/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +2 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/explorerService.js +10 -6
- package/dist/vscode/vs/workbench/contrib/files/browser/explorerViewlet.js +3 -18
- package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.contribution.js +37 -2
- package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.js +65 -3
- package/dist/vscode/vs/workbench/contrib/files/browser/fileCommands.js +3 -3
- package/dist/vscode/vs/workbench/contrib/files/browser/fileConstants.js +3 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/files.contribution.js +41 -6
- package/dist/vscode/vs/workbench/contrib/files/browser/files.js +1 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/views/explorerView.js +3 -3
- package/dist/vscode/vs/workbench/contrib/files/browser/views/explorerViewer.js +6 -2
- package/dist/vscode/vs/workbench/contrib/files/common/explorerModel.js +16 -9
- package/dist/vscode/vs/workbench/contrib/files/common/files.js +1 -6
- package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +200 -0
- package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markers.contribution.js +586 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersFilterOptions.js +75 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersModel.js +201 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersTable.js +451 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersTreeViewer.js +670 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersView.js +857 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersViewActions.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersViewActions.js +132 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/media/markers.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/messages.js +171 -0
- package/dist/vscode/vs/workbench/contrib/markers/common/markers.js +15 -1
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +135 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +421 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +55 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +334 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +606 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +36 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/utils.js +68 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +2 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +158 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser.js +6 -1
- package/dist/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/notebook/common/notebookCommon.js +16 -1
- package/dist/vscode/vs/workbench/contrib/notebook/common/notebookService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/output/browser/logViewer.js +64 -0
- package/dist/vscode/vs/workbench/contrib/output/browser/output.contribution.js +378 -0
- package/dist/vscode/vs/workbench/contrib/output/browser/outputServices.js +39 -3
- package/dist/vscode/vs/workbench/contrib/output/browser/outputView.js +220 -0
- package/dist/vscode/vs/workbench/contrib/output/common/outputChannelModel.js +12 -3
- package/dist/vscode/vs/workbench/contrib/output/common/outputLinkComputer.js +129 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/keybindingWidgets.js +270 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/keybindingsEditor.js +1080 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/keybindings.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/keybindingsEditor.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/preferences.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/settingsWidgets.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferences.contribution.js +1154 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesActions.js +94 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesEditor.js +47 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesIcons.js +37 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesRenderers.js +731 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesSearch.js +271 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesWidgets.js +479 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsEditor2.js +1465 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.js +506 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsLayout.js +296 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsSearchMenu.js +79 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsTree.js +1984 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsTreeModels.js +759 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsWidgets.js +1008 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/tocTree.js +196 -0
- package/dist/vscode/vs/workbench/contrib/preferences/common/preferences.js +68 -0
- package/dist/vscode/vs/workbench/contrib/preferences/common/preferencesContribution.js +157 -0
- package/dist/vscode/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +67 -0
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +16 -16
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +1 -2
- package/dist/vscode/vs/workbench/contrib/remote/browser/remoteExplorer.js +23 -2
- package/dist/vscode/vs/workbench/contrib/remote/browser/tunnelView.js +5 -5
- package/dist/vscode/vs/workbench/contrib/search/browser/media/searchview.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/patternInputWidget.js +217 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/replace.js +3 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/replaceContributions.js +7 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/replaceService.js +222 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/search.contribution.js +54 -15
- package/dist/vscode/vs/workbench/contrib/search/browser/searchActionsBase.js +17 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchFindInput.js +41 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchIcons.js +35 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchMessage.js +58 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchModel.js +1842 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchNotebookHelpers.js +49 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchResultsView.js +379 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchView.js +1867 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchWidget.js +628 -0
- package/dist/vscode/vs/workbench/contrib/search/common/constants.js +30 -1
- package/dist/vscode/vs/workbench/contrib/search/common/search.js +9 -1
- package/dist/vscode/vs/workbench/contrib/search/common/searchHistoryService.js +42 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +477 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditor.js +697 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +188 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +295 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +135 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +268 -0
- package/dist/vscode/vs/workbench/contrib/snippets/browser/tabCompletion.js +2 -2
- package/dist/vscode/vs/workbench/contrib/tasks/common/taskService.js +16 -1
- package/dist/vscode/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +119 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/media/scrollbar.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/media/terminal.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/media/widgets.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/media/xterm.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.contribution.js +238 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalActions.js +1930 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalCommands.js +22 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalConfigHelper.js +213 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +17 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditor.js +186 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +199 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditorService.js +239 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalExtensions.js +22 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalGroup.js +482 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalGroupService.js +372 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcon.js +60 -1
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcons.js +37 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalInstance.js +2123 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalInstanceService.js +79 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalMainContribution.js +82 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalMenus.js +850 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +142 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +618 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileQuickpick.js +278 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.js +417 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileService.js +213 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalQuickAccess.js +144 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalRunRecentQuickPick.js +267 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalService.js +1063 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalStatusList.js +108 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTabbedView.js +417 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTabsList.js +680 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTooltip.js +72 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalUri.js +39 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalView.js +535 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/widgets/widgetManager.js +36 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +469 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +97 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +56 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +416 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +390 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +587 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/environmentVariable.js +3 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/environmentVariableService.js +94 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/history.js +356 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminal.js +266 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +23 -16
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalConfiguration.js +965 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalContextKey.js +157 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalEnvironment.js +272 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalExtensionPoints.js +27 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalStrings.js +86 -0
- package/dist/vscode/vs/workbench/contrib/terminal/electron-sandbox/terminalProfileResolverService.js +46 -0
- package/dist/vscode/vs/workbench/contrib/terminalContrib/links/browser/links.js +3 -0
- package/dist/vscode/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkProviderService.js +26 -0
- package/dist/vscode/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix.js +3 -0
- package/dist/vscode/vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixService.js +143 -0
- package/dist/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.js +85 -0
- package/dist/vscode/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.js +52 -0
- package/dist/vscode/vs/workbench/services/actions/common/menusExtensionPoint.js +14 -6
- package/dist/vscode/vs/workbench/services/assignment/common/assignmentService.js +3 -0
- package/dist/vscode/vs/workbench/services/configuration/browser/configurationService.js +13 -13
- package/dist/vscode/vs/workbench/services/configuration/common/configuration.js +2 -1
- package/dist/vscode/vs/workbench/services/configuration/common/configurationEditing.js +2 -2
- package/dist/vscode/vs/workbench/services/configuration/common/jsonEditingService.js +2 -2
- package/dist/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.js +3 -2
- package/dist/vscode/vs/workbench/services/extensionRecommendations/common/extensionRecommendations.js +4 -0
- package/dist/vscode/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +2 -0
- package/dist/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService.js +3 -0
- package/dist/vscode/vs/workbench/services/extensions/common/extensions.js +14 -2
- package/dist/vscode/vs/workbench/services/extensions/common/extensionsApiProposals.js +10 -1
- package/dist/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +70 -3
- package/dist/vscode/vs/workbench/services/hover/browser/hoverService.js +1 -1
- package/dist/vscode/vs/workbench/services/hover/browser/hoverWidget.js +2 -1
- package/dist/vscode/vs/workbench/services/hover/browser/media/hover.css.js +1 -1
- package/dist/vscode/vs/workbench/services/keybinding/common/keybindingEditing.js +275 -0
- package/dist/vscode/vs/workbench/services/localization/common/locale.js +3 -0
- package/dist/vscode/vs/workbench/services/log/common/logConstants.js +2 -0
- package/dist/vscode/vs/workbench/services/output/common/output.js +4 -1
- package/dist/vscode/vs/workbench/services/preferences/common/preferences.js +22 -1
- package/dist/vscode/vs/workbench/services/preferences/common/preferencesModels.js +6 -0
- package/dist/vscode/vs/workbench/services/preferences/common/preferencesValidation.js +37 -1
- package/dist/vscode/vs/workbench/services/remote/common/remoteAgentService.js +69 -0
- package/dist/vscode/vs/workbench/services/remote/common/remoteExplorerService.js +66 -27
- package/dist/vscode/vs/workbench/services/search/common/fileSearchManager.js +265 -0
- package/dist/vscode/vs/workbench/services/search/common/queryBuilder.js +6 -0
- package/dist/vscode/vs/workbench/services/search/common/replace.js +203 -0
- package/dist/vscode/vs/workbench/services/search/common/search.js +227 -1
- package/dist/vscode/vs/workbench/services/search/common/searchExtTypes.js +6 -0
- package/dist/vscode/vs/workbench/services/search/common/searchHelpers.js +72 -0
- package/dist/vscode/vs/workbench/services/search/common/searchService.js +355 -0
- package/dist/vscode/vs/workbench/services/search/common/textSearchManager.js +309 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/media/suggest.css.js +4 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/simpleCompletionItem.js +10 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/simpleCompletionModel.js +98 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +399 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +83 -0
- package/dist/vscode/vs/workbench/services/terminal/common/embedderTerminalService.js +3 -0
- package/dist/vscode/vs/workbench/services/textfile/browser/textFileService.js +1 -1
- package/dist/vscode/vs/workbench/services/textfile/common/textFileEditorModel.js +10 -3
- package/dist/vscode/vs/workbench/services/themes/browser/fileIconThemeData.js +3 -3
- package/dist/vscode/vs/workbench/services/themes/browser/productIconThemeData.js +3 -3
- package/dist/vscode/vs/workbench/services/themes/common/colorThemeData.js +3 -3
- package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput.js +6 -4
- package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorModel.js +3 -0
- package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.js +4 -0
- package/dist/vscode/vs/workbench/services/userActivity/common/userActivityRegistry.js +15 -0
- package/dist/vscode/vs/workbench/services/userActivity/common/userActivityService.js +37 -0
- package/dist/vscode/vs/workbench/services/userDataSync/common/userDataSync.js +7 -0
- package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.js +40 -0
- package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyService.js +12 -0
- package/dist/vscode/vs/workbench/services/workspaces/common/canonicalUriService.js +19 -0
- package/dist/vscode-default-extensions/css/syntaxes/css.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/json/package.json.js +1 -1
- package/dist/vscode-default-extensions/json/syntaxes/JSONC.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/json/syntaxes/JSONL.tmLanguage.json.extensionResource.js +2 -0
- package/dist/vscode-default-extensions/latex/syntaxes/Bibtex.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/latex/syntaxes/LaTeX.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/latex/syntaxes/TeX.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/lua/syntaxes/lua.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/perl/package.json.js +1 -1
- package/dist/vscode-default-extensions/php/snippets/php.code-snippets.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/sql/language-configuration.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-abyss/themes/abyss-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/package.json.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/themes/dark_modern.json.extensionResource.js +2 -0
- package/dist/vscode-default-extensions/theme-defaults/themes/dark_vs.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/themes/hc_black.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/themes/hc_light.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/themes/light_modern.json.extensionResource.js +2 -0
- package/dist/vscode-default-extensions/theme-defaults/themes/light_vs.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-kimbie-dark/themes/kimbie-dark-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-monokai/themes/monokai-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-monokai-dimmed/themes/dimmed-monokai-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-quietlight/themes/quietlight-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-red/themes/Red-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-seti/icons/vs-seti-icon-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-solarized-dark/themes/solarized-dark-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-solarized-light/themes/solarized-light-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-tomorrow-night-blue/themes/tomorrow-night-blue-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/vb/language-configuration.json.extensionResource.js +1 -1
- package/dist/vscode-services/env.js +4 -2
- package/dist/vscode-services/extHost.js +32 -48
- package/dist/vscode-services/missing-services.js +407 -29
- package/dist/vscode-services/window.js +59 -65
- package/dist/vscode-services/workspace.js +19 -5
- package/dist/workers/outputLinkComputer.worker.d.ts +2 -0
- package/dist/workers/outputLinkComputer.worker.js +3 -0
- package/dist/workspace.d.ts +1 -1
- package/monaco-editor-treemending.patch +1305 -1184
- package/package.json +65 -19
- package/dist/activity.d.ts +0 -2802
- package/dist/collections.d.ts +0 -7
- package/dist/colorRegistry.d.ts +0 -710
- package/dist/vscode/vs/platform/product/common/product.js +0 -48
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionFollowups.js +0 -30
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionInputPart.js +0 -196
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionListRenderer.js +0 -622
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionOptions.js +0 -77
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionWidget.js +0 -311
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/media/interactiveSession.css.js +0 -4
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionContextKeys.js +0 -56
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionModel.js +0 -305
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionService.js +0 -13
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionServiceImpl.js +0 -379
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionViewModel.js +0 -207
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionWidgetHistoryService.js +0 -3
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionWordCounter.js +0 -25
- package/dist/vscode-default-extensions/theme-defaults/themes/dark_plus_experimental.json.extensionResource.js +0 -2
- package/dist/vscode-default-extensions/theme-defaults/themes/light_plus_experimental.json.extensionResource.js +0 -2
|
@@ -0,0 +1,1867 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
+
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
4
|
+
import * as aria from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
|
|
5
|
+
import { ObjectTreeElementCollapseState } from 'monaco-editor/esm/vs/base/browser/ui/tree/tree.js';
|
|
6
|
+
import { Delayer, RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
7
|
+
import * as errors from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
8
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
9
|
+
import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
|
|
10
|
+
import { DisposableStore, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
11
|
+
import * as platform from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
12
|
+
import * as strings from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
13
|
+
import { withNullAsUndefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
14
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
15
|
+
import * as network from 'monaco-editor/esm/vs/base/common/network.js';
|
|
16
|
+
import './media/searchview.css.js';
|
|
17
|
+
import { isCodeEditor, isDiffEditor, getCodeEditor } from 'monaco-editor/esm/vs/editor/browser/editorBrowser.js';
|
|
18
|
+
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
19
|
+
import { EmbeddedCodeEditorWidget } from 'monaco-editor/esm/vs/editor/browser/widget/embeddedCodeEditorWidget.js';
|
|
20
|
+
import { Selection } from 'monaco-editor/esm/vs/editor/common/core/selection.js';
|
|
21
|
+
import { CommonFindController } from 'monaco-editor/esm/vs/editor/contrib/find/browser/findController.js';
|
|
22
|
+
import { MultiCursorSelectionController } from 'monaco-editor/esm/vs/editor/contrib/multicursor/browser/multicursor.js';
|
|
23
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
24
|
+
import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
|
|
25
|
+
import { MenuId } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
26
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
27
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
28
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
29
|
+
import { IContextViewService, IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
30
|
+
import { IDialogService } from 'monaco-editor/esm/vs/platform/dialogs/common/dialogs.js';
|
|
31
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
32
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
33
|
+
import { ServiceCollection } from 'monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js';
|
|
34
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
35
|
+
import { WorkbenchCompressibleObjectTree, getSelectionKeyboardEvent } from 'monaco-editor/esm/vs/platform/list/browser/listService.js';
|
|
36
|
+
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
37
|
+
import { withSelection, IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
|
|
38
|
+
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
39
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
40
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
41
|
+
import { defaultInputBoxStyles, defaultToggleStyles } from 'monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js';
|
|
42
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
43
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
44
|
+
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
45
|
+
import { OpenFileFolderAction, OpenFolderAction } from '../../../browser/actions/workspaceActions.js';
|
|
46
|
+
import { ResourceListDnDHandler } from '../../../browser/dnd.js';
|
|
47
|
+
import { ResourceLabels } from '../../../browser/labels.js';
|
|
48
|
+
import { ViewPane } from '../../../browser/parts/views/viewPane.js';
|
|
49
|
+
import { Memento } from '../../../common/memento.js';
|
|
50
|
+
import { IViewDescriptorService } from '../../../common/views.js';
|
|
51
|
+
import { NotebookEditor } from '../../../../../../override/vs/workbench/contrib/notebook/browser/notebookEditor.js';
|
|
52
|
+
import { IncludePatternInputWidget, ExcludePatternInputWidget } from './patternInputWidget.js';
|
|
53
|
+
import { appendKeyBindingLabel } from './searchActionsBase.js';
|
|
54
|
+
import { searchDetailsIcon } from './searchIcons.js';
|
|
55
|
+
import { renderSearchMessage } from './searchMessage.js';
|
|
56
|
+
import { SearchAccessibilityProvider, SearchDelegate, FolderMatchRenderer, FileMatchRenderer, MatchRenderer } from './searchResultsView.js';
|
|
57
|
+
import { SearchWidget } from './searchWidget.js';
|
|
58
|
+
import { SearchViewVisibleKey, FirstMatchFocusKey, FileMatchOrMatchFocusKey, FileMatchOrFolderMatchFocusKey, FileMatchOrFolderMatchWithResourceFocusKey, FileFocusKey, FolderFocusKey, ResourceFolderFocusKey, HasSearchResults, MatchFocusKey, ViewHasSearchPatternKey, ViewHasReplacePatternKey, ViewHasFilePatternKey, ViewHasSomeCollapsibleKey, InTreeViewKey, SearchViewFocusedKey, InputBoxFocusedKey, PatternIncludesFocusedKey, PatternExcludesFocusedKey, IsEditableItemKey, OpenInEditorCommandId } from '../common/constants.js';
|
|
59
|
+
import { IReplaceService } from './replace.js';
|
|
60
|
+
import { SearchStateKey, SearchUIState, getOutOfWorkspaceEditorResources } from '../common/search.js';
|
|
61
|
+
import { ISearchHistoryService } from '../common/searchHistoryService.js';
|
|
62
|
+
import { searchMatchComparer, FileMatch, SearchResult, FolderMatch, Match, FolderMatchWithResource, MatchInNotebook, ISearchWorkbenchService } from './searchModel.js';
|
|
63
|
+
import { createEditorFromSearchResult } from '../../searchEditor/browser/searchEditorActions.js';
|
|
64
|
+
import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from '../../../services/editor/common/editorService.js';
|
|
65
|
+
import { IPreferencesService } from '../../../services/preferences/common/preferences.js';
|
|
66
|
+
import { QueryBuilder } from '../../../services/search/common/queryBuilder.js';
|
|
67
|
+
import '../../../services/search/common/search.js';
|
|
68
|
+
import { ITextFileService } from '../../../services/textfile/common/textfiles.js';
|
|
69
|
+
import { INotebookService } from '../../notebook/common/notebookService.js';
|
|
70
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
71
|
+
import { TextSearchCompleteMessageType } from '../../../services/search/common/searchExtTypes.js';
|
|
72
|
+
const $ = dom.$;
|
|
73
|
+
const SEARCH_CANCELLED_MESSAGE = ( nls.localize(
|
|
74
|
+
'searchCanceled',
|
|
75
|
+
"Search was canceled before any results could be found - "
|
|
76
|
+
));
|
|
77
|
+
const DEBOUNCE_DELAY = 75;
|
|
78
|
+
let SearchView = class SearchView extends ViewPane {
|
|
79
|
+
constructor(options, fileService, editorService, codeEditorService, progressService, notificationService, dialogService, commandService, contextViewService, instantiationService, viewDescriptorService, configurationService, contextService, searchWorkbenchService, contextKeyService, replaceService, textFileService, preferencesService, themeService, searchHistoryService, contextMenuService, accessibilityService, keybindingService, storageService, openerService, telemetryService, notebookService, logService) {
|
|
80
|
+
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
81
|
+
this.fileService = fileService;
|
|
82
|
+
this.editorService = editorService;
|
|
83
|
+
this.codeEditorService = codeEditorService;
|
|
84
|
+
this.progressService = progressService;
|
|
85
|
+
this.notificationService = notificationService;
|
|
86
|
+
this.dialogService = dialogService;
|
|
87
|
+
this.commandService = commandService;
|
|
88
|
+
this.contextViewService = contextViewService;
|
|
89
|
+
this.contextService = contextService;
|
|
90
|
+
this.searchWorkbenchService = searchWorkbenchService;
|
|
91
|
+
this.replaceService = replaceService;
|
|
92
|
+
this.textFileService = textFileService;
|
|
93
|
+
this.preferencesService = preferencesService;
|
|
94
|
+
this.searchHistoryService = searchHistoryService;
|
|
95
|
+
this.accessibilityService = accessibilityService;
|
|
96
|
+
this.notebookService = notebookService;
|
|
97
|
+
this.logService = logService;
|
|
98
|
+
this.isDisposed = false;
|
|
99
|
+
this.lastFocusState = 'input';
|
|
100
|
+
this.messageDisposables = ( new DisposableStore());
|
|
101
|
+
this.changedWhileHidden = false;
|
|
102
|
+
this.currentSearchQ = Promise.resolve();
|
|
103
|
+
this.pauseSearching = false;
|
|
104
|
+
this._visibleMatches = 0;
|
|
105
|
+
this.container = dom.$('.search-view');
|
|
106
|
+
this.viewletVisible = SearchViewVisibleKey.bindTo(this.contextKeyService);
|
|
107
|
+
this.firstMatchFocused = FirstMatchFocusKey.bindTo(this.contextKeyService);
|
|
108
|
+
this.fileMatchOrMatchFocused = FileMatchOrMatchFocusKey.bindTo(this.contextKeyService);
|
|
109
|
+
this.fileMatchOrFolderMatchFocus = FileMatchOrFolderMatchFocusKey.bindTo(this.contextKeyService);
|
|
110
|
+
this.fileMatchOrFolderMatchWithResourceFocus = FileMatchOrFolderMatchWithResourceFocusKey.bindTo(this.contextKeyService);
|
|
111
|
+
this.fileMatchFocused = FileFocusKey.bindTo(this.contextKeyService);
|
|
112
|
+
this.folderMatchFocused = FolderFocusKey.bindTo(this.contextKeyService);
|
|
113
|
+
this.folderMatchWithResourceFocused = ResourceFolderFocusKey.bindTo(this.contextKeyService);
|
|
114
|
+
this.hasSearchResultsKey = HasSearchResults.bindTo(this.contextKeyService);
|
|
115
|
+
this.matchFocused = MatchFocusKey.bindTo(this.contextKeyService);
|
|
116
|
+
this.searchStateKey = SearchStateKey.bindTo(this.contextKeyService);
|
|
117
|
+
this.hasSearchPatternKey = ViewHasSearchPatternKey.bindTo(this.contextKeyService);
|
|
118
|
+
this.hasReplacePatternKey = ViewHasReplacePatternKey.bindTo(this.contextKeyService);
|
|
119
|
+
this.hasFilePatternKey = ViewHasFilePatternKey.bindTo(this.contextKeyService);
|
|
120
|
+
this.hasSomeCollapsibleResultKey = ViewHasSomeCollapsibleKey.bindTo(this.contextKeyService);
|
|
121
|
+
this.treeViewKey = InTreeViewKey.bindTo(this.contextKeyService);
|
|
122
|
+
this.contextKeyService = this._register(this.contextKeyService.createScoped(this.container));
|
|
123
|
+
SearchViewFocusedKey.bindTo(this.contextKeyService).set(true);
|
|
124
|
+
this.inputBoxFocused = InputBoxFocusedKey.bindTo(this.contextKeyService);
|
|
125
|
+
this.inputPatternIncludesFocused = PatternIncludesFocusedKey.bindTo(this.contextKeyService);
|
|
126
|
+
this.inputPatternExclusionsFocused = PatternExcludesFocusedKey.bindTo(this.contextKeyService);
|
|
127
|
+
this.isEditableItem = IsEditableItemKey.bindTo(this.contextKeyService);
|
|
128
|
+
this.instantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.contextKeyService])));
|
|
129
|
+
this.configurationService.onDidChangeConfiguration(e => {
|
|
130
|
+
if (e.affectsConfiguration('search.sortOrder')) {
|
|
131
|
+
if (this.searchConfig.sortOrder === "modified" ) {
|
|
132
|
+
this.removeFileStats();
|
|
133
|
+
}
|
|
134
|
+
this.refreshTree();
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
this.viewModel = this._register(this.searchWorkbenchService.searchModel);
|
|
138
|
+
this.queryBuilder = this.instantiationService.createInstance(QueryBuilder);
|
|
139
|
+
this.memento = ( new Memento(this.id, storageService));
|
|
140
|
+
this.viewletState = this.memento.getMemento(1 , 1 );
|
|
141
|
+
this._register(this.fileService.onDidFilesChange(e => this.onFilesChanged(e)));
|
|
142
|
+
this._register(this.textFileService.untitled.onWillDispose(model => this.onUntitledDidDispose(model.resource)));
|
|
143
|
+
this._register(this.contextService.onDidChangeWorkbenchState(() => this.onDidChangeWorkbenchState()));
|
|
144
|
+
this._register(this.searchHistoryService.onDidClearHistory(() => this.clearHistory()));
|
|
145
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
|
|
146
|
+
this.delayedRefresh = this._register(( new Delayer(250)));
|
|
147
|
+
this.addToSearchHistoryDelayer = this._register(( new Delayer(2000)));
|
|
148
|
+
this.toggleCollapseStateDelayer = this._register(( new Delayer(100)));
|
|
149
|
+
this.triggerQueryDelayer = this._register(( new Delayer(0)));
|
|
150
|
+
this.treeAccessibilityProvider = this.instantiationService.createInstance(SearchAccessibilityProvider, this.viewModel);
|
|
151
|
+
this.isTreeLayoutViewVisible = this.viewletState['view.treeLayout'] ?? ((this.searchConfig.defaultViewMode === "tree") );
|
|
152
|
+
this._refreshResultsScheduler = this._register(( new RunOnceScheduler(this._updateResults.bind(this), 80)));
|
|
153
|
+
}
|
|
154
|
+
get isTreeLayoutViewVisible() {
|
|
155
|
+
return this.treeViewKey.get() ?? false;
|
|
156
|
+
}
|
|
157
|
+
set isTreeLayoutViewVisible(visible) {
|
|
158
|
+
this.treeViewKey.set(visible);
|
|
159
|
+
}
|
|
160
|
+
setTreeView(visible) {
|
|
161
|
+
if (visible === this.isTreeLayoutViewVisible) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.isTreeLayoutViewVisible = visible;
|
|
165
|
+
this.updateIndentStyles(this.themeService.getFileIconTheme());
|
|
166
|
+
this.refreshTree();
|
|
167
|
+
}
|
|
168
|
+
get state() {
|
|
169
|
+
return this.searchStateKey.get() ?? SearchUIState.Idle;
|
|
170
|
+
}
|
|
171
|
+
set state(v) {
|
|
172
|
+
this.searchStateKey.set(v);
|
|
173
|
+
}
|
|
174
|
+
getContainer() {
|
|
175
|
+
return this.container;
|
|
176
|
+
}
|
|
177
|
+
get searchResult() {
|
|
178
|
+
return this.viewModel && this.viewModel.searchResult;
|
|
179
|
+
}
|
|
180
|
+
onDidChangeWorkbenchState() {
|
|
181
|
+
if (this.contextService.getWorkbenchState() !== 1 && this.searchWithoutFolderMessageElement) {
|
|
182
|
+
dom.hide(this.searchWithoutFolderMessageElement);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
renderBody(parent) {
|
|
186
|
+
super.renderBody(parent);
|
|
187
|
+
this.container = dom.append(parent, dom.$('.search-view'));
|
|
188
|
+
this.searchWidgetsContainerElement = dom.append(this.container, $('.search-widgets-container'));
|
|
189
|
+
this.createSearchWidget(this.searchWidgetsContainerElement);
|
|
190
|
+
const history = this.searchHistoryService.load();
|
|
191
|
+
const filePatterns = this.viewletState['query.filePatterns'] || '';
|
|
192
|
+
const patternExclusions = this.viewletState['query.folderExclusions'] || '';
|
|
193
|
+
const patternExclusionsHistory = history.exclude || [];
|
|
194
|
+
const patternIncludes = this.viewletState['query.folderIncludes'] || '';
|
|
195
|
+
const patternIncludesHistory = history.include || [];
|
|
196
|
+
const onlyOpenEditors = this.viewletState['query.onlyOpenEditors'] || false;
|
|
197
|
+
const queryDetailsExpanded = this.viewletState['query.queryDetailsExpanded'] || '';
|
|
198
|
+
const useExcludesAndIgnoreFiles = typeof this.viewletState['query.useExcludesAndIgnoreFiles'] === 'boolean' ?
|
|
199
|
+
this.viewletState['query.useExcludesAndIgnoreFiles'] : true;
|
|
200
|
+
this.queryDetails = dom.append(this.searchWidgetsContainerElement, $('.query-details'));
|
|
201
|
+
this.toggleQueryDetailsButton = dom.append(this.queryDetails, $('.more' + ThemeIcon.asCSSSelector(searchDetailsIcon), { tabindex: 0, role: 'button', title: ( nls.localize('moreSearch', "Toggle Search Details")) }));
|
|
202
|
+
this._register(dom.addDisposableListener(this.toggleQueryDetailsButton, dom.EventType.CLICK, e => {
|
|
203
|
+
dom.EventHelper.stop(e);
|
|
204
|
+
this.toggleQueryDetails(!this.accessibilityService.isScreenReaderOptimized());
|
|
205
|
+
}));
|
|
206
|
+
this._register(dom.addDisposableListener(this.toggleQueryDetailsButton, dom.EventType.KEY_UP, (e) => {
|
|
207
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
208
|
+
if (event.equals(3 ) || event.equals(10 )) {
|
|
209
|
+
dom.EventHelper.stop(e);
|
|
210
|
+
this.toggleQueryDetails(false);
|
|
211
|
+
}
|
|
212
|
+
}));
|
|
213
|
+
this._register(dom.addDisposableListener(this.toggleQueryDetailsButton, dom.EventType.KEY_DOWN, (e) => {
|
|
214
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
215
|
+
if (event.equals(1024 | 2 )) {
|
|
216
|
+
if (this.searchWidget.isReplaceActive()) {
|
|
217
|
+
this.searchWidget.focusReplaceAllAction();
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
this.searchWidget.isReplaceShown() ? this.searchWidget.replaceInput?.focusOnPreserve() : this.searchWidget.focusRegexAction();
|
|
221
|
+
}
|
|
222
|
+
dom.EventHelper.stop(e);
|
|
223
|
+
}
|
|
224
|
+
}));
|
|
225
|
+
const folderIncludesList = dom.append(this.queryDetails, $('.file-types.includes'));
|
|
226
|
+
const filesToIncludeTitle = ( nls.localize('searchScope.includes', "files to include"));
|
|
227
|
+
dom.append(folderIncludesList, $('h4', undefined, filesToIncludeTitle));
|
|
228
|
+
this.inputPatternIncludes = this._register(this.instantiationService.createInstance(IncludePatternInputWidget, folderIncludesList, this.contextViewService, {
|
|
229
|
+
ariaLabel: filesToIncludeTitle,
|
|
230
|
+
placeholder: ( nls.localize('placeholder.includes', "e.g. *.ts, src/**/include")),
|
|
231
|
+
showPlaceholderOnFocus: true,
|
|
232
|
+
history: patternIncludesHistory,
|
|
233
|
+
inputBoxStyles: defaultInputBoxStyles
|
|
234
|
+
}));
|
|
235
|
+
this.inputPatternIncludes.setValue(patternIncludes);
|
|
236
|
+
this.inputPatternIncludes.setOnlySearchInOpenEditors(onlyOpenEditors);
|
|
237
|
+
this._register(this.inputPatternIncludes.onCancel(() => this.cancelSearch(false)));
|
|
238
|
+
this._register(this.inputPatternIncludes.onChangeSearchInEditorsBox(() => this.triggerQueryChange()));
|
|
239
|
+
this.trackInputBox(this.inputPatternIncludes.inputFocusTracker, this.inputPatternIncludesFocused);
|
|
240
|
+
const excludesList = dom.append(this.queryDetails, $('.file-types.excludes'));
|
|
241
|
+
const excludesTitle = ( nls.localize('searchScope.excludes', "files to exclude"));
|
|
242
|
+
dom.append(excludesList, $('h4', undefined, excludesTitle));
|
|
243
|
+
this.inputPatternExcludes = this._register(this.instantiationService.createInstance(ExcludePatternInputWidget, excludesList, this.contextViewService, {
|
|
244
|
+
ariaLabel: excludesTitle,
|
|
245
|
+
placeholder: ( nls.localize('placeholder.excludes', "e.g. *.ts, src/**/exclude")),
|
|
246
|
+
showPlaceholderOnFocus: true,
|
|
247
|
+
history: patternExclusionsHistory,
|
|
248
|
+
inputBoxStyles: defaultInputBoxStyles
|
|
249
|
+
}));
|
|
250
|
+
this.inputPatternExcludes.setValue(patternExclusions);
|
|
251
|
+
this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(useExcludesAndIgnoreFiles);
|
|
252
|
+
this._register(this.inputPatternExcludes.onCancel(() => this.cancelSearch(false)));
|
|
253
|
+
this._register(this.inputPatternExcludes.onChangeIgnoreBox(() => this.triggerQueryChange()));
|
|
254
|
+
this.trackInputBox(this.inputPatternExcludes.inputFocusTracker, this.inputPatternExclusionsFocused);
|
|
255
|
+
const updateHasFilePatternKey = () => this.hasFilePatternKey.set(this.inputPatternIncludes.getValue().length > 0 || this.inputPatternExcludes.getValue().length > 0);
|
|
256
|
+
updateHasFilePatternKey();
|
|
257
|
+
const onFilePatternSubmit = (triggeredOnType) => {
|
|
258
|
+
this.triggerQueryChange({ triggeredOnType, delay: this.searchConfig.searchOnTypeDebouncePeriod });
|
|
259
|
+
if (triggeredOnType) {
|
|
260
|
+
updateHasFilePatternKey();
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
this._register(this.inputPatternIncludes.onSubmit(onFilePatternSubmit));
|
|
264
|
+
this._register(this.inputPatternExcludes.onSubmit(onFilePatternSubmit));
|
|
265
|
+
this.messagesElement = dom.append(this.container, $('.messages.text-search-provider-messages'));
|
|
266
|
+
if (this.contextService.getWorkbenchState() === 1 ) {
|
|
267
|
+
this.showSearchWithoutFolderMessage();
|
|
268
|
+
}
|
|
269
|
+
this.createSearchResultsView(this.container);
|
|
270
|
+
if (filePatterns !== '' || patternExclusions !== '' || patternIncludes !== '' || queryDetailsExpanded !== '' || !useExcludesAndIgnoreFiles) {
|
|
271
|
+
this.toggleQueryDetails(true, true, true);
|
|
272
|
+
}
|
|
273
|
+
this._register(this.viewModel.searchResult.onChange((event) => this.onSearchResultsChanged(event)));
|
|
274
|
+
this._register(this.onDidChangeBodyVisibility(visible => this.onVisibilityChanged(visible)));
|
|
275
|
+
this.updateIndentStyles(this.themeService.getFileIconTheme());
|
|
276
|
+
this._register(this.themeService.onDidFileIconThemeChange(this.updateIndentStyles, this));
|
|
277
|
+
}
|
|
278
|
+
updateIndentStyles(theme) {
|
|
279
|
+
this.resultsElement.classList.toggle('hide-arrows', this.isTreeLayoutViewVisible && theme.hidesExplorerArrows);
|
|
280
|
+
}
|
|
281
|
+
onVisibilityChanged(visible) {
|
|
282
|
+
this.viewletVisible.set(visible);
|
|
283
|
+
if (visible) {
|
|
284
|
+
if (this.changedWhileHidden) {
|
|
285
|
+
this.refreshAndUpdateCount();
|
|
286
|
+
this.changedWhileHidden = false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
this.lastFocusState = 'input';
|
|
291
|
+
}
|
|
292
|
+
this.viewModel?.searchResult.toggleHighlights(visible);
|
|
293
|
+
}
|
|
294
|
+
get searchAndReplaceWidget() {
|
|
295
|
+
return this.searchWidget;
|
|
296
|
+
}
|
|
297
|
+
get searchIncludePattern() {
|
|
298
|
+
return this.inputPatternIncludes;
|
|
299
|
+
}
|
|
300
|
+
get searchExcludePattern() {
|
|
301
|
+
return this.inputPatternExcludes;
|
|
302
|
+
}
|
|
303
|
+
createSearchWidget(container) {
|
|
304
|
+
const contentPattern = this.viewletState['query.contentPattern'] || '';
|
|
305
|
+
const replaceText = this.viewletState['query.replaceText'] || '';
|
|
306
|
+
const isRegex = this.viewletState['query.regex'] === true;
|
|
307
|
+
const isWholeWords = this.viewletState['query.wholeWords'] === true;
|
|
308
|
+
const isCaseSensitive = this.viewletState['query.caseSensitive'] === true;
|
|
309
|
+
const history = this.searchHistoryService.load();
|
|
310
|
+
const searchHistory = history.search || this.viewletState['query.searchHistory'] || [];
|
|
311
|
+
const replaceHistory = history.replace || this.viewletState['query.replaceHistory'] || [];
|
|
312
|
+
const showReplace = typeof this.viewletState['view.showReplace'] === 'boolean' ? this.viewletState['view.showReplace'] : true;
|
|
313
|
+
const preserveCase = this.viewletState['query.preserveCase'] === true;
|
|
314
|
+
const isInNotebookMarkdownInput = this.viewletState['query.isInNotebookMarkdownInput'] ?? true;
|
|
315
|
+
const isInNotebookMarkdownPreview = this.viewletState['query.isInNotebookMarkdownPreview'] ?? true;
|
|
316
|
+
const isInNotebookCellInput = this.viewletState['query.isInNotebookCellInput'] ?? true;
|
|
317
|
+
const isInNotebookCellOutput = this.viewletState['query.isInNotebookCellOutput'] ?? true;
|
|
318
|
+
this.searchWidget = this._register(this.instantiationService.createInstance(SearchWidget, container, {
|
|
319
|
+
value: contentPattern,
|
|
320
|
+
replaceValue: replaceText,
|
|
321
|
+
isRegex: isRegex,
|
|
322
|
+
isCaseSensitive: isCaseSensitive,
|
|
323
|
+
isWholeWords: isWholeWords,
|
|
324
|
+
searchHistory: searchHistory,
|
|
325
|
+
replaceHistory: replaceHistory,
|
|
326
|
+
preserveCase: preserveCase,
|
|
327
|
+
inputBoxStyles: defaultInputBoxStyles,
|
|
328
|
+
toggleStyles: defaultToggleStyles,
|
|
329
|
+
notebookOptions: {
|
|
330
|
+
isInNotebookMarkdownInput,
|
|
331
|
+
isInNotebookMarkdownPreview,
|
|
332
|
+
isInNotebookCellInput,
|
|
333
|
+
isInNotebookCellOutput,
|
|
334
|
+
}
|
|
335
|
+
}));
|
|
336
|
+
if (!this.searchWidget.searchInput || !this.searchWidget.replaceInput) {
|
|
337
|
+
this.logService.warn(`Cannot fully create search widget. Search or replace input undefined. SearchInput: ${this.searchWidget.searchInput}, ReplaceInput: ${this.searchWidget.replaceInput}`);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (showReplace) {
|
|
341
|
+
this.searchWidget.toggleReplace(true);
|
|
342
|
+
}
|
|
343
|
+
this._register(this.searchWidget.onSearchSubmit(options => this.triggerQueryChange(options)));
|
|
344
|
+
this._register(this.searchWidget.onSearchCancel(({ focus }) => this.cancelSearch(focus)));
|
|
345
|
+
this._register(this.searchWidget.searchInput.onDidOptionChange(() => this.triggerQueryChange()));
|
|
346
|
+
this._register(this.searchWidget.getNotebookFilters().onDidChange(() => this.triggerQueryChange()));
|
|
347
|
+
const updateHasPatternKey = () => this.hasSearchPatternKey.set(this.searchWidget.searchInput ? (this.searchWidget.searchInput.getValue().length > 0) : false);
|
|
348
|
+
updateHasPatternKey();
|
|
349
|
+
this._register(this.searchWidget.searchInput.onDidChange(() => updateHasPatternKey()));
|
|
350
|
+
const updateHasReplacePatternKey = () => this.hasReplacePatternKey.set(this.searchWidget.getReplaceValue().length > 0);
|
|
351
|
+
updateHasReplacePatternKey();
|
|
352
|
+
this._register(this.searchWidget.replaceInput.inputBox.onDidChange(() => updateHasReplacePatternKey()));
|
|
353
|
+
this._register(this.searchWidget.onDidHeightChange(() => this.reLayout()));
|
|
354
|
+
this._register(this.searchWidget.onReplaceToggled(() => this.reLayout()));
|
|
355
|
+
this._register(this.searchWidget.onReplaceStateChange((state) => {
|
|
356
|
+
this.viewModel.replaceActive = state;
|
|
357
|
+
this.refreshTree();
|
|
358
|
+
}));
|
|
359
|
+
this._register(this.searchWidget.onPreserveCaseChange((state) => {
|
|
360
|
+
this.viewModel.preserveCase = state;
|
|
361
|
+
this.refreshTree();
|
|
362
|
+
}));
|
|
363
|
+
this._register(this.searchWidget.onReplaceValueChanged(() => {
|
|
364
|
+
this.viewModel.replaceString = this.searchWidget.getReplaceValue();
|
|
365
|
+
this.delayedRefresh.trigger(() => this.refreshTree());
|
|
366
|
+
}));
|
|
367
|
+
this._register(this.searchWidget.onBlur(() => {
|
|
368
|
+
this.toggleQueryDetailsButton.focus();
|
|
369
|
+
}));
|
|
370
|
+
this._register(this.searchWidget.onReplaceAll(() => this.replaceAll()));
|
|
371
|
+
this.trackInputBox(this.searchWidget.searchInputFocusTracker);
|
|
372
|
+
this.trackInputBox(this.searchWidget.replaceInputFocusTracker);
|
|
373
|
+
}
|
|
374
|
+
onConfigurationUpdated(event) {
|
|
375
|
+
if (event && (event.affectsConfiguration('search.decorations.colors') || event.affectsConfiguration('search.decorations.badges'))) {
|
|
376
|
+
this.refreshTree();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
trackInputBox(inputFocusTracker, contextKey) {
|
|
380
|
+
if (!inputFocusTracker) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
this._register(inputFocusTracker.onDidFocus(() => {
|
|
384
|
+
this.lastFocusState = 'input';
|
|
385
|
+
this.inputBoxFocused.set(true);
|
|
386
|
+
contextKey?.set(true);
|
|
387
|
+
}));
|
|
388
|
+
this._register(inputFocusTracker.onDidBlur(() => {
|
|
389
|
+
this.inputBoxFocused.set(this.searchWidget.searchInputHasFocus()
|
|
390
|
+
|| this.searchWidget.replaceInputHasFocus()
|
|
391
|
+
|| this.inputPatternIncludes.inputHasFocus()
|
|
392
|
+
|| this.inputPatternExcludes.inputHasFocus());
|
|
393
|
+
contextKey?.set(false);
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
onSearchResultsChanged(event) {
|
|
397
|
+
if (this.isVisible()) {
|
|
398
|
+
return this.refreshAndUpdateCount(event);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
this.changedWhileHidden = true;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
refreshAndUpdateCount(event) {
|
|
405
|
+
this.searchWidget.setReplaceAllActionState(!this.viewModel.searchResult.isEmpty());
|
|
406
|
+
this.updateSearchResultCount(this.viewModel.searchResult.query.userDisabledExcludesAndIgnoreFiles, this.viewModel.searchResult.query?.onlyOpenEditors, event?.clearingAll);
|
|
407
|
+
return this.refreshTree(event);
|
|
408
|
+
}
|
|
409
|
+
refreshTree(event) {
|
|
410
|
+
const collapseResults = this.searchConfig.collapseResults;
|
|
411
|
+
if (!event || event.added || event.removed) {
|
|
412
|
+
if (this.searchConfig.sortOrder === "modified" ) {
|
|
413
|
+
this.retrieveFileStats()
|
|
414
|
+
.then(() => this.tree.setChildren(null, this.createResultIterator(collapseResults)));
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
this.tree.setChildren(null, this.createResultIterator(collapseResults));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
if (this.searchConfig.sortOrder === "countAscending" ||
|
|
422
|
+
this.searchConfig.sortOrder === "countDescending" ) {
|
|
423
|
+
this.tree.setChildren(null, this.createResultIterator(collapseResults));
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
event.elements.forEach(element => {
|
|
427
|
+
this.tree.setChildren(element, this.createIterator(element, collapseResults));
|
|
428
|
+
this.tree.rerender(element);
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
createResultIterator(collapseResults) {
|
|
434
|
+
const folderMatches = this.searchResult.folderMatches()
|
|
435
|
+
.filter(fm => !fm.isEmpty())
|
|
436
|
+
.sort(searchMatchComparer);
|
|
437
|
+
if (folderMatches.length === 1) {
|
|
438
|
+
return this.createFolderIterator(folderMatches[0], collapseResults, true);
|
|
439
|
+
}
|
|
440
|
+
return ( Iterable.map(folderMatches, folderMatch => {
|
|
441
|
+
const children = this.createFolderIterator(folderMatch, collapseResults, true);
|
|
442
|
+
return { element: folderMatch, children, incompressible: true };
|
|
443
|
+
}));
|
|
444
|
+
}
|
|
445
|
+
createFolderIterator(folderMatch, collapseResults, childFolderIncompressible) {
|
|
446
|
+
const sortOrder = this.searchConfig.sortOrder;
|
|
447
|
+
const matchArray = this.isTreeLayoutViewVisible ? folderMatch.matches() : folderMatch.allDownstreamFileMatches();
|
|
448
|
+
const matches = matchArray.sort((a, b) => searchMatchComparer(a, b, sortOrder));
|
|
449
|
+
return ( Iterable.map(matches, match => {
|
|
450
|
+
let children;
|
|
451
|
+
if (match instanceof FileMatch) {
|
|
452
|
+
children = this.createFileIterator(match);
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
children = this.createFolderIterator(match, collapseResults, false);
|
|
456
|
+
}
|
|
457
|
+
const collapsed = (collapseResults === 'alwaysCollapse' || (match.count() > 10 && collapseResults !== 'alwaysExpand')) ? ObjectTreeElementCollapseState.PreserveOrCollapsed : ObjectTreeElementCollapseState.PreserveOrExpanded;
|
|
458
|
+
return { element: match, children, collapsed, incompressible: (match instanceof FileMatch) ? true : childFolderIncompressible };
|
|
459
|
+
}));
|
|
460
|
+
}
|
|
461
|
+
createFileIterator(fileMatch) {
|
|
462
|
+
const matches = fileMatch.matches().sort(searchMatchComparer);
|
|
463
|
+
return ( Iterable.map(matches, r => ({ element: r, incompressible: true })));
|
|
464
|
+
}
|
|
465
|
+
createIterator(match, collapseResults) {
|
|
466
|
+
return match instanceof SearchResult ? this.createResultIterator(collapseResults) :
|
|
467
|
+
match instanceof FolderMatch ? this.createFolderIterator(match, collapseResults, false) :
|
|
468
|
+
this.createFileIterator(match);
|
|
469
|
+
}
|
|
470
|
+
replaceAll() {
|
|
471
|
+
if (this.viewModel.searchResult.count() === 0) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
const occurrences = this.viewModel.searchResult.count();
|
|
475
|
+
const fileCount = this.viewModel.searchResult.fileCount();
|
|
476
|
+
const replaceValue = this.searchWidget.getReplaceValue() || '';
|
|
477
|
+
const afterReplaceAllMessage = this.buildAfterReplaceAllMessage(occurrences, fileCount, replaceValue);
|
|
478
|
+
let progressComplete;
|
|
479
|
+
let progressReporter;
|
|
480
|
+
this.progressService.withProgress({ location: this.getProgressLocation(), delay: 100, total: occurrences }, p => {
|
|
481
|
+
progressReporter = p;
|
|
482
|
+
return ( new Promise(resolve => progressComplete = resolve));
|
|
483
|
+
});
|
|
484
|
+
const confirmation = {
|
|
485
|
+
title: ( nls.localize('replaceAll.confirmation.title', "Replace All")),
|
|
486
|
+
message: this.buildReplaceAllConfirmationMessage(occurrences, fileCount, replaceValue),
|
|
487
|
+
primaryButton: ( nls.localize(
|
|
488
|
+
{ key: 'replaceAll.confirm.button', comment: ['&& denotes a mnemonic'] },
|
|
489
|
+
"&&Replace"
|
|
490
|
+
))
|
|
491
|
+
};
|
|
492
|
+
this.dialogService.confirm(confirmation).then(res => {
|
|
493
|
+
if (res.confirmed) {
|
|
494
|
+
this.searchWidget.setReplaceAllActionState(false);
|
|
495
|
+
this.viewModel.searchResult.replaceAll(progressReporter).then(() => {
|
|
496
|
+
progressComplete();
|
|
497
|
+
const messageEl = this.clearMessage();
|
|
498
|
+
dom.append(messageEl, afterReplaceAllMessage);
|
|
499
|
+
this.reLayout();
|
|
500
|
+
}, (error) => {
|
|
501
|
+
progressComplete();
|
|
502
|
+
errors.isCancellationError(error);
|
|
503
|
+
this.notificationService.error(error);
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
progressComplete();
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
buildAfterReplaceAllMessage(occurrences, fileCount, replaceValue) {
|
|
512
|
+
if (occurrences === 1) {
|
|
513
|
+
if (fileCount === 1) {
|
|
514
|
+
if (replaceValue) {
|
|
515
|
+
return ( nls.localize(
|
|
516
|
+
'replaceAll.occurrence.file.message',
|
|
517
|
+
"Replaced {0} occurrence across {1} file with '{2}'.",
|
|
518
|
+
occurrences,
|
|
519
|
+
fileCount,
|
|
520
|
+
replaceValue
|
|
521
|
+
));
|
|
522
|
+
}
|
|
523
|
+
return ( nls.localize(
|
|
524
|
+
'removeAll.occurrence.file.message',
|
|
525
|
+
"Replaced {0} occurrence across {1} file.",
|
|
526
|
+
occurrences,
|
|
527
|
+
fileCount
|
|
528
|
+
));
|
|
529
|
+
}
|
|
530
|
+
if (replaceValue) {
|
|
531
|
+
return ( nls.localize(
|
|
532
|
+
'replaceAll.occurrence.files.message',
|
|
533
|
+
"Replaced {0} occurrence across {1} files with '{2}'.",
|
|
534
|
+
occurrences,
|
|
535
|
+
fileCount,
|
|
536
|
+
replaceValue
|
|
537
|
+
));
|
|
538
|
+
}
|
|
539
|
+
return ( nls.localize(
|
|
540
|
+
'removeAll.occurrence.files.message',
|
|
541
|
+
"Replaced {0} occurrence across {1} files.",
|
|
542
|
+
occurrences,
|
|
543
|
+
fileCount
|
|
544
|
+
));
|
|
545
|
+
}
|
|
546
|
+
if (fileCount === 1) {
|
|
547
|
+
if (replaceValue) {
|
|
548
|
+
return ( nls.localize(
|
|
549
|
+
'replaceAll.occurrences.file.message',
|
|
550
|
+
"Replaced {0} occurrences across {1} file with '{2}'.",
|
|
551
|
+
occurrences,
|
|
552
|
+
fileCount,
|
|
553
|
+
replaceValue
|
|
554
|
+
));
|
|
555
|
+
}
|
|
556
|
+
return ( nls.localize(
|
|
557
|
+
'removeAll.occurrences.file.message',
|
|
558
|
+
"Replaced {0} occurrences across {1} file.",
|
|
559
|
+
occurrences,
|
|
560
|
+
fileCount
|
|
561
|
+
));
|
|
562
|
+
}
|
|
563
|
+
if (replaceValue) {
|
|
564
|
+
return ( nls.localize(
|
|
565
|
+
'replaceAll.occurrences.files.message',
|
|
566
|
+
"Replaced {0} occurrences across {1} files with '{2}'.",
|
|
567
|
+
occurrences,
|
|
568
|
+
fileCount,
|
|
569
|
+
replaceValue
|
|
570
|
+
));
|
|
571
|
+
}
|
|
572
|
+
return ( nls.localize(
|
|
573
|
+
'removeAll.occurrences.files.message',
|
|
574
|
+
"Replaced {0} occurrences across {1} files.",
|
|
575
|
+
occurrences,
|
|
576
|
+
fileCount
|
|
577
|
+
));
|
|
578
|
+
}
|
|
579
|
+
buildReplaceAllConfirmationMessage(occurrences, fileCount, replaceValue) {
|
|
580
|
+
if (occurrences === 1) {
|
|
581
|
+
if (fileCount === 1) {
|
|
582
|
+
if (replaceValue) {
|
|
583
|
+
return ( nls.localize(
|
|
584
|
+
'removeAll.occurrence.file.confirmation.message',
|
|
585
|
+
"Replace {0} occurrence across {1} file with '{2}'?",
|
|
586
|
+
occurrences,
|
|
587
|
+
fileCount,
|
|
588
|
+
replaceValue
|
|
589
|
+
));
|
|
590
|
+
}
|
|
591
|
+
return ( nls.localize(
|
|
592
|
+
'replaceAll.occurrence.file.confirmation.message',
|
|
593
|
+
"Replace {0} occurrence across {1} file?",
|
|
594
|
+
occurrences,
|
|
595
|
+
fileCount
|
|
596
|
+
));
|
|
597
|
+
}
|
|
598
|
+
if (replaceValue) {
|
|
599
|
+
return ( nls.localize(
|
|
600
|
+
'removeAll.occurrence.files.confirmation.message',
|
|
601
|
+
"Replace {0} occurrence across {1} files with '{2}'?",
|
|
602
|
+
occurrences,
|
|
603
|
+
fileCount,
|
|
604
|
+
replaceValue
|
|
605
|
+
));
|
|
606
|
+
}
|
|
607
|
+
return ( nls.localize(
|
|
608
|
+
'replaceAll.occurrence.files.confirmation.message',
|
|
609
|
+
"Replace {0} occurrence across {1} files?",
|
|
610
|
+
occurrences,
|
|
611
|
+
fileCount
|
|
612
|
+
));
|
|
613
|
+
}
|
|
614
|
+
if (fileCount === 1) {
|
|
615
|
+
if (replaceValue) {
|
|
616
|
+
return ( nls.localize(
|
|
617
|
+
'removeAll.occurrences.file.confirmation.message',
|
|
618
|
+
"Replace {0} occurrences across {1} file with '{2}'?",
|
|
619
|
+
occurrences,
|
|
620
|
+
fileCount,
|
|
621
|
+
replaceValue
|
|
622
|
+
));
|
|
623
|
+
}
|
|
624
|
+
return ( nls.localize(
|
|
625
|
+
'replaceAll.occurrences.file.confirmation.message',
|
|
626
|
+
"Replace {0} occurrences across {1} file?",
|
|
627
|
+
occurrences,
|
|
628
|
+
fileCount
|
|
629
|
+
));
|
|
630
|
+
}
|
|
631
|
+
if (replaceValue) {
|
|
632
|
+
return ( nls.localize(
|
|
633
|
+
'removeAll.occurrences.files.confirmation.message',
|
|
634
|
+
"Replace {0} occurrences across {1} files with '{2}'?",
|
|
635
|
+
occurrences,
|
|
636
|
+
fileCount,
|
|
637
|
+
replaceValue
|
|
638
|
+
));
|
|
639
|
+
}
|
|
640
|
+
return ( nls.localize(
|
|
641
|
+
'replaceAll.occurrences.files.confirmation.message',
|
|
642
|
+
"Replace {0} occurrences across {1} files?",
|
|
643
|
+
occurrences,
|
|
644
|
+
fileCount
|
|
645
|
+
));
|
|
646
|
+
}
|
|
647
|
+
clearMessage() {
|
|
648
|
+
this.searchWithoutFolderMessageElement = undefined;
|
|
649
|
+
const wasHidden = this.messagesElement.style.display === 'none';
|
|
650
|
+
dom.clearNode(this.messagesElement);
|
|
651
|
+
dom.show(this.messagesElement);
|
|
652
|
+
this.messageDisposables.clear();
|
|
653
|
+
const newMessage = dom.append(this.messagesElement, $('.message'));
|
|
654
|
+
if (wasHidden) {
|
|
655
|
+
this.reLayout();
|
|
656
|
+
}
|
|
657
|
+
return newMessage;
|
|
658
|
+
}
|
|
659
|
+
createSearchResultsView(container) {
|
|
660
|
+
this.resultsElement = dom.append(container, $('.results.show-file-icons.file-icon-themable-tree'));
|
|
661
|
+
const delegate = this.instantiationService.createInstance(SearchDelegate);
|
|
662
|
+
const identityProvider = {
|
|
663
|
+
getId(element) {
|
|
664
|
+
return element.id();
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
this.treeLabels = this._register(this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility }));
|
|
668
|
+
this.tree = this._register(this.instantiationService.createInstance(WorkbenchCompressibleObjectTree, 'SearchView', this.resultsElement, delegate, [
|
|
669
|
+
this._register(this.instantiationService.createInstance(FolderMatchRenderer, this, this.treeLabels)),
|
|
670
|
+
this._register(this.instantiationService.createInstance(FileMatchRenderer, this, this.treeLabels)),
|
|
671
|
+
this._register(this.instantiationService.createInstance(MatchRenderer, this.viewModel, this)),
|
|
672
|
+
], {
|
|
673
|
+
identityProvider,
|
|
674
|
+
accessibilityProvider: this.treeAccessibilityProvider,
|
|
675
|
+
dnd: this.instantiationService.createInstance(ResourceListDnDHandler, element => {
|
|
676
|
+
if (element instanceof FileMatch) {
|
|
677
|
+
return element.resource;
|
|
678
|
+
}
|
|
679
|
+
if (element instanceof Match) {
|
|
680
|
+
return withSelection(element.parent().resource, element.range());
|
|
681
|
+
}
|
|
682
|
+
return null;
|
|
683
|
+
}),
|
|
684
|
+
multipleSelectionSupport: true,
|
|
685
|
+
selectionNavigation: true,
|
|
686
|
+
overrideStyles: {
|
|
687
|
+
listBackground: this.getBackgroundColor()
|
|
688
|
+
},
|
|
689
|
+
additionalScrollHeight: SearchDelegate.ITEM_HEIGHT
|
|
690
|
+
}));
|
|
691
|
+
this._register(this.tree.onContextMenu(e => this.onContextMenu(e)));
|
|
692
|
+
const updateHasSomeCollapsible = () => this.toggleCollapseStateDelayer.trigger(() => this.hasSomeCollapsibleResultKey.set(this.hasSomeCollapsible()));
|
|
693
|
+
updateHasSomeCollapsible();
|
|
694
|
+
this._register(this.viewModel.searchResult.onChange(() => updateHasSomeCollapsible()));
|
|
695
|
+
this._register(this.tree.onDidChangeCollapseState(() => updateHasSomeCollapsible()));
|
|
696
|
+
this._register(Event.debounce(this.tree.onDidOpen, (last, event) => event, DEBOUNCE_DELAY, true)(options => {
|
|
697
|
+
if (options.element instanceof Match) {
|
|
698
|
+
const selectedMatch = options.element;
|
|
699
|
+
this.currentSelectedFileMatch?.setSelectedMatch(null);
|
|
700
|
+
this.currentSelectedFileMatch = selectedMatch.parent();
|
|
701
|
+
this.currentSelectedFileMatch.setSelectedMatch(selectedMatch);
|
|
702
|
+
this.onFocus(selectedMatch, options.editorOptions.preserveFocus, options.sideBySide, options.editorOptions.pinned);
|
|
703
|
+
}
|
|
704
|
+
}));
|
|
705
|
+
this._register(Event.debounce(this.tree.onDidChangeFocus, (last, event) => event, DEBOUNCE_DELAY, true)(() => {
|
|
706
|
+
const selection = this.tree.getSelection();
|
|
707
|
+
const focus = this.tree.getFocus()[0];
|
|
708
|
+
if (selection.length > 1 && focus instanceof Match) {
|
|
709
|
+
this.onFocus(focus, true);
|
|
710
|
+
}
|
|
711
|
+
}));
|
|
712
|
+
this._register(Event.any(this.tree.onDidFocus, this.tree.onDidChangeFocus)(() => {
|
|
713
|
+
const focus = this.tree.getFocus()[0];
|
|
714
|
+
if (this.tree.isDOMFocused()) {
|
|
715
|
+
this.firstMatchFocused.set(this.tree.navigate().first() === focus);
|
|
716
|
+
this.fileMatchOrMatchFocused.set(!!focus);
|
|
717
|
+
this.fileMatchFocused.set(focus instanceof FileMatch);
|
|
718
|
+
this.folderMatchFocused.set(focus instanceof FolderMatch);
|
|
719
|
+
this.matchFocused.set(focus instanceof Match);
|
|
720
|
+
this.fileMatchOrFolderMatchFocus.set(focus instanceof FileMatch || focus instanceof FolderMatch);
|
|
721
|
+
this.fileMatchOrFolderMatchWithResourceFocus.set(focus instanceof FileMatch || focus instanceof FolderMatchWithResource);
|
|
722
|
+
this.folderMatchWithResourceFocused.set(focus instanceof FolderMatchWithResource);
|
|
723
|
+
this.lastFocusState = 'tree';
|
|
724
|
+
}
|
|
725
|
+
let editable = false;
|
|
726
|
+
if (focus instanceof MatchInNotebook) {
|
|
727
|
+
editable = !focus.isWebviewMatch();
|
|
728
|
+
}
|
|
729
|
+
else if (focus instanceof FileMatch) {
|
|
730
|
+
editable = !focus.hasOnlyReadOnlyMatches();
|
|
731
|
+
}
|
|
732
|
+
else if (focus instanceof FolderMatch) {
|
|
733
|
+
editable = !focus.hasOnlyReadOnlyMatches();
|
|
734
|
+
}
|
|
735
|
+
this.isEditableItem.set(editable);
|
|
736
|
+
}));
|
|
737
|
+
this._register(this.tree.onDidBlur(() => {
|
|
738
|
+
this.firstMatchFocused.reset();
|
|
739
|
+
this.fileMatchOrMatchFocused.reset();
|
|
740
|
+
this.fileMatchFocused.reset();
|
|
741
|
+
this.folderMatchFocused.reset();
|
|
742
|
+
this.matchFocused.reset();
|
|
743
|
+
this.fileMatchOrFolderMatchFocus.reset();
|
|
744
|
+
this.fileMatchOrFolderMatchWithResourceFocus.reset();
|
|
745
|
+
this.folderMatchWithResourceFocused.reset();
|
|
746
|
+
this.isEditableItem.reset();
|
|
747
|
+
}));
|
|
748
|
+
}
|
|
749
|
+
onContextMenu(e) {
|
|
750
|
+
e.browserEvent.preventDefault();
|
|
751
|
+
e.browserEvent.stopPropagation();
|
|
752
|
+
this.contextMenuService.showContextMenu({
|
|
753
|
+
menuId: MenuId.SearchContext,
|
|
754
|
+
menuActionOptions: { shouldForwardArgs: true },
|
|
755
|
+
contextKeyService: this.contextKeyService,
|
|
756
|
+
getAnchor: () => e.anchor,
|
|
757
|
+
getActionsContext: () => e.element,
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
hasSomeCollapsible() {
|
|
761
|
+
const viewer = this.getControl();
|
|
762
|
+
const navigator = viewer.navigate();
|
|
763
|
+
let node = navigator.first();
|
|
764
|
+
do {
|
|
765
|
+
if (!viewer.isCollapsed(node)) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
} while (node = navigator.next());
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
selectNextMatch() {
|
|
772
|
+
if (!this.hasSearchResults()) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
const [selected] = this.tree.getSelection();
|
|
776
|
+
if (selected && !(selected instanceof Match)) {
|
|
777
|
+
if (this.tree.isCollapsed(selected)) {
|
|
778
|
+
this.tree.expand(selected);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
const navigator = this.tree.navigate(selected);
|
|
782
|
+
let next = navigator.next();
|
|
783
|
+
if (!next) {
|
|
784
|
+
next = navigator.first();
|
|
785
|
+
}
|
|
786
|
+
while (next && !(next instanceof Match)) {
|
|
787
|
+
if (this.tree.isCollapsed(next)) {
|
|
788
|
+
this.tree.expand(next);
|
|
789
|
+
}
|
|
790
|
+
next = navigator.next();
|
|
791
|
+
}
|
|
792
|
+
if (next) {
|
|
793
|
+
if (next === selected) {
|
|
794
|
+
this.tree.setFocus([]);
|
|
795
|
+
}
|
|
796
|
+
const event = getSelectionKeyboardEvent(undefined, false, false);
|
|
797
|
+
this.tree.setFocus([next], event);
|
|
798
|
+
this.tree.setSelection([next], event);
|
|
799
|
+
this.tree.reveal(next);
|
|
800
|
+
const ariaLabel = this.treeAccessibilityProvider.getAriaLabel(next);
|
|
801
|
+
if (ariaLabel) {
|
|
802
|
+
aria.alert(ariaLabel);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
selectPreviousMatch() {
|
|
807
|
+
if (!this.hasSearchResults()) {
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
const [selected] = this.tree.getSelection();
|
|
811
|
+
let navigator = this.tree.navigate(selected);
|
|
812
|
+
let prev = navigator.previous();
|
|
813
|
+
while (!prev || (!(prev instanceof Match) && !this.tree.isCollapsed(prev))) {
|
|
814
|
+
const nextPrev = prev ? navigator.previous() : navigator.last();
|
|
815
|
+
if (!prev && !nextPrev) {
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
prev = nextPrev;
|
|
819
|
+
}
|
|
820
|
+
while (!(prev instanceof Match)) {
|
|
821
|
+
const nextItem = navigator.next();
|
|
822
|
+
this.tree.expand(prev);
|
|
823
|
+
navigator = this.tree.navigate(nextItem);
|
|
824
|
+
prev = nextItem ? navigator.previous() : navigator.last();
|
|
825
|
+
}
|
|
826
|
+
if (prev) {
|
|
827
|
+
if (prev === selected) {
|
|
828
|
+
this.tree.setFocus([]);
|
|
829
|
+
}
|
|
830
|
+
const event = getSelectionKeyboardEvent(undefined, false, false);
|
|
831
|
+
this.tree.setFocus([prev], event);
|
|
832
|
+
this.tree.setSelection([prev], event);
|
|
833
|
+
this.tree.reveal(prev);
|
|
834
|
+
const ariaLabel = this.treeAccessibilityProvider.getAriaLabel(prev);
|
|
835
|
+
if (ariaLabel) {
|
|
836
|
+
aria.alert(ariaLabel);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
moveFocusToResults() {
|
|
841
|
+
this.tree.domFocus();
|
|
842
|
+
}
|
|
843
|
+
focus() {
|
|
844
|
+
super.focus();
|
|
845
|
+
if (this.lastFocusState === 'input' || !this.hasSearchResults()) {
|
|
846
|
+
const updatedText = this.searchConfig.seedOnFocus ? this.updateTextFromSelection({ allowSearchOnType: false }) : false;
|
|
847
|
+
this.searchWidget.focus(undefined, undefined, updatedText);
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
this.tree.domFocus();
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
updateTextFromFindWidgetOrSelection({ allowUnselectedWord = true, allowSearchOnType = true }) {
|
|
854
|
+
let activeEditor = this.editorService.activeTextEditorControl;
|
|
855
|
+
if (isCodeEditor(activeEditor) && !activeEditor?.hasTextFocus()) {
|
|
856
|
+
const controller = CommonFindController.get(activeEditor);
|
|
857
|
+
if (controller && controller.isFindInputFocused()) {
|
|
858
|
+
return this.updateTextFromFindWidget(controller, { allowSearchOnType });
|
|
859
|
+
}
|
|
860
|
+
const editors = this.codeEditorService.listCodeEditors();
|
|
861
|
+
activeEditor = editors.find(editor => editor instanceof EmbeddedCodeEditorWidget && editor.getParentEditor() === activeEditor && editor.hasTextFocus())
|
|
862
|
+
?? activeEditor;
|
|
863
|
+
}
|
|
864
|
+
return this.updateTextFromSelection({ allowUnselectedWord, allowSearchOnType }, activeEditor);
|
|
865
|
+
}
|
|
866
|
+
updateTextFromFindWidget(controller, { allowSearchOnType = true }) {
|
|
867
|
+
if (!this.searchConfig.seedWithNearestWord && (window.getSelection()?.toString() ?? '') === '') {
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
const searchString = controller.getState().searchString;
|
|
871
|
+
if (searchString === '') {
|
|
872
|
+
return false;
|
|
873
|
+
}
|
|
874
|
+
this.searchWidget.searchInput?.setCaseSensitive(controller.getState().matchCase);
|
|
875
|
+
this.searchWidget.searchInput?.setWholeWords(controller.getState().wholeWord);
|
|
876
|
+
this.searchWidget.searchInput?.setRegex(controller.getState().isRegex);
|
|
877
|
+
this.updateText(searchString, allowSearchOnType);
|
|
878
|
+
return true;
|
|
879
|
+
}
|
|
880
|
+
updateTextFromSelection({ allowUnselectedWord = true, allowSearchOnType = true }, editor) {
|
|
881
|
+
const seedSearchStringFromSelection = this.configurationService.getValue('editor').find.seedSearchStringFromSelection;
|
|
882
|
+
if (!seedSearchStringFromSelection) {
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
let selectedText = this.getSearchTextFromEditor(allowUnselectedWord, editor);
|
|
886
|
+
if (selectedText === null) {
|
|
887
|
+
return false;
|
|
888
|
+
}
|
|
889
|
+
if (this.searchWidget.searchInput?.getRegex()) {
|
|
890
|
+
selectedText = strings.escapeRegExpCharacters(selectedText);
|
|
891
|
+
}
|
|
892
|
+
this.updateText(selectedText, allowSearchOnType);
|
|
893
|
+
return true;
|
|
894
|
+
}
|
|
895
|
+
updateText(text, allowSearchOnType = true) {
|
|
896
|
+
if (allowSearchOnType && !this.viewModel.searchResult.isDirty) {
|
|
897
|
+
this.searchWidget.setValue(text);
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
this.pauseSearching = true;
|
|
901
|
+
this.searchWidget.setValue(text);
|
|
902
|
+
this.pauseSearching = false;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
focusNextInputBox() {
|
|
906
|
+
if (this.searchWidget.searchInputHasFocus()) {
|
|
907
|
+
if (this.searchWidget.isReplaceShown()) {
|
|
908
|
+
this.searchWidget.focus(true, true);
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
this.moveFocusFromSearchOrReplace();
|
|
912
|
+
}
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
if (this.searchWidget.replaceInputHasFocus()) {
|
|
916
|
+
this.moveFocusFromSearchOrReplace();
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
if (this.inputPatternIncludes.inputHasFocus()) {
|
|
920
|
+
this.inputPatternExcludes.focus();
|
|
921
|
+
this.inputPatternExcludes.select();
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
if (this.inputPatternExcludes.inputHasFocus()) {
|
|
925
|
+
this.selectTreeIfNotSelected();
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
moveFocusFromSearchOrReplace() {
|
|
930
|
+
if (this.showsFileTypes()) {
|
|
931
|
+
this.toggleQueryDetails(true, this.showsFileTypes());
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
this.selectTreeIfNotSelected();
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
focusPreviousInputBox() {
|
|
938
|
+
if (this.searchWidget.searchInputHasFocus()) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
if (this.searchWidget.replaceInputHasFocus()) {
|
|
942
|
+
this.searchWidget.focus(true);
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
if (this.inputPatternIncludes.inputHasFocus()) {
|
|
946
|
+
this.searchWidget.focus(true, true);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
if (this.inputPatternExcludes.inputHasFocus()) {
|
|
950
|
+
this.inputPatternIncludes.focus();
|
|
951
|
+
this.inputPatternIncludes.select();
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
if (this.tree.isDOMFocused()) {
|
|
955
|
+
this.moveFocusFromResults();
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
moveFocusFromResults() {
|
|
960
|
+
if (this.showsFileTypes()) {
|
|
961
|
+
this.toggleQueryDetails(true, true, false, true);
|
|
962
|
+
}
|
|
963
|
+
else {
|
|
964
|
+
this.searchWidget.focus(true, true);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
reLayout() {
|
|
968
|
+
if (this.isDisposed || !this.size) {
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
const actionsPosition = this.searchConfig.actionsPosition;
|
|
972
|
+
this.getContainer().classList.toggle(SearchView.ACTIONS_RIGHT_CLASS_NAME, actionsPosition === 'right');
|
|
973
|
+
this.searchWidget.setWidth(this.size.width - 28 );
|
|
974
|
+
this.inputPatternExcludes.setWidth(this.size.width - 28 );
|
|
975
|
+
this.inputPatternIncludes.setWidth(this.size.width - 28 );
|
|
976
|
+
const widgetHeight = dom.getTotalHeight(this.searchWidgetsContainerElement);
|
|
977
|
+
const messagesHeight = dom.getTotalHeight(this.messagesElement);
|
|
978
|
+
this.tree.layout(this.size.height - widgetHeight - messagesHeight, this.size.width - 28);
|
|
979
|
+
}
|
|
980
|
+
layoutBody(height, width) {
|
|
981
|
+
super.layoutBody(height, width);
|
|
982
|
+
this.size = new dom.Dimension(width, height);
|
|
983
|
+
this.reLayout();
|
|
984
|
+
}
|
|
985
|
+
getControl() {
|
|
986
|
+
return this.tree;
|
|
987
|
+
}
|
|
988
|
+
allSearchFieldsClear() {
|
|
989
|
+
return this.searchWidget.getReplaceValue() === '' &&
|
|
990
|
+
(!this.searchWidget.searchInput || this.searchWidget.searchInput.getValue() === '');
|
|
991
|
+
}
|
|
992
|
+
allFilePatternFieldsClear() {
|
|
993
|
+
return this.searchExcludePattern.getValue() === '' &&
|
|
994
|
+
this.searchIncludePattern.getValue() === '';
|
|
995
|
+
}
|
|
996
|
+
hasSearchResults() {
|
|
997
|
+
return !this.viewModel.searchResult.isEmpty();
|
|
998
|
+
}
|
|
999
|
+
clearSearchResults(clearInput = true) {
|
|
1000
|
+
this.viewModel.searchResult.clear();
|
|
1001
|
+
this.showEmptyStage(true);
|
|
1002
|
+
if (this.contextService.getWorkbenchState() === 1 ) {
|
|
1003
|
+
this.showSearchWithoutFolderMessage();
|
|
1004
|
+
}
|
|
1005
|
+
if (clearInput) {
|
|
1006
|
+
if (this.allSearchFieldsClear()) {
|
|
1007
|
+
this.clearFilePatternFields();
|
|
1008
|
+
}
|
|
1009
|
+
this.searchWidget.clear();
|
|
1010
|
+
}
|
|
1011
|
+
this.viewModel.cancelSearch();
|
|
1012
|
+
this.tree.ariaLabel = ( nls.localize('emptySearch', "Empty Search"));
|
|
1013
|
+
aria.status(( nls.localize('ariaSearchResultsClearStatus', "The search results have been cleared")));
|
|
1014
|
+
this.reLayout();
|
|
1015
|
+
}
|
|
1016
|
+
clearFilePatternFields() {
|
|
1017
|
+
this.searchExcludePattern.clear();
|
|
1018
|
+
this.searchIncludePattern.clear();
|
|
1019
|
+
}
|
|
1020
|
+
cancelSearch(focus = true) {
|
|
1021
|
+
if (this.viewModel.cancelSearch()) {
|
|
1022
|
+
if (focus) {
|
|
1023
|
+
this.searchWidget.focus();
|
|
1024
|
+
}
|
|
1025
|
+
return true;
|
|
1026
|
+
}
|
|
1027
|
+
return false;
|
|
1028
|
+
}
|
|
1029
|
+
selectTreeIfNotSelected() {
|
|
1030
|
+
if (this.tree.getNode(null)) {
|
|
1031
|
+
this.tree.domFocus();
|
|
1032
|
+
const selection = this.tree.getSelection();
|
|
1033
|
+
if (selection.length === 0) {
|
|
1034
|
+
const event = getSelectionKeyboardEvent();
|
|
1035
|
+
this.tree.focusNext(undefined, undefined, event);
|
|
1036
|
+
this.tree.setSelection(this.tree.getFocus(), event);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
getSearchTextFromEditor(allowUnselectedWord, editor) {
|
|
1041
|
+
if (dom.isAncestor(document.activeElement, this.getContainer())) {
|
|
1042
|
+
return null;
|
|
1043
|
+
}
|
|
1044
|
+
editor = editor ?? this.editorService.activeTextEditorControl;
|
|
1045
|
+
if (isDiffEditor(editor)) {
|
|
1046
|
+
if (editor.getOriginalEditor().hasTextFocus()) {
|
|
1047
|
+
editor = editor.getOriginalEditor();
|
|
1048
|
+
}
|
|
1049
|
+
else {
|
|
1050
|
+
editor = editor.getModifiedEditor();
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
if (!isCodeEditor(editor) || !editor.hasModel()) {
|
|
1054
|
+
return null;
|
|
1055
|
+
}
|
|
1056
|
+
const range = editor.getSelection();
|
|
1057
|
+
if (!range) {
|
|
1058
|
+
return null;
|
|
1059
|
+
}
|
|
1060
|
+
if (range.isEmpty() && this.searchConfig.seedWithNearestWord && allowUnselectedWord) {
|
|
1061
|
+
const wordAtPosition = editor.getModel().getWordAtPosition(range.getStartPosition());
|
|
1062
|
+
if (wordAtPosition) {
|
|
1063
|
+
return wordAtPosition.word;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
if (!range.isEmpty()) {
|
|
1067
|
+
let searchText = '';
|
|
1068
|
+
for (let i = range.startLineNumber; i <= range.endLineNumber; i++) {
|
|
1069
|
+
let lineText = editor.getModel().getLineContent(i);
|
|
1070
|
+
if (i === range.endLineNumber) {
|
|
1071
|
+
lineText = lineText.substring(0, range.endColumn - 1);
|
|
1072
|
+
}
|
|
1073
|
+
if (i === range.startLineNumber) {
|
|
1074
|
+
lineText = lineText.substring(range.startColumn - 1);
|
|
1075
|
+
}
|
|
1076
|
+
if (i !== range.startLineNumber) {
|
|
1077
|
+
lineText = '\n' + lineText;
|
|
1078
|
+
}
|
|
1079
|
+
searchText += lineText;
|
|
1080
|
+
}
|
|
1081
|
+
return searchText;
|
|
1082
|
+
}
|
|
1083
|
+
return null;
|
|
1084
|
+
}
|
|
1085
|
+
showsFileTypes() {
|
|
1086
|
+
return this.queryDetails.classList.contains('more');
|
|
1087
|
+
}
|
|
1088
|
+
toggleCaseSensitive() {
|
|
1089
|
+
this.searchWidget.searchInput?.setCaseSensitive(!this.searchWidget.searchInput.getCaseSensitive());
|
|
1090
|
+
this.triggerQueryChange();
|
|
1091
|
+
}
|
|
1092
|
+
toggleWholeWords() {
|
|
1093
|
+
this.searchWidget.searchInput?.setWholeWords(!this.searchWidget.searchInput.getWholeWords());
|
|
1094
|
+
this.triggerQueryChange();
|
|
1095
|
+
}
|
|
1096
|
+
toggleRegex() {
|
|
1097
|
+
this.searchWidget.searchInput?.setRegex(!this.searchWidget.searchInput.getRegex());
|
|
1098
|
+
this.triggerQueryChange();
|
|
1099
|
+
}
|
|
1100
|
+
togglePreserveCase() {
|
|
1101
|
+
this.searchWidget.replaceInput?.setPreserveCase(!this.searchWidget.replaceInput.getPreserveCase());
|
|
1102
|
+
this.triggerQueryChange();
|
|
1103
|
+
}
|
|
1104
|
+
setSearchParameters(args = {}) {
|
|
1105
|
+
if (typeof args.isCaseSensitive === 'boolean') {
|
|
1106
|
+
this.searchWidget.searchInput?.setCaseSensitive(args.isCaseSensitive);
|
|
1107
|
+
}
|
|
1108
|
+
if (typeof args.matchWholeWord === 'boolean') {
|
|
1109
|
+
this.searchWidget.searchInput?.setWholeWords(args.matchWholeWord);
|
|
1110
|
+
}
|
|
1111
|
+
if (typeof args.isRegex === 'boolean') {
|
|
1112
|
+
this.searchWidget.searchInput?.setRegex(args.isRegex);
|
|
1113
|
+
}
|
|
1114
|
+
if (typeof args.filesToInclude === 'string') {
|
|
1115
|
+
this.searchIncludePattern.setValue(String(args.filesToInclude));
|
|
1116
|
+
}
|
|
1117
|
+
if (typeof args.filesToExclude === 'string') {
|
|
1118
|
+
this.searchExcludePattern.setValue(String(args.filesToExclude));
|
|
1119
|
+
}
|
|
1120
|
+
if (typeof args.query === 'string') {
|
|
1121
|
+
this.searchWidget.searchInput?.setValue(args.query);
|
|
1122
|
+
}
|
|
1123
|
+
if (typeof args.replace === 'string') {
|
|
1124
|
+
this.searchWidget.replaceInput?.setValue(args.replace);
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
if (this.searchWidget.replaceInput && this.searchWidget.replaceInput.getValue() !== '') {
|
|
1128
|
+
this.searchWidget.replaceInput.setValue('');
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
if (typeof args.triggerSearch === 'boolean' && args.triggerSearch) {
|
|
1132
|
+
this.triggerQueryChange();
|
|
1133
|
+
}
|
|
1134
|
+
if (typeof args.preserveCase === 'boolean') {
|
|
1135
|
+
this.searchWidget.replaceInput?.setPreserveCase(args.preserveCase);
|
|
1136
|
+
}
|
|
1137
|
+
if (typeof args.useExcludeSettingsAndIgnoreFiles === 'boolean') {
|
|
1138
|
+
this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(args.useExcludeSettingsAndIgnoreFiles);
|
|
1139
|
+
}
|
|
1140
|
+
if (typeof args.onlyOpenEditors === 'boolean') {
|
|
1141
|
+
this.searchIncludePattern.setOnlySearchInOpenEditors(args.onlyOpenEditors);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
toggleQueryDetails(moveFocus = true, show, skipLayout, reverse) {
|
|
1145
|
+
const cls = 'more';
|
|
1146
|
+
show = typeof show === 'undefined' ? !this.queryDetails.classList.contains(cls) : Boolean(show);
|
|
1147
|
+
this.viewletState['query.queryDetailsExpanded'] = show;
|
|
1148
|
+
skipLayout = Boolean(skipLayout);
|
|
1149
|
+
if (show) {
|
|
1150
|
+
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'true');
|
|
1151
|
+
this.queryDetails.classList.add(cls);
|
|
1152
|
+
if (moveFocus) {
|
|
1153
|
+
if (reverse) {
|
|
1154
|
+
this.inputPatternExcludes.focus();
|
|
1155
|
+
this.inputPatternExcludes.select();
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
this.inputPatternIncludes.focus();
|
|
1159
|
+
this.inputPatternIncludes.select();
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
else {
|
|
1164
|
+
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'false');
|
|
1165
|
+
this.queryDetails.classList.remove(cls);
|
|
1166
|
+
if (moveFocus) {
|
|
1167
|
+
this.searchWidget.focus();
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
if (!skipLayout && this.size) {
|
|
1171
|
+
this.reLayout();
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
searchInFolders(folderPaths = []) {
|
|
1175
|
+
this._searchWithIncludeOrExclude(true, folderPaths);
|
|
1176
|
+
}
|
|
1177
|
+
searchOutsideOfFolders(folderPaths = []) {
|
|
1178
|
+
this._searchWithIncludeOrExclude(false, folderPaths);
|
|
1179
|
+
}
|
|
1180
|
+
_searchWithIncludeOrExclude(include, folderPaths) {
|
|
1181
|
+
if (!folderPaths.length || ( folderPaths.some(folderPath => folderPath === '.'))) {
|
|
1182
|
+
this.inputPatternIncludes.setValue('');
|
|
1183
|
+
this.searchWidget.focus();
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
if (!this.showsFileTypes()) {
|
|
1187
|
+
this.toggleQueryDetails(true, true);
|
|
1188
|
+
}
|
|
1189
|
+
(include ? this.inputPatternIncludes : this.inputPatternExcludes).setValue(folderPaths.join(', '));
|
|
1190
|
+
this.searchWidget.focus(false);
|
|
1191
|
+
}
|
|
1192
|
+
triggerQueryChange(_options) {
|
|
1193
|
+
const options = { preserveFocus: true, triggeredOnType: false, delay: 0, ..._options };
|
|
1194
|
+
if (options.triggeredOnType && !this.searchConfig.searchOnType) {
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
if (!this.pauseSearching) {
|
|
1198
|
+
this.triggerQueryDelayer.trigger(() => {
|
|
1199
|
+
this._onQueryChanged(options.preserveFocus, options.triggeredOnType);
|
|
1200
|
+
}, options.delay);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
_onQueryChanged(preserveFocus, triggeredOnType = false) {
|
|
1204
|
+
if (!(this.searchWidget.searchInput?.inputBox.isInputValid())) {
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
const isRegex = this.searchWidget.searchInput.getRegex();
|
|
1208
|
+
const isInNotebookMarkdownInput = this.searchWidget.getNotebookFilters().markupInput;
|
|
1209
|
+
const isInNotebookMarkdownPreview = this.searchWidget.getNotebookFilters().markupPreview;
|
|
1210
|
+
const isInNotebookCellInput = this.searchWidget.getNotebookFilters().codeInput;
|
|
1211
|
+
const isInNotebookCellOutput = this.searchWidget.getNotebookFilters().codeOutput;
|
|
1212
|
+
const isWholeWords = this.searchWidget.searchInput.getWholeWords();
|
|
1213
|
+
const isCaseSensitive = this.searchWidget.searchInput.getCaseSensitive();
|
|
1214
|
+
const contentPattern = this.searchWidget.searchInput.getValue();
|
|
1215
|
+
const excludePatternText = this.inputPatternExcludes.getValue().trim();
|
|
1216
|
+
const includePatternText = this.inputPatternIncludes.getValue().trim();
|
|
1217
|
+
const useExcludesAndIgnoreFiles = this.inputPatternExcludes.useExcludesAndIgnoreFiles();
|
|
1218
|
+
const onlySearchInOpenEditors = this.inputPatternIncludes.onlySearchInOpenEditors();
|
|
1219
|
+
if (contentPattern.length === 0) {
|
|
1220
|
+
this.clearSearchResults(false);
|
|
1221
|
+
this.clearMessage();
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
const content = {
|
|
1225
|
+
pattern: contentPattern,
|
|
1226
|
+
isRegExp: isRegex,
|
|
1227
|
+
isCaseSensitive: isCaseSensitive,
|
|
1228
|
+
isWordMatch: isWholeWords,
|
|
1229
|
+
notebookInfo: {
|
|
1230
|
+
isInNotebookMarkdownInput,
|
|
1231
|
+
isInNotebookMarkdownPreview,
|
|
1232
|
+
isInNotebookCellInput,
|
|
1233
|
+
isInNotebookCellOutput
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
const excludePattern = this.inputPatternExcludes.getValue();
|
|
1237
|
+
const includePattern = this.inputPatternIncludes.getValue();
|
|
1238
|
+
const charsPerLine = content.isRegExp ? 10000 : 1000;
|
|
1239
|
+
const options = {
|
|
1240
|
+
_reason: 'searchView',
|
|
1241
|
+
extraFileResources: this.instantiationService.invokeFunction(getOutOfWorkspaceEditorResources),
|
|
1242
|
+
maxResults: withNullAsUndefined(this.searchConfig.maxResults),
|
|
1243
|
+
disregardIgnoreFiles: !useExcludesAndIgnoreFiles || undefined,
|
|
1244
|
+
disregardExcludeSettings: !useExcludesAndIgnoreFiles || undefined,
|
|
1245
|
+
onlyOpenEditors: onlySearchInOpenEditors,
|
|
1246
|
+
excludePattern,
|
|
1247
|
+
includePattern,
|
|
1248
|
+
previewOptions: {
|
|
1249
|
+
matchLines: 1,
|
|
1250
|
+
charsPerLine
|
|
1251
|
+
},
|
|
1252
|
+
isSmartCase: this.searchConfig.smartCase,
|
|
1253
|
+
expandPatterns: true
|
|
1254
|
+
};
|
|
1255
|
+
const folderResources = this.contextService.getWorkspace().folders;
|
|
1256
|
+
const onQueryValidationError = (err) => {
|
|
1257
|
+
this.searchWidget.searchInput?.showMessage({ content: err.message, type: 3 });
|
|
1258
|
+
this.viewModel.searchResult.clear();
|
|
1259
|
+
};
|
|
1260
|
+
let query;
|
|
1261
|
+
try {
|
|
1262
|
+
query = this.queryBuilder.text(content, ( folderResources.map(folder => folder.uri)), options);
|
|
1263
|
+
}
|
|
1264
|
+
catch (err) {
|
|
1265
|
+
onQueryValidationError(err);
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
this.validateQuery(query).then(() => {
|
|
1269
|
+
this.onQueryTriggered(query, options, excludePatternText, includePatternText, triggeredOnType);
|
|
1270
|
+
if (!preserveFocus) {
|
|
1271
|
+
this.searchWidget.focus(false, undefined, true);
|
|
1272
|
+
}
|
|
1273
|
+
}, onQueryValidationError);
|
|
1274
|
+
}
|
|
1275
|
+
validateQuery(query) {
|
|
1276
|
+
const folderQueriesExistP = ( query.folderQueries.map(fq => {
|
|
1277
|
+
return this.fileService.exists(fq.folder).catch(() => false);
|
|
1278
|
+
}));
|
|
1279
|
+
return Promise.all(folderQueriesExistP).then(existResults => {
|
|
1280
|
+
const existingFolderQueries = query.folderQueries.filter((folderQuery, i) => existResults[i]);
|
|
1281
|
+
if (!query.folderQueries.length || existingFolderQueries.length) {
|
|
1282
|
+
query.folderQueries = existingFolderQueries;
|
|
1283
|
+
}
|
|
1284
|
+
else {
|
|
1285
|
+
const nonExistantPath = query.folderQueries[0].folder.fsPath;
|
|
1286
|
+
const searchPathNotFoundError = ( nls.localize('searchPathNotFoundError', "Search path not found: {0}", nonExistantPath));
|
|
1287
|
+
return Promise.reject(( new Error(searchPathNotFoundError)));
|
|
1288
|
+
}
|
|
1289
|
+
return undefined;
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
onQueryTriggered(query, options, excludePatternText, includePatternText, triggeredOnType) {
|
|
1293
|
+
this.addToSearchHistoryDelayer.trigger(() => {
|
|
1294
|
+
this.searchWidget.searchInput?.onSearchSubmit();
|
|
1295
|
+
this.inputPatternExcludes.onSearchSubmit();
|
|
1296
|
+
this.inputPatternIncludes.onSearchSubmit();
|
|
1297
|
+
});
|
|
1298
|
+
this.viewModel.cancelSearch(true);
|
|
1299
|
+
this.currentSearchQ = this.currentSearchQ
|
|
1300
|
+
.then(() => this.doSearch(query, excludePatternText, includePatternText, triggeredOnType))
|
|
1301
|
+
.then(() => undefined, () => undefined);
|
|
1302
|
+
}
|
|
1303
|
+
_updateResults() {
|
|
1304
|
+
try {
|
|
1305
|
+
if (this.state === SearchUIState.Idle) {
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1308
|
+
const fileCount = this.viewModel.searchResult.fileCount();
|
|
1309
|
+
if (this._visibleMatches !== fileCount) {
|
|
1310
|
+
this._visibleMatches = fileCount;
|
|
1311
|
+
this.refreshAndUpdateCount();
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
finally {
|
|
1315
|
+
this._refreshResultsScheduler.schedule();
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
doSearch(query, excludePatternText, includePatternText, triggeredOnType) {
|
|
1319
|
+
let progressComplete;
|
|
1320
|
+
this.progressService.withProgress({ location: this.getProgressLocation(), delay: triggeredOnType ? 300 : 0 }, _progress => {
|
|
1321
|
+
return ( new Promise(resolve => progressComplete = resolve));
|
|
1322
|
+
});
|
|
1323
|
+
this.searchWidget.searchInput?.clearMessage();
|
|
1324
|
+
this.state = SearchUIState.Searching;
|
|
1325
|
+
this.showEmptyStage();
|
|
1326
|
+
const slowTimer = setTimeout(() => {
|
|
1327
|
+
this.state = SearchUIState.SlowSearch;
|
|
1328
|
+
}, 2000);
|
|
1329
|
+
const onComplete = (completed) => {
|
|
1330
|
+
clearTimeout(slowTimer);
|
|
1331
|
+
this.state = SearchUIState.Idle;
|
|
1332
|
+
progressComplete();
|
|
1333
|
+
this.onSearchResultsChanged();
|
|
1334
|
+
const collapseResults = this.searchConfig.collapseResults;
|
|
1335
|
+
if (collapseResults !== 'alwaysCollapse' && this.viewModel.searchResult.matches().length === 1) {
|
|
1336
|
+
const onlyMatch = this.viewModel.searchResult.matches()[0];
|
|
1337
|
+
if (onlyMatch.count() < 50) {
|
|
1338
|
+
this.tree.expand(onlyMatch);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
this.viewModel.replaceString = this.searchWidget.getReplaceValue();
|
|
1342
|
+
const hasResults = !this.viewModel.searchResult.isEmpty();
|
|
1343
|
+
if (completed?.exit === 1 ) {
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
if (!hasResults) {
|
|
1347
|
+
const hasExcludes = !!excludePatternText;
|
|
1348
|
+
const hasIncludes = !!includePatternText;
|
|
1349
|
+
let message;
|
|
1350
|
+
if (!completed) {
|
|
1351
|
+
message = SEARCH_CANCELLED_MESSAGE;
|
|
1352
|
+
}
|
|
1353
|
+
else if (this.inputPatternIncludes.onlySearchInOpenEditors()) {
|
|
1354
|
+
if (hasIncludes && hasExcludes) {
|
|
1355
|
+
message = ( nls.localize(
|
|
1356
|
+
'noOpenEditorResultsIncludesExcludes',
|
|
1357
|
+
"No results found in open editors matching '{0}' excluding '{1}' - ",
|
|
1358
|
+
includePatternText,
|
|
1359
|
+
excludePatternText
|
|
1360
|
+
));
|
|
1361
|
+
}
|
|
1362
|
+
else if (hasIncludes) {
|
|
1363
|
+
message = ( nls.localize(
|
|
1364
|
+
'noOpenEditorResultsIncludes',
|
|
1365
|
+
"No results found in open editors matching '{0}' - ",
|
|
1366
|
+
includePatternText
|
|
1367
|
+
));
|
|
1368
|
+
}
|
|
1369
|
+
else if (hasExcludes) {
|
|
1370
|
+
message = ( nls.localize(
|
|
1371
|
+
'noOpenEditorResultsExcludes',
|
|
1372
|
+
"No results found in open editors excluding '{0}' - ",
|
|
1373
|
+
excludePatternText
|
|
1374
|
+
));
|
|
1375
|
+
}
|
|
1376
|
+
else {
|
|
1377
|
+
message = ( nls.localize(
|
|
1378
|
+
'noOpenEditorResultsFound',
|
|
1379
|
+
"No results found in open editors. Review your settings for configured exclusions and check your gitignore files - "
|
|
1380
|
+
));
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
else {
|
|
1384
|
+
if (hasIncludes && hasExcludes) {
|
|
1385
|
+
message = ( nls.localize(
|
|
1386
|
+
'noResultsIncludesExcludes',
|
|
1387
|
+
"No results found in '{0}' excluding '{1}' - ",
|
|
1388
|
+
includePatternText,
|
|
1389
|
+
excludePatternText
|
|
1390
|
+
));
|
|
1391
|
+
}
|
|
1392
|
+
else if (hasIncludes) {
|
|
1393
|
+
message = ( nls.localize('noResultsIncludes', "No results found in '{0}' - ", includePatternText));
|
|
1394
|
+
}
|
|
1395
|
+
else if (hasExcludes) {
|
|
1396
|
+
message = ( nls.localize(
|
|
1397
|
+
'noResultsExcludes',
|
|
1398
|
+
"No results found excluding '{0}' - ",
|
|
1399
|
+
excludePatternText
|
|
1400
|
+
));
|
|
1401
|
+
}
|
|
1402
|
+
else {
|
|
1403
|
+
message = ( nls.localize(
|
|
1404
|
+
'noResultsFound',
|
|
1405
|
+
"No results found. Review your settings for configured exclusions and check your gitignore files - "
|
|
1406
|
+
));
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
aria.status(message);
|
|
1410
|
+
const messageEl = this.clearMessage();
|
|
1411
|
+
dom.append(messageEl, message);
|
|
1412
|
+
if (!completed) {
|
|
1413
|
+
const searchAgainButton = this.messageDisposables.add(( new SearchLinkButton(( nls.localize('rerunSearch.message', "Search again")), () => this.triggerQueryChange({ preserveFocus: false }))));
|
|
1414
|
+
dom.append(messageEl, searchAgainButton.element);
|
|
1415
|
+
}
|
|
1416
|
+
else if (hasIncludes || hasExcludes) {
|
|
1417
|
+
const searchAgainButton = this.messageDisposables.add(( new SearchLinkButton(( nls.localize('rerunSearchInAll.message', "Search again in all files")), this.onSearchAgain.bind(this))));
|
|
1418
|
+
dom.append(messageEl, searchAgainButton.element);
|
|
1419
|
+
}
|
|
1420
|
+
else {
|
|
1421
|
+
const openSettingsButton = this.messageDisposables.add(( new SearchLinkButton(( nls.localize('openSettings.message', "Open Settings")), this.onOpenSettings.bind(this))));
|
|
1422
|
+
dom.append(messageEl, openSettingsButton.element);
|
|
1423
|
+
}
|
|
1424
|
+
if (completed) {
|
|
1425
|
+
dom.append(messageEl, $('span', undefined, ' - '));
|
|
1426
|
+
const learnMoreButton = this.messageDisposables.add(( new SearchLinkButton(( nls.localize('openSettings.learnMore', "Learn More")), this.onLearnMore.bind(this))));
|
|
1427
|
+
dom.append(messageEl, learnMoreButton.element);
|
|
1428
|
+
}
|
|
1429
|
+
if (this.contextService.getWorkbenchState() === 1 ) {
|
|
1430
|
+
this.showSearchWithoutFolderMessage();
|
|
1431
|
+
}
|
|
1432
|
+
this.reLayout();
|
|
1433
|
+
}
|
|
1434
|
+
else {
|
|
1435
|
+
this.viewModel.searchResult.toggleHighlights(this.isVisible());
|
|
1436
|
+
aria.status(( nls.localize(
|
|
1437
|
+
'ariaSearchResultsStatus',
|
|
1438
|
+
"Search returned {0} results in {1} files",
|
|
1439
|
+
this.viewModel.searchResult.count(),
|
|
1440
|
+
this.viewModel.searchResult.fileCount()
|
|
1441
|
+
)));
|
|
1442
|
+
}
|
|
1443
|
+
if (completed && completed.limitHit) {
|
|
1444
|
+
completed.messages.push({ type: TextSearchCompleteMessageType.Warning, text: ( nls.localize(
|
|
1445
|
+
'searchMaxResultsWarning',
|
|
1446
|
+
"The result set only contains a subset of all matches. Be more specific in your search to narrow down the results."
|
|
1447
|
+
)) });
|
|
1448
|
+
}
|
|
1449
|
+
if (completed && completed.messages) {
|
|
1450
|
+
for (const message of completed.messages) {
|
|
1451
|
+
this.addMessage(message);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
this.reLayout();
|
|
1455
|
+
};
|
|
1456
|
+
const onError = (e) => {
|
|
1457
|
+
clearTimeout(slowTimer);
|
|
1458
|
+
this.state = SearchUIState.Idle;
|
|
1459
|
+
if (errors.isCancellationError(e)) {
|
|
1460
|
+
return onComplete(undefined);
|
|
1461
|
+
}
|
|
1462
|
+
else {
|
|
1463
|
+
progressComplete();
|
|
1464
|
+
this.searchWidget.searchInput?.showMessage({ content: e.message, type: 3 });
|
|
1465
|
+
this.viewModel.searchResult.clear();
|
|
1466
|
+
return Promise.resolve();
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
this._visibleMatches = 0;
|
|
1470
|
+
this._refreshResultsScheduler.schedule();
|
|
1471
|
+
this.searchWidget.setReplaceAllActionState(false);
|
|
1472
|
+
this.tree.setSelection([]);
|
|
1473
|
+
this.tree.setFocus([]);
|
|
1474
|
+
return this.viewModel.search(query)
|
|
1475
|
+
.then(onComplete, onError);
|
|
1476
|
+
}
|
|
1477
|
+
onOpenSettings(e) {
|
|
1478
|
+
dom.EventHelper.stop(e, false);
|
|
1479
|
+
this.openSettings('@id:files.exclude,search.exclude,search.useParentIgnoreFiles,search.useGlobalIgnoreFiles,search.useIgnoreFiles');
|
|
1480
|
+
}
|
|
1481
|
+
openSettings(query) {
|
|
1482
|
+
const options = { query };
|
|
1483
|
+
return this.contextService.getWorkbenchState() !== 1 ?
|
|
1484
|
+
this.preferencesService.openWorkspaceSettings(options) :
|
|
1485
|
+
this.preferencesService.openUserSettings(options);
|
|
1486
|
+
}
|
|
1487
|
+
onLearnMore() {
|
|
1488
|
+
this.openerService.open(( URI.parse('https://go.microsoft.com/fwlink/?linkid=853977')));
|
|
1489
|
+
}
|
|
1490
|
+
onSearchAgain() {
|
|
1491
|
+
this.inputPatternExcludes.setValue('');
|
|
1492
|
+
this.inputPatternIncludes.setValue('');
|
|
1493
|
+
this.inputPatternIncludes.setOnlySearchInOpenEditors(false);
|
|
1494
|
+
this.triggerQueryChange({ preserveFocus: false });
|
|
1495
|
+
}
|
|
1496
|
+
onEnableExcludes() {
|
|
1497
|
+
this.toggleQueryDetails(false, true);
|
|
1498
|
+
this.searchExcludePattern.setUseExcludesAndIgnoreFiles(true);
|
|
1499
|
+
}
|
|
1500
|
+
onDisableSearchInOpenEditors() {
|
|
1501
|
+
this.toggleQueryDetails(false, true);
|
|
1502
|
+
this.inputPatternIncludes.setOnlySearchInOpenEditors(false);
|
|
1503
|
+
}
|
|
1504
|
+
updateSearchResultCount(disregardExcludesAndIgnores, onlyOpenEditors, clear = false) {
|
|
1505
|
+
const fileCount = this.viewModel.searchResult.fileCount();
|
|
1506
|
+
this.hasSearchResultsKey.set(fileCount > 0);
|
|
1507
|
+
const msgWasHidden = this.messagesElement.style.display === 'none';
|
|
1508
|
+
const messageEl = this.clearMessage();
|
|
1509
|
+
const resultMsg = clear ? '' : this.buildResultCountMessage(this.viewModel.searchResult.count(), fileCount);
|
|
1510
|
+
this.tree.ariaLabel = resultMsg + ( nls.localize(
|
|
1511
|
+
'forTerm',
|
|
1512
|
+
" - Search: {0}",
|
|
1513
|
+
this.searchResult.query?.contentPattern.pattern ?? ''
|
|
1514
|
+
));
|
|
1515
|
+
dom.append(messageEl, resultMsg);
|
|
1516
|
+
if (fileCount > 0) {
|
|
1517
|
+
if (disregardExcludesAndIgnores) {
|
|
1518
|
+
const excludesDisabledMessage = ' - ' + ( nls.localize(
|
|
1519
|
+
'useIgnoresAndExcludesDisabled',
|
|
1520
|
+
"exclude settings and ignore files are disabled"
|
|
1521
|
+
)) + ' ';
|
|
1522
|
+
const enableExcludesButton = this.messageDisposables.add(( new SearchLinkButton(( nls.localize('excludes.enable', "enable")), this.onEnableExcludes.bind(this), ( nls.localize(
|
|
1523
|
+
'useExcludesAndIgnoreFilesDescription',
|
|
1524
|
+
"Use Exclude Settings and Ignore Files"
|
|
1525
|
+
)))));
|
|
1526
|
+
dom.append(messageEl, $('span', undefined, excludesDisabledMessage, '(', enableExcludesButton.element, ')'));
|
|
1527
|
+
}
|
|
1528
|
+
if (onlyOpenEditors) {
|
|
1529
|
+
const searchingInOpenMessage = ' - ' + ( nls.localize('onlyOpenEditors', "searching only in open files")) + ' ';
|
|
1530
|
+
const disableOpenEditorsButton = this.messageDisposables.add(( new SearchLinkButton(( nls.localize('openEditors.disable', "disable")), this.onDisableSearchInOpenEditors.bind(this), ( nls.localize('disableOpenEditors', "Search in entire workspace")))));
|
|
1531
|
+
dom.append(messageEl, $('span', undefined, searchingInOpenMessage, '(', disableOpenEditorsButton.element, ')'));
|
|
1532
|
+
}
|
|
1533
|
+
dom.append(messageEl, ' - ');
|
|
1534
|
+
const openInEditorTooltip = appendKeyBindingLabel(( nls.localize('openInEditor.tooltip', "Copy current search results to an editor")), this.keybindingService.lookupKeybinding(OpenInEditorCommandId));
|
|
1535
|
+
const openInEditorButton = this.messageDisposables.add(( new SearchLinkButton(( nls.localize('openInEditor.message', "Open in editor")), () => this.instantiationService.invokeFunction(createEditorFromSearchResult, this.searchResult, this.searchIncludePattern.getValue(), this.searchExcludePattern.getValue(), this.searchIncludePattern.onlySearchInOpenEditors()), openInEditorTooltip)));
|
|
1536
|
+
dom.append(messageEl, openInEditorButton.element);
|
|
1537
|
+
this.reLayout();
|
|
1538
|
+
}
|
|
1539
|
+
else if (!msgWasHidden) {
|
|
1540
|
+
dom.hide(this.messagesElement);
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
addMessage(message) {
|
|
1544
|
+
const messageBox = this.messagesElement.firstChild;
|
|
1545
|
+
if (!messageBox) {
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1548
|
+
dom.append(messageBox, renderSearchMessage(message, this.instantiationService, this.notificationService, this.openerService, this.commandService, this.messageDisposables, () => this.triggerQueryChange()));
|
|
1549
|
+
}
|
|
1550
|
+
buildResultCountMessage(resultCount, fileCount) {
|
|
1551
|
+
if (resultCount === 1 && fileCount === 1) {
|
|
1552
|
+
return ( nls.localize('search.file.result', "{0} result in {1} file", resultCount, fileCount));
|
|
1553
|
+
}
|
|
1554
|
+
else if (resultCount === 1) {
|
|
1555
|
+
return ( nls.localize('search.files.result', "{0} result in {1} files", resultCount, fileCount));
|
|
1556
|
+
}
|
|
1557
|
+
else if (fileCount === 1) {
|
|
1558
|
+
return ( nls.localize('search.file.results', "{0} results in {1} file", resultCount, fileCount));
|
|
1559
|
+
}
|
|
1560
|
+
else {
|
|
1561
|
+
return ( nls.localize('search.files.results', "{0} results in {1} files", resultCount, fileCount));
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
showSearchWithoutFolderMessage() {
|
|
1565
|
+
this.searchWithoutFolderMessageElement = this.clearMessage();
|
|
1566
|
+
const textEl = dom.append(this.searchWithoutFolderMessageElement, $('p', undefined, ( nls.localize(
|
|
1567
|
+
'searchWithoutFolder',
|
|
1568
|
+
"You have not opened or specified a folder. Only open files are currently searched - "
|
|
1569
|
+
))));
|
|
1570
|
+
const openFolderButton = this.messageDisposables.add(( new SearchLinkButton(( nls.localize('openFolder', "Open Folder")), () => {
|
|
1571
|
+
this.commandService.executeCommand(platform.isMacintosh && platform.isNative ? OpenFileFolderAction.ID : OpenFolderAction.ID).catch(err => errors.onUnexpectedError(err));
|
|
1572
|
+
})));
|
|
1573
|
+
dom.append(textEl, openFolderButton.element);
|
|
1574
|
+
}
|
|
1575
|
+
showEmptyStage(forceHideMessages = false) {
|
|
1576
|
+
const showingCancelled = (this.messagesElement.firstChild?.textContent?.indexOf(SEARCH_CANCELLED_MESSAGE) ?? -1) > -1;
|
|
1577
|
+
if (showingCancelled || forceHideMessages || !this.configurationService.getValue().search.searchOnType) {
|
|
1578
|
+
dom.hide(this.messagesElement);
|
|
1579
|
+
}
|
|
1580
|
+
dom.show(this.resultsElement);
|
|
1581
|
+
this.currentSelectedFileMatch = undefined;
|
|
1582
|
+
}
|
|
1583
|
+
shouldOpenInNotebookEditor(match, uri) {
|
|
1584
|
+
return match instanceof MatchInNotebook || (uri.scheme !== network.Schemas.untitled && this.notebookService.getContributedNotebookTypes(uri).length > 0);
|
|
1585
|
+
}
|
|
1586
|
+
onFocus(lineMatch, preserveFocus, sideBySide, pinned) {
|
|
1587
|
+
const useReplacePreview = this.configurationService.getValue().search.useReplacePreview;
|
|
1588
|
+
const resource = lineMatch instanceof Match ? lineMatch.parent().resource : lineMatch.resource;
|
|
1589
|
+
return (useReplacePreview && this.viewModel.isReplaceActive() && !!this.viewModel.replaceString && !(this.shouldOpenInNotebookEditor(lineMatch, resource))) ?
|
|
1590
|
+
this.replaceService.openReplacePreview(lineMatch, preserveFocus, sideBySide, pinned) :
|
|
1591
|
+
this.open(lineMatch, preserveFocus, sideBySide, pinned, resource);
|
|
1592
|
+
}
|
|
1593
|
+
async open(element, preserveFocus, sideBySide, pinned, resourceInput) {
|
|
1594
|
+
const selection = this.getSelectionFrom(element);
|
|
1595
|
+
const oldParentMatches = element instanceof Match ? element.parent().matches() : [];
|
|
1596
|
+
const resource = resourceInput ?? (element instanceof Match ? element.parent().resource : element.resource);
|
|
1597
|
+
let editor;
|
|
1598
|
+
try {
|
|
1599
|
+
editor = await this.editorService.openEditor({
|
|
1600
|
+
resource: resource,
|
|
1601
|
+
options: {
|
|
1602
|
+
preserveFocus,
|
|
1603
|
+
pinned,
|
|
1604
|
+
selection,
|
|
1605
|
+
revealIfVisible: true
|
|
1606
|
+
}
|
|
1607
|
+
}, sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
|
|
1608
|
+
const editorControl = editor?.getControl();
|
|
1609
|
+
if (element instanceof Match && preserveFocus && isCodeEditor(editorControl)) {
|
|
1610
|
+
this.viewModel.searchResult.rangeHighlightDecorations.highlightRange(editorControl.getModel(), element.range());
|
|
1611
|
+
}
|
|
1612
|
+
else {
|
|
1613
|
+
this.viewModel.searchResult.rangeHighlightDecorations.removeHighlightRange();
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
catch (err) {
|
|
1617
|
+
errors.onUnexpectedError(err);
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
if (editor instanceof NotebookEditor) {
|
|
1621
|
+
const elemParent = element.parent();
|
|
1622
|
+
if (element instanceof Match) {
|
|
1623
|
+
if (element instanceof MatchInNotebook) {
|
|
1624
|
+
element.parent().showMatch(element);
|
|
1625
|
+
}
|
|
1626
|
+
else {
|
|
1627
|
+
const editorWidget = editor.getControl();
|
|
1628
|
+
if (editorWidget) {
|
|
1629
|
+
elemParent.bindNotebookEditorWidget(editorWidget);
|
|
1630
|
+
await elemParent.updateMatchesForEditorWidget();
|
|
1631
|
+
const matchIndex = oldParentMatches.findIndex(e => e.id() === element.id());
|
|
1632
|
+
const matches = element.parent().matches();
|
|
1633
|
+
const match = matchIndex >= matches.length ? matches[matches.length - 1] : matches[matchIndex];
|
|
1634
|
+
if (match instanceof MatchInNotebook) {
|
|
1635
|
+
elemParent.showMatch(match);
|
|
1636
|
+
}
|
|
1637
|
+
if (!this.tree.getFocus().includes(match) || !this.tree.getSelection().includes(match)) {
|
|
1638
|
+
this.tree.setSelection([match], getSelectionKeyboardEvent());
|
|
1639
|
+
this.tree.setFocus([match]);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
openEditorWithMultiCursor(element) {
|
|
1647
|
+
const resource = element instanceof Match ? element.parent().resource : element.resource;
|
|
1648
|
+
return this.editorService.openEditor({
|
|
1649
|
+
resource: resource,
|
|
1650
|
+
options: {
|
|
1651
|
+
preserveFocus: false,
|
|
1652
|
+
pinned: true,
|
|
1653
|
+
revealIfVisible: true
|
|
1654
|
+
}
|
|
1655
|
+
}).then(editor => {
|
|
1656
|
+
if (editor) {
|
|
1657
|
+
let fileMatch = null;
|
|
1658
|
+
if (element instanceof FileMatch) {
|
|
1659
|
+
fileMatch = element;
|
|
1660
|
+
}
|
|
1661
|
+
else if (element instanceof Match) {
|
|
1662
|
+
fileMatch = element.parent();
|
|
1663
|
+
}
|
|
1664
|
+
if (fileMatch) {
|
|
1665
|
+
const selections = ( fileMatch.matches().map(m => ( new Selection(
|
|
1666
|
+
m.range().startLineNumber,
|
|
1667
|
+
m.range().startColumn,
|
|
1668
|
+
m.range().endLineNumber,
|
|
1669
|
+
m.range().endColumn
|
|
1670
|
+
))));
|
|
1671
|
+
const codeEditor = getCodeEditor(editor.getControl());
|
|
1672
|
+
if (codeEditor) {
|
|
1673
|
+
const multiCursorController = MultiCursorSelectionController.get(codeEditor);
|
|
1674
|
+
multiCursorController?.selectAllUsingSelections(selections);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
this.viewModel.searchResult.rangeHighlightDecorations.removeHighlightRange();
|
|
1679
|
+
}, errors.onUnexpectedError);
|
|
1680
|
+
}
|
|
1681
|
+
getSelectionFrom(element) {
|
|
1682
|
+
let match = null;
|
|
1683
|
+
if (element instanceof Match) {
|
|
1684
|
+
match = element;
|
|
1685
|
+
}
|
|
1686
|
+
if (element instanceof FileMatch && element.count() > 0) {
|
|
1687
|
+
match = element.matches()[element.matches().length - 1];
|
|
1688
|
+
}
|
|
1689
|
+
if (match) {
|
|
1690
|
+
const range = match.range();
|
|
1691
|
+
if (this.viewModel.isReplaceActive() && !!this.viewModel.replaceString) {
|
|
1692
|
+
const replaceString = match.replaceString;
|
|
1693
|
+
return {
|
|
1694
|
+
startLineNumber: range.startLineNumber,
|
|
1695
|
+
startColumn: range.startColumn,
|
|
1696
|
+
endLineNumber: range.startLineNumber,
|
|
1697
|
+
endColumn: range.startColumn + replaceString.length
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
return range;
|
|
1701
|
+
}
|
|
1702
|
+
return undefined;
|
|
1703
|
+
}
|
|
1704
|
+
onUntitledDidDispose(resource) {
|
|
1705
|
+
if (!this.viewModel) {
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
const matches = this.viewModel.searchResult.matches();
|
|
1709
|
+
for (let i = 0, len = matches.length; i < len; i++) {
|
|
1710
|
+
if (( resource.toString()) === ( matches[i].resource.toString())) {
|
|
1711
|
+
this.viewModel.searchResult.remove(matches[i]);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
onFilesChanged(e) {
|
|
1716
|
+
if (!this.viewModel || (this.searchConfig.sortOrder !== "modified" && !e.gotDeleted())) {
|
|
1717
|
+
return;
|
|
1718
|
+
}
|
|
1719
|
+
const matches = this.viewModel.searchResult.matches();
|
|
1720
|
+
if (e.gotDeleted()) {
|
|
1721
|
+
const deletedMatches = matches.filter(m => e.contains(m.resource, 2 ));
|
|
1722
|
+
this.viewModel.searchResult.remove(deletedMatches);
|
|
1723
|
+
}
|
|
1724
|
+
else {
|
|
1725
|
+
const changedMatches = matches.filter(m => e.contains(m.resource));
|
|
1726
|
+
if (changedMatches.length && this.searchConfig.sortOrder === "modified" ) {
|
|
1727
|
+
this.updateFileStats(changedMatches).then(() => this.refreshTree());
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
get searchConfig() {
|
|
1732
|
+
return this.configurationService.getValue('search');
|
|
1733
|
+
}
|
|
1734
|
+
clearHistory() {
|
|
1735
|
+
this.searchWidget.clearHistory();
|
|
1736
|
+
this.inputPatternExcludes.clearHistory();
|
|
1737
|
+
this.inputPatternIncludes.clearHistory();
|
|
1738
|
+
}
|
|
1739
|
+
saveState() {
|
|
1740
|
+
if (!this.searchWidget) {
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
const patternExcludes = this.inputPatternExcludes?.getValue().trim() ?? '';
|
|
1744
|
+
const patternIncludes = this.inputPatternIncludes?.getValue().trim() ?? '';
|
|
1745
|
+
const onlyOpenEditors = this.inputPatternIncludes?.onlySearchInOpenEditors() ?? false;
|
|
1746
|
+
const useExcludesAndIgnoreFiles = this.inputPatternExcludes?.useExcludesAndIgnoreFiles() ?? true;
|
|
1747
|
+
const preserveCase = this.viewModel.preserveCase;
|
|
1748
|
+
if (this.searchWidget.searchInput) {
|
|
1749
|
+
const isRegex = this.searchWidget.searchInput.getRegex();
|
|
1750
|
+
const isWholeWords = this.searchWidget.searchInput.getWholeWords();
|
|
1751
|
+
const isCaseSensitive = this.searchWidget.searchInput.getCaseSensitive();
|
|
1752
|
+
const contentPattern = this.searchWidget.searchInput.getValue();
|
|
1753
|
+
const isInNotebookCellInput = this.searchWidget.getNotebookFilters().codeInput;
|
|
1754
|
+
const isInNotebookCellOutput = this.searchWidget.getNotebookFilters().codeOutput;
|
|
1755
|
+
const isInNotebookMarkdownInput = this.searchWidget.getNotebookFilters().markupInput;
|
|
1756
|
+
const isInNotebookMarkdownPreview = this.searchWidget.getNotebookFilters().markupPreview;
|
|
1757
|
+
this.viewletState['query.contentPattern'] = contentPattern;
|
|
1758
|
+
this.viewletState['query.regex'] = isRegex;
|
|
1759
|
+
this.viewletState['query.wholeWords'] = isWholeWords;
|
|
1760
|
+
this.viewletState['query.caseSensitive'] = isCaseSensitive;
|
|
1761
|
+
this.viewletState['query.isInNotebookMarkdownInput'] = isInNotebookMarkdownInput;
|
|
1762
|
+
this.viewletState['query.isInNotebookMarkdownPreview'] = isInNotebookMarkdownPreview;
|
|
1763
|
+
this.viewletState['query.isInNotebookCellInput'] = isInNotebookCellInput;
|
|
1764
|
+
this.viewletState['query.isInNotebookCellOutput'] = isInNotebookCellOutput;
|
|
1765
|
+
}
|
|
1766
|
+
this.viewletState['query.folderExclusions'] = patternExcludes;
|
|
1767
|
+
this.viewletState['query.folderIncludes'] = patternIncludes;
|
|
1768
|
+
this.viewletState['query.useExcludesAndIgnoreFiles'] = useExcludesAndIgnoreFiles;
|
|
1769
|
+
this.viewletState['query.preserveCase'] = preserveCase;
|
|
1770
|
+
this.viewletState['query.onlyOpenEditors'] = onlyOpenEditors;
|
|
1771
|
+
const isReplaceShown = this.searchAndReplaceWidget.isReplaceShown();
|
|
1772
|
+
this.viewletState['view.showReplace'] = isReplaceShown;
|
|
1773
|
+
this.viewletState['view.treeLayout'] = this.isTreeLayoutViewVisible;
|
|
1774
|
+
this.viewletState['query.replaceText'] = isReplaceShown && this.searchWidget.getReplaceValue();
|
|
1775
|
+
const history = Object.create(null);
|
|
1776
|
+
const searchHistory = this.searchWidget.getSearchHistory();
|
|
1777
|
+
if (searchHistory && searchHistory.length) {
|
|
1778
|
+
history.search = searchHistory;
|
|
1779
|
+
}
|
|
1780
|
+
const replaceHistory = this.searchWidget.getReplaceHistory();
|
|
1781
|
+
if (replaceHistory && replaceHistory.length) {
|
|
1782
|
+
history.replace = replaceHistory;
|
|
1783
|
+
}
|
|
1784
|
+
const patternExcludesHistory = this.inputPatternExcludes.getHistory();
|
|
1785
|
+
if (patternExcludesHistory && patternExcludesHistory.length) {
|
|
1786
|
+
history.exclude = patternExcludesHistory;
|
|
1787
|
+
}
|
|
1788
|
+
const patternIncludesHistory = this.inputPatternIncludes.getHistory();
|
|
1789
|
+
if (patternIncludesHistory && patternIncludesHistory.length) {
|
|
1790
|
+
history.include = patternIncludesHistory;
|
|
1791
|
+
}
|
|
1792
|
+
this.searchHistoryService.save(history);
|
|
1793
|
+
this.memento.saveMemento();
|
|
1794
|
+
super.saveState();
|
|
1795
|
+
}
|
|
1796
|
+
async retrieveFileStats() {
|
|
1797
|
+
const files = ( this.searchResult.matches().filter(f => !f.fileStat).map(f => f.resolveFileStat(this.fileService)));
|
|
1798
|
+
await Promise.all(files);
|
|
1799
|
+
}
|
|
1800
|
+
async updateFileStats(elements) {
|
|
1801
|
+
const files = ( elements.map(f => f.resolveFileStat(this.fileService)));
|
|
1802
|
+
await Promise.all(files);
|
|
1803
|
+
}
|
|
1804
|
+
removeFileStats() {
|
|
1805
|
+
for (const fileMatch of this.searchResult.matches()) {
|
|
1806
|
+
fileMatch.fileStat = undefined;
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
dispose() {
|
|
1810
|
+
this.isDisposed = true;
|
|
1811
|
+
this.saveState();
|
|
1812
|
+
super.dispose();
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
SearchView.ACTIONS_RIGHT_CLASS_NAME = 'actions-right';
|
|
1816
|
+
SearchView = ( __decorate([
|
|
1817
|
+
( __param(1, IFileService)),
|
|
1818
|
+
( __param(2, IEditorService)),
|
|
1819
|
+
( __param(3, ICodeEditorService)),
|
|
1820
|
+
( __param(4, IProgressService)),
|
|
1821
|
+
( __param(5, INotificationService)),
|
|
1822
|
+
( __param(6, IDialogService)),
|
|
1823
|
+
( __param(7, ICommandService)),
|
|
1824
|
+
( __param(8, IContextViewService)),
|
|
1825
|
+
( __param(9, IInstantiationService)),
|
|
1826
|
+
( __param(10, IViewDescriptorService)),
|
|
1827
|
+
( __param(11, IConfigurationService)),
|
|
1828
|
+
( __param(12, IWorkspaceContextService)),
|
|
1829
|
+
( __param(13, ISearchWorkbenchService)),
|
|
1830
|
+
( __param(14, IContextKeyService)),
|
|
1831
|
+
( __param(15, IReplaceService)),
|
|
1832
|
+
( __param(16, ITextFileService)),
|
|
1833
|
+
( __param(17, IPreferencesService)),
|
|
1834
|
+
( __param(18, IThemeService)),
|
|
1835
|
+
( __param(19, ISearchHistoryService)),
|
|
1836
|
+
( __param(20, IContextMenuService)),
|
|
1837
|
+
( __param(21, IAccessibilityService)),
|
|
1838
|
+
( __param(22, IKeybindingService)),
|
|
1839
|
+
( __param(23, IStorageService)),
|
|
1840
|
+
( __param(24, IOpenerService)),
|
|
1841
|
+
( __param(25, ITelemetryService)),
|
|
1842
|
+
( __param(26, INotebookService)),
|
|
1843
|
+
( __param(27, ILogService))
|
|
1844
|
+
], SearchView));
|
|
1845
|
+
class SearchLinkButton extends Disposable {
|
|
1846
|
+
constructor(label, handler, tooltip) {
|
|
1847
|
+
super();
|
|
1848
|
+
this.element = $('a.pointer', { tabindex: 0, title: tooltip }, label);
|
|
1849
|
+
this.addEventHandlers(handler);
|
|
1850
|
+
}
|
|
1851
|
+
addEventHandlers(handler) {
|
|
1852
|
+
const wrappedHandler = (e) => {
|
|
1853
|
+
dom.EventHelper.stop(e, false);
|
|
1854
|
+
handler(e);
|
|
1855
|
+
};
|
|
1856
|
+
this._register(dom.addDisposableListener(this.element, dom.EventType.CLICK, wrappedHandler));
|
|
1857
|
+
this._register(dom.addDisposableListener(this.element, dom.EventType.KEY_DOWN, e => {
|
|
1858
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
1859
|
+
if (event.equals(10 ) || event.equals(3 )) {
|
|
1860
|
+
wrappedHandler(e);
|
|
1861
|
+
event.preventDefault();
|
|
1862
|
+
event.stopPropagation();
|
|
1863
|
+
}
|
|
1864
|
+
}));
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
export { SearchView };
|