@codingame/monaco-vscode-api 1.83.7 → 1.83.9

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.
Files changed (303) hide show
  1. package/extensions.js +5 -5
  2. package/lifecycle.js +23 -4
  3. package/missing-services.js +187 -24
  4. package/monaco-editor-treemending.patch +955 -955
  5. package/monaco.d.ts +7 -2
  6. package/monaco.js +12 -1
  7. package/package.json +15 -2
  8. package/service-override/tools/editor.d.ts +1 -1
  9. package/services.d.ts +4 -5
  10. package/services.js +31 -28
  11. package/vscode/src/vs/base/common/uriIpc.js +22 -1
  12. package/vscode/src/vs/base/parts/request/common/request.js +7 -1
  13. package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +116 -1
  14. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementUtil.js +117 -2
  15. package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.js +10 -0
  16. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +42 -0
  17. package/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.js +12 -1
  18. package/vscode/src/vs/platform/extensions/common/extensionValidator.js +306 -1
  19. package/vscode/src/vs/platform/log/common/log.d.ts +27 -2
  20. package/vscode/src/vs/platform/remote/common/remoteAgentConnection.d.ts +9 -1
  21. package/vscode/src/vs/platform/remote/common/remoteExtensionsScanner.js +2 -1
  22. package/vscode/src/vs/platform/request/common/request.js +38 -1
  23. package/vscode/src/vs/platform/telemetry/common/telemetryUtils.js +2 -1
  24. package/vscode/src/vs/platform/tunnel/common/tunnel.d.ts +50 -1
  25. package/vscode/src/vs/platform/userDataProfile/common/userDataProfileIpc.js +63 -0
  26. package/vscode/src/vs/platform/userDataSync/common/ignoredExtensions.js +65 -0
  27. package/vscode/src/vs/platform/userDataSync/common/userDataSync.js +2 -1
  28. package/vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js +3 -0
  29. package/vscode/src/vs/platform/workspace/common/workspace.d.ts +16 -1
  30. package/vscode/src/vs/platform/workspaces/common/workspaces.d.ts +6 -2
  31. package/vscode/src/vs/workbench/api/worker/extensionHostWorker.js +1 -1
  32. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +6 -3
  33. package/vscode/src/vs/workbench/common/editor/diffEditorInput.js +7 -2
  34. package/vscode/src/vs/workbench/common/editor/sideBySideEditorInput.js +56 -2
  35. package/vscode/src/vs/workbench/common/editor.d.ts +17 -1
  36. package/vscode/src/vs/workbench/common/theme.js +3 -3
  37. package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.css.js +4 -0
  38. package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +248 -0
  39. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.js +3291 -0
  40. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsIcons.js +16 -16
  41. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionActions.css.js +4 -0
  42. package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +45 -1
  43. package/vscode/src/vs/workbench/contrib/extensions/common/extensionsFileTemplate.js +67 -0
  44. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +396 -0
  45. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagement.d.ts +23 -3
  46. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagement.js +4 -1
  47. package/vscode/src/vs/workbench/services/extensionRecommendations/common/extensionRecommendations.js +4 -0
  48. package/vscode/src/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +255 -0
  49. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.d.ts +44 -0
  50. package/vscode/src/vs/workbench/services/extensions/common/extensionDescriptionRegistry.d.ts +1 -1
  51. package/vscode/src/vs/workbench/services/extensions/common/extensionHostProtocol.d.ts +1 -1
  52. package/vscode/src/vs/workbench/services/extensions/common/extensions.js +2 -1
  53. package/vscode/src/vs/workbench/services/localization/common/locale.js +4 -0
  54. package/vscode/src/vs/workbench/services/log/common/logConstants.js +2 -1
  55. package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +68 -0
  56. package/vscode/src/vs/workbench/services/remote/common/tunnelModel.d.ts +172 -1
  57. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +53 -2
  58. package/vscode/src/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.js +150 -0
  59. package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +3 -1
  60. package/vscode/src/vs/workbench/services/workspaces/browser/workspaces.js +7 -1
  61. package/vscode.proposed.d.ts +4787 -0
  62. package/workbench.js +37 -0
  63. package/service-override/bulkEdit.js +0 -9
  64. package/service-override/environment.js +0 -21
  65. package/service-override/extensions.js +0 -465
  66. package/service-override/files.js +0 -447
  67. package/service-override/keybindings.js +0 -93
  68. package/service-override/layout.js +0 -230
  69. package/service-override/output.js +0 -21
  70. package/service-override/quickaccess.js +0 -98
  71. package/vscode/src/vs/base/common/console.js +0 -58
  72. package/vscode/src/vs/base/common/keybindingParser.js +0 -87
  73. package/vscode/src/vs/base/common/prefixTree.js +0 -130
  74. package/vscode/src/vs/base/common/tfIdf.js +0 -137
  75. package/vscode/src/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +0 -23
  76. package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +0 -404
  77. package/vscode/src/vs/platform/files/common/fileService.js +0 -957
  78. package/vscode/src/vs/platform/files/common/files.js +0 -81
  79. package/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.js +0 -220
  80. package/vscode/src/vs/platform/files/common/io.js +0 -75
  81. package/vscode/src/vs/platform/files/common/watcher.js +0 -69
  82. package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +0 -48
  83. package/vscode/src/vs/platform/keyboardLayout/common/keyboardMapper.js +0 -23
  84. package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +0 -25
  85. package/vscode/src/vs/platform/log/common/fileLog.js +0 -105
  86. package/vscode/src/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -331
  87. package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.js +0 -65
  88. package/vscode/src/vs/platform/remote/common/managedSocket.js +0 -96
  89. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +0 -29
  90. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +0 -33
  91. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +0 -328
  92. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +0 -66
  93. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -172
  94. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents.js +0 -50
  95. package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +0 -59
  96. package/vscode/src/vs/workbench/api/browser/mainThreadChatSlashCommands.js +0 -47
  97. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +0 -29
  98. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +0 -22
  99. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +0 -105
  100. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +0 -92
  101. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +0 -539
  102. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +0 -78
  103. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +0 -33
  104. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +0 -576
  105. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +0 -385
  106. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +0 -100
  107. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +0 -67
  108. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +0 -66
  109. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +0 -73
  110. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +0 -247
  111. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +0 -368
  112. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +0 -20
  113. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +0 -39
  114. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +0 -409
  115. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +0 -473
  116. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +0 -225
  117. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +0 -22
  118. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +0 -315
  119. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +0 -278
  120. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +0 -281
  121. package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +0 -66
  122. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +0 -26
  123. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +0 -31
  124. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +0 -25
  125. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +0 -945
  126. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +0 -76
  127. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +0 -33
  128. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +0 -76
  129. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +0 -91
  130. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +0 -116
  131. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +0 -156
  132. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +0 -121
  133. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +0 -186
  134. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +0 -127
  135. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +0 -129
  136. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +0 -339
  137. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +0 -23
  138. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +0 -46
  139. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +0 -74
  140. package/vscode/src/vs/workbench/api/browser/mainThreadProfilContentHandlers.js +0 -36
  141. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +0 -66
  142. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +0 -47
  143. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +0 -183
  144. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +0 -28
  145. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +0 -461
  146. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +0 -47
  147. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +0 -146
  148. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +0 -68
  149. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +0 -48
  150. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +0 -51
  151. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +0 -70
  152. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +0 -729
  153. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +0 -51
  154. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +0 -410
  155. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +0 -180
  156. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +0 -22
  157. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +0 -53
  158. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +0 -311
  159. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +0 -221
  160. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +0 -108
  161. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +0 -59
  162. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +0 -27
  163. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +0 -281
  164. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +0 -98
  165. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +0 -133
  166. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +0 -55
  167. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +0 -271
  168. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +0 -33
  169. package/vscode/src/vs/workbench/browser/actions/quickAccessActions.js +0 -230
  170. package/vscode/src/vs/workbench/browser/contextkeys.js +0 -249
  171. package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +0 -358
  172. package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.js +0 -362
  173. package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +0 -265
  174. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +0 -2
  175. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +0 -215
  176. package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +0 -86
  177. package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +0 -55
  178. package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +0 -49
  179. package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +0 -90
  180. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +0 -646
  181. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +0 -295
  182. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +0 -60
  183. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +0 -247
  184. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +0 -107
  185. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +0 -107
  186. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +0 -329
  187. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +0 -378
  188. package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +0 -3
  189. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +0 -1194
  190. package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +0 -17
  191. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +0 -332
  192. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +0 -541
  193. package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +0 -176
  194. package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +0 -4
  195. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +0 -4
  196. package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +0 -99
  197. package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +0 -55
  198. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +0 -143
  199. package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +0 -2
  200. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +0 -71
  201. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +0 -81
  202. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +0 -177
  203. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +0 -3
  204. package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +0 -28
  205. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +0 -142
  206. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +0 -480
  207. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +0 -5
  208. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +0 -83
  209. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +0 -54
  210. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +0 -108
  211. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +0 -258
  212. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +0 -614
  213. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +0 -307
  214. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +0 -36
  215. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +0 -165
  216. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +0 -78
  217. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +0 -68
  218. package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +0 -2
  219. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -106
  220. package/vscode/src/vs/workbench/contrib/output/browser/output.contribution.js +0 -487
  221. package/vscode/src/vs/workbench/contrib/output/browser/outputLinkProvider.js +0 -76
  222. package/vscode/src/vs/workbench/contrib/output/browser/outputServices.js +0 -166
  223. package/vscode/src/vs/workbench/contrib/output/browser/outputView.js +0 -234
  224. package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +0 -287
  225. package/vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +0 -167
  226. package/vscode/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +0 -263
  227. package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +0 -504
  228. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +0 -130
  229. package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +0 -101
  230. package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +0 -26
  231. package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +0 -23
  232. package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +0 -334
  233. package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +0 -45
  234. package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +0 -1286
  235. package/vscode/src/vs/workbench/services/commands/common/commandService.js +0 -77
  236. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +0 -141
  237. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +0 -271
  238. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +0 -50
  239. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +0 -1091
  240. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +0 -40
  241. package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +0 -23
  242. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +0 -641
  243. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +0 -272
  244. package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +0 -56
  245. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +0 -78
  246. package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +0 -47
  247. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +0 -218
  248. package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +0 -917
  249. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +0 -498
  250. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution.js +0 -13
  251. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/cz.win.js +0 -162
  252. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de-swiss.win.js +0 -162
  253. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.darwin.js +0 -125
  254. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.linux.js +0 -180
  255. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.win.js +0 -162
  256. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dk.win.js +0 -162
  257. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dvorak.darwin.js +0 -125
  258. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-belgian.win.js +0 -162
  259. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-ext.darwin.js +0 -125
  260. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-in.win.js +0 -162
  261. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.darwin.js +0 -125
  262. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.win.js +0 -162
  263. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.darwin.js +0 -125
  264. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.win.js +0 -162
  265. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.darwin.js +0 -133
  266. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.linux.js +0 -182
  267. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.win.js +0 -167
  268. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es-latin.win.js +0 -162
  269. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.darwin.js +0 -125
  270. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.linux.js +0 -180
  271. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.win.js +0 -162
  272. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.darwin.js +0 -125
  273. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.linux.js +0 -180
  274. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.win.js +0 -162
  275. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/hu.win.js +0 -162
  276. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.darwin.js +0 -125
  277. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.win.js +0 -162
  278. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp-roman.darwin.js +0 -125
  279. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp.darwin.js +0 -125
  280. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ko.darwin.js +0 -125
  281. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin.js +0 -17
  282. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux.js +0 -6
  283. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win.js +0 -23
  284. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/no.win.js +0 -162
  285. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.darwin.js +0 -125
  286. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.win.js +0 -162
  287. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt-br.win.js +0 -162
  288. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.darwin.js +0 -125
  289. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.win.js +0 -162
  290. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.darwin.js +0 -125
  291. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.linux.js +0 -180
  292. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.win.js +0 -162
  293. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/sv.win.js +0 -164
  294. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/thai.win.js +0 -162
  295. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/tr.win.js +0 -162
  296. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/zh-hans.darwin.js +0 -125
  297. package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.js +0 -72
  298. package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.js +0 -108
  299. package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +0 -886
  300. package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +0 -350
  301. package/vscode/src/vs/workbench/services/quickinput/browser/quickInputService.js +0 -67
  302. package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +0 -4
  303. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +0 -77
