@codingame/monaco-vscode-api 2.1.4 → 2.2.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +24 -0
  2. package/contributions.js +1 -0
  3. package/extensions.d.ts +7 -3
  4. package/extensions.js +28 -8
  5. package/lifecycle.js +11 -3
  6. package/localExtensionHost.js +13 -10
  7. package/missing-services.js +55 -10
  8. package/monaco.js +7 -3
  9. package/package.json +8 -8
  10. package/service-override/tools/views.d.ts +98 -0
  11. package/service-override/tools/views.js +249 -0
  12. package/services.d.ts +4 -2
  13. package/services.js +11 -9
  14. package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
  15. package/vscode/src/vs/base/browser/dom.js +18 -1
  16. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
  17. package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
  18. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
  19. package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
  20. package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
  21. package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
  22. package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
  23. package/vscode/src/vs/base/common/async.js +46 -2
  24. package/vscode/src/vs/base/common/codicons.d.ts +579 -0
  25. package/vscode/src/vs/base/common/event.js +11 -2
  26. package/vscode/src/vs/base/common/keybindingParser.js +87 -0
  27. package/vscode/src/vs/base/common/network.js +1 -2
  28. package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
  29. package/vscode/src/vs/base/common/platform.js +2 -1
  30. package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
  31. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
  32. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
  33. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
  34. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
  35. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
  36. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
  37. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
  38. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
  39. package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
  40. package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
  41. package/vscode/src/vs/platform/log/browser/log.js +24 -0
  42. package/vscode/src/vs/platform/product/common/product.js +1 -2
  43. package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
  44. package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
  45. package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
  46. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
  47. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
  48. package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
  49. package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
  50. package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
  51. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
  52. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
  53. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
  54. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
  55. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
  56. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
  57. package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
  58. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
  59. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
  60. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
  61. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
  62. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
  63. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
  64. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
  65. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
  66. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
  67. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
  68. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
  69. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
  70. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
  71. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
  72. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
  73. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
  74. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
  75. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
  76. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
  77. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
  78. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
  79. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
  80. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
  81. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
  82. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
  83. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
  84. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
  85. package/vscode/src/vs/workbench/browser/window.js +239 -5
  86. package/vscode/src/vs/workbench/common/configuration.js +11 -1
  87. package/vscode/src/vs/workbench/common/theme.js +3 -3
  88. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
  89. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
  90. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
  91. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
  92. package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
  93. package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
  94. package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
  95. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
  96. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
  97. package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
  98. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
  99. package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
  100. package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
  101. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
  102. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
  103. package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
  104. package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
  105. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
  106. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
  107. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
  108. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
  109. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
  110. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
  111. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
  112. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
  113. package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
  114. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
  115. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
  116. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
  117. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
  118. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
  119. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
  120. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
  121. package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +10 -10
  122. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
  123. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
  124. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
  125. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
  126. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
  127. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
  128. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
  129. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
  130. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
  131. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
  132. package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
  133. package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
  134. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
  135. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
  136. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
  137. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
  138. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
  139. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
  140. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
  141. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
  142. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
  143. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
  144. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
  145. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
  146. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
  147. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
  148. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
  149. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
  150. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
  151. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
  152. package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
  154. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
  155. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
  156. package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
  157. package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
  158. package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +2 -2
  159. package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
  160. package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
  161. package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
  162. package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
  163. package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
  164. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
  165. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
  166. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
  167. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
  168. package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
  169. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
  170. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
  171. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
  172. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
  173. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
  174. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
  175. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
  176. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
  177. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
  178. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
  179. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
  180. package/vscode/src/vs/workbench/contrib/workspace/common/workspace.js +16 -0
  181. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
  182. package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
  183. package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
  184. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
  185. package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
  186. package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
  187. package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
  188. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
  189. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
  190. package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
  191. package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
  192. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
  193. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
  194. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
