@codingame/monaco-vscode-notebook-service-override 1.85.1

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 (84) hide show
  1. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  2. package/external/tslib/tslib.es6.js +11 -0
  3. package/index.d.ts +1 -0
  4. package/index.js +1 -0
  5. package/notebook.d.ts +5 -0
  6. package/notebook.js +44 -0
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +32 -0
  9. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  10. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +387 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +668 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +319 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +485 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +238 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +317 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +87 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +93 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +383 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +51 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +46 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +135 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +383 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +117 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +511 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +168 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +57 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +702 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +268 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +45 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +108 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +872 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +393 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +175 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1121 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +339 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +41 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +182 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +509 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +133 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +342 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +666 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +80 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1001 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +202 -0
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  75. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  76. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +217 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  78. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +372 -0
  79. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +706 -0
  80. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +407 -0
  81. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  82. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
  83. package/worker.js +1 -0
  84. package/workers/notebook.worker.js +9 -0
@@ -0,0 +1,3 @@
1
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
2
+
3
+ export { n as default };
@@ -0,0 +1,11 @@
1
+ function __decorate(decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ }
7
+ function __param(paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ }
10
+
11
+ export { __decorate, __param };
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from './notebook.js';
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default } from './notebook.js';
package/notebook.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
2
+
3
+ declare function getServiceOverride(): IEditorOverrideServices;
4
+
5
+ export { getServiceOverride as default };
package/notebook.js ADDED
@@ -0,0 +1,44 @@
1
+ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
2
+ import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
3
+ import { NotebookService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js';
4
+ import { INotebookEditorModelResolverService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService';
5
+ import { INotebookEditorWorkerService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/services/notebookWorkerService';
6
+ import { NotebookEditorWorkerServiceImpl } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js';
7
+ import { INotebookCellStatusBarService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCellStatusBarService';
8
+ import { NotebookCellStatusBarService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js';
9
+ import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
10
+ import { NotebookEditorWidgetService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js';
11
+ import { NotebookModelResolverServiceImpl } from './vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js';
12
+ import { INotebookKernelService, INotebookKernelHistoryService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
13
+ import { NotebookKernelService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js';
14
+ import { NotebookRendererMessagingService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js';
15
+ import { INotebookRendererMessagingService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookRendererMessagingService';
16
+ import { NotebookExecutionStateService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js';
17
+ import { NotebookExecutionService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js';
18
+ import { INotebookExecutionService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionService';
19
+ import { INotebookKeymapService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKeymapService';
20
+ import { NotebookKeymapService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js';
21
+ import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
22
+ import { NotebookKernelHistoryService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js';
23
+ import { INotebookLoggingService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookLoggingService';
24
+ import { NotebookLoggingService } from './vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js';
25
+ import './vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js';
26
+
27
+ function getServiceOverride() {
28
+ return {
29
+ [( INotebookService.toString())]: new SyncDescriptor(NotebookService, [], true),
30
+ [( INotebookEditorWorkerService.toString())]: new SyncDescriptor(NotebookEditorWorkerServiceImpl, [], true),
31
+ [( INotebookEditorModelResolverService.toString())]: new SyncDescriptor(NotebookModelResolverServiceImpl, [], true),
32
+ [( INotebookCellStatusBarService.toString())]: new SyncDescriptor(NotebookCellStatusBarService, [], true),
33
+ [( INotebookEditorService.toString())]: new SyncDescriptor(NotebookEditorWidgetService, [], true),
34
+ [( INotebookKernelService.toString())]: new SyncDescriptor(NotebookKernelService, [], true),
35
+ [( INotebookKernelHistoryService.toString())]: new SyncDescriptor(NotebookKernelHistoryService, [], true),
36
+ [( INotebookExecutionService.toString())]: new SyncDescriptor(NotebookExecutionService, [], true),
37
+ [( INotebookExecutionStateService.toString())]: new SyncDescriptor(NotebookExecutionStateService, [], true),
38
+ [( INotebookRendererMessagingService.toString())]: new SyncDescriptor(NotebookRendererMessagingService, [], true),
39
+ [( INotebookKeymapService.toString())]: new SyncDescriptor(NotebookKeymapService, [], true),
40
+ [( INotebookLoggingService.toString())]: new SyncDescriptor(NotebookLoggingService, [], true)
41
+ };
42
+ }
43
+
44
+ export { getServiceOverride as default };
@@ -0,0 +1,8 @@
1
+ var ConfirmResult;
2
+ ( (function(ConfirmResult) {
3
+ ConfirmResult[ConfirmResult["SAVE"] = 0] = "SAVE";
4
+ ConfirmResult[ConfirmResult["DONT_SAVE"] = 1] = "DONT_SAVE";
5
+ ConfirmResult[ConfirmResult["CANCEL"] = 2] = "CANCEL";
6
+ })(ConfirmResult || (ConfirmResult = {})));
7
+
8
+ export { ConfirmResult };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@codingame/monaco-vscode-notebook-service-override",
3
+ "version": "1.85.1",
4
+ "keywords": [],
5
+ "author": {
6
+ "name": "CodinGame",
7
+ "url": "http://www.codingame.com"
8
+ },
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/CodinGame/monaco-vscode-api.git"
13
+ },
14
+ "type": "module",
15
+ "private": false,
16
+ "description": "VSCode public API plugged on the monaco editor - notebook service-override",
17
+ "main": "index.js",
18
+ "module": "index.js",
19
+ "types": "index.d.ts",
20
+ "dependencies": {
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.85.1",
22
+ "monaco-editor": "0.45.0"
23
+ },
24
+ "exports": {
25
+ ".": {
26
+ "default": "./index.js"
27
+ },
28
+ "./worker": {
29
+ "default": "./worker.js"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".monaco-editor .contentWidgets .empty-editor-hint{color:var(--vscode-input-placeholderForeground)}.monaco-editor .contentWidgets .empty-editor-hint a{color:var(--vscode-textLink-foreground)}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,387 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import './emptyTextEditorHint.css.js';
3
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
4
+ import { dispose, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
5
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
6
+ import { ChangeLanguageAction } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorStatus';
7
+ import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
8
+ import { PLAINTEXT_LANGUAGE_ID } from 'monaco-editor/esm/vs/editor/common/languages/modesRegistry.js';
9
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
10
+ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
11
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
12
+ import { registerEditorContribution } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
13
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
14
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
15
+ import { renderFormattedText } from 'monaco-editor/esm/vs/base/browser/formattedTextRenderer.js';
16
+ import { ApplyFileSnippetAction } from 'vscode/vscode/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets';
17
+ import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSession';
18
+ import { IInlineChatService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
19
+ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
20
+ import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
21
+ import { KeybindingLabel } from 'monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js';
22
+ import { OS } from 'monaco-editor/esm/vs/base/common/platform.js';
23
+ import { status } from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
24
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
25
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/configuration';
26
+ import { OUTPUT_MODE_ID, LOG_MODE_ID } from 'vscode/vscode/vs/workbench/services/output/common/output';
27
+ import { SEARCH_RESULT_LANGUAGE_ID } from 'vscode/vscode/vs/workbench/services/search/common/search';
28
+
29
+ const $ = dom.$;
30
+ ( Registry.as(Extensions.ConfigurationMigration))
31
+ .registerConfigurationMigrations([{
32
+ key: 'workbench.editor.untitled.hint',
33
+ migrateFn: (value, _accessor) => ([
34
+ [emptyTextEditorHintSetting, { value }],
35
+ ['workbench.editor.untitled.hint', { value: undefined }]
36
+ ])
37
+ },
38
+ {
39
+ key: 'accessibility.verbosity.untitledHint',
40
+ migrateFn: (value, _accessor) => ([
41
+ ["accessibility.verbosity.emptyEditorHint" , { value }],
42
+ ['accessibility.verbosity.untitledHint', { value: undefined }]
43
+ ])
44
+ }]);
45
+ const emptyTextEditorHintSetting = 'workbench.editor.empty.hint';
46
+ let EmptyTextEditorHintContribution = class EmptyTextEditorHintContribution {
47
+ static { this.ID = 'editor.contrib.emptyTextEditorHint'; }
48
+ constructor(editor, editorGroupsService, commandService, configurationService, keybindingService, inlineChatSessionService, inlineChatService, telemetryService, productService) {
49
+ this.editor = editor;
50
+ this.editorGroupsService = editorGroupsService;
51
+ this.commandService = commandService;
52
+ this.configurationService = configurationService;
53
+ this.keybindingService = keybindingService;
54
+ this.inlineChatSessionService = inlineChatSessionService;
55
+ this.inlineChatService = inlineChatService;
56
+ this.telemetryService = telemetryService;
57
+ this.productService = productService;
58
+ this.toDispose = [];
59
+ this.toDispose.push(this.editor.onDidChangeModel(() => this.update()));
60
+ this.toDispose.push(this.editor.onDidChangeModelLanguage(() => this.update()));
61
+ this.toDispose.push(this.editor.onDidChangeModelDecorations(() => this.update()));
62
+ this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => {
63
+ if (e.affectsConfiguration(emptyTextEditorHintSetting)) {
64
+ this.update();
65
+ }
66
+ }));
67
+ this.toDispose.push(inlineChatSessionService.onWillStartSession(editor => {
68
+ if (this.editor === editor) {
69
+ this.textHintContentWidget?.dispose();
70
+ }
71
+ }));
72
+ this.toDispose.push(inlineChatSessionService.onDidEndSession(editor => {
73
+ if (this.editor === editor) {
74
+ this.update();
75
+ }
76
+ }));
77
+ }
78
+ _getOptions() {
79
+ return { clickable: true };
80
+ }
81
+ _shouldRenderHint() {
82
+ const configValue = this.configurationService.getValue(emptyTextEditorHintSetting);
83
+ if (configValue === 'hidden') {
84
+ return false;
85
+ }
86
+ if (this.editor.getOption(90 )) {
87
+ return false;
88
+ }
89
+ const model = this.editor.getModel();
90
+ const languageId = model?.getLanguageId();
91
+ if (!model || languageId === OUTPUT_MODE_ID || languageId === LOG_MODE_ID || languageId === SEARCH_RESULT_LANGUAGE_ID) {
92
+ return false;
93
+ }
94
+ if (this.inlineChatSessionService.getSession(this.editor, model.uri)) {
95
+ return false;
96
+ }
97
+ const inlineChatProviders = [...this.inlineChatService.getAllProvider()];
98
+ const shouldRenderDefaultHint = model?.uri.scheme === Schemas.untitled && languageId === PLAINTEXT_LANGUAGE_ID && !inlineChatProviders.length;
99
+ return inlineChatProviders.length > 0 || shouldRenderDefaultHint;
100
+ }
101
+ update() {
102
+ this.textHintContentWidget?.dispose();
103
+ if (this._shouldRenderHint()) {
104
+ this.textHintContentWidget = ( new EmptyTextEditorHintContentWidget(
105
+ this.editor,
106
+ this._getOptions(),
107
+ this.editorGroupsService,
108
+ this.commandService,
109
+ this.configurationService,
110
+ this.keybindingService,
111
+ this.inlineChatService,
112
+ this.telemetryService,
113
+ this.productService
114
+ ));
115
+ }
116
+ }
117
+ dispose() {
118
+ dispose(this.toDispose);
119
+ this.textHintContentWidget?.dispose();
120
+ }
121
+ };
122
+ EmptyTextEditorHintContribution = ( __decorate([
123
+ ( __param(1, IEditorGroupsService)),
124
+ ( __param(2, ICommandService)),
125
+ ( __param(3, IConfigurationService)),
126
+ ( __param(4, IKeybindingService)),
127
+ ( __param(5, IInlineChatSessionService)),
128
+ ( __param(6, IInlineChatService)),
129
+ ( __param(7, ITelemetryService)),
130
+ ( __param(8, IProductService))
131
+ ], EmptyTextEditorHintContribution));
132
+ class EmptyTextEditorHintContentWidget {
133
+ static { this.ID = 'editor.widget.emptyHint'; }
134
+ constructor(editor, options, editorGroupsService, commandService, configurationService, keybindingService, inlineChatService, telemetryService, productService) {
135
+ this.editor = editor;
136
+ this.options = options;
137
+ this.editorGroupsService = editorGroupsService;
138
+ this.commandService = commandService;
139
+ this.configurationService = configurationService;
140
+ this.keybindingService = keybindingService;
141
+ this.inlineChatService = inlineChatService;
142
+ this.telemetryService = telemetryService;
143
+ this.productService = productService;
144
+ this.isVisible = false;
145
+ this.ariaLabel = '';
146
+ this.toDispose = ( new DisposableStore());
147
+ this.toDispose.add(this.inlineChatService.onDidChangeProviders(() => this.onDidChangeModelContent()));
148
+ this.toDispose.add(this.editor.onDidChangeModelContent(() => this.onDidChangeModelContent()));
149
+ this.toDispose.add(this.editor.onDidChangeConfiguration((e) => {
150
+ if (this.domNode && e.hasChanged(50 )) {
151
+ this.editor.applyFontInfo(this.domNode);
152
+ }
153
+ }));
154
+ const onDidFocusEditorText = Event.debounce(this.editor.onDidFocusEditorText, () => undefined, 500);
155
+ this.toDispose.add(onDidFocusEditorText(() => {
156
+ if (this.editor.hasTextFocus() && this.isVisible && this.ariaLabel && this.configurationService.getValue("accessibility.verbosity.emptyEditorHint" )) {
157
+ status(this.ariaLabel);
158
+ }
159
+ }));
160
+ this.onDidChangeModelContent();
161
+ }
162
+ onDidChangeModelContent() {
163
+ if (!this.editor.getModel()?.getValueLength() && !this.hasConflictingDecorations()) {
164
+ this.editor.addContentWidget(this);
165
+ this.isVisible = true;
166
+ }
167
+ else {
168
+ this.editor.removeContentWidget(this);
169
+ this.isVisible = false;
170
+ }
171
+ }
172
+ hasConflictingDecorations() {
173
+ const res = Boolean(this.editor.getLineDecorations(1)?.find((d) => d.options.beforeContentClassName
174
+ || d.options.afterContentClassName
175
+ || d.options.before?.content
176
+ || d.options.after?.content));
177
+ return res;
178
+ }
179
+ getId() {
180
+ return EmptyTextEditorHintContentWidget.ID;
181
+ }
182
+ _getHintInlineChat(providers) {
183
+ const providerName = (providers.length === 1 ? providers[0].label : undefined) ?? this.productService.nameShort;
184
+ const inlineChatId = 'inlineChat.start';
185
+ let ariaLabel = `Ask ${providerName} something or start typing to dismiss.`;
186
+ const handleClick = () => {
187
+ this.telemetryService.publicLog2('workbenchActionExecuted', {
188
+ id: 'inlineChat.hintAction',
189
+ from: 'hint'
190
+ });
191
+ void this.commandService.executeCommand(inlineChatId, { from: 'hint' });
192
+ };
193
+ const hintHandler = {
194
+ disposables: this.toDispose,
195
+ callback: (index, _event) => {
196
+ switch (index) {
197
+ case '0':
198
+ handleClick();
199
+ break;
200
+ }
201
+ }
202
+ };
203
+ const hintElement = $('empty-hint-text');
204
+ hintElement.style.display = 'block';
205
+ const keybindingHint = this.keybindingService.lookupKeybinding(inlineChatId);
206
+ const keybindingHintLabel = keybindingHint?.getLabel();
207
+ if (keybindingHint && keybindingHintLabel) {
208
+ const actionPart = ( localizeWithPath(
209
+ 'vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint',
210
+ 'emptyHintText',
211
+ 'Press {0} to ask {1} to do something. ',
212
+ keybindingHintLabel,
213
+ providerName
214
+ ));
215
+ const [before, after] = ( actionPart.split(keybindingHintLabel).map((fragment) => {
216
+ if (this.options.clickable) {
217
+ const hintPart = $('a', undefined, fragment);
218
+ hintPart.style.fontStyle = 'italic';
219
+ hintPart.style.cursor = 'pointer';
220
+ hintPart.onclick = handleClick;
221
+ return hintPart;
222
+ }
223
+ else {
224
+ const hintPart = $('span', undefined, fragment);
225
+ hintPart.style.fontStyle = 'italic';
226
+ return hintPart;
227
+ }
228
+ }));
229
+ hintElement.appendChild(before);
230
+ const label = ( new KeybindingLabel(hintElement, OS));
231
+ label.set(keybindingHint);
232
+ label.element.style.width = 'min-content';
233
+ label.element.style.display = 'inline';
234
+ if (this.options.clickable) {
235
+ label.element.style.cursor = 'pointer';
236
+ label.element.onclick = handleClick;
237
+ }
238
+ hintElement.appendChild(after);
239
+ const typeToDismiss = ( localizeWithPath(
240
+ 'vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint',
241
+ 'emptyHintTextDismiss',
242
+ 'Start typing to dismiss.'
243
+ ));
244
+ const textHint2 = $('span', undefined, typeToDismiss);
245
+ textHint2.style.fontStyle = 'italic';
246
+ hintElement.appendChild(textHint2);
247
+ ariaLabel = actionPart.concat(typeToDismiss);
248
+ }
249
+ else {
250
+ const hintMsg = ( localizeWithPath(
251
+ 'vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint',
252
+ {
253
+ key: 'inlineChatHint',
254
+ comment: [
255
+ 'Preserve double-square brackets and their order',
256
+ ]
257
+ },
258
+ '[[Ask {0} to do something]] or start typing to dismiss.',
259
+ providerName
260
+ ));
261
+ const rendered = renderFormattedText(hintMsg, { actionHandler: hintHandler });
262
+ hintElement.appendChild(rendered);
263
+ }
264
+ return { ariaLabel, hintHandler, hintElement };
265
+ }
266
+ _getHintDefault() {
267
+ const hintHandler = {
268
+ disposables: this.toDispose,
269
+ callback: (index, event) => {
270
+ switch (index) {
271
+ case '0':
272
+ languageOnClickOrTap(event.browserEvent);
273
+ break;
274
+ case '1':
275
+ snippetOnClickOrTap(event.browserEvent);
276
+ break;
277
+ case '2':
278
+ chooseEditorOnClickOrTap(event.browserEvent);
279
+ break;
280
+ case '3':
281
+ dontShowOnClickOrTap();
282
+ break;
283
+ }
284
+ }
285
+ };
286
+ const languageOnClickOrTap = async (e) => {
287
+ e.stopPropagation();
288
+ this.editor.focus();
289
+ this.telemetryService.publicLog2('workbenchActionExecuted', {
290
+ id: ChangeLanguageAction.ID,
291
+ from: 'hint'
292
+ });
293
+ await this.commandService.executeCommand(ChangeLanguageAction.ID, { from: 'hint' });
294
+ this.editor.focus();
295
+ };
296
+ const snippetOnClickOrTap = async (e) => {
297
+ e.stopPropagation();
298
+ this.telemetryService.publicLog2('workbenchActionExecuted', {
299
+ id: ApplyFileSnippetAction.Id,
300
+ from: 'hint'
301
+ });
302
+ await this.commandService.executeCommand(ApplyFileSnippetAction.Id);
303
+ };
304
+ const chooseEditorOnClickOrTap = async (e) => {
305
+ e.stopPropagation();
306
+ const activeEditorInput = this.editorGroupsService.activeGroup.activeEditor;
307
+ this.telemetryService.publicLog2('workbenchActionExecuted', {
308
+ id: 'welcome.showNewFileEntries',
309
+ from: 'hint'
310
+ });
311
+ const newEditorSelected = await this.commandService.executeCommand('welcome.showNewFileEntries', { from: 'hint' });
312
+ if (newEditorSelected && activeEditorInput !== null && activeEditorInput.resource?.scheme === Schemas.untitled) {
313
+ this.editorGroupsService.activeGroup.closeEditor(activeEditorInput, { preserveFocus: true });
314
+ }
315
+ };
316
+ const dontShowOnClickOrTap = () => {
317
+ this.configurationService.updateValue(emptyTextEditorHintSetting, 'hidden');
318
+ this.dispose();
319
+ this.editor.focus();
320
+ };
321
+ const hintMsg = ( localizeWithPath(
322
+ 'vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint',
323
+ {
324
+ key: 'message',
325
+ comment: [
326
+ 'Preserve double-square brackets and their order',
327
+ 'language refers to a programming language'
328
+ ]
329
+ },
330
+ '[[Select a language]], or [[fill with template]], or [[open a different editor]] to get started.\nStart typing to dismiss or [[don\'t show]] this again.'
331
+ ));
332
+ const hintElement = renderFormattedText(hintMsg, {
333
+ actionHandler: hintHandler,
334
+ renderCodeSegments: false,
335
+ });
336
+ hintElement.style.fontStyle = 'italic';
337
+ const keybindingsLookup = [ChangeLanguageAction.ID, ApplyFileSnippetAction.Id, 'welcome.showNewFileEntries'];
338
+ const keybindingLabels = ( keybindingsLookup.map((id) => this.keybindingService.lookupKeybinding(id)?.getLabel() ?? id));
339
+ const ariaLabel = ( localizeWithPath(
340
+ 'vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint',
341
+ 'defaultHintAriaLabel',
342
+ 'Execute {0} to select a language, execute {1} to fill with template, or execute {2} to open a different editor and get started. Start typing to dismiss.',
343
+ ...keybindingLabels
344
+ ));
345
+ for (const anchor of hintElement.querySelectorAll('a')) {
346
+ anchor.style.cursor = 'pointer';
347
+ const id = keybindingsLookup.shift();
348
+ const title = id && this.keybindingService.lookupKeybinding(id)?.getLabel();
349
+ anchor.title = title ?? '';
350
+ }
351
+ return { hintElement, ariaLabel };
352
+ }
353
+ getDomNode() {
354
+ if (!this.domNode) {
355
+ this.domNode = $('.empty-editor-hint');
356
+ this.domNode.style.width = 'max-content';
357
+ this.domNode.style.paddingLeft = '4px';
358
+ const inlineChatProviders = [...this.inlineChatService.getAllProvider()];
359
+ const { hintElement, ariaLabel } = !inlineChatProviders.length ? this._getHintDefault() : this._getHintInlineChat(inlineChatProviders);
360
+ this.domNode.append(hintElement);
361
+ this.ariaLabel = ariaLabel.concat(( localizeWithPath(
362
+ 'vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint',
363
+ 'disableHint',
364
+ ' Toggle {0} in settings to disable this hint.',
365
+ "accessibility.verbosity.emptyEditorHint"
366
+ )));
367
+ this.toDispose.add(dom.addDisposableListener(this.domNode, 'click', () => {
368
+ this.editor.focus();
369
+ }));
370
+ this.editor.applyFontInfo(this.domNode);
371
+ }
372
+ return this.domNode;
373
+ }
374
+ getPosition() {
375
+ return {
376
+ position: { lineNumber: 1, column: 1 },
377
+ preference: [0 ]
378
+ };
379
+ }
380
+ dispose() {
381
+ this.editor.removeContentWidget(this);
382
+ dispose(this.toDispose);
383
+ }
384
+ }
385
+ registerEditorContribution(EmptyTextEditorHintContribution.ID, EmptyTextEditorHintContribution, 0 );
386
+
387
+ export { EmptyTextEditorHintContribution, emptyTextEditorHintSetting };