@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.
- package/dist/Console.d.ts +3 -0
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +807 -871
- package/dist/Console.js.map +1 -1
- package/dist/ConsoleInput.d.ts +1 -38
- package/dist/ConsoleInput.d.ts.map +1 -1
- package/dist/ConsoleInput.js +331 -436
- package/dist/ConsoleInput.js.map +1 -1
- package/dist/ConsoleMenu.js +159 -215
- package/dist/ConsoleMenu.js.map +1 -1
- package/dist/ConsolePropTypes.js +1 -1
- package/dist/ConsolePropTypes.js.map +1 -1
- package/dist/ConsoleShortcuts.js +2 -2
- package/dist/ConsoleShortcuts.js.map +1 -1
- package/dist/ConsoleStatusBar.js +85 -125
- package/dist/ConsoleStatusBar.js.map +1 -1
- package/dist/StoragePropTypes.js +2 -2
- package/dist/StoragePropTypes.js.map +1 -1
- package/dist/command-history/CommandHistory.css +5 -2
- package/dist/command-history/CommandHistory.css.map +1 -1
- package/dist/command-history/CommandHistory.d.ts +5 -0
- package/dist/command-history/CommandHistory.d.ts.map +1 -1
- package/dist/command-history/CommandHistory.js +303 -391
- package/dist/command-history/CommandHistory.js.map +1 -1
- package/dist/command-history/CommandHistoryActions.css +4 -0
- package/dist/command-history/CommandHistoryActions.css.map +1 -1
- package/dist/command-history/CommandHistoryActions.d.ts.map +1 -1
- package/dist/command-history/CommandHistoryActions.js +40 -79
- package/dist/command-history/CommandHistoryActions.js.map +1 -1
- package/dist/command-history/CommandHistoryItem.css +1 -1
- package/dist/command-history/CommandHistoryItem.d.ts +5 -0
- package/dist/command-history/CommandHistoryItem.d.ts.map +1 -1
- package/dist/command-history/CommandHistoryItem.js +15 -9
- package/dist/command-history/CommandHistoryItem.js.map +1 -1
- package/dist/command-history/CommandHistoryItemTooltip.d.ts +1 -40
- package/dist/command-history/CommandHistoryItemTooltip.d.ts.map +1 -1
- package/dist/command-history/CommandHistoryItemTooltip.js +139 -189
- package/dist/command-history/CommandHistoryItemTooltip.js.map +1 -1
- package/dist/command-history/CommandHistoryViewportUpdater.js +30 -35
- package/dist/command-history/CommandHistoryViewportUpdater.js.map +1 -1
- package/dist/command-history/index.js +5 -5
- package/dist/command-history/index.js.map +1 -1
- package/dist/common/Code.js +34 -70
- package/dist/common/Code.js.map +1 -1
- package/dist/common/ConsoleConstants.js +3 -24
- package/dist/common/ConsoleConstants.js.map +1 -1
- package/dist/common/ConsoleUtils.d.ts +1 -3
- package/dist/common/ConsoleUtils.d.ts.map +1 -1
- package/dist/common/ConsoleUtils.js +60 -94
- package/dist/common/ConsoleUtils.js.map +1 -1
- package/dist/common/ObjectIcon.js +4 -2
- package/dist/common/ObjectIcon.js.map +1 -1
- package/dist/common/index.d.js +1 -34
- package/dist/common/index.d.js.map +1 -1
- package/dist/common/index.js +4 -4
- package/dist/common/index.js.map +1 -1
- package/dist/console-history/ConsoleHistory.js +27 -63
- package/dist/console-history/ConsoleHistory.js.map +1 -1
- package/dist/console-history/ConsoleHistoryItem.js +116 -154
- package/dist/console-history/ConsoleHistoryItem.js.map +1 -1
- package/dist/console-history/ConsoleHistoryItemResult.js +4 -2
- package/dist/console-history/ConsoleHistoryItemResult.js.map +1 -1
- package/dist/console-history/ConsoleHistoryResultErrorMessage.js +94 -132
- package/dist/console-history/ConsoleHistoryResultErrorMessage.js.map +1 -1
- package/dist/console-history/ConsoleHistoryResultInProgress.js +42 -76
- package/dist/console-history/ConsoleHistoryResultInProgress.js.map +1 -1
- package/dist/console-history/index.js +5 -5
- package/dist/console-history/index.js.map +1 -1
- package/dist/csv/CsvFormats.js +14 -28
- package/dist/csv/CsvFormats.js.map +1 -1
- package/dist/csv/CsvInputBar.css +25 -23
- package/dist/csv/CsvInputBar.css.map +1 -1
- package/dist/csv/CsvInputBar.d.ts +2 -45
- package/dist/csv/CsvInputBar.d.ts.map +1 -1
- package/dist/csv/CsvInputBar.js +298 -372
- package/dist/csv/CsvInputBar.js.map +1 -1
- package/dist/csv/CsvOverlay.js +197 -243
- package/dist/csv/CsvOverlay.js.map +1 -1
- package/dist/csv/CsvParser.js +186 -209
- package/dist/csv/CsvParser.js.map +1 -1
- package/dist/csv/CsvTypeParser.js +185 -210
- package/dist/csv/CsvTypeParser.js.map +1 -1
- package/dist/csv/NewTableColumnTypes.js +1 -5
- package/dist/csv/NewTableColumnTypes.js.map +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/log/LogLevelMenuItem.js +24 -58
- package/dist/log/LogLevelMenuItem.js.map +1 -1
- package/dist/log/LogView.js +429 -484
- package/dist/log/LogView.js.map +1 -1
- package/dist/monaco/MonacoCompletionProvider.js +92 -124
- package/dist/monaco/MonacoCompletionProvider.js.map +1 -1
- package/dist/monaco/MonacoUtils.js +315 -331
- package/dist/monaco/MonacoUtils.js.map +1 -1
- package/dist/monaco/index.js +2 -2
- package/dist/monaco/index.js.map +1 -1
- package/dist/monaco/lang/db.js +3 -3
- package/dist/monaco/lang/db.js.map +1 -1
- package/dist/monaco/lang/groovy.js +3 -3
- package/dist/monaco/lang/groovy.js.map +1 -1
- package/dist/monaco/lang/log.js +3 -3
- package/dist/monaco/lang/log.js.map +1 -1
- package/dist/monaco/lang/python.js +3 -3
- package/dist/monaco/lang/python.js.map +1 -1
- package/dist/monaco/lang/scala.js +5 -5
- package/dist/monaco/lang/scala.js.map +1 -1
- package/dist/notebook/Editor.js +101 -141
- package/dist/notebook/Editor.js.map +1 -1
- package/dist/notebook/ScriptEditor.js +261 -301
- package/dist/notebook/ScriptEditor.js.map +1 -1
- package/dist/notebook/ScriptEditorUtils.js +26 -42
- package/dist/notebook/ScriptEditorUtils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -56
package/dist/ConsoleInput.js
CHANGED
|
@@ -1,54 +1,18 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
-
|
|
3
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
-
|
|
5
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
-
|
|
9
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
10
|
-
|
|
11
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
-
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
-
|
|
15
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
2
|
|
|
17
3
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
18
4
|
|
|
19
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
|
-
|
|
21
|
-
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); } }
|
|
22
|
-
|
|
23
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
24
|
-
|
|
25
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
26
|
-
|
|
27
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
|
-
|
|
29
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
30
|
-
|
|
31
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
32
|
-
|
|
33
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
34
|
-
|
|
35
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
36
|
-
|
|
37
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
38
|
-
|
|
39
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
40
6
|
|
|
41
7
|
import React, { PureComponent } from 'react';
|
|
42
8
|
import PropTypes from 'prop-types';
|
|
43
9
|
import classNames from 'classnames';
|
|
44
|
-
import { connect } from 'react-redux';
|
|
45
10
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
46
11
|
import Log from '@deephaven/log';
|
|
47
12
|
import { PromiseUtils } from '@deephaven/utils';
|
|
48
|
-
import {
|
|
49
|
-
import { MonacoCompletionProvider, MonacoTheme, MonacoUtils } from './monaco';
|
|
13
|
+
import { MonacoCompletionProvider, MonacoTheme, MonacoUtils } from "./monaco/index.js";
|
|
50
14
|
import "./ConsoleInput.css";
|
|
51
|
-
import StoragePropTypes from
|
|
15
|
+
import StoragePropTypes from "./StoragePropTypes.js";
|
|
52
16
|
var log = Log.module('ConsoleInput');
|
|
53
17
|
var LINE_HEIGHT = parseInt(MonacoTheme['line-height'], 10);
|
|
54
18
|
var TOP_PADDING = 6;
|
|
@@ -59,437 +23,377 @@ var BUFFER_SIZE = 100;
|
|
|
59
23
|
* Component for input in a console session. Handles loading the recent command history
|
|
60
24
|
*/
|
|
61
25
|
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
_this.commandHistoryIndex = null;
|
|
78
|
-
_this.commandSuggestionContainer = null;
|
|
79
|
-
_this.isCommandModified = false;
|
|
80
|
-
_this.loadingPromise = null;
|
|
81
|
-
_this.timestamp = Date.now();
|
|
82
|
-
_this.bufferIndex = 0;
|
|
83
|
-
_this.history = [];
|
|
84
|
-
_this.state = {
|
|
26
|
+
export class ConsoleInput extends PureComponent {
|
|
27
|
+
constructor(props) {
|
|
28
|
+
super(props);
|
|
29
|
+
this.handleWindowResize = this.handleWindowResize.bind(this);
|
|
30
|
+
this.cancelListener = null;
|
|
31
|
+
this.commandContainer = /*#__PURE__*/React.createRef();
|
|
32
|
+
this.commandEditor = null;
|
|
33
|
+
this.commandHistoryIndex = null;
|
|
34
|
+
this.commandSuggestionContainer = null;
|
|
35
|
+
this.isCommandModified = false;
|
|
36
|
+
this.loadingPromise = null;
|
|
37
|
+
this.timestamp = Date.now();
|
|
38
|
+
this.bufferIndex = 0;
|
|
39
|
+
this.history = [];
|
|
40
|
+
this.state = {
|
|
85
41
|
commandEditorHeight: LINE_HEIGHT,
|
|
86
42
|
isFocused: false,
|
|
87
43
|
model: null
|
|
88
44
|
};
|
|
89
|
-
return _this;
|
|
90
45
|
}
|
|
91
46
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
47
|
+
componentDidMount() {
|
|
48
|
+
this.initCommandEditor();
|
|
49
|
+
window.addEventListener('resize', this.handleWindowResize);
|
|
50
|
+
this.loadMoreHistory();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
componentDidUpdate() {
|
|
54
|
+
this.layoutEditor();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
componentWillUnmount() {
|
|
58
|
+
window.removeEventListener('resize', this.handleWindowResize);
|
|
59
|
+
|
|
60
|
+
if (this.loadingPromise != null) {
|
|
61
|
+
this.loadingPromise.cancel();
|
|
103
62
|
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "componentWillUnmount",
|
|
106
|
-
value: function componentWillUnmount() {
|
|
107
|
-
window.removeEventListener('resize', this.handleWindowResize);
|
|
108
63
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
64
|
+
this.destroyCommandEditor();
|
|
65
|
+
}
|
|
112
66
|
|
|
113
|
-
|
|
67
|
+
setConsoleText(text) {
|
|
68
|
+
var focus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
69
|
+
var execute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
70
|
+
|
|
71
|
+
if (!text) {
|
|
72
|
+
return;
|
|
114
73
|
}
|
|
115
|
-
}, {
|
|
116
|
-
key: "setConsoleText",
|
|
117
|
-
value: function setConsoleText(text) {
|
|
118
|
-
var focus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
119
|
-
var execute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
120
|
-
|
|
121
|
-
if (!text) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
74
|
|
|
125
|
-
|
|
126
|
-
|
|
75
|
+
log.debug('Command received: ', text);
|
|
76
|
+
this.commandEditor.setValue(text);
|
|
127
77
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
78
|
+
if (focus) {
|
|
79
|
+
this.focusEnd();
|
|
80
|
+
}
|
|
131
81
|
|
|
132
|
-
|
|
82
|
+
this.updateDimensions();
|
|
133
83
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
84
|
+
if (execute) {
|
|
85
|
+
this.processCommand();
|
|
137
86
|
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
_this2.setState({
|
|
185
|
-
isFocused: true
|
|
186
|
-
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
initCommandEditor() {
|
|
90
|
+
var {
|
|
91
|
+
language,
|
|
92
|
+
session
|
|
93
|
+
} = this.props;
|
|
94
|
+
var commandSettings = {
|
|
95
|
+
copyWithSyntaxHighlighting: 'false',
|
|
96
|
+
cursorStyle: 'block',
|
|
97
|
+
fixedOverflowWidgets: true,
|
|
98
|
+
folding: false,
|
|
99
|
+
fontFamily: 'Fira Mono',
|
|
100
|
+
glyphMargin: false,
|
|
101
|
+
language,
|
|
102
|
+
lineHeight: LINE_HEIGHT,
|
|
103
|
+
lineDecorationsWidth: 3,
|
|
104
|
+
lineNumbers: 'off',
|
|
105
|
+
minimap: {
|
|
106
|
+
enabled: false
|
|
107
|
+
},
|
|
108
|
+
renderLineHighlight: 'none',
|
|
109
|
+
scrollBeyondLastLine: false,
|
|
110
|
+
scrollbar: {
|
|
111
|
+
arrowSize: 0,
|
|
112
|
+
horizontal: 'hidden',
|
|
113
|
+
horizontalScrollbarSize: 0
|
|
114
|
+
},
|
|
115
|
+
padding: {
|
|
116
|
+
top: TOP_PADDING,
|
|
117
|
+
bottom: BOTTOM_PADDING
|
|
118
|
+
},
|
|
119
|
+
tabCompletion: 'on',
|
|
120
|
+
value: '',
|
|
121
|
+
wordWrap: 'on'
|
|
122
|
+
};
|
|
123
|
+
this.commandEditor = monaco.editor.create(this.commandContainer.current, commandSettings);
|
|
124
|
+
MonacoUtils.setEOL(this.commandEditor);
|
|
125
|
+
MonacoUtils.openDocument(this.commandEditor, session);
|
|
126
|
+
this.commandEditor.onDidChangeModelContent(() => {
|
|
127
|
+
this.isCommandModified = true;
|
|
128
|
+
this.updateDimensions();
|
|
129
|
+
});
|
|
130
|
+
this.commandEditor.onDidFocusEditorText(() => {
|
|
131
|
+
this.setState({
|
|
132
|
+
isFocused: true
|
|
187
133
|
});
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
134
|
+
});
|
|
135
|
+
this.commandEditor.onDidBlurEditorText(() => {
|
|
136
|
+
this.setState({
|
|
137
|
+
isFocused: false
|
|
192
138
|
});
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
keyEvent.preventDefault();
|
|
212
|
-
return;
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Register for keydown events to capture the `Enter` key.
|
|
142
|
+
* Need to do it this way instead of using `addCommand`, because that would eat the Enter key in all situations, which is not what we want.
|
|
143
|
+
* Can't do it in `onDidChangeModelContent` either, since we want to stop the Enter action from modifying the command.
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
this.commandEditor.onKeyDown(keyEvent => {
|
|
147
|
+
if (!this.isCommandModified || this.commandEditor.getModel().getValueLength() === 0) {
|
|
148
|
+
if (keyEvent.keyCode === monaco.KeyCode.UpArrow) {
|
|
149
|
+
var {
|
|
150
|
+
commandHistoryIndex
|
|
151
|
+
} = this;
|
|
152
|
+
|
|
153
|
+
if (commandHistoryIndex != null) {
|
|
154
|
+
this.loadCommand(commandHistoryIndex + 1);
|
|
155
|
+
} else {
|
|
156
|
+
this.loadCommand(0);
|
|
213
157
|
}
|
|
214
158
|
|
|
215
|
-
|
|
216
|
-
|
|
159
|
+
keyEvent.stopPropagation();
|
|
160
|
+
keyEvent.preventDefault();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (keyEvent.keyCode === monaco.KeyCode.DownArrow) {
|
|
165
|
+
var {
|
|
166
|
+
commandHistoryIndex: _commandHistoryIndex
|
|
167
|
+
} = this;
|
|
168
|
+
|
|
169
|
+
if (_commandHistoryIndex != null && _commandHistoryIndex >= 0) {
|
|
170
|
+
this.loadCommand(_commandHistoryIndex - 1);
|
|
171
|
+
} else {
|
|
172
|
+
this.commandHistoryIndex = null;
|
|
173
|
+
}
|
|
217
174
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
175
|
+
keyEvent.stopPropagation();
|
|
176
|
+
keyEvent.preventDefault();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
223
180
|
|
|
181
|
+
if (!keyEvent.altKey && !keyEvent.shiftKey && !keyEvent.metaKey) {
|
|
182
|
+
if (keyEvent.keyCode === monaco.KeyCode.Enter) {
|
|
183
|
+
if (!this.isSuggestionMenuPopulated()) {
|
|
224
184
|
keyEvent.stopPropagation();
|
|
225
185
|
keyEvent.preventDefault();
|
|
226
|
-
|
|
186
|
+
this.processCommand();
|
|
227
187
|
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
_this2.processCommand();
|
|
237
|
-
}
|
|
238
|
-
} else if (keyEvent.keyCode === monaco.KeyCode.Tab) {
|
|
239
|
-
if (!_this2.isSuggestionMenuActive()) {
|
|
240
|
-
keyEvent.stopPropagation();
|
|
241
|
-
keyEvent.preventDefault();
|
|
242
|
-
|
|
243
|
-
_this2.commandEditor.trigger('Tab key trigger suggestions', 'editor.action.triggerSuggest', {});
|
|
244
|
-
} else if (!_this2.isSuggestionMenuPopulated()) {
|
|
245
|
-
keyEvent.stopPropagation();
|
|
246
|
-
keyEvent.preventDefault();
|
|
247
|
-
}
|
|
188
|
+
} else if (keyEvent.keyCode === monaco.KeyCode.Tab) {
|
|
189
|
+
if (!this.isSuggestionMenuActive()) {
|
|
190
|
+
keyEvent.stopPropagation();
|
|
191
|
+
keyEvent.preventDefault();
|
|
192
|
+
this.commandEditor.trigger('Tab key trigger suggestions', 'editor.action.triggerSuggest', {});
|
|
193
|
+
} else if (!this.isSuggestionMenuPopulated()) {
|
|
194
|
+
keyEvent.stopPropagation();
|
|
195
|
+
keyEvent.preventDefault();
|
|
248
196
|
}
|
|
249
197
|
}
|
|
250
|
-
}); // Override the Ctrl+F functionality so that the find window doesn't appear
|
|
251
|
-
|
|
252
|
-
this.commandEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_F, // eslint-disable-line no-bitwise
|
|
253
|
-
function () {});
|
|
254
|
-
MonacoUtils.removeConflictingKeybindings(this.commandEditor);
|
|
255
|
-
MonacoUtils.registerPasteHandler(this.commandEditor);
|
|
256
|
-
this.commandEditor.focus();
|
|
257
|
-
this.updateDimensions();
|
|
258
|
-
this.setState({
|
|
259
|
-
model: this.commandEditor.getModel()
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
}, {
|
|
263
|
-
key: "destroyCommandEditor",
|
|
264
|
-
value: function destroyCommandEditor() {
|
|
265
|
-
var session = this.props.session;
|
|
266
|
-
|
|
267
|
-
if (this.commandEditor) {
|
|
268
|
-
MonacoUtils.closeDocument(this.commandEditor, session);
|
|
269
|
-
this.commandEditor.dispose();
|
|
270
|
-
this.commandEditor = null;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
key: "handleWindowResize",
|
|
275
|
-
value: function handleWindowResize() {
|
|
276
|
-
this.updateDimensions();
|
|
277
|
-
}
|
|
278
|
-
}, {
|
|
279
|
-
key: "isSuggestionMenuActive",
|
|
280
|
-
value: function isSuggestionMenuActive() {
|
|
281
|
-
if (!this.commandSuggestionContainer) {
|
|
282
|
-
this.commandSuggestionContainer = this.commandEditor.getDomNode().querySelector('.suggest-widget');
|
|
283
198
|
}
|
|
199
|
+
}); // Override the Ctrl+F functionality so that the find window doesn't appear
|
|
200
|
+
|
|
201
|
+
this.commandEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_F, // eslint-disable-line no-bitwise
|
|
202
|
+
() => {});
|
|
203
|
+
MonacoUtils.removeConflictingKeybindings(this.commandEditor);
|
|
204
|
+
MonacoUtils.registerPasteHandler(this.commandEditor);
|
|
205
|
+
this.commandEditor.focus();
|
|
206
|
+
this.updateDimensions();
|
|
207
|
+
this.setState({
|
|
208
|
+
model: this.commandEditor.getModel()
|
|
209
|
+
});
|
|
210
|
+
}
|
|
284
211
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
212
|
+
destroyCommandEditor() {
|
|
213
|
+
var {
|
|
214
|
+
session
|
|
215
|
+
} = this.props;
|
|
216
|
+
|
|
217
|
+
if (this.commandEditor) {
|
|
218
|
+
MonacoUtils.closeDocument(this.commandEditor, session);
|
|
219
|
+
this.commandEditor.dispose();
|
|
220
|
+
this.commandEditor = null;
|
|
291
221
|
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
handleWindowResize() {
|
|
225
|
+
this.updateDimensions();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
isSuggestionMenuActive() {
|
|
229
|
+
if (!this.commandSuggestionContainer) {
|
|
230
|
+
this.commandSuggestionContainer = this.commandEditor.getDomNode().querySelector('.suggest-widget');
|
|
296
231
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
232
|
+
|
|
233
|
+
return this.commandSuggestionContainer && this.commandSuggestionContainer.classList.contains('visible');
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
isSuggestionMenuPopulated() {
|
|
237
|
+
return this.isSuggestionMenuActive() && this.commandSuggestionContainer.querySelector('.monaco-list-rows').childElementCount > 0;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
focus() {
|
|
241
|
+
this.commandEditor.focus();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
focusEnd() {
|
|
245
|
+
var model = this.commandEditor.getModel();
|
|
246
|
+
var lastLine = model.getLineCount();
|
|
247
|
+
var column = model.getLineLength(lastLine) + 1;
|
|
248
|
+
var lastCharTop = this.commandEditor.getTopForPosition(lastLine, column);
|
|
249
|
+
this.commandEditor.setPosition({
|
|
250
|
+
lineNumber: lastLine,
|
|
251
|
+
column
|
|
252
|
+
});
|
|
253
|
+
this.commandEditor.setScrollTop(lastCharTop);
|
|
254
|
+
this.commandEditor.focus();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
clear() {
|
|
258
|
+
this.commandEditor.focus();
|
|
259
|
+
this.commandEditor.getModel().setValue('');
|
|
260
|
+
this.commandHistoryIndex = null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
layoutEditor() {
|
|
264
|
+
if (this.commandEditor) {
|
|
265
|
+
this.commandEditor.layout();
|
|
310
266
|
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
this.commandEditor.getModel().setValue('');
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
loadCommand(index) {
|
|
270
|
+
if (index < 0) {
|
|
316
271
|
this.commandHistoryIndex = null;
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
272
|
+
this.commandEditor.getModel().setValue('');
|
|
273
|
+
} else if (index < this.history.length) {
|
|
274
|
+
this.commandHistoryIndex = index;
|
|
275
|
+
this.commandEditor.getModel().setValue(this.history[this.history.length - index - 1]);
|
|
276
|
+
|
|
277
|
+
if (index > this.history.length - BUFFER_SIZE) {
|
|
278
|
+
this.loadMoreHistory();
|
|
323
279
|
}
|
|
324
280
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
|
|
281
|
+
|
|
282
|
+
this.isCommandModified = false;
|
|
283
|
+
this.focusEnd();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
loadMoreHistory() {
|
|
287
|
+
var _this = this;
|
|
288
|
+
|
|
289
|
+
return _asyncToGenerator(function* () {
|
|
290
|
+
try {
|
|
291
|
+
if (_this.loadingPromise != null || _this.bufferIndex == null) {
|
|
292
|
+
return;
|
|
337
293
|
}
|
|
338
|
-
}
|
|
339
294
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (!(this.loadingPromise != null || this.bufferIndex == null)) {
|
|
356
|
-
_context.next = 3;
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return _context.abrupt("return");
|
|
361
|
-
|
|
362
|
-
case 3:
|
|
363
|
-
_this$props2 = this.props, commandHistoryStorage = _this$props2.commandHistoryStorage, language = _this$props2.language, scope = _this$props2.scope;
|
|
364
|
-
this.loadingPromise = PromiseUtils.makeCancelable(commandHistoryStorage.getTable(language, scope, this.timestamp), function (resolved) {
|
|
365
|
-
return resolved.close();
|
|
366
|
-
});
|
|
367
|
-
_context.next = 7;
|
|
368
|
-
return this.loadingPromise;
|
|
369
|
-
|
|
370
|
-
case 7:
|
|
371
|
-
table = _context.sent;
|
|
372
|
-
table.setReversed(true);
|
|
373
|
-
table.setViewport({
|
|
374
|
-
top: this.bufferIndex,
|
|
375
|
-
bottom: this.bufferIndex + BUFFER_SIZE - 1
|
|
376
|
-
});
|
|
377
|
-
this.loadingPromise = PromiseUtils.makeCancelable(table.getViewportData(), function () {
|
|
378
|
-
return table.close();
|
|
379
|
-
});
|
|
380
|
-
_context.next = 13;
|
|
381
|
-
return this.loadingPromise;
|
|
382
|
-
|
|
383
|
-
case 13:
|
|
384
|
-
viewportData = _context.sent;
|
|
385
|
-
this.bufferIndex += BUFFER_SIZE;
|
|
386
|
-
|
|
387
|
-
if (this.bufferIndex >= table.size) {
|
|
388
|
-
// We've loaded the full history, no need to load any more
|
|
389
|
-
this.bufferIndex = null;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
this.history = [].concat(_toConsumableArray(viewportData.items.map(function (_ref) {
|
|
393
|
-
var name = _ref.name;
|
|
394
|
-
return name;
|
|
395
|
-
}).reverse()), _toConsumableArray(this.history));
|
|
396
|
-
this.loadingPromise = null;
|
|
397
|
-
table.close();
|
|
398
|
-
_context.next = 28;
|
|
399
|
-
break;
|
|
400
|
-
|
|
401
|
-
case 21:
|
|
402
|
-
_context.prev = 21;
|
|
403
|
-
_context.t0 = _context["catch"](0);
|
|
404
|
-
this.loadingPromise = null;
|
|
405
|
-
|
|
406
|
-
if (!PromiseUtils.isCanceled(_context.t0)) {
|
|
407
|
-
_context.next = 27;
|
|
408
|
-
break;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
log.debug2('Promise canceled, not loading history');
|
|
412
|
-
return _context.abrupt("return");
|
|
413
|
-
|
|
414
|
-
case 27:
|
|
415
|
-
log.error('Error fetching history', _context.t0);
|
|
416
|
-
|
|
417
|
-
case 28:
|
|
418
|
-
case "end":
|
|
419
|
-
return _context.stop();
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}, _callee, this, [[0, 21]]);
|
|
423
|
-
}));
|
|
295
|
+
var {
|
|
296
|
+
commandHistoryStorage,
|
|
297
|
+
language,
|
|
298
|
+
scope
|
|
299
|
+
} = _this.props;
|
|
300
|
+
_this.loadingPromise = PromiseUtils.makeCancelable(commandHistoryStorage.getTable(language, scope, _this.timestamp), resolved => resolved.close());
|
|
301
|
+
var table = yield _this.loadingPromise;
|
|
302
|
+
table.setReversed(true);
|
|
303
|
+
table.setViewport({
|
|
304
|
+
top: _this.bufferIndex,
|
|
305
|
+
bottom: _this.bufferIndex + BUFFER_SIZE - 1
|
|
306
|
+
});
|
|
307
|
+
_this.loadingPromise = PromiseUtils.makeCancelable(table.getViewportData(), () => table.close());
|
|
308
|
+
var viewportData = yield _this.loadingPromise;
|
|
309
|
+
_this.bufferIndex += BUFFER_SIZE;
|
|
424
310
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
311
|
+
if (_this.bufferIndex >= table.size) {
|
|
312
|
+
// We've loaded the full history, no need to load any more
|
|
313
|
+
_this.bufferIndex = null;
|
|
314
|
+
}
|
|
428
315
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
key: "updateDimensions",
|
|
445
|
-
value: function updateDimensions() {
|
|
446
|
-
var _this3 = this;
|
|
316
|
+
_this.history = [...viewportData.items.map((_ref) => {
|
|
317
|
+
var {
|
|
318
|
+
name
|
|
319
|
+
} = _ref;
|
|
320
|
+
return name;
|
|
321
|
+
}).reverse(), ..._this.history];
|
|
322
|
+
_this.loadingPromise = null;
|
|
323
|
+
table.close();
|
|
324
|
+
} catch (err) {
|
|
325
|
+
_this.loadingPromise = null;
|
|
326
|
+
|
|
327
|
+
if (PromiseUtils.isCanceled(err)) {
|
|
328
|
+
log.debug2('Promise canceled, not loading history');
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
447
331
|
|
|
448
|
-
|
|
449
|
-
return;
|
|
332
|
+
log.error('Error fetching history', err);
|
|
450
333
|
}
|
|
334
|
+
})();
|
|
335
|
+
}
|
|
451
336
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
commandEditorHeight = _this$state.commandEditorHeight,
|
|
469
|
-
isFocused = _this$state.isFocused,
|
|
470
|
-
model = _this$state.model;
|
|
471
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
472
|
-
className: "console-input-wrapper"
|
|
473
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
474
|
-
className: classNames('console-input-inner-wrapper', {
|
|
475
|
-
focus: isFocused
|
|
476
|
-
})
|
|
477
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
478
|
-
className: ConsoleInput.INPUT_CLASS_NAME,
|
|
479
|
-
ref: this.commandContainer,
|
|
480
|
-
style: {
|
|
481
|
-
height: commandEditorHeight
|
|
482
|
-
}
|
|
483
|
-
}), model && /*#__PURE__*/React.createElement(MonacoCompletionProvider, {
|
|
484
|
-
model: model,
|
|
485
|
-
language: language,
|
|
486
|
-
session: session
|
|
487
|
-
})));
|
|
337
|
+
processCommand() {
|
|
338
|
+
this.isCommandModified = false;
|
|
339
|
+
this.commandHistoryIndex = null;
|
|
340
|
+
var command = this.commandEditor.getValue().trim();
|
|
341
|
+
this.history.push(command);
|
|
342
|
+
this.commandEditor.setValue('');
|
|
343
|
+
this.updateDimensions();
|
|
344
|
+
var {
|
|
345
|
+
onSubmit
|
|
346
|
+
} = this.props;
|
|
347
|
+
onSubmit(command);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
updateDimensions() {
|
|
351
|
+
if (!this.commandEditor) {
|
|
352
|
+
return;
|
|
488
353
|
}
|
|
489
|
-
}]);
|
|
490
354
|
|
|
491
|
-
|
|
492
|
-
|
|
355
|
+
var {
|
|
356
|
+
maxHeight
|
|
357
|
+
} = this.props;
|
|
358
|
+
var contentHeight = this.commandEditor.getContentHeight();
|
|
359
|
+
var commandEditorHeight = Math.max(Math.min(contentHeight, maxHeight), MIN_INPUT_HEIGHT);
|
|
360
|
+
this.setState({
|
|
361
|
+
commandEditorHeight
|
|
362
|
+
}, () => {
|
|
363
|
+
this.commandEditor.layout();
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
render() {
|
|
368
|
+
var {
|
|
369
|
+
language,
|
|
370
|
+
session
|
|
371
|
+
} = this.props;
|
|
372
|
+
var {
|
|
373
|
+
commandEditorHeight,
|
|
374
|
+
isFocused,
|
|
375
|
+
model
|
|
376
|
+
} = this.state;
|
|
377
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
378
|
+
className: "console-input-wrapper"
|
|
379
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
380
|
+
className: classNames('console-input-inner-wrapper', {
|
|
381
|
+
focus: isFocused
|
|
382
|
+
})
|
|
383
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
384
|
+
className: ConsoleInput.INPUT_CLASS_NAME,
|
|
385
|
+
ref: this.commandContainer,
|
|
386
|
+
style: {
|
|
387
|
+
height: commandEditorHeight
|
|
388
|
+
}
|
|
389
|
+
}), model && /*#__PURE__*/React.createElement(MonacoCompletionProvider, {
|
|
390
|
+
model: model,
|
|
391
|
+
language: language,
|
|
392
|
+
session: session
|
|
393
|
+
})));
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
}
|
|
493
397
|
|
|
494
398
|
_defineProperty(ConsoleInput, "INPUT_CLASS_NAME", 'console-input');
|
|
495
399
|
|
|
@@ -505,14 +409,5 @@ ConsoleInput.defaultProps = {
|
|
|
505
409
|
maxHeight: LINE_HEIGHT * 10,
|
|
506
410
|
scope: null
|
|
507
411
|
};
|
|
508
|
-
|
|
509
|
-
var mapStateToProps = function mapStateToProps(state) {
|
|
510
|
-
return {
|
|
511
|
-
commandHistoryStorage: getCommandHistoryStorage(state)
|
|
512
|
-
};
|
|
513
|
-
};
|
|
514
|
-
|
|
515
|
-
export default connect(mapStateToProps, null, null, {
|
|
516
|
-
forwardRef: true
|
|
517
|
-
})(ConsoleInput);
|
|
412
|
+
export default ConsoleInput;
|
|
518
413
|
//# sourceMappingURL=ConsoleInput.js.map
|