@elyra/canvas 12.41.0 → 12.43.0
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/{_baseIteratee-05ccf6a8.js → _baseIteratee-148093b7.js} +3 -3
- package/dist/{_baseIteratee-05ccf6a8.js.map → _baseIteratee-148093b7.js.map} +1 -1
- package/dist/{canvas-constants-079172c0.js → canvas-constants-acb99f64.js} +2 -2
- package/dist/{canvas-constants-079172c0.js.map → canvas-constants-acb99f64.js.map} +1 -1
- package/dist/canvas-controller-6726b9ac.js +2 -0
- package/dist/canvas-controller-6726b9ac.js.map +1 -0
- package/dist/canvas-controller-6c6bc68f.js +2 -0
- package/dist/canvas-controller-6c6bc68f.js.map +1 -0
- package/dist/common-canvas-9374ef35.js +2 -0
- package/dist/common-canvas-9374ef35.js.map +1 -0
- package/dist/common-canvas-a6435bdb.js +2 -0
- package/dist/common-canvas-a6435bdb.js.map +1 -0
- package/dist/common-canvas.es.js +1 -1
- package/dist/common-canvas.es.js.map +1 -1
- package/dist/common-canvas.js +1 -1
- package/dist/common-canvas.js.map +1 -1
- package/dist/common-properties-08707efe.js +2 -0
- package/dist/common-properties-08707efe.js.map +1 -0
- package/dist/common-properties-acd55e94.js +2 -0
- package/dist/common-properties-acd55e94.js.map +1 -0
- package/dist/context-menu-wrapper-271eb2df.js +2 -0
- package/dist/context-menu-wrapper-271eb2df.js.map +1 -0
- package/dist/context-menu-wrapper-e4a7ab4d.js +2 -0
- package/dist/context-menu-wrapper-e4a7ab4d.js.map +1 -0
- package/dist/{datarecord-metadata-v3-schema-59505bc5.js → datarecord-metadata-v3-schema-03427296.js} +2 -2
- package/dist/{datarecord-metadata-v3-schema-59505bc5.js.map → datarecord-metadata-v3-schema-03427296.js.map} +1 -1
- package/dist/{flexible-table-63ffd573.js → flexible-table-107ca2fd.js} +1 -1
- package/dist/{flexible-table-63ffd573.js.map → flexible-table-107ca2fd.js.map} +1 -1
- package/dist/{flexible-table-43e2d052.js → flexible-table-5cc1ad6b.js} +2 -2
- package/dist/{flexible-table-43e2d052.js.map → flexible-table-5cc1ad6b.js.map} +1 -1
- package/dist/{icon-0390f1fe.js → icon-2caf035c.js} +2 -2
- package/dist/{icon-0390f1fe.js.map → icon-2caf035c.js.map} +1 -1
- package/dist/{index-57503b50.js → index-5dac3da8.js} +2 -2
- package/dist/{index-57503b50.js.map → index-5dac3da8.js.map} +1 -1
- package/dist/{index-1cd54914.js → index-fee06179.js} +2 -2
- package/dist/{index-1cd54914.js.map → index-fee06179.js.map} +1 -1
- package/dist/{isArrayLikeObject-36898fcb.js → isArrayLikeObject-7a30aa4b.js} +2 -2
- package/dist/{isArrayLikeObject-36898fcb.js.map → isArrayLikeObject-7a30aa4b.js.map} +1 -1
- package/dist/lib/canvas-controller.es.js +1 -1
- package/dist/lib/canvas-controller.js +1 -1
- package/dist/lib/canvas.es.js +1 -1
- package/dist/lib/canvas.js +1 -1
- package/dist/lib/context-menu.es.js +1 -1
- package/dist/lib/context-menu.js +1 -1
- package/dist/lib/properties/clem.es.js +2 -0
- package/dist/lib/properties/clem.es.js.map +1 -0
- package/dist/lib/properties/clem.js +2 -0
- package/dist/lib/properties/clem.js.map +1 -0
- package/dist/lib/properties/field-picker.es.js +1 -1
- package/dist/lib/properties/field-picker.js +1 -1
- package/dist/lib/properties/flexible-table.es.js +1 -1
- package/dist/lib/properties/flexible-table.js +1 -1
- package/dist/lib/properties/getPythonHints.es.js +2 -0
- package/dist/lib/properties/getPythonHints.es.js.map +1 -0
- package/dist/lib/properties/getPythonHints.js +2 -0
- package/dist/lib/properties/getPythonHints.js.map +1 -0
- package/dist/lib/properties.es.js +1 -1
- package/dist/lib/properties.js +1 -1
- package/dist/lib/tooltip.es.js +1 -1
- package/dist/lib/tooltip.es.js.map +1 -1
- package/dist/lib/tooltip.js +1 -1
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/styles/common-canvas.min.css +1 -1
- package/dist/styles/common-canvas.min.css.map +1 -1
- package/dist/toolbar-ccc1d600.js +2 -0
- package/dist/toolbar-ccc1d600.js.map +1 -0
- package/dist/toolbar-e4445bf8.js +2 -0
- package/dist/toolbar-e4445bf8.js.map +1 -0
- package/package.json +12 -4
- package/rollup.config.js +2 -0
- package/src/color-picker/color-picker.jsx +96 -17
- package/src/command-actions/arrangeLayoutAction.js +7 -6
- package/src/command-actions/attachNodeToLinksAction.js +4 -4
- package/src/command-actions/collapseSuperNodeInPlaceAction.js +5 -5
- package/src/command-actions/colorSelectedObjectsAction.js +4 -4
- package/src/command-actions/commonPropertiesAction.js +1 -1
- package/src/command-actions/convertSuperNodeExternalToLocalAction.js +4 -4
- package/src/command-actions/convertSuperNodeLocalToExternalAction.js +4 -4
- package/src/command-actions/createAutoNodeAction.js +14 -5
- package/src/command-actions/createCommentAction.js +4 -10
- package/src/command-actions/createCommentLinkAction.js +4 -4
- package/src/command-actions/createNodeAction.js +13 -4
- package/src/command-actions/createNodeAttachLinksAction.js +4 -4
- package/src/command-actions/createNodeLinkAction.js +13 -4
- package/src/command-actions/createNodeLinkDetachedAction.js +4 -4
- package/src/command-actions/createNodeOnLinkAction.js +4 -4
- package/src/command-actions/createSuperNodeAction.js +7 -7
- package/src/command-actions/deconstructSuperNodeAction.js +5 -5
- package/src/command-actions/deleteLinkAction.js +4 -4
- package/src/command-actions/deleteObjectsAction.js +15 -6
- package/src/command-actions/disconnectObjectsAction.js +13 -4
- package/src/command-actions/displayPreviousPipelineAction.js +4 -4
- package/src/command-actions/displaySubPipelineAction.js +4 -4
- package/src/command-actions/editCommentAction.js +4 -4
- package/src/command-actions/editDecorationLabelAction.js +4 -4
- package/src/command-actions/expandSuperNodeInPlaceAction.js +5 -5
- package/src/command-actions/insertNodeIntoLinkAction.js +4 -4
- package/src/command-actions/moveObjectsAction.js +4 -4
- package/src/command-actions/pasteAction.js +16 -7
- package/src/command-actions/saveToPaletteAction.js +4 -4
- package/src/command-actions/setLinksStyleAction.js +4 -4
- package/src/command-actions/setNodeLabelAction.js +4 -4
- package/src/command-actions/setObjectsStyleAction.js +4 -4
- package/src/command-actions/sizeAndPositionObjectsAction.js +4 -4
- package/src/command-actions/updateLinkAction.js +4 -4
- package/src/common-canvas/canvas-controller-menu-utils.js +1 -1
- package/src/common-canvas/canvas-controller.js +116 -62
- package/src/common-canvas/cc-central-items.jsx +1 -5
- package/src/common-canvas/cc-context-toolbar.jsx +9 -13
- package/src/common-canvas/cc-toolbar.jsx +28 -9
- package/src/common-canvas/common-canvas.scss +3 -3
- package/src/common-canvas/svg-canvas-d3.scss +3 -2
- package/src/common-canvas/svg-canvas-renderer.js +50 -23
- package/src/common-canvas/svg-canvas-utils-drag-det-link.js +8 -1
- package/src/common-canvas/svg-canvas-utils-drag-new-link.js +1 -1
- package/src/common-properties/components/field-picker/field-picker.jsx +4 -0
- package/src/common-properties/components/table-buttons/table-buttons.scss +0 -1
- package/src/common-properties/controls/checkbox/checkbox.scss +0 -1
- package/src/common-properties/controls/expression/expression-builder/expression-builder.jsx +32 -26
- package/src/common-properties/controls/expression/expression.jsx +143 -116
- package/src/common-properties/controls/expression/expression.scss +43 -45
- package/src/common-properties/controls/expression/languages/CLEM-hint.js +86 -159
- package/src/common-properties/controls/expression/languages/python-hint.js +41 -104
- package/src/common-properties/controls/expression/languages/r-hint.js +61 -128
- package/src/common-properties/index.js +4 -2
- package/src/common-properties/properties-controller.js +5 -0
- package/src/context-menu/common-context-menu.jsx +4 -1
- package/src/index.js +14 -4
- package/src/notification-panel/notification-panel.jsx +82 -56
- package/src/notification-panel/notification-panel.scss +42 -40
- package/src/object-model/object-model.js +19 -5
- package/src/object-model/redux/canvas-store.js +4 -3
- package/src/object-model/redux/reducers/canvasinfo.js +7 -11
- package/src/object-model/redux/reducers/canvastoolbar.js +5 -6
- package/src/palette/palette-dialog-topbar.jsx +27 -38
- package/src/palette/palette-flyout-content-category.jsx +25 -6
- package/src/palette/palette.scss +8 -40
- package/src/toolbar/{toolbar-utils.js → index.js} +3 -18
- package/src/toolbar/toolbar-action-item.jsx +122 -316
- package/src/toolbar/toolbar-button-item.jsx +381 -0
- package/src/toolbar/toolbar-divider-item.jsx +4 -5
- package/src/toolbar/toolbar-overflow-item.jsx +85 -37
- package/src/toolbar/toolbar-sub-menu-item.jsx +236 -0
- package/src/toolbar/toolbar-sub-menu.jsx +252 -0
- package/src/toolbar/toolbar-sub-panel.jsx +94 -0
- package/src/toolbar/toolbar-sub-utils.js +86 -0
- package/src/toolbar/toolbar.jsx +386 -148
- package/src/toolbar/toolbar.scss +63 -56
- package/src/tooltip/tooltip.jsx +65 -12
- package/stats.html +1 -1
- package/assets/images/palette/close_32.svg +0 -1
- package/assets/images/palette/palette_close.svg +0 -4
- package/assets/images/palette/palette_grid_deselected.svg +0 -2
- package/assets/images/palette/palette_grid_hover.svg +0 -2
- package/assets/images/palette/palette_grid_selected.svg +0 -2
- package/assets/images/palette/palette_list_deselected.svg +0 -1
- package/assets/images/palette/palette_list_hover.svg +0 -1
- package/assets/images/palette/palette_list_selected.svg +0 -1
- package/assets/images/palette/palette_open.svg +0 -4
- package/assets/images/zoom_to_fit.svg +0 -8
- package/dist/canvas-controller-1e71b405.js +0 -2
- package/dist/canvas-controller-1e71b405.js.map +0 -1
- package/dist/canvas-controller-4bed5320.js +0 -2
- package/dist/canvas-controller-4bed5320.js.map +0 -1
- package/dist/common-canvas-097c5169.js +0 -2
- package/dist/common-canvas-097c5169.js.map +0 -1
- package/dist/common-canvas-e13c0858.js +0 -2
- package/dist/common-canvas-e13c0858.js.map +0 -1
- package/dist/common-properties-706cef87.js +0 -2
- package/dist/common-properties-706cef87.js.map +0 -1
- package/dist/common-properties-9bd69b61.js +0 -2
- package/dist/common-properties-9bd69b61.js.map +0 -1
- package/dist/context-menu-wrapper-3a7fdec8.js +0 -2
- package/dist/context-menu-wrapper-3a7fdec8.js.map +0 -1
- package/dist/context-menu-wrapper-fc85d853.js +0 -2
- package/dist/context-menu-wrapper-fc85d853.js.map +0 -1
- package/dist/toolbar-918ab52e.js +0 -2
- package/dist/toolbar-918ab52e.js.map +0 -1
- package/dist/toolbar-fdb750f9.js +0 -2
- package/dist/toolbar-fdb750f9.js.map +0 -1
- package/src/palette/palette-dialog-topbar-three-way-icon.jsx +0 -82
- package/src/toolbar/toolbar-action-sub-area.jsx +0 -126
- package/src/toolbar/toolbar-overflow-menu.jsx +0 -77
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -15,16 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/* eslint no-useless-escape: "off" */
|
|
18
|
+
import { LanguageSupport, StreamLanguage } from "@codemirror/language";
|
|
19
|
+
import { completeFromList } from "@codemirror/autocomplete";
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
function register(cm) {
|
|
21
|
-
CodeMirror = cm;
|
|
22
|
-
CodeMirror.registerHelper("hint", "CLEM", CLEMHint);
|
|
23
|
-
CodeMirror.defineMode("CLEM", defineMode);
|
|
24
|
-
CodeMirror.defineMIME("text/x-CLEM", "CLEM");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const CLEMKeywords = ("@BLANK @DIFF1 @DIFF2 @FIELD @FIELDS_BETWEEN @FIELDS_MATCHING " +
|
|
21
|
+
const keywords = ("@BLANK @DIFF1 @DIFF2 @FIELD @FIELDS_BETWEEN @FIELDS_MATCHING " +
|
|
28
22
|
"@GLOBAL_MAX @GLOBAL_MEAN @GLOBAL_MIN @GLOBAL_SDEV @GLOBAL_SUM @INDEX @LAST_NON_BLANK " +
|
|
29
23
|
"@MAX @MEAN @MIN @MULTI_RESPONSE_SET @NULL @OFFSET @PARTITION_FIELD @PREDICTED " +
|
|
30
24
|
"@SDEV @SINCE @SINCE0 @SUM @TARGET @TESTING_PARTITION @THIS @TODAY @TRAINING_PARTITION " +
|
|
@@ -50,173 +44,106 @@ const CLEMKeywords = ("@BLANK @DIFF1 @DIFF2 @FIELD @FIELDS_BETWEEN @FIELDS_MATCH
|
|
|
50
44
|
"substring_between sum_n tan tanh testbit time_before time_hours_difference time_in_hours " +
|
|
51
45
|
"time_in_mins time_in_secs time_mins_difference").split(" ");
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
return scriptHint(editor, CLEMKeywords,
|
|
55
|
-
function(e, cur) {
|
|
56
|
-
return e.getTokenAt(cur);
|
|
57
|
-
},
|
|
58
|
-
options);
|
|
59
|
-
}
|
|
47
|
+
const clemKeywords = keywords.map((keyword) => ({ label: keyword, type: "keyword" }));
|
|
60
48
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
const isSpecialChar = /[\[\]{}\(\),;\:\.]/;
|
|
50
|
+
const isDigit = /\d/;
|
|
51
|
+
const isNumberChar = /[\w\.]/;
|
|
52
|
+
const isWordChar = /[\w\$_]/;
|
|
53
|
+
const isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
|
54
|
+
|
|
55
|
+
function tokenResolve(stream, state) {
|
|
56
|
+
const ch = stream.next();
|
|
57
|
+
if (ch === "#" && state.startOfLine) {
|
|
58
|
+
stream.skipToEnd();
|
|
59
|
+
return "meta";
|
|
67
60
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
token = { start: cur.ch, end: cur.ch, string: "", state: token.state,
|
|
73
|
-
type: token.string === "." ? "property" : null };
|
|
74
|
-
} else if (token.end > cur.ch) {
|
|
75
|
-
token.end = cur.ch;
|
|
76
|
-
token.string = token.string.slice(0, cur.ch - token.start);
|
|
61
|
+
|
|
62
|
+
if (ch === "\"") {
|
|
63
|
+
tokenString(ch, stream, state);
|
|
64
|
+
return "string";
|
|
77
65
|
}
|
|
78
66
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
67
|
+
if (ch === "'") {
|
|
68
|
+
tokenVariable(ch, stream, state);
|
|
69
|
+
return "variable";
|
|
70
|
+
}
|
|
83
71
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
if (isSpecialChar.test(ch)) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
87
75
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
76
|
+
if (isDigit.test(ch)) {
|
|
77
|
+
stream.eatWhile(isNumberChar);
|
|
78
|
+
return "number";
|
|
79
|
+
}
|
|
80
|
+
if (isOperatorChar.test(ch)) {
|
|
81
|
+
stream.eatWhile(isOperatorChar);
|
|
82
|
+
return "operator";
|
|
92
83
|
}
|
|
93
84
|
|
|
94
|
-
|
|
85
|
+
stream.eatWhile(isWordChar);
|
|
86
|
+
const cur = stream.current();
|
|
87
|
+
if (keywords.indexOf(cur) !== -1) {
|
|
88
|
+
return "keyword";
|
|
89
|
+
}
|
|
90
|
+
return "variable";
|
|
95
91
|
}
|
|
96
92
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"@VALIDATION_PARTITION abs allbutfirst allbutlast alphabefore and arccos arccosh arcsin " +
|
|
105
|
-
"arcsinh arctan arctan2 arctanh area cdf_chisq cdf_f cdf_normal cdf_t close_to COND1 " +
|
|
106
|
-
"and COND2 COND1 or COND2 cos cosh count_equal count_greater_than count_less_than " +
|
|
107
|
-
"count_non_nulls count_not_equal count_nulls count_substring crosses date_before " +
|
|
108
|
-
"date_days_difference date_from_ywd date_in_days date_in_months date_in_weeks date_in_years " +
|
|
109
|
-
"date_iso_day date_iso_week date_iso_year date_months_difference date_weeks_difference " +
|
|
110
|
-
"date_years_difference datetime_date datetime_day datetime_day_name datetime_day_short_name " +
|
|
111
|
-
"datetime_hour datetime_in_seconds datetime_minute datetime_month datetime_month_name " +
|
|
112
|
-
"datetime_month_short_name datetime_now datetime_second datetime_time datetime_timestamp " +
|
|
113
|
-
"datetime_weekday datetime_year distance div endstring exp first_index first_non_null " +
|
|
114
|
-
"first_non_null_index fracof hasendstring hasmidstring hasstartstring hassubstring hassubstring " +
|
|
115
|
-
"if then else elseif endif integer_bitcount integer_leastbit integer_length intof is_date " +
|
|
116
|
-
"is_datetime is_integer is_number is_real is_string is_time is_timestamp isalphacode " +
|
|
117
|
-
"isendstring islowercode ismidstring isnumbercode isstartstring issubstring issubstring " +
|
|
118
|
-
"issubstring_count issubstring_lim isuppercode last last_index last_non_null last_non_null_index " +
|
|
119
|
-
"length locchar locchar_back log log10 lowertoupper max max_index max_n MEAN mean_n member " +
|
|
120
|
-
"min min_index min_n negate not num_points oneof or overlap pi random random0 rem replace " +
|
|
121
|
-
"replicate round sdev_n sign sin sinh skipchar skipchar_back soundex soundex_difference sqrt " +
|
|
122
|
-
"startstring stb_centroid_latitude stb_centroid_longitude stripchar strmember subscrs substring " +
|
|
123
|
-
"substring_between sum_n tan tanh testbit time_before time_hours_difference time_in_hours " +
|
|
124
|
-
"time_in_mins time_in_secs time_mins_difference").split(" ");
|
|
125
|
-
|
|
126
|
-
var isSpecialChar = /[\[\]{}\(\),;\:\.]/;
|
|
127
|
-
var isDigit = /\d/;
|
|
128
|
-
var isNumberChar = /[\w\.]/;
|
|
129
|
-
var isWordChar = /[\w\$_]/;
|
|
130
|
-
|
|
131
|
-
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
|
132
|
-
|
|
133
|
-
function tokenResolve(stream, state) {
|
|
134
|
-
var ch = stream.next();
|
|
135
|
-
if (ch === "#" && state.startOfLine) {
|
|
136
|
-
stream.skipToEnd();
|
|
137
|
-
return "meta";
|
|
93
|
+
function tokenString(quote, stream, state) {
|
|
94
|
+
let next;
|
|
95
|
+
let end = false;
|
|
96
|
+
while (typeof (next = stream.next()) !== "undefined") {
|
|
97
|
+
if (next === quote) {
|
|
98
|
+
end = true;
|
|
99
|
+
break;
|
|
138
100
|
}
|
|
139
|
-
|
|
140
|
-
if (ch === "\"") {
|
|
141
|
-
tokenString(ch, stream, state);
|
|
142
|
-
return "string";
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (ch === "'") {
|
|
146
|
-
tokenVariable(ch, stream, state);
|
|
147
|
-
return "variable";
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (isSpecialChar.test(ch)) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (isDigit.test(ch)) {
|
|
155
|
-
stream.eatWhile(isNumberChar);
|
|
156
|
-
return "number";
|
|
157
|
-
}
|
|
158
|
-
if (isOperatorChar.test(ch)) {
|
|
159
|
-
stream.eatWhile(isOperatorChar);
|
|
160
|
-
return "operator";
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
stream.eatWhile(isWordChar);
|
|
164
|
-
var cur = stream.current();
|
|
165
|
-
if (keywords.indexOf(cur) !== -1) {
|
|
166
|
-
return "keyword";
|
|
167
|
-
}
|
|
168
|
-
return "variable";
|
|
169
101
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
var next;
|
|
173
|
-
var end = false;
|
|
174
|
-
while (typeof (next = stream.next()) !== "undefined") {
|
|
175
|
-
if (next === quote) {
|
|
176
|
-
end = true;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (end) {
|
|
181
|
-
state.tokenize = null;
|
|
182
|
-
}
|
|
183
|
-
return "string";
|
|
102
|
+
if (end) {
|
|
103
|
+
state.tokenize = null;
|
|
184
104
|
}
|
|
105
|
+
return "string";
|
|
106
|
+
}
|
|
185
107
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (end) {
|
|
196
|
-
state.tokenize = null;
|
|
108
|
+
function tokenVariable(quote, stream, state) {
|
|
109
|
+
let next;
|
|
110
|
+
let end = false;
|
|
111
|
+
while (typeof (next = stream.next()) !== "undefined") {
|
|
112
|
+
if (next === quote) {
|
|
113
|
+
end = true;
|
|
114
|
+
break;
|
|
197
115
|
}
|
|
198
|
-
return "variable";
|
|
199
116
|
}
|
|
117
|
+
if (end) {
|
|
118
|
+
state.tokenize = null;
|
|
119
|
+
}
|
|
120
|
+
return "variable";
|
|
121
|
+
}
|
|
200
122
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
123
|
+
// Define CLEM language
|
|
124
|
+
const clemLanguage = StreamLanguage.define({
|
|
125
|
+
name: "CLEM",
|
|
126
|
+
startState: function() {
|
|
127
|
+
return { tokenize: null };
|
|
128
|
+
},
|
|
129
|
+
token: function(stream, state) {
|
|
130
|
+
if (stream.eatSpace()) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
const style = (state.tokenize || tokenResolve)(stream, state);
|
|
134
|
+
return style;
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Autocompletions
|
|
139
|
+
const clemCompletion = clemLanguage.data.of({
|
|
140
|
+
autocomplete: completeFromList(clemKeywords)
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
function clem() {
|
|
144
|
+
return new LanguageSupport(clemLanguage, [clemCompletion]);
|
|
218
145
|
}
|
|
219
146
|
|
|
220
147
|
export {
|
|
221
|
-
|
|
148
|
+
clem
|
|
222
149
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,110 +14,47 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
context.push(tprop);
|
|
57
|
-
|
|
58
|
-
var completionList = getCompletions(token, context);
|
|
59
|
-
completionList.sort();
|
|
60
|
-
|
|
61
|
-
return { list: completionList,
|
|
62
|
-
from: CodeMirror.Pos(cur.line, token.start),
|
|
63
|
-
to: CodeMirror.Pos(cur.line, token.end) };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function pythonHint(editor) {
|
|
67
|
-
return scriptHint(editor, pythonKeywordsL, function(e, cur) {
|
|
68
|
-
return e.getTokenAt(cur);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var pythonKeywords = "and del from not while as elif global or with assert else if pass yield" +
|
|
74
|
-
"break except import print class exec in raise continue finally is return def for lambda try";
|
|
75
|
-
var pythonKeywordsL = pythonKeywords.split(" ");
|
|
76
|
-
|
|
77
|
-
var pythonBuiltins = "abs divmod input open staticmethod all enumerate int ord str " +
|
|
78
|
-
"any eval isinstance pow sum basestring execfile issubclass print super" +
|
|
79
|
-
"bin file iter property tuple bool filter len range type" +
|
|
80
|
-
"bytearray float list raw_input unichr callable format locals reduce unicode" +
|
|
81
|
-
"chr frozenset long reload vars classmethod getattr map repr xrange" +
|
|
82
|
-
"cmp globals max reversed zip compile hasattr memoryview round __import__" +
|
|
83
|
-
"complex hash min set apply delattr help next setattr buffer" +
|
|
84
|
-
"dict hex object slice coerce dir id oct sorted intern ";
|
|
85
|
-
var pythonBuiltinsL = pythonBuiltins.split(" ").join("() ")
|
|
86
|
-
.split(" ");
|
|
87
|
-
|
|
88
|
-
function getCompletions(token, context) {
|
|
89
|
-
var found = [];
|
|
90
|
-
var start = token.string;
|
|
91
|
-
function maybeAdd(str) {
|
|
92
|
-
if (str.lastIndexOf(start, 0) === 0 && !arrayContains(found, str)) {
|
|
93
|
-
found.push(str);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function gatherCompletions(_obj) {
|
|
98
|
-
forEach(pythonBuiltinsL, maybeAdd);
|
|
99
|
-
forEach(pythonKeywordsL, maybeAdd);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (context) {
|
|
103
|
-
var obj = context.pop();
|
|
104
|
-
var base = "";
|
|
105
|
-
|
|
106
|
-
if (obj.type === "variable") {
|
|
107
|
-
base = obj.string;
|
|
108
|
-
} else if (obj.type === "variable-3") {
|
|
109
|
-
base = ":" + obj.string;
|
|
110
|
-
}
|
|
111
|
-
while (base !== null && context.length) {
|
|
112
|
-
base = base[context.pop().string];
|
|
113
|
-
}
|
|
114
|
-
if (base !== null) {
|
|
115
|
-
gatherCompletions(base);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return found;
|
|
17
|
+
// Ref: https://docs.python.org/3.12/reference/lexical_analysis.html#keywords
|
|
18
|
+
const pythonKeywords = [
|
|
19
|
+
"await",
|
|
20
|
+
"else",
|
|
21
|
+
"pass",
|
|
22
|
+
"break",
|
|
23
|
+
"except",
|
|
24
|
+
"in",
|
|
25
|
+
"raise",
|
|
26
|
+
"finally",
|
|
27
|
+
"is",
|
|
28
|
+
"return",
|
|
29
|
+
"and",
|
|
30
|
+
"continue",
|
|
31
|
+
"lambda",
|
|
32
|
+
"as",
|
|
33
|
+
"nonlocal",
|
|
34
|
+
"assert",
|
|
35
|
+
"del",
|
|
36
|
+
"global",
|
|
37
|
+
"not",
|
|
38
|
+
"with",
|
|
39
|
+
"async",
|
|
40
|
+
"elif",
|
|
41
|
+
"or",
|
|
42
|
+
"yield"
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
// Ref: https://docs.python.org/3/library/functions.html
|
|
46
|
+
const pythonFunctions = [];
|
|
47
|
+
|
|
48
|
+
function getPythonHints() {
|
|
49
|
+
const pythonHints = [];
|
|
50
|
+
|
|
51
|
+
pythonKeywords.forEach((keyword) => pythonHints.push({ label: keyword, type: "keyword" }));
|
|
52
|
+
|
|
53
|
+
pythonFunctions.forEach((func) => pythonHints.push({ label: func, type: "function" }));
|
|
54
|
+
|
|
55
|
+
return pythonHints;
|
|
119
56
|
}
|
|
120
57
|
|
|
121
58
|
export {
|
|
122
|
-
|
|
59
|
+
getPythonHints
|
|
123
60
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,143 +14,76 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
CodeMirror.registerHelper("hint", "r", rHint);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function forEach(arr, f) {
|
|
24
|
-
for (var e = arr.length, i = 0; i < e; ++i) {
|
|
25
|
-
f(arr[i]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
17
|
+
import { LanguageSupport, StreamLanguage } from "@codemirror/language";
|
|
18
|
+
import { completeFromList } from "@codemirror/autocomplete";
|
|
19
|
+
import { r } from "@codemirror/legacy-modes/mode/r";
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
const builtIns = "zapsmall xzfile xtfrm xor writeLines writeChar writeBin write withVisible withRestarts within" +
|
|
22
|
+
" withCallingHandlers withAutoprint with while which weekdays warnings warning version Vectorize vector vapply" +
|
|
23
|
+
" validUTF8 validEnc utf8ToInt UseMethod url unz untracemem untrace unsplit unserialize unname unlockBinding unloadNamespace" +
|
|
24
|
+
" unlist unlink unique union undebug unclass typeof tryCatch try truncate trunc trimws trigamma" +
|
|
25
|
+
" transform tracingState tracemem traceback trace toupper toString topenv tolower textConnectionValue textConnection" +
|
|
26
|
+
" testPlatformEquivalence tempfile tempdir tcrossprod taskCallbackManager tapply tanpi tanh tan tabulate table T t system2 system" +
|
|
27
|
+
" switch sweep svd suspendInterrupts suppressWarnings suppressPackageStartupMessages suppressMessages summary sum" +
|
|
28
|
+
" substring substr substitute subset sub strwrap structure strtrim strtoi strsplit strrep strptime strftime" +
|
|
29
|
+
" stopifnot stop stdout stdin stderr startsWith standardGeneric srcref srcfilecopy srcfilealias srcfile sQuote sqrt sprintf split" +
|
|
30
|
+
" source sort solve socketSelect socketConnection sinpi sink sinh single sin simplify2array simpleWarning simpleMessage simpleError" +
|
|
31
|
+
" simpleCondition signif signalCondition sign shQuote showConnections setwd setTimeLimit setSessionTimeLimit setNamespaceInfo setHook" +
|
|
32
|
+
" setequal setdiff serialize sequence seq_len seq_along seq seek searchpaths search scan scale saveRDS save sapply sample rowSums" +
|
|
33
|
+
" rowsum rownames rowMeans row round RNGversion length lchoose lbeta lazyLoadDBfetch lazyLoadDBexec" +
|
|
34
|
+
" RNGkind rm rle rev returnValue return retracemem restartFormals restartDescription requireNamespace require replicate replace repeat" +
|
|
35
|
+
" rep_len rep removeTaskCallback remove regmatches registerS3methods registerS3method regexpr regexec Reduce Recall" +
|
|
36
|
+
" readRenviron readRDS readLines readline readChar readBin Re rcond rbind rawToChar rawToBits rawShift rawConnectionValue rawConnection" +
|
|
37
|
+
" raw rapply rank range R_system_version quote quit quarters qr q pushBackLength pushBack psigamma provideDimnames prod prmatrix print" +
|
|
38
|
+
" prettyNum pretty Position polyroot pmin pmax pmatch pipe pi pcre_config paste0 paste parseNamespaceFile parse" +
|
|
39
|
+
" packBits packageStartupMessage packageHasNamespace packageEvent package_version outer ordered order options open OlsonNames" +
|
|
40
|
+
" oldClass objects nzchar numeric_version numeric NROW nrow normalizePath norm noquote nlevels ngettext NextMethod next Negate NCOL ncol" +
|
|
41
|
+
" nchar nargs namespaceImportMethods namespaceImportFrom namespaceImportClasses namespaceImport namespaceExport" +
|
|
42
|
+
" months mode Mod missing min mget message merge memDecompress memCompress mean max matrix match mapply Map" +
|
|
43
|
+
" makeActiveBinding ls logical logb log2 log1p log10 log lockEnvironment lockBinding local loadNamespace loadingNamespaceInfo loadedNamespaces" +
|
|
44
|
+
" load list2env list license licence library libcurlVersion lgamma lfactorial levels LETTERS letters lengths" +
|
|
45
|
+
" lazyLoad lapply labels La_version La_library l10n_info kronecker kappa julian jitter isTRUE isSymmetric isSeekable isS4 isRestart isOpen" +
|
|
46
|
+
" ISOdatetime ISOdate isNamespaceLoaded isNamespace isIncomplete isFALSE isdebugged isBaseNamespace isatty" +
|
|
47
|
+
" invokeRestartInteractively invokeRestart invisible intToUtf8 intToBits intersect acosh acos abs abbreviate" +
|
|
48
|
+
" interactive interaction integer inherits importIntoEnv Im ifelse if identity identical icuSetCollate icuGetCollate iconvlist iconv I" +
|
|
49
|
+
" gzfile gzcon gsub grouping grepRaw grepl grep gregexpr globalenv gl getwd gettextf gettext getTaskCallbackNames getSrcLines getRversion" +
|
|
50
|
+
" getOption getNativeSymbolInfo getNamespaceVersion getNamespaceUsers getNamespaceName getNamespaceInfo getNamespaceImports getNamespaceExports" +
|
|
51
|
+
" getNamespace getLoadedDLLs getHook getExportedValue geterrmessage getElement getDLLRegisteredRoutines getConnection getCallingDLLe" +
|
|
52
|
+
" getCallingDLL getAllConnections get0 get gctorture2 gctorture gcinfo gc gamma function forwardsolve formatDL formatC format" +
|
|
53
|
+
" formals forceAndCall force for flush floor findRestart findPackageEnv findInterval Find Filter file fifo factorial factor F extSoftVersion" +
|
|
54
|
+
" expression expm1 exp exists evalq eval environmentName environmentIsLocked environment enquote endsWith Encoding" +
|
|
55
|
+
" encodeString enc2utf8 enc2native emptyenv eigen eapply dynGet duplicated dump droplevels drop dQuote dput double dontCheck dirname dir" +
|
|
56
|
+
" digamma difftime diff dget determinant detach det deparse delayedAssign asNamespace asinh asin" +
|
|
57
|
+
" debugonce debuggingState debug date cut curlGetHeaders cumsum cumprod cummin cummax Cstack_info crossprod cospi cosh cos contributors Conj" +
|
|
58
|
+
" conflicts conditionMessage conditionCall computeRestarts complex comment commandArgs colSums colnames colMeans col" +
|
|
59
|
+
" closeAllConnections close clearPushBack class choose chol2inv chol chkDots check_tzones chartr charToRaw charmatch character ceiling" +
|
|
60
|
+
" cbind cat casefold capabilities callCC call c bzfile by builtins browserText browserSetDebug browserCondition browser break bquote body" +
|
|
61
|
+
" bitwXor bitwShiftR bitwShiftL bitwOr bitwNot bitwAnd bindtextdomain bindingIsLocked bindingIsActive beta besselY besselK besselJ besselI" +
|
|
62
|
+
" basename baseenv backsolve autoloader autoload attributes attr attachNamespace attach atanh atan2 atan assign asS4 asS3" +
|
|
63
|
+
" arrayInd array args Arg apply append aperm anyNA anyDuplicated any allowInterrupts all alist agrepl agrep addTaskCallback addNA";
|
|
41
64
|
|
|
42
|
-
|
|
43
|
-
var cur = editor.getCursor();
|
|
44
|
-
var token = getToken(editor, cur);
|
|
45
|
-
var tprop = token;
|
|
46
|
-
var context;
|
|
47
|
-
// ignore irregular word tokens
|
|
48
|
-
if (!(/^[\w$_]*$/).test(token.string)) {
|
|
49
|
-
token = tprop = { start: cur.ch, end: cur.ch, string: "", state: token.state,
|
|
50
|
-
className: token.string === ":" ? "r-type" : null };
|
|
51
|
-
}
|
|
52
|
-
if (!context) {
|
|
53
|
-
context = [];
|
|
54
|
-
}
|
|
55
|
-
context.push(tprop);
|
|
65
|
+
const rBuiltIns = builtIns.split(" ");
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
function getRHints() {
|
|
68
|
+
const rHints = [];
|
|
59
69
|
|
|
60
|
-
|
|
61
|
-
from: CodeMirror.Pos(cur.line, token.start),
|
|
62
|
-
to: CodeMirror.Pos(cur.line, token.end) };
|
|
63
|
-
}
|
|
70
|
+
rBuiltIns.forEach((builtIn) => rHints.push({ label: builtIn, type: "keyword" }));
|
|
64
71
|
|
|
65
|
-
|
|
66
|
-
return scriptHint(editor, rKeywordsL, function(e, cur) {
|
|
67
|
-
return e.getTokenAt(cur);
|
|
68
|
-
});
|
|
72
|
+
return rHints;
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass";
|
|
74
|
-
var rKeywordsL = rKeywords.split("|");
|
|
75
|
-
|
|
76
|
-
var rBuiltIns = "zapsmall xzfile xtfrm xor writeLines writeChar writeBin write withVisible withRestarts within" +
|
|
77
|
-
"withCallingHandlers withAutoprint with while which weekdays warnings warning version Vectorize vector vapply" +
|
|
78
|
-
"validUTF8 validEnc utf8ToInt UseMethod url unz untracemem untrace unsplit unserialize unname unlockBinding unloadNamespace" +
|
|
79
|
-
"unlist unlink unique union undebug unclass typeof tryCatch try truncate trunc trimws trigamma" +
|
|
80
|
-
"transform tracingState tracemem traceback trace toupper toString topenv tolower textConnectionValue textConnection" +
|
|
81
|
-
"testPlatformEquivalence tempfile tempdir tcrossprod taskCallbackManager tapply tanpi tanh tan tabulate table T t system2 system" +
|
|
82
|
-
"switch sweep svd suspendInterrupts suppressWarnings suppressPackageStartupMessages suppressMessages summary sum" +
|
|
83
|
-
"substring substr substitute subset sub strwrap structure strtrim strtoi strsplit strrep strptime strftime" +
|
|
84
|
-
"stopifnot stop stdout stdin stderr startsWith standardGeneric srcref srcfilecopy srcfilealias srcfile sQuote sqrt sprintf split" +
|
|
85
|
-
"source sort solve socketSelect socketConnection sinpi sink sinh single sin simplify2array simpleWarning simpleMessage simpleError" +
|
|
86
|
-
"simpleCondition signif signalCondition sign shQuote showConnections setwd setTimeLimit setSessionTimeLimit setNamespaceInfo setHook" +
|
|
87
|
-
"setequal setdiff serialize sequence seq_len seq_along seq seek searchpaths search scan scale saveRDS save sapply sample rowSums" +
|
|
88
|
-
"rowsum rownames rowMeans row round RNGversion length lchoose lbeta lazyLoadDBfetch lazyLoadDBexec" +
|
|
89
|
-
"RNGkind rm rle rev returnValue return retracemem restartFormals restartDescription requireNamespace require replicate replace repeat" +
|
|
90
|
-
"rep_len rep removeTaskCallback remove regmatches registerS3methods registerS3method regexpr regexec Reduce Recall" +
|
|
91
|
-
"readRenviron readRDS readLines readline readChar readBin Re rcond rbind rawToChar rawToBits rawShift rawConnectionValue rawConnection" +
|
|
92
|
-
"raw rapply rank range R_system_version quote quit quarters qr q pushBackLength pushBack psigamma provideDimnames prod prmatrix print" +
|
|
93
|
-
"prettyNum pretty Position polyroot pmin pmax pmatch pipe pi pcre_config paste0 paste parseNamespaceFile parse" +
|
|
94
|
-
"packBits packageStartupMessage packageHasNamespace packageEvent package_version outer ordered order options open OlsonNames" +
|
|
95
|
-
"oldClass objects nzchar numeric_version numeric NROW nrow normalizePath norm noquote nlevels ngettext NextMethod next Negate NCOL ncol" +
|
|
96
|
-
"nchar nargs namespaceImportMethods namespaceImportFrom namespaceImportClasses namespaceImport namespaceExport" +
|
|
97
|
-
"months mode Mod missing min mget message merge memDecompress memCompress mean max matrix match mapply Map" +
|
|
98
|
-
"makeActiveBinding ls logical logb log2 log1p log10 log lockEnvironment lockBinding local loadNamespace loadingNamespaceInfo loadedNamespaces" +
|
|
99
|
-
"load list2env list license licence library libcurlVersion lgamma lfactorial levels LETTERS letters lengths" +
|
|
100
|
-
"lazyLoad lapply labels La_version La_library l10n_info kronecker kappa julian jitter isTRUE isSymmetric isSeekable isS4 isRestart isOpen" +
|
|
101
|
-
"ISOdatetime ISOdate isNamespaceLoaded isNamespace isIncomplete isFALSE isdebugged isBaseNamespace isatty" +
|
|
102
|
-
"invokeRestartInteractively invokeRestart invisible intToUtf8 intToBits intersect acosh acos abs abbreviate" +
|
|
103
|
-
"interactive interaction integer inherits importIntoEnv Im ifelse if identity identical icuSetCollate icuGetCollate iconvlist iconv I" +
|
|
104
|
-
"gzfile gzcon gsub grouping grepRaw grepl grep gregexpr globalenv gl getwd gettextf gettext getTaskCallbackNames getSrcLines getRversion" +
|
|
105
|
-
"getOption getNativeSymbolInfo getNamespaceVersion getNamespaceUsers getNamespaceName getNamespaceInfo getNamespaceImports getNamespaceExports" +
|
|
106
|
-
"getNamespace getLoadedDLLs getHook getExportedValue geterrmessage getElement getDLLRegisteredRoutines getConnection getCallingDLLe" +
|
|
107
|
-
"getCallingDLL getAllConnections get0 get gctorture2 gctorture gcinfo gc gamma function forwardsolve formatDL formatC format" +
|
|
108
|
-
"formals forceAndCall force for flush floor findRestart findPackageEnv findInterval Find Filter file fifo factorial factor F extSoftVersion" +
|
|
109
|
-
"expression expm1 exp exists evalq eval environmentName environmentIsLocked environment enquote endsWith Encoding" +
|
|
110
|
-
"encodeString enc2utf8 enc2native emptyenv eigen eapply dynGet duplicated dump droplevels drop dQuote dput double dontCheck dirname dir" +
|
|
111
|
-
"digamma difftime diff dget determinant detach det deparse delayedAssign asNamespace asinh asin" +
|
|
112
|
-
"debugonce debuggingState debug date cut curlGetHeaders cumsum cumprod cummin cummax Cstack_info crossprod cospi cosh cos contributors Conj" +
|
|
113
|
-
"conflicts conditionMessage conditionCall computeRestarts complex comment commandArgs colSums colnames colMeans col" +
|
|
114
|
-
"closeAllConnections close clearPushBack class choose chol2inv chol chkDots check_tzones chartr charToRaw charmatch character ceiling" +
|
|
115
|
-
"cbind cat casefold capabilities callCC call c bzfile by builtins browserText browserSetDebug browserCondition browser break bquote body" +
|
|
116
|
-
"bitwXor bitwShiftR bitwShiftL bitwOr bitwNot bitwAnd bindtextdomain bindingIsLocked bindingIsActive beta besselY besselK besselJ besselI" +
|
|
117
|
-
"basename baseenv backsolve autoloader autoload attributes attr attachNamespace attach atanh atan2 atan assign asS4 asS3" +
|
|
118
|
-
"arrayInd array args Arg apply append aperm anyNA anyDuplicated any allowInterrupts all alist agrepl agrep addTaskCallback addNA";
|
|
119
|
-
var rBuiltInsL = rBuiltIns.split(" ");
|
|
120
|
-
|
|
121
|
-
function getCompletions(token, context) {
|
|
122
|
-
var found = [];
|
|
123
|
-
var start = token.string;
|
|
124
|
-
function maybeAdd(str) {
|
|
125
|
-
if (str.lastIndexOf(start, 0) === 0 && !arrayContains(found, str)) {
|
|
126
|
-
found.push(str);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function gatherCompletions(_obj) {
|
|
131
|
-
forEach(rBuiltInsL, maybeAdd);
|
|
132
|
-
forEach(rKeywordsL, maybeAdd);
|
|
133
|
-
}
|
|
75
|
+
// Define R language
|
|
76
|
+
const rLan = StreamLanguage.define(r);
|
|
134
77
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
78
|
+
// Autocompletions
|
|
79
|
+
const rCompletion = rLan.data.of({
|
|
80
|
+
autocomplete: completeFromList(getRHints())
|
|
81
|
+
});
|
|
138
82
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
} else if (obj.type === "variable-3") {
|
|
142
|
-
base = ":" + obj.string;
|
|
143
|
-
}
|
|
144
|
-
while (base !== null && context.length) {
|
|
145
|
-
base = base[context.pop().string];
|
|
146
|
-
}
|
|
147
|
-
if (base !== null) {
|
|
148
|
-
gatherCompletions(base);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return found;
|
|
83
|
+
function rLanguage() {
|
|
84
|
+
return new LanguageSupport(rLan, [rCompletion]);
|
|
152
85
|
}
|
|
153
86
|
|
|
154
87
|
export {
|
|
155
|
-
|
|
88
|
+
rLanguage
|
|
156
89
|
};
|