@deephaven/console 0.5.2-matplotlib.2 → 0.6.1-demo.8

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 (114) hide show
  1. package/dist/Console.d.ts +3 -0
  2. package/dist/Console.d.ts.map +1 -1
  3. package/dist/Console.js +807 -871
  4. package/dist/Console.js.map +1 -1
  5. package/dist/ConsoleInput.d.ts +1 -38
  6. package/dist/ConsoleInput.d.ts.map +1 -1
  7. package/dist/ConsoleInput.js +331 -436
  8. package/dist/ConsoleInput.js.map +1 -1
  9. package/dist/ConsoleMenu.js +159 -215
  10. package/dist/ConsoleMenu.js.map +1 -1
  11. package/dist/ConsolePropTypes.js +1 -1
  12. package/dist/ConsolePropTypes.js.map +1 -1
  13. package/dist/ConsoleShortcuts.js +2 -2
  14. package/dist/ConsoleShortcuts.js.map +1 -1
  15. package/dist/ConsoleStatusBar.js +85 -125
  16. package/dist/ConsoleStatusBar.js.map +1 -1
  17. package/dist/StoragePropTypes.js +2 -2
  18. package/dist/StoragePropTypes.js.map +1 -1
  19. package/dist/command-history/CommandHistory.css +5 -2
  20. package/dist/command-history/CommandHistory.css.map +1 -1
  21. package/dist/command-history/CommandHistory.d.ts +5 -0
  22. package/dist/command-history/CommandHistory.d.ts.map +1 -1
  23. package/dist/command-history/CommandHistory.js +303 -391
  24. package/dist/command-history/CommandHistory.js.map +1 -1
  25. package/dist/command-history/CommandHistoryActions.css +4 -0
  26. package/dist/command-history/CommandHistoryActions.css.map +1 -1
  27. package/dist/command-history/CommandHistoryActions.d.ts.map +1 -1
  28. package/dist/command-history/CommandHistoryActions.js +40 -79
  29. package/dist/command-history/CommandHistoryActions.js.map +1 -1
  30. package/dist/command-history/CommandHistoryItem.css +1 -1
  31. package/dist/command-history/CommandHistoryItem.d.ts +5 -0
  32. package/dist/command-history/CommandHistoryItem.d.ts.map +1 -1
  33. package/dist/command-history/CommandHistoryItem.js +15 -9
  34. package/dist/command-history/CommandHistoryItem.js.map +1 -1
  35. package/dist/command-history/CommandHistoryItemTooltip.d.ts +1 -40
  36. package/dist/command-history/CommandHistoryItemTooltip.d.ts.map +1 -1
  37. package/dist/command-history/CommandHistoryItemTooltip.js +139 -189
  38. package/dist/command-history/CommandHistoryItemTooltip.js.map +1 -1
  39. package/dist/command-history/CommandHistoryViewportUpdater.js +30 -35
  40. package/dist/command-history/CommandHistoryViewportUpdater.js.map +1 -1
  41. package/dist/command-history/index.js +5 -5
  42. package/dist/command-history/index.js.map +1 -1
  43. package/dist/common/Code.js +34 -70
  44. package/dist/common/Code.js.map +1 -1
  45. package/dist/common/ConsoleConstants.js +3 -24
  46. package/dist/common/ConsoleConstants.js.map +1 -1
  47. package/dist/common/ConsoleUtils.d.ts +1 -3
  48. package/dist/common/ConsoleUtils.d.ts.map +1 -1
  49. package/dist/common/ConsoleUtils.js +60 -94
  50. package/dist/common/ConsoleUtils.js.map +1 -1
  51. package/dist/common/ObjectIcon.js +4 -2
  52. package/dist/common/ObjectIcon.js.map +1 -1
  53. package/dist/common/index.d.js +1 -34
  54. package/dist/common/index.d.js.map +1 -1
  55. package/dist/common/index.js +4 -4
  56. package/dist/common/index.js.map +1 -1
  57. package/dist/console-history/ConsoleHistory.js +27 -63
  58. package/dist/console-history/ConsoleHistory.js.map +1 -1
  59. package/dist/console-history/ConsoleHistoryItem.js +116 -154
  60. package/dist/console-history/ConsoleHistoryItem.js.map +1 -1
  61. package/dist/console-history/ConsoleHistoryItemResult.js +4 -2
  62. package/dist/console-history/ConsoleHistoryItemResult.js.map +1 -1
  63. package/dist/console-history/ConsoleHistoryResultErrorMessage.js +94 -132
  64. package/dist/console-history/ConsoleHistoryResultErrorMessage.js.map +1 -1
  65. package/dist/console-history/ConsoleHistoryResultInProgress.js +42 -76
  66. package/dist/console-history/ConsoleHistoryResultInProgress.js.map +1 -1
  67. package/dist/console-history/index.js +5 -5
  68. package/dist/console-history/index.js.map +1 -1
  69. package/dist/csv/CsvFormats.js +14 -28
  70. package/dist/csv/CsvFormats.js.map +1 -1
  71. package/dist/csv/CsvInputBar.css +25 -23
  72. package/dist/csv/CsvInputBar.css.map +1 -1
  73. package/dist/csv/CsvInputBar.d.ts +2 -45
  74. package/dist/csv/CsvInputBar.d.ts.map +1 -1
  75. package/dist/csv/CsvInputBar.js +298 -372
  76. package/dist/csv/CsvInputBar.js.map +1 -1
  77. package/dist/csv/CsvOverlay.js +197 -243
  78. package/dist/csv/CsvOverlay.js.map +1 -1
  79. package/dist/csv/CsvParser.js +186 -209
  80. package/dist/csv/CsvParser.js.map +1 -1
  81. package/dist/csv/CsvTypeParser.js +185 -210
  82. package/dist/csv/CsvTypeParser.js.map +1 -1
  83. package/dist/csv/NewTableColumnTypes.js +1 -5
  84. package/dist/csv/NewTableColumnTypes.js.map +1 -1
  85. package/dist/index.js +14 -14
  86. package/dist/index.js.map +1 -1
  87. package/dist/log/LogLevelMenuItem.js +24 -58
  88. package/dist/log/LogLevelMenuItem.js.map +1 -1
  89. package/dist/log/LogView.js +429 -484
  90. package/dist/log/LogView.js.map +1 -1
  91. package/dist/monaco/MonacoCompletionProvider.js +92 -124
  92. package/dist/monaco/MonacoCompletionProvider.js.map +1 -1
  93. package/dist/monaco/MonacoUtils.js +315 -331
  94. package/dist/monaco/MonacoUtils.js.map +1 -1
  95. package/dist/monaco/index.js +2 -2
  96. package/dist/monaco/index.js.map +1 -1
  97. package/dist/monaco/lang/db.js +3 -3
  98. package/dist/monaco/lang/db.js.map +1 -1
  99. package/dist/monaco/lang/groovy.js +3 -3
  100. package/dist/monaco/lang/groovy.js.map +1 -1
  101. package/dist/monaco/lang/log.js +3 -3
  102. package/dist/monaco/lang/log.js.map +1 -1
  103. package/dist/monaco/lang/python.js +3 -3
  104. package/dist/monaco/lang/python.js.map +1 -1
  105. package/dist/monaco/lang/scala.js +5 -5
  106. package/dist/monaco/lang/scala.js.map +1 -1
  107. package/dist/notebook/Editor.js +101 -141
  108. package/dist/notebook/Editor.js.map +1 -1
  109. package/dist/notebook/ScriptEditor.js +261 -301
  110. package/dist/notebook/ScriptEditor.js.map +1 -1
  111. package/dist/notebook/ScriptEditorUtils.js +26 -42
  112. package/dist/notebook/ScriptEditorUtils.js.map +1 -1
  113. package/dist/tsconfig.tsbuildinfo +1 -1
  114. package/package.json +26 -56