@@ -0,0 +1,61 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from '../../../../nls.js';
3
+ import { VIEWLET_ID } from './files.js';
4
+ import { ILifecycleService } from '../../../services/lifecycle/common/lifecycle.js';
5
+ import { Disposable, MutableDisposable } from '../../../../base/common/lifecycle.js';
6
+ import { NumberBadge, IActivityService } from '../../../services/activity/common/activity.js';
7
+ import { IWorkingCopyService } from '../../../services/workingCopy/common/workingCopyService.js';
8
+ import { IFilesConfigurationService } from '../../../services/filesConfiguration/common/filesConfigurationService.js';
9
+ let DirtyFilesIndicator = class DirtyFilesIndicator extends Disposable {
10
+ constructor(lifecycleService, activityService, workingCopyService, filesConfigurationService) {
11
+ super();
12
+ this.lifecycleService = lifecycleService;
13
+ this.activityService = activityService;
14
+ this.workingCopyService = workingCopyService;
15
+ this.filesConfigurationService = filesConfigurationService;
16
+ this.badgeHandle = this._register(( new MutableDisposable()));
17
+ this.lastKnownDirtyCount = 0;
18
+ this.updateActivityBadge();
19
+ this.registerListeners();
20
+ }
21
+ registerListeners() {
22
+ this._register(this.workingCopyService.onDidChangeDirty(workingCopy => this.onWorkingCopyDidChangeDirty(workingCopy)));
23
+ this.lifecycleService.onDidShutdown(() => this.dispose());
24
+ }
25
+ onWorkingCopyDidChangeDirty(workingCopy) {
26
+ const gotDirty = workingCopy.isDirty();
27
+ if (gotDirty && !((workingCopy.capabilities & 2) ) && this.filesConfigurationService.hasShortAutoSaveDelay(workingCopy.resource)) {
28
+ return;
29
+ }
30
+ if (gotDirty || this.lastKnownDirtyCount > 0) {
31
+ this.updateActivityBadge();
32
+ }
33
+ }
34
+ updateActivityBadge() {
35
+ const dirtyCount = this.lastKnownDirtyCount = this.workingCopyService.dirtyCount;
36
+ if (dirtyCount > 0) {
37
+ this.badgeHandle.value = this.activityService.showViewContainerActivity(VIEWLET_ID, {
38
+ badge: ( new NumberBadge(dirtyCount, num => num === 1 ? ( localizeWithPath(
39
+ 'vs/workbench/contrib/files/common/dirtyFilesIndicator',
40
+ 'dirtyFile',
41
+ "1 unsaved file"
42
+ )) : ( localizeWithPath(
43
+ 'vs/workbench/contrib/files/common/dirtyFilesIndicator',
44
+ 'dirtyFiles',
45
+ "{0} unsaved files",
46
+ dirtyCount
47
+ )))),
48
+ });
49
+ }
50
+ else {
51
+ this.badgeHandle.clear();
52
+ }
53
+ }
54
+ };
55
+ DirtyFilesIndicator = ( __decorate([
56
+ ( __param(0, ILifecycleService)),
57
+ ( __param(1, IActivityService)),
58
+ ( __param(2, IWorkingCopyService)),
59
+ ( __param(3, IFilesConfigurationService))
60
+ ], DirtyFilesIndicator));
61
+ export { DirtyFilesIndicator };
@@ -1,3 +1,27 @@
1
+ import { Emitter } from '../../../../base/common/event.js';
2
+ import { Disposable } from '../../../../base/common/lifecycle.js';
1
3
  import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
2
4
  const IInteractiveDocumentService = ( createDecorator('IInteractiveDocumentService'));
