@darajs/components 1.16.4 → 1.16.6-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dara_components-1.16.6a1-py3-none-any.whl +0 -0
- package/dist/smart/code-editor.d.ts.map +1 -1
- package/dist/smart/code-editor.js +27 -2
- package/dist/smart/code-editor.js.map +1 -1
- package/dist/smart/index.d.ts +1 -0
- package/dist/smart/index.d.ts.map +1 -1
- package/dist/smart/index.js +1 -0
- package/dist/smart/index.js.map +1 -1
- package/dist/smart/ui-code-editor/code-editor.d.ts +119 -0
- package/dist/smart/ui-code-editor/code-editor.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/code-editor.js +358 -0
- package/dist/smart/ui-code-editor/code-editor.js.map +1 -0
- package/dist/smart/ui-code-editor/codemirror-context.d.ts +18 -0
- package/dist/smart/ui-code-editor/codemirror-context.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/codemirror-context.js +10 -0
- package/dist/smart/ui-code-editor/codemirror-context.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/argument-hints.d.ts +21 -0
- package/dist/smart/ui-code-editor/extensions/argument-hints.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/argument-hints.js +250 -0
- package/dist/smart/ui-code-editor/extensions/argument-hints.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/code-folding.d.ts +3 -0
- package/dist/smart/ui-code-editor/extensions/code-folding.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/code-folding.js +69 -0
- package/dist/smart/ui-code-editor/extensions/code-folding.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/json.d.ts +16 -0
- package/dist/smart/ui-code-editor/extensions/json.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/json.js +29 -0
- package/dist/smart/ui-code-editor/extensions/json.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/lsp-utils.d.ts +39 -0
- package/dist/smart/ui-code-editor/extensions/lsp-utils.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/lsp-utils.js +299 -0
- package/dist/smart/ui-code-editor/extensions/lsp-utils.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/markdown.d.ts +13 -0
- package/dist/smart/ui-code-editor/extensions/markdown.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/markdown.js +19 -0
- package/dist/smart/ui-code-editor/extensions/markdown.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/python.d.ts +15 -0
- package/dist/smart/ui-code-editor/extensions/python.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/python.js +21 -0
- package/dist/smart/ui-code-editor/extensions/python.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/shared.d.ts +48 -0
- package/dist/smart/ui-code-editor/extensions/shared.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/shared.js +166 -0
- package/dist/smart/ui-code-editor/extensions/shared.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/sql.d.ts +14 -0
- package/dist/smart/ui-code-editor/extensions/sql.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/sql.js +23 -0
- package/dist/smart/ui-code-editor/extensions/sql.js.map +1 -0
- package/dist/smart/ui-code-editor/index.d.ts +25 -0
- package/dist/smart/ui-code-editor/index.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/index.js +25 -0
- package/dist/smart/ui-code-editor/index.js.map +1 -0
- package/dist/smart/ui-code-editor/types.d.ts +65 -0
- package/dist/smart/ui-code-editor/types.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/types.js +5 -0
- package/dist/smart/ui-code-editor/types.js.map +1 -0
- package/dist/smart/ui-code-editor/utils.d.ts +16 -0
- package/dist/smart/ui-code-editor/utils.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/utils.js +33 -0
- package/dist/smart/ui-code-editor/utils.js.map +1 -0
- package/dist/umd/dara.components.umd.js +35044 -31126
- package/dist/umd/style.css +749 -0
- package/package.json +27 -14
- package/dist/dara_components-1.16.4-py3-none-any.whl +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StateField } from '@codemirror/state';
|
|
2
|
+
import type { EditorView, Tooltip } from '@codemirror/view';
|
|
3
|
+
import { ViewPlugin } from '@codemirror/view';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import type { WsClient } from '../types';
|
|
6
|
+
export type ArgumentHintsTooltip = [StateField<Tooltip | null>, ViewPlugin<any>];
|
|
7
|
+
export declare const closeTooltip: import("@codemirror/state").StateEffectType<null>;
|
|
8
|
+
/**
|
|
9
|
+
* Close the argument hints tooltip.
|
|
10
|
+
*/
|
|
11
|
+
export declare function closeArgumentsHintsTooltip(view: EditorView): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an argument hints tooltip, displaying signature help for the current function call.
|
|
14
|
+
*
|
|
15
|
+
* @param client - the websocket client
|
|
16
|
+
* @param uri - the uri of the file
|
|
17
|
+
* @param tooltipRef - a ref to the tooltip element
|
|
18
|
+
* @param setTooltipContent - a function to set the content of the tooltip
|
|
19
|
+
*/
|
|
20
|
+
export declare function argumentHints(client: WsClient | undefined, uri: string | null | undefined, tooltipRef: React.MutableRefObject<any>, setTooltipContent: (el: React.ReactNode) => void): ArgumentHintsTooltip | null;
|
|
21
|
+
//# sourceMappingURL=argument-hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument-hints.d.ts","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/argument-hints.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAwB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAA2B,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC,MAAM,MAAM,oBAAoB,GAAG,CAAC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AACjF,eAAO,MAAM,YAAY,mDAA6B,CAAC;AA0QvD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAGpE;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CACzB,MAAM,EAAE,QAAQ,GAAG,SAAS,EAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EACvC,iBAAiB,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,GACjD,oBAAoB,GAAG,IAAI,CAM7B"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
+
};
|
|
15
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { syntaxTree } from '@codemirror/language';
|
|
17
|
+
import { MapMode, StateEffect, StateField } from '@codemirror/state';
|
|
18
|
+
import { ViewPlugin, showTooltip } from '@codemirror/view';
|
|
19
|
+
import * as React from 'react';
|
|
20
|
+
import styled from '@darajs/styled-components';
|
|
21
|
+
import { Markdown } from '@darajs/ui-components';
|
|
22
|
+
import { isEmptyMarkdown } from '../utils';
|
|
23
|
+
import { getLspSignatureHelp } from './lsp-utils';
|
|
24
|
+
export const closeTooltip = StateEffect.define();
|
|
25
|
+
/**
|
|
26
|
+
* Cursor tooltip extension for displaying argument hints.
|
|
27
|
+
*
|
|
28
|
+
* Modified from: https://github.com/ChromeDevTools/devtools-frontend/blob/main/front_end/ui/components/text_editor/cursor_tooltip.ts
|
|
29
|
+
*/
|
|
30
|
+
function cursorTooltip(source) {
|
|
31
|
+
var _instances, _scheduleUpdate, _startUpdate, _a;
|
|
32
|
+
const openOrUpdateTooltip = StateEffect.define();
|
|
33
|
+
const state = StateField.define({
|
|
34
|
+
create() {
|
|
35
|
+
return null;
|
|
36
|
+
},
|
|
37
|
+
update(val, tr) {
|
|
38
|
+
let ret = val;
|
|
39
|
+
// update position
|
|
40
|
+
if (ret && !tr.changes.empty) {
|
|
41
|
+
const newPos = tr.changes.mapPos(ret.pos, -1, MapMode.TrackDel);
|
|
42
|
+
ret = newPos === null ? null : { pos: newPos, create: ret.create, above: true };
|
|
43
|
+
}
|
|
44
|
+
// handle open/close effects
|
|
45
|
+
for (const effect of tr.effects) {
|
|
46
|
+
if (effect.is(openOrUpdateTooltip)) {
|
|
47
|
+
// if we have a tooltip already open, just run the new updater so we don't flicker
|
|
48
|
+
if (val) {
|
|
49
|
+
effect.value.update();
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
ret = {
|
|
53
|
+
pos: tr.state.selection.main.from,
|
|
54
|
+
create: effect.value.create,
|
|
55
|
+
above: true,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (effect.is(closeTooltip)) {
|
|
60
|
+
ret = null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return ret;
|
|
64
|
+
},
|
|
65
|
+
provide: (field) => showTooltip.from(field),
|
|
66
|
+
});
|
|
67
|
+
const plugin = ViewPlugin.fromClass((_a = class {
|
|
68
|
+
constructor() {
|
|
69
|
+
_instances.add(this);
|
|
70
|
+
this.pending = -1;
|
|
71
|
+
this.updateID = 0;
|
|
72
|
+
}
|
|
73
|
+
update(update) {
|
|
74
|
+
this.updateID++;
|
|
75
|
+
if (update.transactions.some((tr) => tr.selection) && update.state.selection.main.empty) {
|
|
76
|
+
__classPrivateFieldGet(this, _instances, "m", _scheduleUpdate).call(this, update.view);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
_instances = new WeakSet(),
|
|
81
|
+
_scheduleUpdate = function _scheduleUpdate(view) {
|
|
82
|
+
if (this.pending > -1) {
|
|
83
|
+
clearTimeout(this.pending);
|
|
84
|
+
}
|
|
85
|
+
this.pending = window.setTimeout(() => __classPrivateFieldGet(this, _instances, "m", _startUpdate).call(this, view), 50);
|
|
86
|
+
},
|
|
87
|
+
_startUpdate = function _startUpdate(view) {
|
|
88
|
+
this.pending = -1;
|
|
89
|
+
const { main } = view.state.selection;
|
|
90
|
+
if (main.empty) {
|
|
91
|
+
const { updateID } = this;
|
|
92
|
+
source(view.state, main.from).then((tooltip) => {
|
|
93
|
+
if (this.updateID !== updateID) {
|
|
94
|
+
if (this.pending < 0) {
|
|
95
|
+
__classPrivateFieldGet(this, _instances, "m", _scheduleUpdate).call(this, view);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else if (tooltip) {
|
|
99
|
+
// resolved to a tooltip, send open/update effect to state
|
|
100
|
+
view.dispatch({ effects: openOrUpdateTooltip.of(tooltip) });
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// resolved to null, send close effect to state
|
|
104
|
+
view.dispatch({ effects: closeTooltip.of(null) });
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
_a));
|
|
110
|
+
return [state, plugin];
|
|
111
|
+
}
|
|
112
|
+
const SignatureTooltipWrapper = styled.div `
|
|
113
|
+
overflow-y: auto;
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
`;
|
|
117
|
+
const CodeWrapper = styled.pre `
|
|
118
|
+
padding: 0.25rem 0.75rem;
|
|
119
|
+
white-space: normal;
|
|
120
|
+
background-color: ${(props) => props.theme.colors.blue2};
|
|
121
|
+
`;
|
|
122
|
+
const DocsWrapper = styled.div `
|
|
123
|
+
height: 100%;
|
|
124
|
+
padding: 0.75rem;
|
|
125
|
+
border-top: 1px solid ${(props) => props.theme.colors.grey3};
|
|
126
|
+
`;
|
|
127
|
+
function SignatureHelpTooltip(props) {
|
|
128
|
+
var _a;
|
|
129
|
+
const activeSignature = React.useMemo(() => {
|
|
130
|
+
var _a;
|
|
131
|
+
return props.signature.signatures[(_a = props.signature.activeSignature) !== null && _a !== void 0 ? _a : 0];
|
|
132
|
+
}, [props.signature]);
|
|
133
|
+
let documentation = null;
|
|
134
|
+
if (activeSignature) {
|
|
135
|
+
if (typeof activeSignature.documentation === 'string') {
|
|
136
|
+
documentation = activeSignature.documentation;
|
|
137
|
+
}
|
|
138
|
+
else if ((_a = activeSignature.documentation) === null || _a === void 0 ? void 0 : _a.value) {
|
|
139
|
+
documentation = activeSignature.documentation.value;
|
|
140
|
+
}
|
|
141
|
+
// after setting its value check if it's empty, then set to null
|
|
142
|
+
if (documentation && isEmptyMarkdown(documentation)) {
|
|
143
|
+
documentation = null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// split up label into arguments so we can highlight the active one
|
|
147
|
+
const splitLabel = React.useMemo(() => {
|
|
148
|
+
if (!activeSignature || !activeSignature.label || typeof props.signature.activeParameter !== 'number') {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
// Regex to extract the function name and arguments
|
|
152
|
+
const regex = /^(\w+)\((.*)\)$/;
|
|
153
|
+
const match = activeSignature.label.match(regex);
|
|
154
|
+
// invalid format
|
|
155
|
+
if (!match) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
const functionName = match[1]; // e.g., "name"
|
|
159
|
+
const argumentsString = match[2]; // e.g., "arg1, arg2, ..."
|
|
160
|
+
if (!argumentsString) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
// Split arguments based on commas, taking care not to split inside argument values (e.g., nested parentheses)
|
|
164
|
+
const argumentList = argumentsString.split(/,(?![^(]*\))/);
|
|
165
|
+
// out of range
|
|
166
|
+
if (props.signature.activeParameter >= argumentList.length) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
functionName,
|
|
171
|
+
argumentList,
|
|
172
|
+
};
|
|
173
|
+
}, [activeSignature, props.signature.activeParameter]);
|
|
174
|
+
if (!activeSignature) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return (_jsxs(SignatureTooltipWrapper, { children: [splitLabel && (_jsxs(CodeWrapper, { children: [_jsxs("span", { children: [splitLabel.functionName, "("] }), splitLabel.argumentList.map((arg, idx) => (_jsxs("span", { style: {
|
|
178
|
+
fontWeight: idx === props.signature.activeParameter ? 'bold' : 'normal',
|
|
179
|
+
}, children: [arg, idx < splitLabel.argumentList.length - 1 && ', '] }, idx))), _jsx("span", { children: ")" })] })), !splitLabel && _jsx(CodeWrapper, { children: activeSignature.label }), documentation && (_jsx(DocsWrapper, { children: _jsx(Markdown, { markdown: documentation }) }))] }));
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Create a function to get the argument hints for the current function call.
|
|
183
|
+
*
|
|
184
|
+
* Adapted from:
|
|
185
|
+
* https://github.com/ChromeDevTools/devtools-frontend/blob/68ead267f2b342b5488b73a73660ca2d040071f6/front_end/ui/components/text_editor/javascript.ts
|
|
186
|
+
*
|
|
187
|
+
* @param client - the websocket client
|
|
188
|
+
* @param uri - the uri of the file
|
|
189
|
+
* @param tooltipRef - a ref to the tooltip element
|
|
190
|
+
* @param setTooltipContent - a function to set the content of the tooltip
|
|
191
|
+
*/
|
|
192
|
+
function getArgumentHints(client, uri, tooltipRef, setTooltipContent) {
|
|
193
|
+
return function getArgumentHintsInner(state, pos) {
|
|
194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
var _a;
|
|
196
|
+
const node = syntaxTree(state).resolveInner(pos).enterUnfinishedNodesBefore(pos);
|
|
197
|
+
if (node.name !== 'ArgList') {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const callee = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.getChild('Expression');
|
|
201
|
+
if (!callee) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
const linePosInfo = state.doc.lineAt(pos);
|
|
205
|
+
const line = linePosInfo.number - 1;
|
|
206
|
+
const signature = yield getLspSignatureHelp(client, uri, line, pos - linePosInfo.from);
|
|
207
|
+
if (!signature || !signature.signatures.length) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
create: () => {
|
|
212
|
+
const dom = tooltipRef.current;
|
|
213
|
+
setTooltipContent(_jsx(SignatureHelpTooltip, { signature: signature }));
|
|
214
|
+
return {
|
|
215
|
+
dom,
|
|
216
|
+
destroy: () => {
|
|
217
|
+
setTooltipContent(null);
|
|
218
|
+
},
|
|
219
|
+
overlap: true,
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
update: () => {
|
|
223
|
+
setTooltipContent(_jsx(SignatureHelpTooltip, { signature: signature }));
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Close the argument hints tooltip.
|
|
231
|
+
*/
|
|
232
|
+
export function closeArgumentsHintsTooltip(view) {
|
|
233
|
+
view.dispatch({ effects: closeTooltip.of(null) });
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Creates an argument hints tooltip, displaying signature help for the current function call.
|
|
238
|
+
*
|
|
239
|
+
* @param client - the websocket client
|
|
240
|
+
* @param uri - the uri of the file
|
|
241
|
+
* @param tooltipRef - a ref to the tooltip element
|
|
242
|
+
* @param setTooltipContent - a function to set the content of the tooltip
|
|
243
|
+
*/
|
|
244
|
+
export function argumentHints(client, uri, tooltipRef, setTooltipContent) {
|
|
245
|
+
if (!uri || !client) {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
return cursorTooltip(getArgumentHints(client, uri, tooltipRef, setTooltipContent));
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=argument-hints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument-hints.js","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/argument-hints.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAQ,CAAC;AASvD;;;;GAI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I,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CACzB,MAA4B,EAC5B,GAA8B,EAC9B,UAAuC,EACvC,iBAAgD;IAEhD,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,aAAa,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-folding.d.ts","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/code-folding.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,mBAAmB,CAAC;AA0EhE,eAAO,MAAM,qBAAqB,QAAO,SASxC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { codeFolding, foldGutter, foldKeymap } from '@codemirror/language';
|
|
2
|
+
import { keymap } from '@codemirror/view';
|
|
3
|
+
/**
|
|
4
|
+
* Prepare the placeholder text for a folded range
|
|
5
|
+
* This is the text that will be displayed when the range is folded
|
|
6
|
+
* (e.g., "... X lines")
|
|
7
|
+
*
|
|
8
|
+
* @param state - the editor state
|
|
9
|
+
* @param range - the range to fold
|
|
10
|
+
* @returns - the placeholder text
|
|
11
|
+
*/
|
|
12
|
+
function preparePlaceholder(state, range) {
|
|
13
|
+
// Get the folded range's line count
|
|
14
|
+
const startPos = range.from;
|
|
15
|
+
const endPos = range.to;
|
|
16
|
+
const lineCount = state.doc.lineAt(endPos).number - state.doc.lineAt(startPos).number;
|
|
17
|
+
// Return the custom placeholder text (e.g., "Folded: 3 lines")
|
|
18
|
+
return `... ${lineCount} ${lineCount === 1 ? 'line' : 'lines'}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create the DOM element for a folded range
|
|
22
|
+
* This is the element that will be displayed when the range is folded
|
|
23
|
+
*
|
|
24
|
+
* @param view - the editor view
|
|
25
|
+
* @param onclick - the click handler to toggle folding
|
|
26
|
+
* @param prepared - the prepared placeholder text
|
|
27
|
+
* @returns - the DOM element for the folded range
|
|
28
|
+
*/
|
|
29
|
+
function placeholderDOM(view, onclick, prepared) {
|
|
30
|
+
const span = document.createElement('span');
|
|
31
|
+
span.setAttribute('aria-label', 'folded code');
|
|
32
|
+
span.setAttribute('title', 'unfold');
|
|
33
|
+
span.setAttribute('contenteditable', 'false');
|
|
34
|
+
span.className = 'cm-foldPlaceholder';
|
|
35
|
+
span.textContent = prepared; // Display the prepared text (e.g., "Folded: X lines")
|
|
36
|
+
// Add the default click handler to toggle folding
|
|
37
|
+
span.addEventListener('click', onclick);
|
|
38
|
+
return span;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A function that creates the DOM element used to indicate a given line is folded or can be folded.
|
|
42
|
+
*
|
|
43
|
+
* @param open - a boolean indicating whether the line is open or closed
|
|
44
|
+
* @returns - the DOM element for the marker
|
|
45
|
+
*/
|
|
46
|
+
function markerDOM(open) {
|
|
47
|
+
const span = document.createElement('span');
|
|
48
|
+
span.setAttribute('aria-label', 'fold marker');
|
|
49
|
+
span.setAttribute('title', open ? 'fold' : 'unfold');
|
|
50
|
+
span.setAttribute('contenteditable', 'false');
|
|
51
|
+
span.className = 'cm-foldMarker';
|
|
52
|
+
span.textContent = '›';
|
|
53
|
+
if (!open) {
|
|
54
|
+
span.style.display = 'inline-block';
|
|
55
|
+
span.style.transform = 'rotate(90deg)';
|
|
56
|
+
}
|
|
57
|
+
return span;
|
|
58
|
+
}
|
|
59
|
+
export const codeFoldingExtensions = () => [
|
|
60
|
+
foldGutter({
|
|
61
|
+
markerDOM,
|
|
62
|
+
}),
|
|
63
|
+
codeFolding({
|
|
64
|
+
placeholderDOM,
|
|
65
|
+
preparePlaceholder,
|
|
66
|
+
}),
|
|
67
|
+
keymap.of(foldKeymap),
|
|
68
|
+
];
|
|
69
|
+
//# sourceMappingURL=code-folding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-folding.js","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/code-folding.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CACvB,KAAkB,EAClB,KAGC;IAED,oCAAoC;IACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC;IAC5B,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC;IACxB,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IAEtF,+DAA+D;IAC/D,OAAO,OAAO,SAAS,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AACpE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAC,IAAgB,EAAE,OAA+B,EAAE,QAAa;IACpF,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAC/C,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAC9C,IAAI,CAAC,SAAS,GAAG,oBAAoB,CAAC;IACtC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC,sDAAsD;IAEnF,kDAAkD;IAClD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAExC,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAa;IAC5B,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAC/C,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAC9C,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;IACjC,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;IAEvB,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC;IAC3C,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAc,EAAE,CAAC;IAClD,UAAU,CAAC;QACP,SAAS;KACZ,CAAC;IACF,WAAW,CAAC;QACR,cAAc;QACd,kBAAkB;KACrB,CAAC;IACF,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
/**
|
|
3
|
+
* Get the extensions for JSON
|
|
4
|
+
* Currently includes:
|
|
5
|
+
* - lineNumbers
|
|
6
|
+
* - json
|
|
7
|
+
* - jsonLanguage
|
|
8
|
+
* - linter
|
|
9
|
+
* - bracketMatching
|
|
10
|
+
* - closeBrackets
|
|
11
|
+
* - codeFoldingExtensions
|
|
12
|
+
*
|
|
13
|
+
* @returns - an array of extensions for JSON
|
|
14
|
+
*/
|
|
15
|
+
export declare const getJSONExtensions: () => Extension[];
|
|
16
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/json.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAAS,EAQ7C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { closeBrackets } from '@codemirror/autocomplete';
|
|
2
|
+
import { json, jsonLanguage, jsonParseLinter } from '@codemirror/lang-json';
|
|
3
|
+
import { bracketMatching } from '@codemirror/language';
|
|
4
|
+
import { linter } from '@codemirror/lint';
|
|
5
|
+
import { lineNumbers } from '@codemirror/view';
|
|
6
|
+
import { codeFoldingExtensions } from './code-folding';
|
|
7
|
+
/**
|
|
8
|
+
* Get the extensions for JSON
|
|
9
|
+
* Currently includes:
|
|
10
|
+
* - lineNumbers
|
|
11
|
+
* - json
|
|
12
|
+
* - jsonLanguage
|
|
13
|
+
* - linter
|
|
14
|
+
* - bracketMatching
|
|
15
|
+
* - closeBrackets
|
|
16
|
+
* - codeFoldingExtensions
|
|
17
|
+
*
|
|
18
|
+
* @returns - an array of extensions for JSON
|
|
19
|
+
*/
|
|
20
|
+
export const getJSONExtensions = () => [
|
|
21
|
+
lineNumbers(),
|
|
22
|
+
json(),
|
|
23
|
+
jsonLanguage,
|
|
24
|
+
linter(jsonParseLinter()),
|
|
25
|
+
bracketMatching(),
|
|
26
|
+
closeBrackets(),
|
|
27
|
+
codeFoldingExtensions(),
|
|
28
|
+
];
|
|
29
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/json.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAgB,EAAE,CAAC;IAChD,WAAW,EAAE;IACb,IAAI,EAAE;IACN,YAAY;IACZ,MAAM,CAAC,eAAe,EAAE,CAAC;IACzB,eAAe,EAAE;IACjB,aAAa,EAAE;IACf,qBAAqB,EAAE;CAC1B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
2
|
+
import { type SignatureHelp } from 'vscode-languageserver-types';
|
|
3
|
+
import type { LspDefinitionResponse, LspHoverResponse, WsClient } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Helper to get LSP completions
|
|
6
|
+
*
|
|
7
|
+
* @param client - the websocket client
|
|
8
|
+
* @param context - the completion context
|
|
9
|
+
* @param uri - the uri of the file
|
|
10
|
+
*/
|
|
11
|
+
export declare function getLspCompletion(client: WsClient, context: CompletionContext, uri: string): Promise<CompletionResult | null>;
|
|
12
|
+
/**
|
|
13
|
+
* Helper to send hover request to backend
|
|
14
|
+
*
|
|
15
|
+
* @param client - the websocket client
|
|
16
|
+
* @param uri - the uri of the file
|
|
17
|
+
* @param line - the line number
|
|
18
|
+
* @param ch - the character number
|
|
19
|
+
*/
|
|
20
|
+
export declare function getLspInspection(client: WsClient, uri: string, line: number, ch: number): Promise<LspHoverResponse | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Helper to get definition from LSP server
|
|
23
|
+
*
|
|
24
|
+
* @param client - the websocket client
|
|
25
|
+
* @param uri - the uri of the file
|
|
26
|
+
* @param line - the line number
|
|
27
|
+
* @param ch - the character number
|
|
28
|
+
*/
|
|
29
|
+
export declare function getLspDefinition(client: WsClient, uri: string, line: number, ch: number): Promise<LspDefinitionResponse | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Helper function to get signature help from LSP server
|
|
32
|
+
*
|
|
33
|
+
* @param client - the websocket client
|
|
34
|
+
* @param uri - the uri of the file
|
|
35
|
+
* @param line - the line number
|
|
36
|
+
* @param ch - the character number
|
|
37
|
+
*/
|
|
38
|
+
export declare function getLspSignatureHelp(client: WsClient, uri: string, line: number, ch: number): Promise<SignatureHelp | null>;
|
|
39
|
+
//# sourceMappingURL=lsp-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-utils.d.ts","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/lsp-utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEhG,OAAO,EAA2C,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE1G,OAAO,KAAK,EAER,qBAAqB,EACrB,gBAAgB,EAGhB,QAAQ,EACX,MAAM,UAAU,CAAC;AA4GlB;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,MAAM,GACZ,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA0HlC;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,QAAQ,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA2BlC;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,QAAQ,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CA2BvC;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,QAAQ,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA2B/B"}
|