@@ -1,9 +1,3 @@
1
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
-
3
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
4
-
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
6
-
7
1
  /**
8
2
  * Exports a function for initializing monaco with the deephaven theme/config
9
3
  */
@@ -64,358 +58,348 @@ import 'monaco-editor/esm/vs/editor/contrib/wordOperations/wordOperations';
64
58
  import 'monaco-editor/esm/vs/editor/contrib/wordPartOperations/wordPartOperations';
65
59
  import Log from '@deephaven/log';
66
60
  import MonacoTheme from "./MonacoTheme.module.css";
67
- import PyLang from './lang/python';
68
- import GroovyLang from './lang/groovy';
69
- import ScalaLang from './lang/scala';
70
- import DbLang from './lang/db';
71
- import LogLang from './lang/log';
61
+ import PyLang from "./lang/python.js";
62
+ import GroovyLang from "./lang/groovy.js";
63
+ import ScalaLang from "./lang/scala.js";
64
+ import DbLang from "./lang/db.js";
65
+ import LogLang from "./lang/log.js";
72
66
  var log = Log.module('MonacoUtils');
73
67
 
74
- var MonacoUtils = /*#__PURE__*/function () {
75
- function MonacoUtils() {
76
- _classCallCheck(this, MonacoUtils);
68
+ class MonacoUtils {
69
+ static init() {
70
+ log.debug('Initializing Monaco...');
71
+ var {
72
+ registerLanguages,
73
+ removeHashtag
74
+ } = MonacoUtils;
75
+ var dhDarkRules = [{
76
+ token: '',
77
+ foreground: removeHashtag(MonacoTheme.foreground)
78
+ }, {
79
+ token: 'string',
80
+ foreground: removeHashtag(MonacoTheme.string)
81
+ }, {
82
+ token: 'string.delim',
83
+ foreground: removeHashtag(MonacoTheme['string-delim'])
84
+ }, {
85
+ token: 'keyword',
86
+ foreground: removeHashtag(MonacoTheme.keyword)
87
+ }, {
88
+ token: 'identifier.js',
89
+ foreground: removeHashtag(MonacoTheme['identifier-js'])
90
+ }, {
91
+ token: 'delimiter',
92
+ foreground: removeHashtag(MonacoTheme.delimiter)
93
+ }, {
94
+ token: 'comment',
95
+ foreground: removeHashtag(MonacoTheme.comment)
96
+ }, {
97
+ token: 'number',
98
+ foreground: removeHashtag(MonacoTheme.number)
99
+ }, {
100
+ token: 'storage',
101
+ foreground: removeHashtag(MonacoTheme.storage)
102
+ }, {
103
+ token: 'identifier',
104
+ foreground: removeHashtag(MonacoTheme.identifier)
105
+ }, {
106
+ token: 'namespace.identifier',
107
+ foreground: removeHashtag(MonacoTheme['namespace-identifier'])
108
+ }, {
109
+ token: 'operator',
110
+ foreground: removeHashtag(MonacoTheme.operator)
111
+ }, {
112
+ token: 'predefined',
113
+ foreground: removeHashtag(MonacoTheme.predefined)
114
+ }, {
115
+ token: 'error.log',
116
+ foreground: MonacoTheme['log-error'].substring(1)
117
+ }, {
118
+ token: 'warn.log',
119
+ foreground: removeHashtag(MonacoTheme['log-warn'])
120
+ }, {
121
+ token: 'info.log',
122
+ foreground: removeHashtag(MonacoTheme['log-info'])
123
+ }, {
124
+ token: 'stdout.log',
125
+ foreground: removeHashtag(MonacoTheme['log-stdout'])
126
+ }, {
127
+ token: 'trace.log',
128
+ foreground: removeHashtag(MonacoTheme['log-trace'])
129
+ }, {
130
+ token: 'debug.log',
131
+ foreground: removeHashtag(MonacoTheme['log-debug'])
132
+ }, {
133
+ token: 'date.log',
134
+ foreground: removeHashtag(MonacoTheme['log-date'])
135
+ }];
136
+ var dhDarkColors = {
137
+ errorForeground: MonacoTheme['error-foreground'],
138
+ 'inputOption.activeBorder': MonacoTheme['input-option-active-border'],
139
+ 'editor.background': MonacoTheme.background,
140
+ 'editor.foreground': MonacoTheme.foreground,
141
+ 'editor.lineHighlightBackground': MonacoTheme['editor-line-highlight-bg'],
142
+ 'editorLineNumber.foreground': MonacoTheme['editor-line-number-foreground'],
143
+ 'editor.selectionBackground': MonacoTheme['editor-selection-background'],
144
+ 'editor.findMatchBackground': MonacoTheme['editor-find-match-background'],
145
+ 'editor.findMatchHighlightBackground': MonacoTheme['editor-find-match-highlight-background'],
146
+ 'editorSuggestWidget.background': MonacoTheme['editor-suggest-widget-background'],
147
+ 'editorSuggestWidget.border': MonacoTheme['editor-suggest-widget-border'],
148
+ 'editorSuggestWidget.foreground': MonacoTheme['editor-suggest-widget-foreground'],
149
+ 'editorSuggestWidget.selectedBackground': MonacoTheme['editor-suggest-widget-selected-background'],
150
+ 'editorSuggestWidget.highlightForeground': MonacoTheme['editor-suggest-widget-highlightForeground'],
151
+ 'list.hoverBackground': MonacoTheme['list-hover-background'],
152
+ 'dropdown.background': MonacoTheme['context-menu-background'],
153
+ 'dropdown.foreground': MonacoTheme['context-menu-foreground'],
154
+ 'menu.selectionBackground': MonacoTheme['menu-selection-background'],
155
+ 'list.focusBackground': MonacoTheme['menu-selection-background'],
156
+ 'editorWidget.background': MonacoTheme['editor-widget-background'],
157
+ 'inputOption.activeBackground': MonacoTheme['input-option-active-background'],
158
+ 'inputOption.activeForeground': MonacoTheme['input-option-active-foreground'],
159
+ focusBorder: MonacoTheme['focus-border'],
160
+ 'input.background': MonacoTheme['input-background'],
161
+ 'input.foreground': MonacoTheme['input-foreground'],
162
+ 'input.border': MonacoTheme['input-border']
163
+ };
164
+ monaco.editor.defineTheme('dh-dark', {
165
+ base: 'vs-dark',
166
+ inherit: true,
167
+ rules: dhDarkRules,
168
+ colors: dhDarkColors
169
+ });
170
+ log.debug2('monaco theme: ', MonacoTheme);
171
+ monaco.editor.setTheme('dh-dark');
172
+ registerLanguages([DbLang, PyLang, GroovyLang, LogLang, ScalaLang]);
173
+ log.debug('Monaco initialized.');
77
174
  }
175
+ /**
176
+ * Remove the hashtag prefix from a CSS color string.
177
+ * Monaco expects colors to be the value only, no hashtag.
178
+ * @param {String} color The hex color string to remove the hashtag from, eg. '#ffffff'
179
+ */
78
180
 
79
- _createClass(MonacoUtils, null, [{
80
- key: "init",
81
- value: function init() {
82
- log.debug('Initializing Monaco...');
83
- var registerLanguages = MonacoUtils.registerLanguages,
84
- removeHashtag = MonacoUtils.removeHashtag;
85
- var dhDarkRules = [{
86
- token: '',
87
- foreground: removeHashtag(MonacoTheme.foreground)
88
- }, {
89
- token: 'string',
90
- foreground: removeHashtag(MonacoTheme.string)
91
- }, {
92
- token: 'string.delim',
93
- foreground: removeHashtag(MonacoTheme['string-delim'])
94
- }, {
95
- token: 'keyword',
96
- foreground: removeHashtag(MonacoTheme.keyword)
97
- }, {
98
- token: 'identifier.js',
99
- foreground: removeHashtag(MonacoTheme['identifier-js'])
100
- }, {
101
- token: 'delimiter',
102
- foreground: removeHashtag(MonacoTheme.delimiter)
103
- }, {
104
- token: 'comment',
105
- foreground: removeHashtag(MonacoTheme.comment)
106
- }, {
107
- token: 'number',
108
- foreground: removeHashtag(MonacoTheme.number)
109
- }, {
110
- token: 'storage',
111
- foreground: removeHashtag(MonacoTheme.storage)
112
- }, {
113
- token: 'identifier',
114
- foreground: removeHashtag(MonacoTheme.identifier)
115
- }, {
116
- token: 'namespace.identifier',
117
- foreground: removeHashtag(MonacoTheme['namespace-identifier'])
118
- }, {
119
- token: 'operator',
120
- foreground: removeHashtag(MonacoTheme.operator)
121
- }, {
122
- token: 'predefined',
123
- foreground: removeHashtag(MonacoTheme.predefined)
124
- }, {
125
- token: 'error.log',
126
- foreground: MonacoTheme['log-error'].substring(1)
127
- }, {
128
- token: 'warn.log',
129
- foreground: removeHashtag(MonacoTheme['log-warn'])
130
- }, {
131
- token: 'info.log',
132
- foreground: removeHashtag(MonacoTheme['log-info'])
133
- }, {
134
- token: 'stdout.log',
135
- foreground: removeHashtag(MonacoTheme['log-stdout'])
136
- }, {
137
- token: 'trace.log',
138
- foreground: removeHashtag(MonacoTheme['log-trace'])
139
- }, {
140
- token: 'debug.log',
141
- foreground: removeHashtag(MonacoTheme['log-debug'])
142
- }, {
143
- token: 'date.log',
144
- foreground: removeHashtag(MonacoTheme['log-date'])
145
- }];
146
- var dhDarkColors = {
147
- errorForeground: MonacoTheme['error-foreground'],
148
- 'inputOption.activeBorder': MonacoTheme['input-option-active-border'],
149
- 'editor.background': MonacoTheme.background,
150
- 'editor.foreground': MonacoTheme.foreground,
151
- 'editor.lineHighlightBackground': MonacoTheme['editor-line-highlight-bg'],
152
- 'editorLineNumber.foreground': MonacoTheme['editor-line-number-foreground'],
153
- 'editor.selectionBackground': MonacoTheme['editor-selection-background'],
154
- 'editor.findMatchBackground': MonacoTheme['editor-find-match-background'],
155
- 'editor.findMatchHighlightBackground': MonacoTheme['editor-find-match-highlight-background'],
156
- 'editorSuggestWidget.background': MonacoTheme['editor-suggest-widget-background'],
157
- 'editorSuggestWidget.border': MonacoTheme['editor-suggest-widget-border'],
158
- 'editorSuggestWidget.foreground': MonacoTheme['editor-suggest-widget-foreground'],
159
- 'editorSuggestWidget.selectedBackground': MonacoTheme['editor-suggest-widget-selected-background'],
160
- 'editorSuggestWidget.highlightForeground': MonacoTheme['editor-suggest-widget-highlightForeground'],
161
- 'list.hoverBackground': MonacoTheme['list-hover-background'],
162
- 'dropdown.background': MonacoTheme['context-menu-background'],
163
- 'dropdown.foreground': MonacoTheme['context-menu-foreground'],
164
- 'menu.selectionBackground': MonacoTheme['menu-selection-background'],
165
- 'list.focusBackground': MonacoTheme['menu-selection-background'],
166
- 'editorWidget.background': MonacoTheme['editor-widget-background'],
167
- 'inputOption.activeBackground': MonacoTheme['input-option-active-background'],
168
- 'inputOption.activeForeground': MonacoTheme['input-option-active-foreground'],
169
- focusBorder: MonacoTheme['focus-border'],
170
- 'input.background': MonacoTheme['input-background'],
171
- 'input.foreground': MonacoTheme['input-foreground'],
172
- 'input.border': MonacoTheme['input-border']
173
- };
174
- monaco.editor.defineTheme('dh-dark', {
175
- base: 'vs-dark',
176
- inherit: true,
177
- rules: dhDarkRules,
178
- colors: dhDarkColors
179
- });
180
- log.debug2('monaco theme: ', MonacoTheme);
181
- monaco.editor.setTheme('dh-dark');
182
- registerLanguages([DbLang, PyLang, GroovyLang, LogLang, ScalaLang]);
183
- log.debug('Monaco initialized.');
184
- }
185
- /**
186
- * Remove the hashtag prefix from a CSS color string.
187
- * Monaco expects colors to be the value only, no hashtag.
188
- * @param {String} color The hex color string to remove the hashtag from, eg. '#ffffff'
189
- */
190
181
 
191
- }, {
192
- key: "removeHashtag",
193
- value: function removeHashtag(color) {
194
- return color.substring(1);
195
- }
196
- }, {
197
- key: "registerLanguages",
198
- value: function registerLanguages(languages) {
199
- // First override the default loader for any language we have a custom definition for
200
- // https://github.com/Microsoft/monaco-editor/issues/252#issuecomment-482786867
201
- var languageIds = languages.map(function (_ref) {
202
- var id = _ref.id;
203
- return id;
204
- });
205
- monaco.languages.getLanguages().filter(function (_ref2) {
206
- var id = _ref2.id;
207
- return languageIds.includes(id);
208
- }).forEach(function (languageParam) {
209
- var language = languageParam;
210
- log.debug2('Overriding default language loader:', language.id);
182
+ static removeHashtag(color) {
183
+ return color.substring(1);
184
+ }
211
185
 
212
- language.loader = function () {
213
- return {
214
- then: function then() {}
215
- };
216
- };
217
- }); // Then register our language definitions
186
+ static registerLanguages(languages) {
187
+ // First override the default loader for any language we have a custom definition for
188
+ // https://github.com/Microsoft/monaco-editor/issues/252#issuecomment-482786867
189
+ var languageIds = languages.map((_ref) => {
190
+ var {
191
+ id
192
+ } = _ref;
193
+ return id;
194
+ });
195
+ monaco.languages.getLanguages().filter((_ref2) => {
196
+ var {
197
+ id
198
+ } = _ref2;
199
+ return languageIds.includes(id);
200
+ }).forEach(languageParam => {
201
+ var language = languageParam;
202
+ log.debug2('Overriding default language loader:', language.id);
218
203
 
219
- languages.forEach(function (language) {
220
- MonacoUtils.registerLanguage(language);
204
+ language.loader = () => ({
205
+ then: () => {}
221
206
  });
222
- }
223
- }, {
224
- key: "registerLanguage",
225
- value: function registerLanguage(language) {
226
- log.debug2('Registering language: ', language.id);
227
- monaco.languages.register(language);
228
- monaco.languages.onLanguage(language.id, function () {
229
- monaco.languages.setLanguageConfiguration(language.id, language.conf);
230
- monaco.languages.setMonarchTokensProvider(language.id, language.language);
231
- });
232
- }
233
- /**
234
- * Set EOL preference for the editor
235
- * @param {monaco.editor.IEditor} editor The editor to set the EOL for
236
- * @param {monaco.editor.EndOfLineSequence} eolSequence EOL sequence
237
- */
207
+ }); // Then register our language definitions
238
208
 
239
- }, {
240
- key: "setEOL",
241
- value: function setEOL(editor) {
242
- var eolSequence = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : monaco.editor.EndOfLineSequence.LF;
243
- editor.getModel().setEOL(eolSequence);
244
- }
245
- /**
246
- * Links an editor with a provided session to provide completion items.
247
- * @param {dh.IdeSession} session The IdeSession to link
248
- * @param {monaco.editor.IEditor} editor The editor to link the session to
249
- * @return A cleanup function for disposing of the created listeners
250
- */
209
+ languages.forEach(language => {
210
+ MonacoUtils.registerLanguage(language);
211
+ });
212
+ }
213
+
214
+ static registerLanguage(language) {
215
+ log.debug2('Registering language: ', language.id);
216
+ monaco.languages.register(language);
217
+ monaco.languages.onLanguage(language.id, () => {
218
+ monaco.languages.setLanguageConfiguration(language.id, language.conf);
219
+ monaco.languages.setMonarchTokensProvider(language.id, language.language);
220
+ });
221
+ }
222
+ /**
223
+ * Set EOL preference for the editor
224
+ * @param {monaco.editor.IEditor} editor The editor to set the EOL for
225
+ * @param {monaco.editor.EndOfLineSequence} eolSequence EOL sequence
226
+ */
251
227
 
252
- }, {
253
- key: "openDocument",
254
- value: function openDocument(editor, session) {
255
- var model = editor.getModel();
256
- var didOpenDocumentParams = {
257
- textDocument: {
258
- uri: "".concat(model.uri),
259
- languageId: model.getModeId(),
260
- version: model.getVersionId(),
261
- text: model.getValue()
262
- }
263
- };
264
- log.debug2('didOpenDocumentParams: ', didOpenDocumentParams);
265
- session.openDocument(didOpenDocumentParams);
266
- var dispose = editor.onDidChangeModelContent(function (changedEvent) {
267
- var changes = changedEvent.changes,
268
- versionId = changedEvent.versionId;
269
- var contentChanges = [];
270
228
 
271
- for (var i = 0; i < changes.length; i += 1) {
272
- var change = changes[i];
273
- var range = change.range,
274
- rangeLength = change.rangeLength,
275
- text = change.text;
276
- var contentChange = {
277
- range: {
278
- start: {
279
- line: range.startLineNumber - 1,
280
- character: range.startColumn - 1
281
- },
282
- end: {
283
- line: range.endLineNumber - 1,
284
- character: range.endColumn - 1
285
- }
286
- },
287
- rangeLength: rangeLength,
288
- text: text
289
- };
290
- contentChanges.push(contentChange);
291
- }
229
+ static setEOL(editor) {
230
+ var eolSequence = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : monaco.editor.EndOfLineSequence.LF;
231
+ editor.getModel().setEOL(eolSequence);
232
+ }
233
+ /**
234
+ * Links an editor with a provided session to provide completion items.
235
+ * @param {dh.IdeSession} session The IdeSession to link
236
+ * @param {monaco.editor.IEditor} editor The editor to link the session to
237
+ * @return A cleanup function for disposing of the created listeners
238
+ */
292
239
 
293
- if (contentChanges.length > 0) {
294
- var didChangeDocumentParams = {
295
- textDocument: {
296
- version: versionId,
297
- uri: "".concat(model.uri)
240
+
241
+ static openDocument(editor, session) {
242
+ var model = editor.getModel();
243
+ var didOpenDocumentParams = {
244
+ textDocument: {
245
+ uri: "".concat(model.uri),
246
+ languageId: model.getModeId(),
247
+ version: model.getVersionId(),
248
+ text: model.getValue()
249
+ }
250
+ };
251
+ log.debug2('didOpenDocumentParams: ', didOpenDocumentParams);
252
+ session.openDocument(didOpenDocumentParams);
253
+ var dispose = editor.onDidChangeModelContent(changedEvent => {
254
+ var {
255
+ changes,
256
+ versionId
257
+ } = changedEvent;
258
+ var contentChanges = [];
259
+
260
+ for (var i = 0; i < changes.length; i += 1) {
261
+ var change = changes[i];
262
+ var {
263
+ range,
264
+ rangeLength,
265
+ text
266
+ } = change;
267
+ var contentChange = {
268
+ range: {
269
+ start: {
270
+ line: range.startLineNumber - 1,
271
+ character: range.startColumn - 1
298
272
  },
299
- contentChanges: contentChanges
300
- };
301
- log.debug2('didChangeDocumentParams', didChangeDocumentParams);
302
- session.changeDocument(didChangeDocumentParams);
303
- }
304
- });
305
- return dispose;
306
- }
307
- }, {
308
- key: "closeDocument",
309
- value: function closeDocument(editor, session) {
310
- var model = editor.getModel();
311
- var didCloseDocumentParams = {
312
- textDocument: {
313
- uri: "".concat(model.uri)
314
- }
315
- };
316
- session.closeDocument(didCloseDocumentParams);
317
- }
318
- /**
319
- * Register a paste handle to clean up any garbage code pasted.
320
- * Most of this comes from copying from Slack, which has a bad habit of injecting their own characters in your code snippets.
321
- * I've emailed Slack about the issue and they're working on it. I can't reference a ticket number because their ticket system is entirely internally facing.
322
- * @param {Monaco.editor} editor The editor the register the paste handler for
323
- */
273
+ end: {
274
+ line: range.endLineNumber - 1,
275
+ character: range.endColumn - 1
276
+ }
277
+ },
278
+ rangeLength,
279
+ text
280
+ };
281
+ contentChanges.push(contentChange);
282
+ }
324
283
 
325
- }, {
326
- key: "registerPasteHandler",
327
- value: function registerPasteHandler(editor) {
328
- editor.onDidPaste(function (pasteEvent) {
329
- var smartQuotes = /“|”/g;
330
- var invalidChars = /\u200b/g;
331
- var editorModel = editor.getModel();
332
- var pastedText = editorModel.getValueInRange(pasteEvent.range);
284
+ if (contentChanges.length > 0) {
285
+ var didChangeDocumentParams = {
286
+ textDocument: {
287
+ version: versionId,
288
+ uri: "".concat(model.uri)
289
+ },
290
+ contentChanges
291
+ };
292
+ log.debug2('didChangeDocumentParams', didChangeDocumentParams);
293
+ session.changeDocument(didChangeDocumentParams);
294
+ }
295
+ });
296
+ return dispose;
297
+ }
298
+
299
+ static closeDocument(editor, session) {
300
+ var model = editor.getModel();
301
+ var didCloseDocumentParams = {
302
+ textDocument: {
303
+ uri: "".concat(model.uri)
304
+ }
305
+ };
306
+ session.closeDocument(didCloseDocumentParams);
307
+ }
308
+ /**
309
+ * Register a paste handle to clean up any garbage code pasted.
310
+ * Most of this comes from copying from Slack, which has a bad habit of injecting their own characters in your code snippets.
311
+ * I've emailed Slack about the issue and they're working on it. I can't reference a ticket number because their ticket system is entirely internally facing.
312
+ * @param {Monaco.editor} editor The editor the register the paste handler for
313
+ */
333
314
 
334
- if (smartQuotes.test(pastedText) || invalidChars.test(pastedText)) {
335
- editorModel.applyEdits([{
336
- range: pasteEvent.range,
337
- text: pastedText.replace(smartQuotes, '"').replace(invalidChars, '')
338
- }]);
339
- }
340
- });
341
- }
342
- }, {
343
- key: "isMacPlatform",
344
- value: function isMacPlatform() {
345
- var platform = window.navigator.platform;
346
- return platform.startsWith('Mac');
347
- }
348
- /**
349
- * Remove any keybindings which are used for our own shortcuts.
350
- * This allows the key events to bubble up so a component higher up can capture them
351
- * @param {Monaco.editor} editor The editor to remove the keybindings from
352
- */
353
315
 
354
- }, {
355
- key: "removeConflictingKeybindings",
356
- value: function removeConflictingKeybindings(editor) {
357
- // Multi-mod key events have a specific order
358
- // E.g. ctrl+alt+UpArrow is not found, but alt+ctrl+UpArrow is found
359
- // meta is WindowsKey on Windows and cmd on Mac
360
- // ctrl is ctrl Windows and ctrl on Mac
361
- // alt is alt on Windows and option on Mac
362
- var keybindings = [{
363
- windows: 'ctrl+D',
364
- mac: 'meta+D'
365
- }, {
366
- windows: 'ctrl+H'
367
- }];
316
+ static registerPasteHandler(editor) {
317
+ editor.onDidPaste(pasteEvent => {
318
+ var smartQuotes = /“|”/g;
319
+ var invalidChars = /\u200b/g;
320
+ var editorModel = editor.getModel();
321
+ var pastedText = editorModel.getValueInRange(pasteEvent.range);
368
322
 
369
- try {
370
- keybindings.forEach(function (keybinding) {
371
- return MonacoUtils.removeKeybinding(editor, MonacoUtils.isMacPlatform() ? keybinding.mac : keybinding.windows);
372
- });
373
- } catch (err) {
374
- // This is probably only caused by Monaco changing private methods used here
375
- log.error(err);
323
+ if (smartQuotes.test(pastedText) || invalidChars.test(pastedText)) {
324
+ editorModel.applyEdits([{
325
+ range: pasteEvent.range,
326
+ text: pastedText.replace(smartQuotes, '"').replace(invalidChars, '')
327
+ }]);
376
328
  }
329
+ });
330
+ }
331
+
332
+ static isMacPlatform() {
333
+ var {
334
+ platform
335
+ } = window.navigator;
336
+ return platform.startsWith('Mac');
337
+ }
338
+ /**
339
+ * Remove any keybindings which are used for our own shortcuts.
340
+ * This allows the key events to bubble up so a component higher up can capture them
341
+ * @param {Monaco.editor} editor The editor to remove the keybindings from
342
+ */
343
+
344
+
345
+ static removeConflictingKeybindings(editor) {
346
+ // Multi-mod key events have a specific order
347
+ // E.g. ctrl+alt+UpArrow is not found, but alt+ctrl+UpArrow is found
348
+ // meta is WindowsKey on Windows and cmd on Mac
349
+ // ctrl is ctrl Windows and ctrl on Mac
350
+ // alt is alt on Windows and option on Mac
351
+ var keybindings = [{
352
+ windows: 'ctrl+D',
353
+ mac: 'meta+D'
354
+ }, {
355
+ windows: 'ctrl+H'
356
+ }];
357
+
358
+ try {
359
+ keybindings.forEach(keybinding => MonacoUtils.removeKeybinding(editor, MonacoUtils.isMacPlatform() ? keybinding.mac : keybinding.windows));
360
+ } catch (err) {
361
+ // This is probably only caused by Monaco changing private methods used here
362
+ log.error(err);
377
363
  }
378
- /**
379
- * Remove a keybinding and allow the events to bubble up
380
- * If you want the keybinding removed for all editors, add it to removeConflictingKeybindings
381
- * Monaco still captures the event if you choose to override the keybinding with a no-op function
382
- *
383
- * Based on the following comment to remove a keybinding and let the event bubble up
384
- * https://github.com/microsoft/monaco-editor/issues/287#issuecomment-331447475
385
- * The issue for an API for this has apparently been open since 2016. Link below
386
- * https://github.com/microsoft/monaco-editor/issues/102
387
- * @param {Monaco.editor} editor The editor to remove the keybinding from
388
- * @param {string} keybinding The key string to remove. E.g. 'ctrl+C' for copy on Windows
389
- */
364
+ }
365
+ /**
366
+ * Remove a keybinding and allow the events to bubble up
367
+ * If you want the keybinding removed for all editors, add it to removeConflictingKeybindings
368
+ * Monaco still captures the event if you choose to override the keybinding with a no-op function
369
+ *
370
+ * Based on the following comment to remove a keybinding and let the event bubble up
371
+ * https://github.com/microsoft/monaco-editor/issues/287#issuecomment-331447475
372
+ * The issue for an API for this has apparently been open since 2016. Link below
373
+ * https://github.com/microsoft/monaco-editor/issues/102
374
+ * @param {Monaco.editor} editor The editor to remove the keybinding from
375
+ * @param {string} keybinding The key string to remove. E.g. 'ctrl+C' for copy on Windows
376
+ */
390
377
 
391
- }, {
392
- key: "removeKeybinding",
393
- value: function removeKeybinding(editor, keybinding) {
394
- if (!keybinding) {
395
- return;
396
- }
397
- /* eslint-disable no-underscore-dangle */
398
- // It's possible a single keybinding has multiple commands depending on context
399
378
 
379
+ static removeKeybinding(editor, keybinding) {
380
+ if (!keybinding) {
381
+ return;
382
+ }
383
+ /* eslint-disable no-underscore-dangle */
384
+ // It's possible a single keybinding has multiple commands depending on context
400
385
 
401
- var keybindings = editor._standaloneKeybindingService._getResolver()._map.get(keybinding);
402
386
 
403
- if (keybindings) {
404
- keybindings.forEach(function (elem) {
405
- log.debug2("Removing Monaco keybinding ".concat(keybinding, " for ").concat(elem.command));
387
+ var keybindings = editor._standaloneKeybindingService._getResolver()._map.get(keybinding);
406
388
 
407
- editor._standaloneKeybindingService.addDynamicKeybinding("-".concat(elem.command), null, function () {});
408
- });
409
- } else {
410
- log.warn("Did not find any keybindings to remove for ".concat(keybinding));
411
- }
412
- /* eslint-enable no-underscore-dangle */
389
+ if (keybindings) {
390
+ keybindings.forEach(elem => {
391
+ log.debug2("Removing Monaco keybinding ".concat(keybinding, " for ").concat(elem.command));
413
392
 
393
+ editor._standaloneKeybindingService.addDynamicKeybinding("-".concat(elem.command), null, () => {});
394
+ });
395
+ } else {
396
+ log.warn("Did not find any keybindings to remove for ".concat(keybinding));
414
397
  }
415
- }]);
398
+ /* eslint-enable no-underscore-dangle */
399
+
400
+ }
416
401
 
417
- return MonacoUtils;
418
- }();
402
+ }
419
403
 
420
404
  export default MonacoUtils;
421
405
  //# sourceMappingURL=MonacoUtils.js.map