3
- export { IInteractiveDocumentService };
5
+ class InteractiveDocumentService extends Disposable {
6
+ constructor() {
7
+ super();
8
+ this._onWillAddInteractiveDocument = this._register(( new Emitter()));
9
+ this.onWillAddInteractiveDocument = this._onWillAddInteractiveDocument.event;
10
+ this._onWillRemoveInteractiveDocument = this._register(( new Emitter()));
11
+ this.onWillRemoveInteractiveDocument = this._onWillRemoveInteractiveDocument.event;
12
+ }
13
+ willCreateInteractiveDocument(notebookUri, inputUri, languageId) {
14
+ this._onWillAddInteractiveDocument.fire({
15
+ notebookUri,
16
+ inputUri,
17
+ languageId
18
+ });
19
+ }
20
+ willRemoveInteractiveDocument(notebookUri, inputUri) {
21
+ this._onWillRemoveInteractiveDocument.fire({
22
+ notebookUri,
23
+ inputUri
24
+ });
25
+ }
26
+ }
27
+ export { IInteractiveDocumentService, InteractiveDocumentService };
@@ -0,0 +1,178 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Event } from '../../../../base/common/event.js';
3
+ import { basename, extname } from '../../../../base/common/path.js';
4
+ import { joinPath, isEqual } from '../../../../base/common/resources.js';
5
+ import { PLAINTEXT_LANGUAGE_ID } from '../../../../editor/common/languages/modesRegistry.js';
6
+ import { ITextModelService } from '../../../../editor/common/services/resolverService.js';
7
+ import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
8
+ import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
9
+ import { EditorInput } from '../../../common/editor/editorInput.js';
10
+ import { IInteractiveDocumentService } from './interactiveDocumentService.js';
11
+ import { IInteractiveHistoryService } from './interactiveHistoryService.js';
12
+ import { NotebookEditorInput } from '../../notebook/common/notebookEditorInput.js';
13
+ import { INotebookService } from '../../notebook/common/notebookService.js';
14
+ import { IFileDialogService } from '../../../../platform/dialogs/common/dialogs.js';
15
+ var InteractiveEditorInput_1;
16
+ let InteractiveEditorInput = class InteractiveEditorInput extends EditorInput {
17
+ static { InteractiveEditorInput_1 = this; }
18
+ static create(instantiationService, resource, inputResource, title, language) {
19
+ return instantiationService.createInstance(InteractiveEditorInput_1, resource, inputResource, title, language);
20
+ }
21
+ static { this.windowNames = {}; }
22
+ static setName(notebookUri, title) {
23
+ if (title) {
24
+ this.windowNames[notebookUri.path] = title;
25
+ }
26
+ }
27
+ static { this.ID = 'workbench.input.interactive'; }
28
+ get editorId() {
29
+ return 'interactive';
30
+ }
31
+ get typeId() {
32
+ return InteractiveEditorInput_1.ID;
33
+ }
34
+ get language() {
35
+ return this._inputModelRef?.object.textEditorModel.getLanguageId() ?? this._initLanguage;
36
+ }
37
+ get notebookEditorInput() {
38
+ return this._notebookEditorInput;
39
+ }
40
+ get editorInputs() {
41
+ return [this._notebookEditorInput];
42
+ }
43
+ get resource() {
44
+ return this._resource;
45
+ }
46
+ get inputResource() {
47
+ return this._inputResource;
48
+ }
49
+ get primary() {
50
+ return this._notebookEditorInput;
51
+ }
52
+ constructor(resource, inputResource, title, languageId, instantiationService, textModelService, interactiveDocumentService, historyService, _notebookService, _fileDialogService) {
53
+ const input = NotebookEditorInput.getOrCreate(instantiationService, resource, undefined, 'interactive', {});
54
+ super();
55
+ this._notebookService = _notebookService;
56
+ this._fileDialogService = _fileDialogService;
57
+ this._notebookEditorInput = input;
58
+ this._register(this._notebookEditorInput);
59
+ this.name = title ?? InteractiveEditorInput_1.windowNames[resource.path] ?? basename(resource.path, extname(resource.path));
60
+ this._initLanguage = languageId;
61
+ this._resource = resource;
62
+ this._inputResource = inputResource;
63
+ this._inputResolver = null;
64
+ this._editorModelReference = null;
65
+ this._inputModelRef = null;
66
+ this._textModelService = textModelService;
67
+ this._interactiveDocumentService = interactiveDocumentService;
68
+ this._historyService = historyService;
69
+ this._registerListeners();
70
+ }
71
+ _registerListeners() {
72
+ const oncePrimaryDisposed = Event.once(this.primary.onWillDispose);
73
+ this._register(oncePrimaryDisposed(() => {
74
+ if (!this.isDisposed()) {
75
+ this.dispose();
76
+ }
77
+ }));
78
+ this._register(this.primary.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
79
+ this._register(this.primary.onDidChangeLabel(() => this._onDidChangeLabel.fire()));
80
+ this._register(this.primary.onDidChangeCapabilities(() => this._onDidChangeCapabilities.fire()));
81
+ }
82
+ get capabilities() {
83
+ return 4
84
+ | 2
85
+ | 1024
86
+ | 512 ;
87
+ }
88
+ async _resolveEditorModel() {
89
+ if (!this._editorModelReference) {
90
+ this._editorModelReference = await this._notebookEditorInput.resolve();
91
+ }
92
+ return this._editorModelReference;
93
+ }
94
+ async resolve() {
95
+ if (this._editorModelReference) {
96
+ return this._editorModelReference;
97
+ }
98
+ if (this._inputResolver) {
99
+ return this._inputResolver;
100
+ }
101
+ this._inputResolver = this._resolveEditorModel();
102
+ return this._inputResolver;
103
+ }
104
+ async resolveInput(language) {
105
+ if (this._inputModelRef) {
106
+ return this._inputModelRef.object.textEditorModel;
107
+ }
108
+ const resolvedLanguage = language ?? this._initLanguage ?? PLAINTEXT_LANGUAGE_ID;
109
+ this._interactiveDocumentService.willCreateInteractiveDocument(this.resource, this.inputResource, resolvedLanguage);
110
+ this._inputModelRef = await this._textModelService.createModelReference(this.inputResource);
111
+ return this._inputModelRef.object.textEditorModel;
112
+ }
113
+ async save(group, options) {
114
+ if (this._editorModelReference) {
115
+ if (this.hasCapability(4 )) {
116
+ return this.saveAs(group, options);
117
+ }
118
+ else {
119
+ await this._editorModelReference.save(options);
120
+ }
121
+ return this;
122
+ }
123
+ return undefined;
124
+ }
125
+ async saveAs(group, options) {
126
+ if (!this._editorModelReference) {
127
+ return undefined;
128
+ }
129
+ const provider = this._notebookService.getContributedNotebookType('interactive');
130
+ if (!provider) {
131
+ return undefined;
132
+ }
133
+ const filename = this.getName() + '.ipynb';
134
+ const pathCandidate = joinPath(await this._fileDialogService.defaultFilePath(), filename);
135
+ const target = await this._fileDialogService.pickFileToSave(pathCandidate, options?.availableFileSystems);
136
+ if (!target) {
137
+ return undefined;
138
+ }
139
+ return await this._editorModelReference.saveAs(target);
140
+ }
141
+ matches(otherInput) {
142
+ if (super.matches(otherInput)) {
143
+ return true;
144
+ }
145
+ if (otherInput instanceof InteractiveEditorInput_1) {
146
+ return isEqual(this.resource, otherInput.resource) && isEqual(this.inputResource, otherInput.inputResource);
147
+ }
148
+ return false;
149
+ }
150
+ getName() {
151
+ return this.name;
152
+ }
153
+ isModified() {
154
+ return this._editorModelReference?.isModified() ?? false;
155
+ }
156
+ dispose() {
157
+ this._editorModelReference?.revert({ soft: true });
158
+ this._notebookEditorInput?.dispose();
159
+ this._editorModelReference?.dispose();
160
+ this._editorModelReference = null;
161
+ this._interactiveDocumentService.willRemoveInteractiveDocument(this.resource, this.inputResource);
162
+ this._inputModelRef?.dispose();
163
+ this._inputModelRef = null;
164
+ super.dispose();
165
+ }
166
+ get historyService() {
167
+ return this._historyService;
168
+ }
169
+ };
170
+ InteractiveEditorInput = InteractiveEditorInput_1 = ( __decorate([
171
+ ( __param(4, IInstantiationService)),
172
+ ( __param(5, ITextModelService)),
173
+ ( __param(6, IInteractiveDocumentService)),
174
+ ( __param(7, IInteractiveHistoryService)),
175
+ ( __param(8, INotebookService)),
176
+ ( __param(9, IFileDialogService))
177
+ ], InteractiveEditorInput));
178
+ export { InteractiveEditorInput };
@@ -0,0 +1,49 @@
1
+ import { HistoryNavigator2 } from '../../../../base/common/history.js';
2
+ import { Disposable } from '../../../../base/common/lifecycle.js';
3
+ import { ResourceMap } from '../../../../base/common/map.js';
4
+ import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
5
+ const IInteractiveHistoryService = ( createDecorator('IInteractiveHistoryService'));
6
+ class InteractiveHistoryService extends Disposable {
7
+ constructor() {
8
+ super();
9
+ this._history = ( new ResourceMap());
10
+ }
11
+ addToHistory(uri, value) {
12
+ if (!( this._history.has(uri))) {
13
+ this._history.set(uri, ( new HistoryNavigator2([value], 50)));
14
+ return;
15
+ }
16
+ const history = this._history.get(uri);
17
+ history.resetCursor();
18
+ if (history?.current() !== value) {
19
+ history?.add(value);
20
+ }
21
+ }
22
+ getPreviousValue(uri) {
23
+ const history = this._history.get(uri);
24
+ return history?.previous() ?? null;
25
+ }
26
+ getNextValue(uri) {
27
+ const history = this._history.get(uri);
28
+ return history?.next() ?? null;
29
+ }
30
+ replaceLast(uri, value) {
31
+ if (!( this._history.has(uri))) {
32
+ this._history.set(uri, ( new HistoryNavigator2([value], 50)));
33
+ return;
34
+ }
35
+ else {
36
+ const history = this._history.get(uri);
37
+ if (history?.current() !== value) {
38
+ history?.replaceLast(value);
39
+ }
40
+ }
41
+ }
42
+ clearHistory(uri) {
43
+ this._history.delete(uri);
44
+ }
45
+ has(uri) {
46
+ return ( this._history.has(uri)) ? true : false;
47
+ }
48
+ }
49
+ export { IInteractiveHistoryService, InteractiveHistoryService };