@@ -1,957 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
3
- import { ResourceQueue, Promises } from 'monaco-editor/esm/vs/base/common/async.js';
4
- import { VSBuffer, bufferToReadable, streamToBuffer, newWriteableBufferStream, bufferedStreamToBuffer, readableToBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
5
- import { CancellationToken, CancellationTokenSource } from 'monaco-editor/esm/vs/base/common/cancellation.js';
6
- import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
7
- import { hash } from 'monaco-editor/esm/vs/base/common/hash.js';
8
- import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
9
- import { Disposable, toDisposable, dispose, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
10
- import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/ternarySearchTree.js';
11
- import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
12
- import { mark } from 'monaco-editor/esm/vs/base/common/performance.js';
13
- import { isAbsolutePath, extUri, extUriIgnorePathCase } from 'monaco-editor/esm/vs/base/common/resources.js';
14
- import { isReadableStream, peekStream, peekReadable, consumeStream, transform, newWriteableStream, isReadableBufferedStream, listenStream } from 'monaco-editor/esm/vs/base/common/stream.js';
15
- import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
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
- import { readFileIntoStream } from './io.js';
18
- import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
19
- import { ErrorNoTelemetry } from 'monaco-editor/esm/vs/base/common/errors.js';
20
- let FileService = class FileService extends Disposable {
21
- constructor(logService) {
22
- super();
23
- this.logService = logService;
24
- this.BUFFER_SIZE = 256 * 1024;
25
- this._onDidChangeFileSystemProviderRegistrations = this._register(( new Emitter()));
26
- this.onDidChangeFileSystemProviderRegistrations = this._onDidChangeFileSystemProviderRegistrations.event;
27
- this._onWillActivateFileSystemProvider = this._register(( new Emitter()));
28
- this.onWillActivateFileSystemProvider = this._onWillActivateFileSystemProvider.event;
29
- this._onDidChangeFileSystemProviderCapabilities = this._register(( new Emitter()));
30
- this.onDidChangeFileSystemProviderCapabilities = this._onDidChangeFileSystemProviderCapabilities.event;
31
- this.provider = ( new Map());
32
- this._onDidRunOperation = this._register(( new Emitter()));
33
- this.onDidRunOperation = this._onDidRunOperation.event;
34
- this._onDidFilesChange = this._register(( new Emitter()));
35
- this.onDidFilesChange = this._onDidFilesChange.event;
36
- this._onDidWatchError = this._register(( new Emitter()));
37
- this.onDidWatchError = this._onDidWatchError.event;
38
- this.activeWatchers = ( new Map());
39
- this.writeQueue = this._register(( new ResourceQueue()));
40
- }
41
- registerProvider(scheme, provider) {
42
- if (( this.provider.has(scheme))) {
43
- throw new Error(`A filesystem provider for the scheme '${scheme}' is already registered.`);
44
- }
45
- mark(`code/registerFilesystem/${scheme}`);
46
- const providerDisposables = ( new DisposableStore());
47
- this.provider.set(scheme, provider);
48
- this._onDidChangeFileSystemProviderRegistrations.fire({ added: true, scheme, provider });
49
- providerDisposables.add(provider.onDidChangeFile(changes => this._onDidFilesChange.fire(( new FileChangesEvent(changes, !this.isPathCaseSensitive(provider))))));
50
- if (typeof provider.onDidWatchError === 'function') {
51
- providerDisposables.add(provider.onDidWatchError(error => this._onDidWatchError.fire(( new Error(error)))));
52
- }
53
- providerDisposables.add(provider.onDidChangeCapabilities(() => this._onDidChangeFileSystemProviderCapabilities.fire({ provider, scheme })));
54
- return toDisposable(() => {
55
- this._onDidChangeFileSystemProviderRegistrations.fire({ added: false, scheme, provider });
56
- this.provider.delete(scheme);
57
- dispose(providerDisposables);
58
- });
59
- }
60
- getProvider(scheme) {
61
- return this.provider.get(scheme);
62
- }
63
- async activateProvider(scheme) {
64
- const joiners = [];
65
- this._onWillActivateFileSystemProvider.fire({
66
- scheme,
67
- join(promise) {
68
- joiners.push(promise);
69
- },
70
- });
71
- if (( this.provider.has(scheme))) {
72
- return;
73
- }
74
- await Promises.settled(joiners);
75
- }
76
- async canHandleResource(resource) {
77
- await this.activateProvider(resource.scheme);
78
- return this.hasProvider(resource);
79
- }
80
- hasProvider(resource) {
81
- return ( this.provider.has(resource.scheme));
82
- }
83
- hasCapability(resource, capability) {
84
- const provider = this.provider.get(resource.scheme);
85
- return !!(provider && (provider.capabilities & capability));
86
- }
87
- listCapabilities() {
88
- return ( Iterable.map(
89
- this.provider,
90
- ([scheme, provider]) => ({ scheme, capabilities: provider.capabilities })
91
- ));
92
- }
93
- async withProvider(resource) {
94
- if (!isAbsolutePath(resource)) {
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
- }
97
- await this.activateProvider(resource.scheme);
98
- const provider = this.provider.get(resource.scheme);
99
- if (!provider) {
100
- const error = ( new ErrorNoTelemetry());
101
- error.message = ( localizeWithPath(
102
- 'vs/platform/files/common/fileService',
103
- 'noProviderFound',
104
- "ENOPRO: No file system provider found for resource '{0}'",
105
- ( resource.toString())
106
- ));
107
- throw error;
108
- }
109
- return provider;
110
- }
111
- async withReadProvider(resource) {
112
- const provider = await this.withProvider(resource);
113
- if (hasOpenReadWriteCloseCapability(provider) || hasReadWriteCapability(provider) || hasFileReadStreamCapability(provider)) {
114
- return provider;
115
- }
116
- throw new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`);
117
- }
118
- async withWriteProvider(resource) {
119
- const provider = await this.withProvider(resource);
120
- if (hasOpenReadWriteCloseCapability(provider) || hasReadWriteCapability(provider)) {
121
- return provider;
122
- }
123
- throw new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`);
124
- }
125
- async resolve(resource, options) {
126
- try {
127
- return await this.doResolveFile(resource, options);
128
- }
129
- catch (error) {
130
- if (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {
131
- throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileNotFoundError', "Unable to resolve nonexistent file '{0}'", this.resourceForError(resource)), 1 );
132
- }
133
- throw ensureFileSystemProviderError(error);
134
- }
135
- }
136
- async doResolveFile(resource, options) {
137
- const provider = await this.withProvider(resource);
138
- const isPathCaseSensitive = this.isPathCaseSensitive(provider);
139
- const resolveTo = options?.resolveTo;
140
- const resolveSingleChildDescendants = options?.resolveSingleChildDescendants;
141
- const resolveMetadata = options?.resolveMetadata;
142
- const stat = await provider.stat(resource);
143
- let trie;
144
- return this.toFileStat(provider, resource, stat, undefined, !!resolveMetadata, (stat, siblings) => {
145
- if (!trie) {
146
- trie = TernarySearchTree.forUris(() => !isPathCaseSensitive);
147
- trie.set(resource, true);
148
- if (resolveTo) {
149
- trie.fill(true, resolveTo);
150
- }
151
- }
152
- if (trie.get(stat.resource) || trie.findSuperstr(stat.resource.with({ query: null, fragment: null } ))) {
153
- return true;
154
- }
155
- if (stat.isDirectory && resolveSingleChildDescendants) {
156
- return siblings === 1;
157
- }
158
- return false;
159
- });
160
- }
161
- async toFileStat(provider, resource, stat, siblings, resolveMetadata, recurse) {
162
- const { providerExtUri } = this.getExtUri(provider);
163
- const fileStat = {
164
- resource,
165
- name: providerExtUri.basename(resource),
166
- isFile: (stat.type & FileType.File) !== 0,
167
- isDirectory: (stat.type & FileType.Directory) !== 0,
168
- isSymbolicLink: (stat.type & FileType.SymbolicLink) !== 0,
169
- mtime: stat.mtime,
170
- ctime: stat.ctime,
171
- size: stat.size,
172
- readonly: Boolean((stat.permissions ?? 0) & FilePermission.Readonly) || Boolean(provider.capabilities & 2048 ),
173
- locked: Boolean((stat.permissions ?? 0) & FilePermission.Locked),
174
- etag: etag({ mtime: stat.mtime, size: stat.size }),
175
- children: undefined
176
- };
177
- if (fileStat.isDirectory && recurse(fileStat, siblings)) {
178
- try {
179
- const entries = await provider.readdir(resource);
180
- const resolvedEntries = await Promises.settled(( entries.map(async ([name, type]) => {
181
- try {
182
- const childResource = providerExtUri.joinPath(resource, name);
183
- const childStat = resolveMetadata ? await provider.stat(childResource) : { type };
184
- return await this.toFileStat(provider, childResource, childStat, entries.length, resolveMetadata, recurse);
185
- }
186
- catch (error) {
187
- this.logService.trace(error);
188
- return null;
189
- }
190
- })));
191
- fileStat.children = coalesce(resolvedEntries);
192
- }
193
- catch (error) {
194
- this.logService.trace(error);
195
- fileStat.children = [];
196
- }
197
- return fileStat;
198
- }
199
- return fileStat;
200
- }
201
- async resolveAll(toResolve) {
202
- return Promises.settled(( toResolve.map(async (entry) => {
203
- try {
204
- return { stat: await this.doResolveFile(entry.resource, entry.options), success: true };
205
- }
206
- catch (error) {
207
- this.logService.trace(error);
208
- return { stat: undefined, success: false };
209
- }
210
- })));
211
- }
212
- async stat(resource) {
213
- const provider = await this.withProvider(resource);
214
- const stat = await provider.stat(resource);
215
- return this.toFileStat(provider, resource, stat, undefined, true, () => false );
216
- }
217
- async exists(resource) {
218
- const provider = await this.withProvider(resource);
219
- try {
220
- const stat = await provider.stat(resource);
221
- return !!stat;
222
- }
223
- catch (error) {
224
- return false;
225
- }
226
- }
227
- async canCreateFile(resource, options) {
228
- try {
229
- await this.doValidateCreateFile(resource, options);
230
- }
231
- catch (error) {
232
- return error;
233
- }
234
- return true;
235
- }
236
- async doValidateCreateFile(resource, options) {
237
- if (!options?.overwrite && (await this.exists(resource))) {
238
- 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);
239
- }
240
- }
241
- async createFile(resource, bufferOrReadableOrStream = VSBuffer.fromString(''), options) {
242
- await this.doValidateCreateFile(resource, options);
243
- const fileStat = await this.writeFile(resource, bufferOrReadableOrStream);
244
- this._onDidRunOperation.fire(( new FileOperationEvent(resource, 0 , fileStat)));
245
- return fileStat;
246
- }
247
- async writeFile(resource, bufferOrReadableOrStream, options) {
248
- const provider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(resource), resource);
249
- const { providerExtUri } = this.getExtUri(provider);
250
- let writeFileOptions = options;
251
- if (hasFileAtomicWriteCapability(provider) && !writeFileOptions?.atomic) {
252
- const enforcedAtomicWrite = provider.enforceAtomicWriteFile?.(resource);
253
- if (enforcedAtomicWrite) {
254
- writeFileOptions = { ...options, atomic: enforcedAtomicWrite };
255
- }
256
- }
257
- try {
258
- const stat = await this.validateWriteFile(provider, resource, writeFileOptions);
259
- if (!stat) {
260
- await this.mkdirp(provider, providerExtUri.dirname(resource));
261
- }
262
- let bufferOrReadableOrStreamOrBufferedStream;
263
- if (hasReadWriteCapability(provider) && !(bufferOrReadableOrStream instanceof VSBuffer)) {
264
- if (isReadableStream(bufferOrReadableOrStream)) {
265
- const bufferedStream = await peekStream(bufferOrReadableOrStream, 3);
266
- if (bufferedStream.ended) {
267
- bufferOrReadableOrStreamOrBufferedStream = VSBuffer.concat(bufferedStream.buffer);
268
- }
269
- else {
270
- bufferOrReadableOrStreamOrBufferedStream = bufferedStream;
271
- }
272
- }
273
- else {
274
- bufferOrReadableOrStreamOrBufferedStream = peekReadable(bufferOrReadableOrStream, data => VSBuffer.concat(data), 3);
275
- }
276
- }
277
- else {
278
- bufferOrReadableOrStreamOrBufferedStream = bufferOrReadableOrStream;
279
- }
280
- if (!hasOpenReadWriteCloseCapability(provider) ||
281
- (hasReadWriteCapability(provider) && bufferOrReadableOrStreamOrBufferedStream instanceof VSBuffer) ||
282
- (hasReadWriteCapability(provider) && hasFileAtomicWriteCapability(provider) && writeFileOptions?.atomic)
283
- ) {
284
- await this.doWriteUnbuffered(provider, resource, writeFileOptions, bufferOrReadableOrStreamOrBufferedStream);
285
- }
286
- else {
287
- await this.doWriteBuffered(provider, resource, writeFileOptions, bufferOrReadableOrStreamOrBufferedStream instanceof VSBuffer ? bufferToReadable(bufferOrReadableOrStreamOrBufferedStream) : bufferOrReadableOrStreamOrBufferedStream);
288
- }
289
- this._onDidRunOperation.fire(( new FileOperationEvent(resource, 4 )));
290
- }
291
- catch (error) {
292
- 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);
293
- }
294
- return this.resolve(resource, { resolveMetadata: true });
295
- }
296
- async validateWriteFile(provider, resource, options) {
297
- const unlock = !!options?.unlock;
298
- if (unlock && !((provider.capabilities & 8192) )) {
299
- throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'writeFailedUnlockUnsupported', "Unable to unlock file '{0}' because provider does not support it.", this.resourceForError(resource)));
300
- }
301
- const atomic = !!options?.atomic;
302
- if (atomic) {
303
- if (!((provider.capabilities & 32768) )) {
304
- 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)));
305
- }
306
- if (!((provider.capabilities & 2) )) {
307
- 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)));
308
- }
309
- if (unlock) {
310
- throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'writeFailedAtomicUnlock', "Unable to unlock file '{0}' because atomic write is enabled.", this.resourceForError(resource)));
311
- }
312
- }
313
- let stat = undefined;
314
- try {
315
- stat = await provider.stat(resource);
316
- }
317
- catch (error) {
318
- return undefined;
319
- }
320
- if ((stat.type & FileType.Directory) !== 0) {
321
- 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);
322
- }
323
- this.throwIfFileIsReadonly(resource, stat);
324
- if (typeof options?.mtime === 'number' && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED &&
325
- typeof stat.mtime === 'number' && typeof stat.size === 'number' &&
326
- options.mtime < stat.mtime && options.etag !== etag({ mtime: options.mtime , size: stat.size })) {
327
- throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileModifiedError', "File Modified Since"), 3 , options);
328
- }
329
- return stat;
330
- }
331
- async readFile(resource, options, token) {
332
- const provider = await this.withReadProvider(resource);
333
- if (options?.atomic) {
334
- return this.doReadFileAtomic(provider, resource, options, token);
335
- }
336
- return this.doReadFile(provider, resource, options, token);
337
- }
338
- async doReadFileAtomic(provider, resource, options, token) {
339
- return ( new Promise((resolve, reject) => {
340
- this.writeQueue.queueFor(resource, this.getExtUri(provider).providerExtUri).queue(async () => {
341
- try {
342
- const content = await this.doReadFile(provider, resource, options, token);
343
- resolve(content);
344
- }
345
- catch (error) {
346
- reject(error);
347
- }
348
- });
349
- }));
350
- }
351
- async doReadFile(provider, resource, options, token) {
352
- const stream = await this.doReadFileStream(provider, resource, {
353
- ...options,
354
- preferUnbuffered: true
355
- }, token);
356
- return {
357
- ...stream,
358
- value: await streamToBuffer(stream.value)
359
- };
360
- }
361
- async readFileStream(resource, options, token) {
362
- const provider = await this.withReadProvider(resource);
363
- return this.doReadFileStream(provider, resource, options, token);
364
- }
365
- async doReadFileStream(provider, resource, options, token) {
366
- const cancellableSource = ( new CancellationTokenSource(token));
367
- let readFileOptions = options;
368
- if (hasFileAtomicReadCapability(provider) && provider.enforceAtomicReadFile?.(resource)) {
369
- readFileOptions = { ...options, atomic: true };
370
- }
371
- const statPromise = this.validateReadFile(resource, readFileOptions).then(stat => stat, error => {
372
- cancellableSource.dispose(true);
373
- throw error;
374
- });
375
- let fileStream = undefined;
376
- try {
377
- if (typeof readFileOptions?.etag === 'string' && readFileOptions.etag !== ETAG_DISABLED) {
378
- await statPromise;
379
- }
380
- if ((readFileOptions?.atomic && hasFileAtomicReadCapability(provider)) ||
381
- !(hasOpenReadWriteCloseCapability(provider) || hasFileReadStreamCapability(provider)) ||
382
- (hasReadWriteCapability(provider) && readFileOptions?.preferUnbuffered)
383
- ) {
384
- fileStream = this.readFileUnbuffered(provider, resource, readFileOptions);
385
- }
386
- else if (hasFileReadStreamCapability(provider)) {
387
- fileStream = this.readFileStreamed(provider, resource, cancellableSource.token, readFileOptions);
388
- }
389
- else {
390
- fileStream = this.readFileBuffered(provider, resource, cancellableSource.token, readFileOptions);
391
- }
392
- fileStream.on('end', () => cancellableSource.dispose());
393
- fileStream.on('error', () => cancellableSource.dispose());
394
- const fileStat = await statPromise;
395
- return {
396
- ...fileStat,
397
- value: fileStream
398
- };
399
- }
400
- catch (error) {
401
- if (fileStream) {
402
- await consumeStream(fileStream);
403
- }
404
- throw this.restoreReadError(error, resource, readFileOptions);
405
- }
406
- }
407
- restoreReadError(error, resource, options) {
408
- const message = ( localizeWithPath(
409
- 'vs/platform/files/common/fileService',
410
- 'err.read',
411
- "Unable to read file '{0}' ({1})",
412
- this.resourceForError(resource),
413
- ( ensureFileSystemProviderError(error).toString())
414
- ));
415
- if (error instanceof NotModifiedSinceFileOperationError) {
416
- return ( new NotModifiedSinceFileOperationError(message, error.stat, options));
417
- }
418
- if (error instanceof TooLargeFileOperationError) {
419
- return ( new TooLargeFileOperationError(message, error.fileOperationResult, error.size, error.options));
420
- }
421
- return ( new FileOperationError(message, toFileOperationResult(error), options));
422
- }
423
- readFileStreamed(provider, resource, token, options = Object.create(null)) {
424
- const fileStream = provider.readFileStream(resource, options, token);
425
- return transform(fileStream, {
426
- data: data => data instanceof VSBuffer ? data : VSBuffer.wrap(data),
427
- error: error => this.restoreReadError(error, resource, options)
428
- }, data => VSBuffer.concat(data));
429
- }
430
- readFileBuffered(provider, resource, token, options = Object.create(null)) {
431
- const stream = newWriteableBufferStream();
432
- readFileIntoStream(provider, resource, stream, data => data, {
433
- ...options,
434
- bufferSize: this.BUFFER_SIZE,
435
- errorTransformer: error => this.restoreReadError(error, resource, options)
436
- }, token);
437
- return stream;
438
- }
439
- readFileUnbuffered(provider, resource, options) {
440
- const stream = newWriteableStream(data => VSBuffer.concat(data));
441
- (async () => {
442
- try {
443
- let buffer;
444
- if (options?.atomic && hasFileAtomicReadCapability(provider)) {
445
- buffer = await provider.readFile(resource, { atomic: true });
446
- }
447
- else {
448
- buffer = await provider.readFile(resource);
449
- }
450
- if (typeof options?.position === 'number') {
451
- buffer = buffer.slice(options.position);
452
- }
453
- if (typeof options?.length === 'number') {
454
- buffer = buffer.slice(0, options.length);
455
- }
456
- this.validateReadFileLimits(resource, buffer.byteLength, options);
457
- stream.end(VSBuffer.wrap(buffer));
458
- }
459
- catch (err) {
460
- stream.error(err);
461
- stream.end();
462
- }
463
- })();
464
- return stream;
465
- }
466
- async validateReadFile(resource, options) {
467
- const stat = await this.resolve(resource, { resolveMetadata: true });
468
- if (stat.isDirectory) {
469
- 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);
470
- }
471
- if (typeof options?.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
472
- throw new NotModifiedSinceFileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'fileNotModifiedError', "File not modified since"), stat, options);
473
- }
474
- this.validateReadFileLimits(resource, stat.size, options);
475
- return stat;
476
- }
477
- validateReadFileLimits(resource, size, options) {
478
- if (typeof options?.limits?.size === 'number' && size > options.limits.size) {
479
- 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);
480
- }
481
- }
482
- async canMove(source, target, overwrite) {
483
- return this.doCanMoveCopy(source, target, 'move', overwrite);
484
- }
485
- async canCopy(source, target, overwrite) {
486
- return this.doCanMoveCopy(source, target, 'copy', overwrite);
487
- }
488
- async doCanMoveCopy(source, target, mode, overwrite) {
489
- if (( source.toString()) !== ( target.toString())) {
490
- try {
491
- const sourceProvider = mode === 'move' ? this.throwIfFileSystemIsReadonly(await this.withWriteProvider(source), source) : await this.withReadProvider(source);
492
- const targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);
493
- await this.doValidateMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite);
494
- }
495
- catch (error) {
496
- return error;
497
- }
498
- }
499
- return true;
500
- }
501
- async move(source, target, overwrite) {
502
- const sourceProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(source), source);
503
- const targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);
504
- const mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'move', !!overwrite);
505
- const fileStat = await this.resolve(target, { resolveMetadata: true });
506
- this._onDidRunOperation.fire(( new FileOperationEvent(
507
- source,
508
- mode === 'move' ? 2 : 3 ,
509
- fileStat
510
- )));
511
- return fileStat;
512
- }
513
- async copy(source, target, overwrite) {
514
- const sourceProvider = await this.withReadProvider(source);
515
- const targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);
516
- const mode = await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'copy', !!overwrite);
517
- const fileStat = await this.resolve(target, { resolveMetadata: true });
518
- this._onDidRunOperation.fire(( new FileOperationEvent(
519
- source,
520
- mode === 'copy' ? 3 : 2 ,
521
- fileStat
522
- )));
523
- return fileStat;
524
- }
525
- async doMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite) {
526
- if (( source.toString()) === ( target.toString())) {
527
- return mode;
528
- }
529
- const { exists, isSameResourceWithDifferentPathCase } = await this.doValidateMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite);
530
- if (exists && !isSameResourceWithDifferentPathCase && overwrite) {
531
- await this.del(target, { recursive: true });
532
- }
533
- await this.mkdirp(targetProvider, this.getExtUri(targetProvider).providerExtUri.dirname(target));
534
- if (mode === 'copy') {
535
- if (sourceProvider === targetProvider && hasFileFolderCopyCapability(sourceProvider)) {
536
- await sourceProvider.copy(source, target, { overwrite });
537
- }
538
- else {
539
- const sourceFile = await this.resolve(source);
540
- if (sourceFile.isDirectory) {
541
- await this.doCopyFolder(sourceProvider, sourceFile, targetProvider, target);
542
- }
543
- else {
544
- await this.doCopyFile(sourceProvider, source, targetProvider, target);
545
- }
546
- }
547
- return mode;
548
- }
549
- else {
550
- if (sourceProvider === targetProvider) {
551
- await sourceProvider.rename(source, target, { overwrite });
552
- return mode;
553
- }
554
- else {
555
- await this.doMoveCopy(sourceProvider, source, targetProvider, target, 'copy', overwrite);
556
- await this.del(source, { recursive: true });
557
- return 'copy';
558
- }
559
- }
560
- }
561
- async doCopyFile(sourceProvider, source, targetProvider, target) {
562
- if (hasOpenReadWriteCloseCapability(sourceProvider) && hasOpenReadWriteCloseCapability(targetProvider)) {
563
- return this.doPipeBuffered(sourceProvider, source, targetProvider, target);
564
- }
565
- if (hasOpenReadWriteCloseCapability(sourceProvider) && hasReadWriteCapability(targetProvider)) {
566
- return this.doPipeBufferedToUnbuffered(sourceProvider, source, targetProvider, target);
567
- }
568
- if (hasReadWriteCapability(sourceProvider) && hasOpenReadWriteCloseCapability(targetProvider)) {
569
- return this.doPipeUnbufferedToBuffered(sourceProvider, source, targetProvider, target);
570
- }
571
- if (hasReadWriteCapability(sourceProvider) && hasReadWriteCapability(targetProvider)) {
572
- return this.doPipeUnbuffered(sourceProvider, source, targetProvider, target);
573
- }
574
- }
575
- async doCopyFolder(sourceProvider, sourceFolder, targetProvider, targetFolder) {
576
- await targetProvider.mkdir(targetFolder);
577
- if (Array.isArray(sourceFolder.children)) {
578
- await Promises.settled(( sourceFolder.children.map(async (sourceChild) => {
579
- const targetChild = this.getExtUri(targetProvider).providerExtUri.joinPath(targetFolder, sourceChild.name);
580
- if (sourceChild.isDirectory) {
581
- return this.doCopyFolder(sourceProvider, await this.resolve(sourceChild.resource), targetProvider, targetChild);
582
- }
583
- else {
584
- return this.doCopyFile(sourceProvider, sourceChild.resource, targetProvider, targetChild);
585
- }
586
- })));
587
- }
588
- }
589
- async doValidateMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite) {
590
- let isSameResourceWithDifferentPathCase = false;
591
- if (sourceProvider === targetProvider) {
592
- const { providerExtUri, isPathCaseSensitive } = this.getExtUri(sourceProvider);
593
- if (!isPathCaseSensitive) {
594
- isSameResourceWithDifferentPathCase = providerExtUri.isEqual(source, target);
595
- }
596
- if (isSameResourceWithDifferentPathCase && mode === 'copy') {
597
- 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)));
598
- }
599
- if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
600
- 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)));
601
- }
602
- }
603
- const exists = await this.exists(target);
604
- if (exists && !isSameResourceWithDifferentPathCase) {
605
- if (!overwrite) {
606
- 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 );
607
- }
608
- if (sourceProvider === targetProvider) {
609
- const { providerExtUri } = this.getExtUri(sourceProvider);
610
- if (providerExtUri.isEqualOrParent(source, target)) {
611
- 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)));
612
- }
613
- }
614
- }
615
- return { exists, isSameResourceWithDifferentPathCase };
616
- }
617
- getExtUri(provider) {
618
- const isPathCaseSensitive = this.isPathCaseSensitive(provider);
619
- return {
620
- providerExtUri: isPathCaseSensitive ? extUri : extUriIgnorePathCase,
621
- isPathCaseSensitive
622
- };
623
- }
624
- isPathCaseSensitive(provider) {
625
- return !!((provider.capabilities & 1024) );
626
- }
627
- async createFolder(resource) {
628
- const provider = this.throwIfFileSystemIsReadonly(await this.withProvider(resource), resource);
629
- await this.mkdirp(provider, resource);
630
- const fileStat = await this.resolve(resource, { resolveMetadata: true });
631
- this._onDidRunOperation.fire(( new FileOperationEvent(resource, 0 , fileStat)));
632
- return fileStat;
633
- }
634
- async mkdirp(provider, directory) {
635
- const directoriesToCreate = [];
636
- const { providerExtUri } = this.getExtUri(provider);
637
- while (!providerExtUri.isEqual(directory, providerExtUri.dirname(directory))) {
638
- try {
639
- const stat = await provider.stat(directory);
640
- if ((stat.type & FileType.Directory) === 0) {
641
- 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)));
642
- }
643
- break;
644
- }
645
- catch (error) {
646
- if (toFileSystemProviderErrorCode(error) !== FileSystemProviderErrorCode.FileNotFound) {
647
- throw error;
648
- }
649
- directoriesToCreate.push(providerExtUri.basename(directory));
650
- directory = providerExtUri.dirname(directory);
651
- }
652
- }
653
- for (let i = directoriesToCreate.length - 1; i >= 0; i--) {
654
- directory = providerExtUri.joinPath(directory, directoriesToCreate[i]);
655
- try {
656
- await provider.mkdir(directory);
657
- }
658
- catch (error) {
659
- if (toFileSystemProviderErrorCode(error) !== FileSystemProviderErrorCode.FileExists) {
660
- throw error;
661
- }
662
- }
663
- }
664
- }
665
- async canDelete(resource, options) {
666
- try {
667
- await this.doValidateDelete(resource, options);
668
- }
669
- catch (error) {
670
- return error;
671
- }
672
- return true;
673
- }
674
- async doValidateDelete(resource, options) {
675
- const provider = this.throwIfFileSystemIsReadonly(await this.withProvider(resource), resource);
676
- const useTrash = !!options?.useTrash;
677
- if (useTrash && !((provider.capabilities & 4096) )) {
678
- 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)));
679
- }
680
- const atomic = options?.atomic;
681
- if (atomic && !((provider.capabilities & 65536) )) {
682
- 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)));
683
- }
684
- if (useTrash && atomic) {
685
- throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'deleteFailedTrashAndAtomicUnsupported', "Unable to atomically delete file '{0}' because using trash is enabled.", this.resourceForError(resource)));
686
- }
687
- let stat = undefined;
688
- try {
689
- stat = await provider.stat(resource);
690
- }
691
- catch (error) {
692
- }
693
- if (stat) {
694
- this.throwIfFileIsReadonly(resource, stat);
695
- }
696
- else {
697
- throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'deleteFailedNotFound', "Unable to delete nonexistent file '{0}'", this.resourceForError(resource)), 1 );
698
- }
699
- const recursive = !!options?.recursive;
700
- if (!recursive) {
701
- const stat = await this.resolve(resource);
702
- if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
703
- throw new Error(localizeWithPath('vs/platform/files/common/fileService', 'deleteFailedNonEmptyFolder', "Unable to delete non-empty folder '{0}'.", this.resourceForError(resource)));
704
- }
705
- }
706
- return provider;
707
- }
708
- async del(resource, options) {
709
- const provider = await this.doValidateDelete(resource, options);
710
- let deleteFileOptions = options;
711
- if (hasFileAtomicDeleteCapability(provider) && !deleteFileOptions?.atomic) {
712
- const enforcedAtomicDelete = provider.enforceAtomicDelete?.(resource);
713
- if (enforcedAtomicDelete) {
714
- deleteFileOptions = { ...options, atomic: enforcedAtomicDelete };
715
- }
716
- }
717
- const useTrash = !!deleteFileOptions?.useTrash;
718
- const recursive = !!deleteFileOptions?.recursive;
719
- const atomic = deleteFileOptions?.atomic ?? false;
720
- await provider.delete(resource, { recursive, useTrash, atomic });
721
- this._onDidRunOperation.fire(( new FileOperationEvent(resource, 1 )));
722
- }
723
- async cloneFile(source, target) {
724
- const sourceProvider = await this.withProvider(source);
725
- const targetProvider = this.throwIfFileSystemIsReadonly(await this.withWriteProvider(target), target);
726
- if (sourceProvider === targetProvider && this.getExtUri(sourceProvider).providerExtUri.isEqual(source, target)) {
727
- return;
728
- }
729
- if (sourceProvider === targetProvider && hasFileCloneCapability(sourceProvider)) {
730
- return sourceProvider.cloneFile(source, target);
731
- }
732
- await this.mkdirp(targetProvider, this.getExtUri(targetProvider).providerExtUri.dirname(target));
733
- const sourceWriteQueue = this.writeQueue.queueFor(source, this.getExtUri(sourceProvider).providerExtUri);
734
- if (sourceProvider === targetProvider && hasFileFolderCopyCapability(sourceProvider)) {
735
- return sourceWriteQueue.queue(() => sourceProvider.copy(source, target, { overwrite: true }));
736
- }
737
- return sourceWriteQueue.queue(() => this.doCopyFile(sourceProvider, source, targetProvider, target));
738
- }
739
- watch(resource, options = { recursive: false, excludes: [] }) {
740
- const disposables = ( new DisposableStore());
741
- let watchDisposed = false;
742
- let disposeWatch = () => { watchDisposed = true; };
743
- disposables.add(toDisposable(() => disposeWatch()));
744
- (async () => {
745
- try {
746
- const disposable = await this.doWatch(resource, options);
747
- if (watchDisposed) {
748
- dispose(disposable);
749
- }
750
- else {
751
- disposeWatch = () => dispose(disposable);
752
- }
753
- }
754
- catch (error) {
755
- this.logService.error(error);
756
- }
757
- })();
758
- return disposables;
759
- }
760
- async doWatch(resource, options) {
761
- const provider = await this.withProvider(resource);
762
- const watchHash = hash([this.getExtUri(provider).providerExtUri.getComparisonKey(resource), options]);
763
- let watcher = this.activeWatchers.get(watchHash);
764
- if (!watcher) {
765
- watcher = {
766
- count: 0,
767
- disposable: provider.watch(resource, options)
768
- };
769
- this.activeWatchers.set(watchHash, watcher);
770
- }
771
- watcher.count += 1;
772
- return toDisposable(() => {
773
- if (watcher) {
774
- watcher.count--;
775
- if (watcher.count === 0) {
776
- dispose(watcher.disposable);
777
- this.activeWatchers.delete(watchHash);
778
- }
779
- }
780
- });
781
- }
782
- dispose() {
783
- super.dispose();
784
- for (const [, watcher] of this.activeWatchers) {
785
- dispose(watcher.disposable);
786
- }
787
- this.activeWatchers.clear();
788
- }
789
- async doWriteBuffered(provider, resource, options, readableOrStreamOrBufferedStream) {
790
- return this.writeQueue.queueFor(resource, this.getExtUri(provider).providerExtUri).queue(async () => {
791
- const handle = await provider.open(resource, { create: true, unlock: options?.unlock ?? false });
792
- try {
793
- if (isReadableStream(readableOrStreamOrBufferedStream) || isReadableBufferedStream(readableOrStreamOrBufferedStream)) {
794
- await this.doWriteStreamBufferedQueued(provider, handle, readableOrStreamOrBufferedStream);
795
- }
796
- else {
797
- await this.doWriteReadableBufferedQueued(provider, handle, readableOrStreamOrBufferedStream);
798
- }
799
- }
800
- catch (error) {
801
- throw ensureFileSystemProviderError(error);
802
- }
803
- finally {
804
- await provider.close(handle);
805
- }
806
- });
807
- }
808
- async doWriteStreamBufferedQueued(provider, handle, streamOrBufferedStream) {
809
- let posInFile = 0;
810
- let stream;
811
- if (isReadableBufferedStream(streamOrBufferedStream)) {
812
- if (streamOrBufferedStream.buffer.length > 0) {
813
- const chunk = VSBuffer.concat(streamOrBufferedStream.buffer);
814
- await this.doWriteBuffer(provider, handle, chunk, chunk.byteLength, posInFile, 0);
815
- posInFile += chunk.byteLength;
816
- }
817
- if (streamOrBufferedStream.ended) {
818
- return;
819
- }
820
- stream = streamOrBufferedStream.stream;
821
- }
822
- else {
823
- stream = streamOrBufferedStream;
824
- }
825
- return ( new Promise((resolve, reject) => {
826
- listenStream(stream, {
827
- onData: async (chunk) => {
828
- stream.pause();
829
- try {
830
- await this.doWriteBuffer(provider, handle, chunk, chunk.byteLength, posInFile, 0);
831
- }
832
- catch (error) {
833
- return reject(error);
834
- }
835
- posInFile += chunk.byteLength;
836
- setTimeout(() => stream.resume());
837
- },
838
- onError: error => reject(error),
839
- onEnd: () => resolve()
840
- });
841
- }));
842
- }
843
- async doWriteReadableBufferedQueued(provider, handle, readable) {
844
- let posInFile = 0;
845
- let chunk;
846
- while ((chunk = readable.read()) !== null) {
847
- await this.doWriteBuffer(provider, handle, chunk, chunk.byteLength, posInFile, 0);
848
- posInFile += chunk.byteLength;
849
- }
850
- }
851
- async doWriteBuffer(provider, handle, buffer, length, posInFile, posInBuffer) {
852
- let totalBytesWritten = 0;
853
- while (totalBytesWritten < length) {
854
- const bytesWritten = await provider.write(handle, posInFile + totalBytesWritten, buffer.buffer, posInBuffer + totalBytesWritten, length - totalBytesWritten);
855
- totalBytesWritten += bytesWritten;
856
- }
857
- }
858
- async doWriteUnbuffered(provider, resource, options, bufferOrReadableOrStreamOrBufferedStream) {
859
- return this.writeQueue.queueFor(resource, this.getExtUri(provider).providerExtUri).queue(() => this.doWriteUnbufferedQueued(provider, resource, options, bufferOrReadableOrStreamOrBufferedStream));
860
- }
861
- async doWriteUnbufferedQueued(provider, resource, options, bufferOrReadableOrStreamOrBufferedStream) {
862
- let buffer;
863
- if (bufferOrReadableOrStreamOrBufferedStream instanceof VSBuffer) {
864
- buffer = bufferOrReadableOrStreamOrBufferedStream;
865
- }
866
- else if (isReadableStream(bufferOrReadableOrStreamOrBufferedStream)) {
867
- buffer = await streamToBuffer(bufferOrReadableOrStreamOrBufferedStream);
868
- }
869
- else if (isReadableBufferedStream(bufferOrReadableOrStreamOrBufferedStream)) {
870
- buffer = await bufferedStreamToBuffer(bufferOrReadableOrStreamOrBufferedStream);
871
- }
872
- else {
873
- buffer = readableToBuffer(bufferOrReadableOrStreamOrBufferedStream);
874
- }
875
- await provider.writeFile(resource, buffer.buffer, { create: true, overwrite: true, unlock: options?.unlock ?? false, atomic: options?.atomic ?? false });
876
- }
877
- async doPipeBuffered(sourceProvider, source, targetProvider, target) {
878
- return this.writeQueue.queueFor(target, this.getExtUri(targetProvider).providerExtUri).queue(() => this.doPipeBufferedQueued(sourceProvider, source, targetProvider, target));
879
- }
880
- async doPipeBufferedQueued(sourceProvider, source, targetProvider, target) {
881
- let sourceHandle = undefined;
882
- let targetHandle = undefined;
883
- try {
884
- sourceHandle = await sourceProvider.open(source, { create: false });
885
- targetHandle = await targetProvider.open(target, { create: true, unlock: false });
886
- const buffer = VSBuffer.alloc(this.BUFFER_SIZE);
887
- let posInFile = 0;
888
- let posInBuffer = 0;
889
- let bytesRead = 0;
890
- do {
891
- bytesRead = await sourceProvider.read(sourceHandle, posInFile, buffer.buffer, posInBuffer, buffer.byteLength - posInBuffer);
892
- await this.doWriteBuffer(targetProvider, targetHandle, buffer, bytesRead, posInFile, posInBuffer);
893
- posInFile += bytesRead;
894
- posInBuffer += bytesRead;
895
- if (posInBuffer === buffer.byteLength) {
896
- posInBuffer = 0;
897
- }
898
- } while (bytesRead > 0);
899
- }
900
- catch (error) {
901
- throw ensureFileSystemProviderError(error);
902
- }
903
- finally {
904
- await Promises.settled([
905
- typeof sourceHandle === 'number' ? sourceProvider.close(sourceHandle) : Promise.resolve(),
906
- typeof targetHandle === 'number' ? targetProvider.close(targetHandle) : Promise.resolve(),
907
- ]);
908
- }
909
- }
910
- async doPipeUnbuffered(sourceProvider, source, targetProvider, target) {
911
- return this.writeQueue.queueFor(target, this.getExtUri(targetProvider).providerExtUri).queue(() => this.doPipeUnbufferedQueued(sourceProvider, source, targetProvider, target));
912
- }
913
- async doPipeUnbufferedQueued(sourceProvider, source, targetProvider, target) {
914
- return targetProvider.writeFile(target, await sourceProvider.readFile(source), { create: true, overwrite: true, unlock: false, atomic: false });
915
- }
916
- async doPipeUnbufferedToBuffered(sourceProvider, source, targetProvider, target) {
917
- return this.writeQueue.queueFor(target, this.getExtUri(targetProvider).providerExtUri).queue(() => this.doPipeUnbufferedToBufferedQueued(sourceProvider, source, targetProvider, target));
918
- }
919
- async doPipeUnbufferedToBufferedQueued(sourceProvider, source, targetProvider, target) {
920
- const targetHandle = await targetProvider.open(target, { create: true, unlock: false });
921
- try {
922
- const buffer = await sourceProvider.readFile(source);
923
- await this.doWriteBuffer(targetProvider, targetHandle, VSBuffer.wrap(buffer), buffer.byteLength, 0, 0);
924
- }
925
- catch (error) {
926
- throw ensureFileSystemProviderError(error);
927
- }
928
- finally {
929
- await targetProvider.close(targetHandle);
930
- }
931
- }
932
- async doPipeBufferedToUnbuffered(sourceProvider, source, targetProvider, target) {
933
- const buffer = await streamToBuffer(this.readFileBuffered(sourceProvider, source, CancellationToken.None));
934
- await this.doWriteUnbuffered(targetProvider, target, undefined, buffer);
935
- }
936
- throwIfFileSystemIsReadonly(provider, resource) {
937
- if (provider.capabilities & 2048 ) {
938
- throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'err.readonly', "Unable to modify read-only file '{0}'", this.resourceForError(resource)), 6 );
939
- }
940
- return provider;
941
- }
942
- throwIfFileIsReadonly(resource, stat) {
943
- if ((stat.permissions ?? 0) & FilePermission.Readonly) {
944
- throw new FileOperationError(localizeWithPath('vs/platform/files/common/fileService', 'err.readonly', "Unable to modify read-only file '{0}'", this.resourceForError(resource)), 6 );
945
- }
946
- }
947
- resourceForError(resource) {
948
- if (resource.scheme === Schemas.file) {
949
- return resource.fsPath;
950
- }
951
- return ( resource.toString(true));
952
- }
953
- };
954
- FileService = ( __decorate([
955
- ( __param(0, ILogService))
956
- ], FileService));
957
- export { FileService };