@codingame/monaco-vscode-api 1.83.1 → 1.83.3-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/extensions.d.ts +3 -3
- package/extensions.js +31 -33
- package/l10n.d.ts +4 -0
- package/l10n.js +10 -0
- package/missing-services.js +4 -2
- package/monaco-editor-treemending.patch +12268 -1070
- package/monaco-treemending.js +8 -2
- package/package.json +8 -1
- package/service-override/extensions.js +2 -2
- package/service-override/layout.js +2 -2
- package/tools/l10n.js +177 -0
- package/tools.js +22 -1
- package/vscode/src/vs/base/browser/ui/menu/menubar.js +1 -1
- package/vscode/src/vs/base/browser/ui/splitview/paneview.js +2 -2
- package/vscode/src/vs/base/common/date.js +55 -55
- package/vscode/src/vs/base/common/jsonErrorMessages.js +10 -10
- package/vscode/src/vs/base/common/tfIdf.js +137 -0
- package/vscode/src/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +23 -0
- package/vscode/src/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +115 -0
- package/vscode/src/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +112 -0
- package/vscode/src/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +334 -0
- package/vscode/src/vs/platform/dialogs/common/dialogs.js +10 -14
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +3 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionNls.js +2 -2
- package/vscode/src/vs/platform/files/common/fileService.js +28 -37
- package/vscode/src/vs/platform/files/common/files.js +6 -6
- package/vscode/src/vs/platform/files/common/io.js +2 -2
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +3 -9
- package/vscode/src/vs/platform/quickinput/browser/commandsQuickAccess.js +300 -0
- package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.js +59 -0
- package/vscode/src/vs/platform/quickinput/browser/pickerQuickAccess.js +212 -0
- package/vscode/src/vs/platform/request/common/request.js +2 -2
- package/vscode/src/vs/platform/theme/common/tokenClassificationRegistry.js +42 -63
- package/vscode/src/vs/platform/workspaces/common/workspaces.js +15 -15
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +13 -32
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +50 -52
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +58 -69
- package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +4 -5
- package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +38 -50
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +23 -23
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +21 -53
- package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +4 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +4 -5
- package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +6 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +4 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +2 -12
- package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +15 -9
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +16 -20
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +6 -28
- package/vscode/src/vs/workbench/api/browser/statusBarExtensionPoint.js +60 -0
- package/vscode/src/vs/workbench/api/common/extHostChat.js +3 -3
- package/vscode/src/vs/workbench/api/common/extHostCommands.js +59 -65
- package/vscode/src/vs/workbench/api/common/extHostConsoleForwarder.js +8 -8
- package/vscode/src/vs/workbench/api/common/extHostDiagnostics.js +2 -6
- package/vscode/src/vs/workbench/api/common/extHostExtensionService.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostLanguageFeatures.js +150 -222
- package/vscode/src/vs/workbench/api/common/extHostLogService.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostNotebook.js +3 -3
- package/vscode/src/vs/workbench/api/common/extHostProgress.js +2 -6
- package/vscode/src/vs/workbench/api/common/extHostSCM.js +54 -58
- package/vscode/src/vs/workbench/api/common/extHostStatusBar.js +3 -7
- package/vscode/src/vs/workbench/api/common/extHostTelemetry.js +2 -6
- package/vscode/src/vs/workbench/api/common/extHostTerminalService.js +2 -6
- package/vscode/src/vs/workbench/api/common/extHostTreeViews.js +55 -57
- package/vscode/src/vs/workbench/api/common/extHostTunnelService.js +28 -28
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +265 -277
- package/vscode/src/vs/workbench/api/common/extHostWorkspace.js +2 -7
- package/vscode/src/vs/workbench/api/common/extensionHostMain.js +17 -19
- package/vscode/src/vs/workbench/api/common/jsonValidationExtensionPoint.js +9 -34
- package/vscode/src/vs/workbench/api/worker/extHostExtensionService.js +5 -5
- package/vscode/src/vs/workbench/browser/actions/layoutActions.js +898 -68
- package/vscode/src/vs/workbench/browser/actions/quickAccessActions.js +7 -7
- package/vscode/src/vs/workbench/browser/actions/windowActions.js +32 -38
- package/vscode/src/vs/workbench/browser/actions/workspaceActions.js +103 -13
- package/vscode/src/vs/workbench/browser/actions/workspaceCommands.js +2 -2
- package/vscode/src/vs/workbench/browser/editor.js +3 -3
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions.js +12 -27
- package/vscode/src/vs/workbench/browser/parts/compositeBarActions.js +12 -12
- package/vscode/src/vs/workbench/browser/parts/editor/binaryDiffEditor.js +2 -7
- package/vscode/src/vs/workbench/browser/parts/editor/binaryEditor.js +4 -7
- package/vscode/src/vs/workbench/browser/parts/editor/breadcrumbs.js +42 -90
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +140 -272
- package/vscode/src/vs/workbench/browser/parts/editor/editorActions.js +115 -148
- package/vscode/src/vs/workbench/browser/parts/editor/editorCommands.js +21 -33
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +7 -19
- package/vscode/src/vs/workbench/browser/parts/editor/editorPlaceholder.js +10 -26
- package/vscode/src/vs/workbench/browser/parts/editor/editorQuickAccess.js +7 -17
- package/vscode/src/vs/workbench/browser/parts/editor/editorStatus.js +60 -81
- package/vscode/src/vs/workbench/browser/parts/editor/sideBySideEditor.js +27 -33
- package/vscode/src/vs/workbench/browser/parts/editor/textCodeEditor.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/editor/textDiffEditor.js +19 -32
- package/vscode/src/vs/workbench/browser/parts/editor/textEditor.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.js +8 -8
- package/vscode/src/vs/workbench/browser/parts/panel/panelActions.js +69 -34
- package/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.js +58 -34
- package/vscode/src/vs/workbench/browser/parts/views/viewFilter.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/views/viewPane.js +3 -9
- package/vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.js +6 -6
- package/vscode/src/vs/workbench/browser/parts/views/viewsService.js +7 -11
- package/vscode/src/vs/workbench/browser/quickaccess.js +7 -3
- package/vscode/src/vs/workbench/browser/workbench.contribution.js +186 -683
- package/vscode/src/vs/workbench/common/configuration.js +12 -15
- package/vscode/src/vs/workbench/common/contextkeys.js +272 -90
- package/vscode/src/vs/workbench/common/editor/diffEditorInput.js +2 -2
- package/vscode/src/vs/workbench/common/editor/sideBySideEditorInput.js +2 -7
- package/vscode/src/vs/workbench/common/editor/textEditorModel.js +2 -6
- package/vscode/src/vs/workbench/common/editor.js +5 -5
- package/vscode/src/vs/workbench/common/theme.js +137 -527
- package/vscode/src/vs/workbench/common/views.js +4 -8
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.js +15 -55
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.js +3 -8
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleView.js +22 -60
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.js +9 -15
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +18 -48
- package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.js +58 -74
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatAgents.js +5 -10
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +5 -13
- package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +8 -27
- package/vscode/src/vs/workbench/contrib/codeActions/common/codeActionsExtensionPoint.js +5 -17
- package/vscode/src/vs/workbench/contrib/codeActions/common/documentationExtensionPoint.js +6 -15
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js +7 -20
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js +63 -216
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.js +4 -7
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +5 -8
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.js +8 -11
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.js +5 -15
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMinimap.js +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.js +5 -5
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleRenderControlCharacter.js +3 -6
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleRenderWhitespace.js +3 -6
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +10 -9
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +6 -15
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +5 -20
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +3 -10
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +4 -4
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +3 -20
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +9 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +4 -13
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +19 -19
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.contribution.js +26 -77
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +5 -17
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +31 -40
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +10 -29
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +8 -8
- package/vscode/src/vs/workbench/contrib/comments/common/commentContextKeys.js +25 -21
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.js +1 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/debugColors.js +20 -20
- package/vscode/src/vs/workbench/contrib/debug/browser/debugIcons.js +56 -98
- package/vscode/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/common/debug.js +96 -180
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsIcons.js +25 -79
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/configuration.js +4 -15
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpenerService.js +4 -8
- package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +56 -19
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.js +76 -230
- package/vscode/src/vs/workbench/contrib/files/browser/fileConstants.js +6 -5
- package/vscode/src/vs/workbench/contrib/files/browser/fileImportExport.js +33 -103
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +228 -99
- package/vscode/src/vs/workbench/contrib/files/browser/views/emptyView.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerDecorationsProvider.js +5 -9
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerView.js +5 -5
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerViewer.js +15 -35
- package/vscode/src/vs/workbench/contrib/files/browser/views/openEditorsView.js +5 -8
- package/vscode/src/vs/workbench/contrib/files/common/files.js +27 -48
- package/vscode/src/vs/workbench/contrib/folding/browser/folding.contribution.js +3 -6
- package/vscode/src/vs/workbench/contrib/format/browser/formatModified.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlayHints/browser/inlayHintsAccessibilty.js +5 -8
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +112 -52
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +30 -96
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +73 -126
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +3 -3
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +42 -0
- package/vscode/src/vs/workbench/contrib/output/browser/output.contribution.js +23 -29
- package/vscode/src/vs/workbench/contrib/output/browser/outputView.js +3 -3
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +13 -16
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +15 -34
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +12 -17
- package/vscode/src/vs/workbench/contrib/scm/browser/dirtyDiffSwitcher.js +2 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +26 -75
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.js +4 -19
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsFile.js +4 -4
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsService.js +60 -99
- package/vscode/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.js +5 -14
- package/vscode/src/vs/workbench/contrib/tasks/common/taskService.js +26 -13
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +88 -96
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +5 -17
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +7 -28
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +21 -78
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalContextKey.js +21 -53
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +2 -2
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.js +2 -5
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +113 -348
- package/vscode/src/vs/workbench/services/assignment/common/assignmentService.js +2 -5
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +31 -1
- package/vscode/src/vs/workbench/services/configuration/common/jsonEditingService.js +1 -4
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +16 -16
- package/vscode/src/vs/workbench/services/decorations/browser/decorationsService.js +2 -2
- package/vscode/src/vs/workbench/services/editor/common/editorResolverService.js +2 -5
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +4 -4
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +27 -29
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +104 -141
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +35 -39
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +25 -25
- package/vscode/src/vs/workbench/services/extensions/common/extensionsRegistry.js +80 -296
- package/vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +6 -21
- package/vscode/src/vs/workbench/services/host/browser/browserHostService.js +3 -6
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +24 -81
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +2 -2
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingEditing.js +11 -17
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +30 -32
- package/vscode/src/vs/workbench/services/language/common/languageService.js +23 -98
- package/vscode/src/vs/workbench/services/remote/common/tunnelModel.js +83 -95
- package/vscode/src/vs/workbench/services/search/common/queryBuilder.js +1 -5
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +11 -23
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModel.js +32 -32
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +2 -7
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +2 -2
- package/vscode/src/vs/workbench/services/themes/common/colorExtensionPoint.js +16 -53
- package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +50 -1
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +25 -99
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +16 -16
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +6 -3
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +15 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopySaveParticipant.js +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyBackupService.js +32 -42
|
@@ -12,7 +12,7 @@ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
|
12
12
|
import { mark } from 'monaco-editor/esm/vs/base/common/performance.js';
|
|
13
13
|
import { isAbsolutePath, extUri, extUriIgnorePathCase } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
14
14
|
import { isReadableStream, peekStream, peekReadable, consumeStream, transform, newWriteableStream, isReadableBufferedStream, listenStream } from 'monaco-editor/esm/vs/base/common/stream.js';
|
|
15
|
-
import {
|
|
15
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
16
16
|
import { FileChangesEvent, FileOperationError, hasOpenReadWriteCloseCapability, hasReadWriteCapability, hasFileReadStreamCapability, toFileSystemProviderErrorCode, FileSystemProviderErrorCode, ensureFileSystemProviderError, FileType, FilePermission, etag, FileOperationEvent, hasFileAtomicWriteCapability, toFileOperationResult, ETAG_DISABLED, hasFileAtomicReadCapability, NotModifiedSinceFileOperationError, TooLargeFileOperationError, hasFileFolderCopyCapability, hasFileAtomicDeleteCapability, hasFileCloneCapability } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
17
17
|
import { readFileIntoStream } from './io.js';
|
|
18
18
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
@@ -92,17 +92,13 @@ let FileService = class FileService extends Disposable {
|
|
|
92
92
|
}
|
|
93
93
|
async withProvider(resource) {
|
|
94
94
|
if (!isAbsolutePath(resource)) {
|
|
95
|
-
throw new FileOperationError(
|
|
95
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'invalidPath', "Unable to resolve filesystem provider with relative file path '{0}'", this.resourceForError(resource)), 8 );
|
|
96
96
|
}
|
|
97
97
|
await this.activateProvider(resource.scheme);
|
|
98
98
|
const provider = this.provider.get(resource.scheme);
|
|
99
99
|
if (!provider) {
|
|
100
100
|
const error = ( new ErrorNoTelemetry());
|
|
101
|
-
error.message = (
|
|
102
|
-
'noProviderFound',
|
|
103
|
-
"ENOPRO: No file system provider found for resource '{0}'",
|
|
104
|
-
( resource.toString())
|
|
105
|
-
));
|
|
101
|
+
error.message = localizeWithPath('vs/platform/files/common/fileService', 'noProviderFound', "ENOPRO: No file system provider found for resource '{0}'", ( resource.toString()));
|
|
106
102
|
throw error;
|
|
107
103
|
}
|
|
108
104
|
return provider;
|
|
@@ -127,7 +123,7 @@ let FileService = class FileService extends Disposable {
|
|
|
127
123
|
}
|
|
128
124
|
catch (error) {
|
|
129
125
|
if (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {
|
|
130
|
-
throw new FileOperationError(
|
|
126
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileNotFoundError', "Unable to resolve nonexistent file '{0}'", this.resourceForError(resource)), 1 );
|
|
131
127
|
}
|
|
132
128
|
throw ensureFileSystemProviderError(error);
|
|
133
129
|
}
|
|
@@ -234,7 +230,7 @@ let FileService = class FileService extends Disposable {
|
|
|
234
230
|
}
|
|
235
231
|
async doValidateCreateFile(resource, options) {
|
|
236
232
|
if (!options?.overwrite && (await this.exists(resource))) {
|
|
237
|
-
throw new FileOperationError(
|
|
233
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileExists', "Unable to create file '{0}' that already exists when overwrite flag is not set", this.resourceForError(resource)), 3 , options);
|
|
238
234
|
}
|
|
239
235
|
}
|
|
240
236
|
async createFile(resource, bufferOrReadableOrStream = VSBuffer.fromString(''), options) {
|
|
@@ -288,25 +284,25 @@ let FileService = class FileService extends Disposable {
|
|
|
288
284
|
this._onDidRunOperation.fire(( new FileOperationEvent(resource, 4 )));
|
|
289
285
|
}
|
|
290
286
|
catch (error) {
|
|
291
|
-
throw new FileOperationError(
|
|
287
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'err.write', "Unable to write file '{0}' ({1})", this.resourceForError(resource), ensureFileSystemProviderError(error).toString()), toFileOperationResult(error), writeFileOptions);
|
|
292
288
|
}
|
|
293
289
|
return this.resolve(resource, { resolveMetadata: true });
|
|
294
290
|
}
|
|
295
291
|
async validateWriteFile(provider, resource, options) {
|
|
296
292
|
const unlock = !!options?.unlock;
|
|
297
293
|
if (unlock && !((provider.capabilities & 8192) )) {
|
|
298
|
-
throw new Error(
|
|
294
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'writeFailedUnlockUnsupported', "Unable to unlock file '{0}' because provider does not support it.", this.resourceForError(resource)));
|
|
299
295
|
}
|
|
300
296
|
const atomic = !!options?.atomic;
|
|
301
297
|
if (atomic) {
|
|
302
298
|
if (!((provider.capabilities & 32768) )) {
|
|
303
|
-
throw new Error(
|
|
299
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'writeFailedAtomicUnsupported1', "Unable to atomically write file '{0}' because provider does not support it.", this.resourceForError(resource)));
|
|
304
300
|
}
|
|
305
301
|
if (!((provider.capabilities & 2) )) {
|
|
306
|
-
throw new Error(
|
|
302
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'writeFailedAtomicUnsupported2', "Unable to atomically write file '{0}' because provider does not support unbuffered writes.", this.resourceForError(resource)));
|
|
307
303
|
}
|
|
308
304
|
if (unlock) {
|
|
309
|
-
throw new Error(
|
|
305
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'writeFailedAtomicUnlock', "Unable to unlock file '{0}' because atomic write is enabled.", this.resourceForError(resource)));
|
|
310
306
|
}
|
|
311
307
|
}
|
|
312
308
|
let stat = undefined;
|
|
@@ -317,13 +313,13 @@ let FileService = class FileService extends Disposable {
|
|
|
317
313
|
return undefined;
|
|
318
314
|
}
|
|
319
315
|
if ((stat.type & FileType.Directory) !== 0) {
|
|
320
|
-
throw new FileOperationError(
|
|
316
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileIsDirectoryWriteError', "Unable to write file '{0}' that is actually a directory", this.resourceForError(resource)), 0 , options);
|
|
321
317
|
}
|
|
322
318
|
this.throwIfFileIsReadonly(resource, stat);
|
|
323
319
|
if (typeof options?.mtime === 'number' && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED &&
|
|
324
320
|
typeof stat.mtime === 'number' && typeof stat.size === 'number' &&
|
|
325
321
|
options.mtime < stat.mtime && options.etag !== etag({ mtime: options.mtime , size: stat.size })) {
|
|
326
|
-
throw new FileOperationError(
|
|
322
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileModifiedError', "File Modified Since"), 3 , options);
|
|
327
323
|
}
|
|
328
324
|
return stat;
|
|
329
325
|
}
|
|
@@ -404,12 +400,7 @@ let FileService = class FileService extends Disposable {
|
|
|
404
400
|
}
|
|
405
401
|
}
|
|
406
402
|
restoreReadError(error, resource, options) {
|
|
407
|
-
const message = (
|
|
408
|
-
'err.read',
|
|
409
|
-
"Unable to read file '{0}' ({1})",
|
|
410
|
-
this.resourceForError(resource),
|
|
411
|
-
( ensureFileSystemProviderError(error).toString())
|
|
412
|
-
));
|
|
403
|
+
const message = localizeWithPath('vs/platform/files/common/fileService', 'err.read', "Unable to read file '{0}' ({1})", this.resourceForError(resource), ( ensureFileSystemProviderError(error).toString()));
|
|
413
404
|
if (error instanceof NotModifiedSinceFileOperationError) {
|
|
414
405
|
return ( new NotModifiedSinceFileOperationError(message, error.stat, options));
|
|
415
406
|
}
|
|
@@ -464,17 +455,17 @@ let FileService = class FileService extends Disposable {
|
|
|
464
455
|
async validateReadFile(resource, options) {
|
|
465
456
|
const stat = await this.resolve(resource, { resolveMetadata: true });
|
|
466
457
|
if (stat.isDirectory) {
|
|
467
|
-
throw new FileOperationError(
|
|
458
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileIsDirectoryReadError', "Unable to read file '{0}' that is actually a directory", this.resourceForError(resource)), 0 , options);
|
|
468
459
|
}
|
|
469
460
|
if (typeof options?.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
|
|
470
|
-
throw new NotModifiedSinceFileOperationError(
|
|
461
|
+
throw new NotModifiedSinceFileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileNotModifiedError', "File not modified since"), stat, options);
|
|
471
462
|
}
|
|
472
463
|
this.validateReadFileLimits(resource, stat.size, options);
|
|
473
464
|
return stat;
|
|
474
465
|
}
|
|
475
466
|
validateReadFileLimits(resource, size, options) {
|
|
476
467
|
if (typeof options?.limits?.size === 'number' && size > options.limits.size) {
|
|
477
|
-
throw new TooLargeFileOperationError(
|
|
468
|
+
throw new TooLargeFileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileTooLargeError', "Unable to read file '{0}' that is too large to open", this.resourceForError(resource)), 7 , size, options);
|
|
478
469
|
}
|
|
479
470
|
}
|
|
480
471
|
async canMove(source, target, overwrite) {
|
|
@@ -592,21 +583,21 @@ let FileService = class FileService extends Disposable {
|
|
|
592
583
|
isSameResourceWithDifferentPathCase = providerExtUri.isEqual(source, target);
|
|
593
584
|
}
|
|
594
585
|
if (isSameResourceWithDifferentPathCase && mode === 'copy') {
|
|
595
|
-
throw new Error(
|
|
586
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'unableToMoveCopyError1', "Unable to copy when source '{0}' is same as target '{1}' with different path case on a case insensitive file system", this.resourceForError(source), this.resourceForError(target)));
|
|
596
587
|
}
|
|
597
588
|
if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
|
|
598
|
-
throw new Error(
|
|
589
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'unableToMoveCopyError2', "Unable to move/copy when source '{0}' is parent of target '{1}'.", this.resourceForError(source), this.resourceForError(target)));
|
|
599
590
|
}
|
|
600
591
|
}
|
|
601
592
|
const exists = await this.exists(target);
|
|
602
593
|
if (exists && !isSameResourceWithDifferentPathCase) {
|
|
603
594
|
if (!overwrite) {
|
|
604
|
-
throw new FileOperationError(
|
|
595
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'unableToMoveCopyError3', "Unable to move/copy '{0}' because target '{1}' already exists at destination.", this.resourceForError(source), this.resourceForError(target)), 4 );
|
|
605
596
|
}
|
|
606
597
|
if (sourceProvider === targetProvider) {
|
|
607
598
|
const { providerExtUri } = this.getExtUri(sourceProvider);
|
|
608
599
|
if (providerExtUri.isEqualOrParent(source, target)) {
|
|
609
|
-
throw new Error(
|
|
600
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'unableToMoveCopyError4', "Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.", this.resourceForError(source), this.resourceForError(target)));
|
|
610
601
|
}
|
|
611
602
|
}
|
|
612
603
|
}
|
|
@@ -636,7 +627,7 @@ let FileService = class FileService extends Disposable {
|
|
|
636
627
|
try {
|
|
637
628
|
const stat = await provider.stat(directory);
|
|
638
629
|
if ((stat.type & FileType.Directory) === 0) {
|
|
639
|
-
throw new Error(
|
|
630
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'mkdirExistsError', "Unable to create folder '{0}' that already exists but is not a directory", this.resourceForError(directory)));
|
|
640
631
|
}
|
|
641
632
|
break;
|
|
642
633
|
}
|
|
@@ -673,14 +664,14 @@ let FileService = class FileService extends Disposable {
|
|
|
673
664
|
const provider = this.throwIfFileSystemIsReadonly(await this.withProvider(resource), resource);
|
|
674
665
|
const useTrash = !!options?.useTrash;
|
|
675
666
|
if (useTrash && !((provider.capabilities & 4096) )) {
|
|
676
|
-
throw new Error(
|
|
667
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'deleteFailedTrashUnsupported', "Unable to delete file '{0}' via trash because provider does not support it.", this.resourceForError(resource)));
|
|
677
668
|
}
|
|
678
669
|
const atomic = options?.atomic;
|
|
679
670
|
if (atomic && !((provider.capabilities & 65536) )) {
|
|
680
|
-
throw new Error(
|
|
671
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'deleteFailedAtomicUnsupported', "Unable to delete file '{0}' atomically because provider does not support it.", this.resourceForError(resource)));
|
|
681
672
|
}
|
|
682
673
|
if (useTrash && atomic) {
|
|
683
|
-
throw new Error(
|
|
674
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'deleteFailedTrashAndAtomicUnsupported', "Unable to atomically delete file '{0}' because using trash is enabled.", this.resourceForError(resource)));
|
|
684
675
|
}
|
|
685
676
|
let stat = undefined;
|
|
686
677
|
try {
|
|
@@ -692,13 +683,13 @@ let FileService = class FileService extends Disposable {
|
|
|
692
683
|
this.throwIfFileIsReadonly(resource, stat);
|
|
693
684
|
}
|
|
694
685
|
else {
|
|
695
|
-
throw new FileOperationError(
|
|
686
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'deleteFailedNotFound', "Unable to delete nonexistent file '{0}'", this.resourceForError(resource)), 1 );
|
|
696
687
|
}
|
|
697
688
|
const recursive = !!options?.recursive;
|
|
698
689
|
if (!recursive) {
|
|
699
690
|
const stat = await this.resolve(resource);
|
|
700
691
|
if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
|
|
701
|
-
throw new Error(
|
|
692
|
+
throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'deleteFailedNonEmptyFolder', "Unable to delete non-empty folder '{0}'.", this.resourceForError(resource)));
|
|
702
693
|
}
|
|
703
694
|
}
|
|
704
695
|
return provider;
|
|
@@ -933,13 +924,13 @@ let FileService = class FileService extends Disposable {
|
|
|
933
924
|
}
|
|
934
925
|
throwIfFileSystemIsReadonly(provider, resource) {
|
|
935
926
|
if (provider.capabilities & 2048 ) {
|
|
936
|
-
throw new FileOperationError(
|
|
927
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'err.readonly', "Unable to modify read-only file '{0}'", this.resourceForError(resource)), 6 );
|
|
937
928
|
}
|
|
938
929
|
return provider;
|
|
939
930
|
}
|
|
940
931
|
throwIfFileIsReadonly(resource, stat) {
|
|
941
932
|
if ((stat.permissions ?? 0) & FilePermission.Readonly) {
|
|
942
|
-
throw new FileOperationError(
|
|
933
|
+
throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'err.readonly', "Unable to modify read-only file '{0}'", this.resourceForError(resource)), 6 );
|
|
943
934
|
}
|
|
944
935
|
}
|
|
945
936
|
resourceForError(resource) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNumber } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
3
3
|
var FileType;
|
|
4
4
|
( (function(FileType) {
|
|
5
5
|
FileType[FileType["Unknown"] = 0] = "Unknown";
|
|
@@ -44,18 +44,18 @@ class ByteSize {
|
|
|
44
44
|
size = 0;
|
|
45
45
|
}
|
|
46
46
|
if (size < ByteSize.KB) {
|
|
47
|
-
return (
|
|
47
|
+
return localizeWithPath('vs/platform/files/common/files', 'sizeB', "{0}B", size.toFixed(0));
|
|
48
48
|
}
|
|
49
49
|
if (size < ByteSize.MB) {
|
|
50
|
-
return (
|
|
50
|
+
return localizeWithPath('vs/platform/files/common/files', 'sizeKB', "{0}KB", (size / ByteSize.KB).toFixed(2));
|
|
51
51
|
}
|
|
52
52
|
if (size < ByteSize.GB) {
|
|
53
|
-
return (
|
|
53
|
+
return localizeWithPath('vs/platform/files/common/files', 'sizeMB', "{0}MB", (size / ByteSize.MB).toFixed(2));
|
|
54
54
|
}
|
|
55
55
|
if (size < ByteSize.TB) {
|
|
56
|
-
return (
|
|
56
|
+
return localizeWithPath('vs/platform/files/common/files', 'sizeGB', "{0}GB", (size / ByteSize.GB).toFixed(2));
|
|
57
57
|
}
|
|
58
|
-
return (
|
|
58
|
+
return localizeWithPath('vs/platform/files/common/files', 'sizeTB', "{0}TB", (size / ByteSize.TB).toFixed(2));
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
export { ByteSize, FileChangeType, FilePermission, FileSystemProviderCapabilities, FileType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
2
2
|
import { canceled } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
3
|
-
import {
|
|
3
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
4
4
|
import { ensureFileSystemProviderError, createFileSystemProviderError, FileSystemProviderErrorCode } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
5
5
|
async function readFileIntoStream(provider, resource, target, transformer, options, token) {
|
|
6
6
|
let error = undefined;
|
|
@@ -68,7 +68,7 @@ function throwIfCancelled(token) {
|
|
|
68
68
|
}
|
|
69
69
|
function throwIfTooLarge(totalBytesRead, options) {
|
|
70
70
|
if (typeof options?.limits?.size === 'number' && totalBytesRead > options.limits.size) {
|
|
71
|
-
throw createFileSystemProviderError(
|
|
71
|
+
throw createFileSystemProviderError(localizeWithPath('vs/platform/files/common/io', 'fileTooLargeError', "File is too large to open"), FileSystemProviderErrorCode.FileTooLarge);
|
|
72
72
|
}
|
|
73
73
|
return true;
|
|
74
74
|
}
|
|
@@ -13,27 +13,21 @@ const keyboardConfiguration = {
|
|
|
13
13
|
'id': 'keyboard',
|
|
14
14
|
'order': 15,
|
|
15
15
|
'type': 'object',
|
|
16
|
-
'title':
|
|
16
|
+
'title': nls.localizeWithPath('vs/platform/keyboardLayout/common/keyboardConfig', 'keyboardConfigurationTitle', "Keyboard"),
|
|
17
17
|
'properties': {
|
|
18
18
|
'keyboard.dispatch': {
|
|
19
19
|
scope: 1 ,
|
|
20
20
|
type: 'string',
|
|
21
21
|
enum: ['code', 'keyCode'],
|
|
22
22
|
default: 'code',
|
|
23
|
-
markdownDescription:
|
|
24
|
-
'dispatch',
|
|
25
|
-
"Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
|
|
26
|
-
)),
|
|
23
|
+
markdownDescription: nls.localizeWithPath('vs/platform/keyboardLayout/common/keyboardConfig', 'dispatch', "Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."),
|
|
27
24
|
included: OS === 2 || OS === 3
|
|
28
25
|
},
|
|
29
26
|
'keyboard.mapAltGrToCtrlAlt': {
|
|
30
27
|
scope: 1 ,
|
|
31
28
|
type: 'boolean',
|
|
32
29
|
default: false,
|
|
33
|
-
markdownDescription:
|
|
34
|
-
'mapAltGrToCtrlAlt',
|
|
35
|
-
"Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."
|
|
36
|
-
)),
|
|
30
|
+
markdownDescription: nls.localizeWithPath('vs/platform/keyboardLayout/common/keyboardConfig', 'mapAltGrToCtrlAlt', "Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."),
|
|
37
31
|
included: OS === 1
|
|
38
32
|
}
|
|
39
33
|
}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { toErrorMessage } from 'monaco-editor/esm/vs/base/common/errorMessage.js';
|
|
3
|
+
import { isCancellationError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
4
|
+
import { or, matchesPrefix, matchesWords, matchesContiguousSubString } from 'monaco-editor/esm/vs/base/common/filters.js';
|
|
5
|
+
import { createSingleCallFunction } from 'monaco-editor/esm/vs/base/common/functional.js';
|
|
6
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
7
|
+
import { LRUCache } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
8
|
+
import { normalizeTfIdfScores, TfIdfCalculator } from '../../../base/common/tfIdf.js';
|
|
9
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
10
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
11
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
12
|
+
import '../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
13
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
14
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
15
|
+
import { PickerQuickAccessProvider } from './pickerQuickAccess.js';
|
|
16
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
17
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
18
|
+
import { IDialogService } from '../../dialogs/common/dialogs.js';
|
|
19
|
+
var AbstractCommandsQuickAccessProvider_1, CommandsHistory_1;
|
|
20
|
+
let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvider extends PickerQuickAccessProvider {
|
|
21
|
+
static { AbstractCommandsQuickAccessProvider_1 = this; }
|
|
22
|
+
static { this.PREFIX = '>'; }
|
|
23
|
+
static { this.TFIDF_THRESHOLD = 0.5; }
|
|
24
|
+
static { this.TFIDF_MAX_RESULTS = 5; }
|
|
25
|
+
static { this.WORD_FILTER = or(matchesPrefix, matchesWords, matchesContiguousSubString); }
|
|
26
|
+
constructor(options, instantiationService, keybindingService, commandService, telemetryService, dialogService) {
|
|
27
|
+
super(AbstractCommandsQuickAccessProvider_1.PREFIX, options);
|
|
28
|
+
this.instantiationService = instantiationService;
|
|
29
|
+
this.keybindingService = keybindingService;
|
|
30
|
+
this.commandService = commandService;
|
|
31
|
+
this.telemetryService = telemetryService;
|
|
32
|
+
this.dialogService = dialogService;
|
|
33
|
+
this.commandsHistory = this._register(this.instantiationService.createInstance(CommandsHistory));
|
|
34
|
+
this.options = options;
|
|
35
|
+
}
|
|
36
|
+
async _getPicks(filter, _disposables, token, runOptions) {
|
|
37
|
+
const allCommandPicks = await this.getCommandPicks(token);
|
|
38
|
+
if (token.isCancellationRequested) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const runTfidf = createSingleCallFunction(() => {
|
|
42
|
+
const tfidf = ( new TfIdfCalculator());
|
|
43
|
+
tfidf.updateDocuments(( allCommandPicks.map(commandPick => ({
|
|
44
|
+
key: commandPick.commandId,
|
|
45
|
+
textChunks: [commandPick.label + (commandPick.commandAlias ? ` ${commandPick.commandAlias}` : '')]
|
|
46
|
+
}))));
|
|
47
|
+
const result = tfidf.calculateScores(filter, token);
|
|
48
|
+
return normalizeTfIdfScores(result)
|
|
49
|
+
.filter(score => score.score > AbstractCommandsQuickAccessProvider_1.TFIDF_THRESHOLD)
|
|
50
|
+
.slice(0, AbstractCommandsQuickAccessProvider_1.TFIDF_MAX_RESULTS);
|
|
51
|
+
});
|
|
52
|
+
const filteredCommandPicks = [];
|
|
53
|
+
for (const commandPick of allCommandPicks) {
|
|
54
|
+
const labelHighlights = AbstractCommandsQuickAccessProvider_1.WORD_FILTER(filter, commandPick.label) ?? undefined;
|
|
55
|
+
const aliasHighlights = commandPick.commandAlias ? AbstractCommandsQuickAccessProvider_1.WORD_FILTER(filter, commandPick.commandAlias) ?? undefined : undefined;
|
|
56
|
+
if (labelHighlights || aliasHighlights) {
|
|
57
|
+
commandPick.highlights = {
|
|
58
|
+
label: labelHighlights,
|
|
59
|
+
detail: this.options.showAlias ? aliasHighlights : undefined
|
|
60
|
+
};
|
|
61
|
+
filteredCommandPicks.push(commandPick);
|
|
62
|
+
}
|
|
63
|
+
else if (filter === commandPick.commandId) {
|
|
64
|
+
filteredCommandPicks.push(commandPick);
|
|
65
|
+
}
|
|
66
|
+
else if (filter.length >= 3) {
|
|
67
|
+
const tfidf = runTfidf();
|
|
68
|
+
if (token.isCancellationRequested) {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
const tfidfScore = tfidf.find(score => score.key === commandPick.commandId);
|
|
72
|
+
if (tfidfScore) {
|
|
73
|
+
commandPick.tfIdfScore = tfidfScore.score;
|
|
74
|
+
filteredCommandPicks.push(commandPick);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const mapLabelToCommand = ( new Map());
|
|
79
|
+
for (const commandPick of filteredCommandPicks) {
|
|
80
|
+
const existingCommandForLabel = mapLabelToCommand.get(commandPick.label);
|
|
81
|
+
if (existingCommandForLabel) {
|
|
82
|
+
commandPick.description = commandPick.commandId;
|
|
83
|
+
existingCommandForLabel.description = existingCommandForLabel.commandId;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
mapLabelToCommand.set(commandPick.label, commandPick);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
filteredCommandPicks.sort((commandPickA, commandPickB) => {
|
|
90
|
+
if (commandPickA.tfIdfScore && commandPickB.tfIdfScore) {
|
|
91
|
+
if (commandPickA.tfIdfScore === commandPickB.tfIdfScore) {
|
|
92
|
+
return commandPickA.label.localeCompare(commandPickB.label);
|
|
93
|
+
}
|
|
94
|
+
return commandPickB.tfIdfScore - commandPickA.tfIdfScore;
|
|
95
|
+
}
|
|
96
|
+
else if (commandPickA.tfIdfScore) {
|
|
97
|
+
return 1;
|
|
98
|
+
}
|
|
99
|
+
else if (commandPickB.tfIdfScore) {
|
|
100
|
+
return -1;
|
|
101
|
+
}
|
|
102
|
+
const commandACounter = this.commandsHistory.peek(commandPickA.commandId);
|
|
103
|
+
const commandBCounter = this.commandsHistory.peek(commandPickB.commandId);
|
|
104
|
+
if (commandACounter && commandBCounter) {
|
|
105
|
+
return commandACounter > commandBCounter ? -1 : 1;
|
|
106
|
+
}
|
|
107
|
+
if (commandACounter) {
|
|
108
|
+
return -1;
|
|
109
|
+
}
|
|
110
|
+
if (commandBCounter) {
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
if (this.options.suggestedCommandIds) {
|
|
114
|
+
const commandASuggestion = ( this.options.suggestedCommandIds.has(commandPickA.commandId));
|
|
115
|
+
const commandBSuggestion = ( this.options.suggestedCommandIds.has(commandPickB.commandId));
|
|
116
|
+
if (commandASuggestion && commandBSuggestion) {
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
if (commandASuggestion) {
|
|
120
|
+
return -1;
|
|
121
|
+
}
|
|
122
|
+
if (commandBSuggestion) {
|
|
123
|
+
return 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return commandPickA.label.localeCompare(commandPickB.label);
|
|
127
|
+
});
|
|
128
|
+
const commandPicks = [];
|
|
129
|
+
let addOtherSeparator = false;
|
|
130
|
+
let addSuggestedSeparator = true;
|
|
131
|
+
let addCommonlyUsedSeparator = !!this.options.suggestedCommandIds;
|
|
132
|
+
for (let i = 0; i < filteredCommandPicks.length; i++) {
|
|
133
|
+
const commandPick = filteredCommandPicks[i];
|
|
134
|
+
if (i === 0 && this.commandsHistory.peek(commandPick.commandId)) {
|
|
135
|
+
commandPicks.push({ type: 'separator', label: localizeWithPath('vs/platform/quickinput/browser/commandsQuickAccess', 'recentlyUsed', "recently used") });
|
|
136
|
+
addOtherSeparator = true;
|
|
137
|
+
}
|
|
138
|
+
if (addSuggestedSeparator && commandPick.tfIdfScore !== undefined) {
|
|
139
|
+
commandPicks.push({ type: 'separator', label: localizeWithPath('vs/platform/quickinput/browser/commandsQuickAccess', 'suggested', "similar commands") });
|
|
140
|
+
addSuggestedSeparator = false;
|
|
141
|
+
}
|
|
142
|
+
if (addCommonlyUsedSeparator && commandPick.tfIdfScore === undefined && !this.commandsHistory.peek(commandPick.commandId) && this.options.suggestedCommandIds?.has(commandPick.commandId)) {
|
|
143
|
+
commandPicks.push({ type: 'separator', label: localizeWithPath('vs/platform/quickinput/browser/commandsQuickAccess', 'commonlyUsed', "commonly used") });
|
|
144
|
+
addOtherSeparator = true;
|
|
145
|
+
addCommonlyUsedSeparator = false;
|
|
146
|
+
}
|
|
147
|
+
if (addOtherSeparator && commandPick.tfIdfScore === undefined && !this.commandsHistory.peek(commandPick.commandId) && !this.options.suggestedCommandIds?.has(commandPick.commandId)) {
|
|
148
|
+
commandPicks.push({ type: 'separator', label: localizeWithPath('vs/platform/quickinput/browser/commandsQuickAccess', 'morecCommands', "other commands") });
|
|
149
|
+
addOtherSeparator = false;
|
|
150
|
+
}
|
|
151
|
+
commandPicks.push(this.toCommandPick(commandPick, runOptions));
|
|
152
|
+
}
|
|
153
|
+
if (!this.hasAdditionalCommandPicks(filter, token)) {
|
|
154
|
+
return commandPicks;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
picks: commandPicks,
|
|
158
|
+
additionalPicks: (async () => {
|
|
159
|
+
const additionalCommandPicks = await this.getAdditionalCommandPicks(allCommandPicks, filteredCommandPicks, filter, token);
|
|
160
|
+
if (token.isCancellationRequested) {
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
const commandPicks = ( additionalCommandPicks.map(commandPick => this.toCommandPick(commandPick, runOptions)));
|
|
164
|
+
if (addSuggestedSeparator && commandPicks[0]?.type !== 'separator') {
|
|
165
|
+
commandPicks.unshift({ type: 'separator', label: localizeWithPath('vs/platform/quickinput/browser/commandsQuickAccess', 'suggested', "similar commands") });
|
|
166
|
+
}
|
|
167
|
+
return commandPicks;
|
|
168
|
+
})()
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
toCommandPick(commandPick, runOptions) {
|
|
172
|
+
if (commandPick.type === 'separator') {
|
|
173
|
+
return commandPick;
|
|
174
|
+
}
|
|
175
|
+
const keybinding = this.keybindingService.lookupKeybinding(commandPick.commandId);
|
|
176
|
+
const ariaLabel = keybinding ?
|
|
177
|
+
localizeWithPath('vs/platform/quickinput/browser/commandsQuickAccess', 'commandPickAriaLabelWithKeybinding', "{0}, {1}", commandPick.label, keybinding.getAriaLabel()) :
|
|
178
|
+
commandPick.label;
|
|
179
|
+
return {
|
|
180
|
+
...commandPick,
|
|
181
|
+
ariaLabel,
|
|
182
|
+
detail: this.options.showAlias && commandPick.commandAlias !== commandPick.label ? commandPick.commandAlias : undefined,
|
|
183
|
+
keybinding,
|
|
184
|
+
accept: async () => {
|
|
185
|
+
this.commandsHistory.push(commandPick.commandId);
|
|
186
|
+
this.telemetryService.publicLog2('workbenchActionExecuted', {
|
|
187
|
+
id: commandPick.commandId,
|
|
188
|
+
from: runOptions?.from ?? 'quick open'
|
|
189
|
+
});
|
|
190
|
+
try {
|
|
191
|
+
commandPick.args?.length
|
|
192
|
+
? await this.commandService.executeCommand(commandPick.commandId, ...commandPick.args)
|
|
193
|
+
: await this.commandService.executeCommand(commandPick.commandId);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
if (!isCancellationError(error)) {
|
|
197
|
+
this.dialogService.error(localizeWithPath('vs/platform/quickinput/browser/commandsQuickAccess', 'canNotRun', "Command '{0}' resulted in an error", commandPick.label), toErrorMessage(error));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
AbstractCommandsQuickAccessProvider = AbstractCommandsQuickAccessProvider_1 = ( __decorate([
|
|
205
|
+
( __param(1, IInstantiationService)),
|
|
206
|
+
( __param(2, IKeybindingService)),
|
|
207
|
+
( __param(3, ICommandService)),
|
|
208
|
+
( __param(4, ITelemetryService)),
|
|
209
|
+
( __param(5, IDialogService))
|
|
210
|
+
], AbstractCommandsQuickAccessProvider));
|
|
211
|
+
let CommandsHistory = class CommandsHistory extends Disposable {
|
|
212
|
+
static { CommandsHistory_1 = this; }
|
|
213
|
+
static { this.DEFAULT_COMMANDS_HISTORY_LENGTH = 50; }
|
|
214
|
+
static { this.PREF_KEY_CACHE = 'commandPalette.mru.cache'; }
|
|
215
|
+
static { this.PREF_KEY_COUNTER = 'commandPalette.mru.counter'; }
|
|
216
|
+
static { this.counter = 1; }
|
|
217
|
+
constructor(storageService, configurationService) {
|
|
218
|
+
super();
|
|
219
|
+
this.storageService = storageService;
|
|
220
|
+
this.configurationService = configurationService;
|
|
221
|
+
this.configuredCommandsHistoryLength = 0;
|
|
222
|
+
this.updateConfiguration();
|
|
223
|
+
this.load();
|
|
224
|
+
this.registerListeners();
|
|
225
|
+
}
|
|
226
|
+
registerListeners() {
|
|
227
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this.updateConfiguration(e)));
|
|
228
|
+
}
|
|
229
|
+
updateConfiguration(e) {
|
|
230
|
+
if (e && !e.affectsConfiguration('workbench.commandPalette.history')) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
this.configuredCommandsHistoryLength = CommandsHistory_1.getConfiguredCommandHistoryLength(this.configurationService);
|
|
234
|
+
if (CommandsHistory_1.cache && CommandsHistory_1.cache.limit !== this.configuredCommandsHistoryLength) {
|
|
235
|
+
CommandsHistory_1.cache.limit = this.configuredCommandsHistoryLength;
|
|
236
|
+
CommandsHistory_1.saveState(this.storageService);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
load() {
|
|
240
|
+
const raw = this.storageService.get(CommandsHistory_1.PREF_KEY_CACHE, 0 );
|
|
241
|
+
let serializedCache;
|
|
242
|
+
if (raw) {
|
|
243
|
+
try {
|
|
244
|
+
serializedCache = JSON.parse(raw);
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const cache = CommandsHistory_1.cache = ( new LRUCache(this.configuredCommandsHistoryLength, 1));
|
|
250
|
+
if (serializedCache) {
|
|
251
|
+
let entries;
|
|
252
|
+
if (serializedCache.usesLRU) {
|
|
253
|
+
entries = serializedCache.entries;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
entries = serializedCache.entries.sort((a, b) => a.value - b.value);
|
|
257
|
+
}
|
|
258
|
+
entries.forEach(entry => cache.set(entry.key, entry.value));
|
|
259
|
+
}
|
|
260
|
+
CommandsHistory_1.counter = this.storageService.getNumber(CommandsHistory_1.PREF_KEY_COUNTER, 0 , CommandsHistory_1.counter);
|
|
261
|
+
}
|
|
262
|
+
push(commandId) {
|
|
263
|
+
if (!CommandsHistory_1.cache) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
CommandsHistory_1.cache.set(commandId, CommandsHistory_1.counter++);
|
|
267
|
+
CommandsHistory_1.saveState(this.storageService);
|
|
268
|
+
}
|
|
269
|
+
peek(commandId) {
|
|
270
|
+
return CommandsHistory_1.cache?.peek(commandId);
|
|
271
|
+
}
|
|
272
|
+
static saveState(storageService) {
|
|
273
|
+
if (!CommandsHistory_1.cache) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const serializedCache = { usesLRU: true, entries: [] };
|
|
277
|
+
CommandsHistory_1.cache.forEach((value, key) => serializedCache.entries.push({ key, value }));
|
|
278
|
+
storageService.store(CommandsHistory_1.PREF_KEY_CACHE, JSON.stringify(serializedCache), 0 , 0 );
|
|
279
|
+
storageService.store(CommandsHistory_1.PREF_KEY_COUNTER, CommandsHistory_1.counter, 0 , 0 );
|
|
280
|
+
}
|
|
281
|
+
static getConfiguredCommandHistoryLength(configurationService) {
|
|
282
|
+
const config = configurationService.getValue();
|
|
283
|
+
const configuredCommandHistoryLength = config.workbench?.commandPalette?.history;
|
|
284
|
+
if (typeof configuredCommandHistoryLength === 'number') {
|
|
285
|
+
return configuredCommandHistoryLength;
|
|
286
|
+
}
|
|
287
|
+
return CommandsHistory_1.DEFAULT_COMMANDS_HISTORY_LENGTH;
|
|
288
|
+
}
|
|
289
|
+
static clearHistory(configurationService, storageService) {
|
|
290
|
+
const commandHistoryLength = CommandsHistory_1.getConfiguredCommandHistoryLength(configurationService);
|
|
291
|
+
CommandsHistory_1.cache = ( new LRUCache(commandHistoryLength));
|
|
292
|
+
CommandsHistory_1.counter = 1;
|
|
293
|
+
CommandsHistory_1.saveState(storageService);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
CommandsHistory = CommandsHistory_1 = ( __decorate([
|
|
297
|
+
( __param(0, IStorageService)),
|
|
298
|
+
( __param(1, IConfigurationService))
|
|
299
|
+
], CommandsHistory));
|
|
300
|
+
export { AbstractCommandsQuickAccessProvider, CommandsHistory };
|