@difizen/libro-cofine-editor 0.1.18 → 0.1.19
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/es/editor-contribution.d.ts.map +1 -1
- package/es/editor-contribution.js +2 -1
- package/es/language/python/data/snippets/python.snippets.json +0 -30
- package/es/libro-e2-editor.d.ts +5 -5
- package/es/libro-e2-editor.d.ts.map +1 -1
- package/es/libro-e2-editor.js +68 -65
- package/es/libro-e2-preload.d.ts.map +1 -1
- package/es/libro-e2-preload.js +1 -3
- package/package.json +7 -7
- package/src/editor-contribution.ts +2 -5
- package/src/language/python/data/snippets/python.snippets.json +0 -30
- package/src/libro-e2-editor.ts +55 -39
- package/src/libro-e2-preload.ts +0 -2
- package/es/language/lsp/completion-provider.d.ts +0 -13
- package/es/language/lsp/completion-provider.d.ts.map +0 -1
- package/es/language/lsp/completion-provider.js +0 -294
- package/es/language/lsp/diagnostic-provider.d.ts +0 -27
- package/es/language/lsp/diagnostic-provider.d.ts.map +0 -1
- package/es/language/lsp/diagnostic-provider.js +0 -230
- package/es/language/lsp/format-provider.d.ts +0 -9
- package/es/language/lsp/format-provider.d.ts.map +0 -1
- package/es/language/lsp/format-provider.js +0 -143
- package/es/language/lsp/hover-provider.d.ts +0 -8
- package/es/language/lsp/hover-provider.d.ts.map +0 -1
- package/es/language/lsp/hover-provider.js +0 -136
- package/es/language/lsp/language-feature-provider.d.ts +0 -22
- package/es/language/lsp/language-feature-provider.d.ts.map +0 -1
- package/es/language/lsp/language-feature-provider.js +0 -194
- package/es/language/lsp/lsp-contribution.d.ts +0 -22
- package/es/language/lsp/lsp-contribution.d.ts.map +0 -1
- package/es/language/lsp/lsp-contribution.js +0 -135
- package/es/language/lsp/module.d.ts +0 -2
- package/es/language/lsp/module.d.ts.map +0 -1
- package/es/language/lsp/module.js +0 -3
- package/es/language/lsp/semantic-highlight-provider.d.ts +0 -9
- package/es/language/lsp/semantic-highlight-provider.d.ts.map +0 -1
- package/es/language/lsp/semantic-highlight-provider.js +0 -41
- package/es/language/lsp/signature-help-provider.d.ts +0 -8
- package/es/language/lsp/signature-help-provider.d.ts.map +0 -1
- package/es/language/lsp/signature-help-provider.js +0 -108
- package/es/language/lsp/type-concerters.d.ts +0 -7
- package/es/language/lsp/type-concerters.d.ts.map +0 -1
- package/es/language/lsp/type-concerters.js +0 -35
- package/src/language/lsp/completion-provider.ts +0 -213
- package/src/language/lsp/diagnostic-provider.ts +0 -168
- package/src/language/lsp/format-provider.ts +0 -88
- package/src/language/lsp/hover-provider.ts +0 -98
- package/src/language/lsp/language-feature-provider.ts +0 -107
- package/src/language/lsp/lsp-contribution.ts +0 -129
- package/src/language/lsp/module.ts +0 -5
- package/src/language/lsp/semantic-highlight-provider.ts +0 -26
- package/src/language/lsp/signature-help-provider.ts +0 -65
- package/src/language/lsp/type-concerters.ts +0 -72
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-contribution.d.ts","sourceRoot":"","sources":["../src/editor-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"editor-contribution.d.ts","sourceRoot":"","sources":["../src/editor-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAIpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAGL,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,qBACa,yBAA0B,YAAW,sBAAsB;IAEtE,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAE9D,OAAO,EAAE,iBAAiB,CAAC;IAE3B,aAAa,+DAAwB;gBAGL,oBAAoB,EAAE,oBAAoB;IAK1E,YAAY,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAKnC;IAEF,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAOhC"}
|
|
@@ -9,6 +9,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
9
9
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
10
10
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
11
11
|
import { CodeEditorContribution } from '@difizen/libro-code-editor';
|
|
12
|
+
import { MIME } from '@difizen/libro-common';
|
|
12
13
|
import { inject, singleton } from '@difizen/mana-app';
|
|
13
14
|
import { LanguageSpecRegistry } from "./language-specs.js";
|
|
14
15
|
import { e2StateFactory, libroE2DefaultConfig, LibroE2EditorFactory } from "./libro-e2-editor.js";
|
|
@@ -32,7 +33,7 @@ export var LibroE2EditorContribution = (_dec = singleton({
|
|
|
32
33
|
_createClass(LibroE2EditorContribution, [{
|
|
33
34
|
key: "canHandle",
|
|
34
35
|
value: function canHandle(mime) {
|
|
35
|
-
var mimes = [
|
|
36
|
+
var mimes = [MIME.odpssql, MIME.python, MIME.prompt];
|
|
36
37
|
if (mimes.includes(mime)) {
|
|
37
38
|
return 50 + 1;
|
|
38
39
|
}
|
|
@@ -189,35 +189,5 @@
|
|
|
189
189
|
"prefix": "async/with",
|
|
190
190
|
"body": ["async with ${1:expr} as ${2:var}:", "\t${3:block}"],
|
|
191
191
|
"description": "Code snippet for an async with statement"
|
|
192
|
-
},
|
|
193
|
-
"ipdb": {
|
|
194
|
-
"scope": "python",
|
|
195
|
-
"prefix": "ipdb",
|
|
196
|
-
"body": ["import ipdb; ipdb.set_trace()"],
|
|
197
|
-
"description": "Code snippet for ipdb debug"
|
|
198
|
-
},
|
|
199
|
-
"pdb": {
|
|
200
|
-
"scope": "python",
|
|
201
|
-
"prefix": "pdb",
|
|
202
|
-
"body": ["import pdb; pdb.set_trace()"],
|
|
203
|
-
"description": "Code snippet for pdb debug"
|
|
204
|
-
},
|
|
205
|
-
"pudb": {
|
|
206
|
-
"scope": "python",
|
|
207
|
-
"prefix": "pudb",
|
|
208
|
-
"body": ["import pudb; pudb.set_trace()"],
|
|
209
|
-
"description": "Code snippet for pudb debug"
|
|
210
|
-
},
|
|
211
|
-
"add/new/cell": {
|
|
212
|
-
"scope": "python",
|
|
213
|
-
"prefix": "add/new/cell",
|
|
214
|
-
"body": ["# %%"],
|
|
215
|
-
"description": "Code snippet to add a new cell"
|
|
216
|
-
},
|
|
217
|
-
"mark/markdown": {
|
|
218
|
-
"scope": "python",
|
|
219
|
-
"prefix": "mark/markdown",
|
|
220
|
-
"body": ["# %% [markdown]"],
|
|
221
|
-
"description": "Code snippet to add a new markdown cell"
|
|
222
192
|
}
|
|
223
193
|
}
|
package/es/libro-e2-editor.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { CodeEditorFactory, CompletionProvider, EditorState, EditorStateFactory, ICoordinate, IEditor, IEditorConfig, IEditorOptions, IModel, IPosition, IRange, SearchMatch, TooltipProvider } from '@difizen/libro-code-editor';
|
|
1
|
+
import type { CodeEditorFactory, CompletionProvider, EditorState, EditorStateFactory, ICoordinate, IEditor, IEditorConfig, IEditorOptions, IModel, IModelContentChange, IPosition, IRange, SearchMatch, TooltipProvider } from '@difizen/libro-code-editor';
|
|
2
2
|
import type { E2Editor } from '@difizen/libro-cofine-editor-core';
|
|
3
3
|
import type { LSPProvider } from '@difizen/libro-lsp';
|
|
4
4
|
import { CommandRegistry, Deferred, ThemeService } from '@difizen/mana-app';
|
|
5
5
|
import { DisposableCollection, Emitter } from '@difizen/mana-app';
|
|
6
6
|
import 'resize-observer-polyfill';
|
|
7
7
|
import * as monaco from '@difizen/monaco-editor-core';
|
|
8
|
-
import { LSPContribution } from './language/lsp/lsp-contribution.js';
|
|
9
8
|
import { LanguageSpecRegistry } from './language-specs.js';
|
|
10
9
|
import { PlaceholderContentWidget } from './placeholder.js';
|
|
11
10
|
import type { MonacoEditorOptions, MonacoEditorType, MonacoMatch } from './types.js';
|
|
@@ -161,7 +160,6 @@ export declare const libroE2DefaultConfig: Required<LibroE2EditorConfig>;
|
|
|
161
160
|
export declare const LibroE2EditorFactory: unique symbol;
|
|
162
161
|
export type LibroE2EditorFactory = CodeEditorFactory;
|
|
163
162
|
export declare const E2EditorClassname = "libro-e2-editor";
|
|
164
|
-
export declare const LibroE2URIScheme = "libro-e2";
|
|
165
163
|
export type E2EditorState = monaco.editor.ITextModel | null;
|
|
166
164
|
export declare const e2StateFactory: (languageSpecRegistry: LanguageSpecRegistry) => EditorStateFactory<E2EditorState>;
|
|
167
165
|
export declare class LibroE2Editor implements IEditor {
|
|
@@ -170,7 +168,6 @@ export declare class LibroE2Editor implements IEditor {
|
|
|
170
168
|
protected readonly themeService: ThemeService;
|
|
171
169
|
protected readonly languageSpecRegistry: LanguageSpecRegistry;
|
|
172
170
|
protected readonly commandRegistry: CommandRegistry;
|
|
173
|
-
protected lspContribution: LSPContribution;
|
|
174
171
|
protected defaultLineHeight: number;
|
|
175
172
|
protected toDispose: DisposableCollection;
|
|
176
173
|
/**
|
|
@@ -202,6 +199,8 @@ export declare class LibroE2Editor implements IEditor {
|
|
|
202
199
|
get editor(): E2Editor<MonacoEditorType> | undefined;
|
|
203
200
|
get monacoEditor(): MonacoEditorType | undefined;
|
|
204
201
|
get lineCount(): number;
|
|
202
|
+
protected onModelContentChangedEmitter: Emitter<IModelContentChange[]>;
|
|
203
|
+
onModelContentChanged: import("@difizen/mana-app").Event<IModelContentChange[]>;
|
|
205
204
|
lspProvider?: LSPProvider;
|
|
206
205
|
completionProvider?: CompletionProvider;
|
|
207
206
|
tooltipProvider?: TooltipProvider;
|
|
@@ -257,6 +256,7 @@ export declare class LibroE2Editor implements IEditor {
|
|
|
257
256
|
endLineNumber: number;
|
|
258
257
|
endColumn: number;
|
|
259
258
|
};
|
|
259
|
+
protected toEditorRange(range: monaco.IRange): IRange;
|
|
260
260
|
getSelectionValue: (range?: IRange | undefined) => string | undefined;
|
|
261
261
|
getPositionAt: (offset: number) => IPosition | undefined;
|
|
262
262
|
protected toMonacoMatch(match: SearchMatch): MonacoMatch;
|
|
@@ -276,13 +276,13 @@ export declare class LibroE2Editor implements IEditor {
|
|
|
276
276
|
setSelections: (selections: IRange[]) => void;
|
|
277
277
|
revealSelection: (selection: IRange) => void;
|
|
278
278
|
highlightMatches: (matches: SearchMatch[], currentIndex: number | undefined) => void;
|
|
279
|
+
format: () => void;
|
|
279
280
|
protected _isDisposed: boolean;
|
|
280
281
|
/**
|
|
281
282
|
* Tests whether the editor is disposed.
|
|
282
283
|
*/
|
|
283
284
|
get disposed(): boolean;
|
|
284
285
|
dispose: () => void;
|
|
285
|
-
disposeLSP(): void;
|
|
286
286
|
disposeResizeObserver: () => void;
|
|
287
287
|
}
|
|
288
288
|
//# sourceMappingURL=libro-e2-editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-e2-editor.d.ts","sourceRoot":"","sources":["../src/libro-e2-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,aAAa,EACb,cAAc,EACd,MAAM,EACN,SAAS,EACT,MAAM,EACN,WAAW,E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AM,UAQ7C;IAEF,iBAAiB,UAAW;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,UAM3D;IAEF,iBAAiB,kBAOf;IACF,iBAAiB,aAAc,SAAS,UAKtC;IACF,YAAY;;;MAYV;IACF,YAAY,cAAe,MAAM,UAE/B;IACF,aAAa,iBAeX;IACF,aAAa,eAAgB,MAAM,EAAE,UAYnC;IAEF,eAAe,cAAe,MAAM,UAElC;IACF,gBAAgB,YAAa,WAAW,EAAE,gBAAgB,MAAM,GAAG,SAAS,UAiC1E;IAEF,MAAM,aAEJ;IAEF,SAAS,CAAC,WAAW,UAAS;IAC9B;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,OAAO,aAQL;IAEF,qBAAqB,aAInB;CACH"}
|
package/es/libro-e2-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2,
|
|
1
|
+
var _dec, _dec2, _class, _class2, _descriptor;
|
|
2
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
3
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
4
4
|
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,14 +16,14 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
16
16
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
17
|
import { defaultConfig } from '@difizen/libro-code-editor';
|
|
18
18
|
import { EditorProvider, MonacoEnvironment } from '@difizen/libro-cofine-editor-core';
|
|
19
|
+
import { MIME } from '@difizen/libro-common';
|
|
19
20
|
import { NotebookCommands } from '@difizen/libro-core';
|
|
20
21
|
import { CommandRegistry, Deferred, getOrigin, inject, ThemeService, transient, watch } from '@difizen/mana-app';
|
|
21
22
|
import { Disposable, DisposableCollection, Emitter } from '@difizen/mana-app';
|
|
22
|
-
import { editor, Selection } from '@difizen/monaco-editor-core';
|
|
23
|
+
import { editor, KeyCode, Selection } from '@difizen/monaco-editor-core';
|
|
23
24
|
import 'resize-observer-polyfill';
|
|
24
25
|
import * as monaco from '@difizen/monaco-editor-core';
|
|
25
26
|
import { v4 } from 'uuid';
|
|
26
|
-
import { LSPContribution } from "./language/lsp/lsp-contribution.js";
|
|
27
27
|
import { LanguageSpecRegistry } from "./language-specs.js";
|
|
28
28
|
import { PlaceholderContentWidget } from "./placeholder.js";
|
|
29
29
|
import { MonacoRange, MonacoUri } from "./types.js";
|
|
@@ -38,7 +38,7 @@ export var libroE2DefaultConfig = _objectSpread(_objectSpread({}, defaultConfig)
|
|
|
38
38
|
},
|
|
39
39
|
scrollBarHeight: 12,
|
|
40
40
|
mode: 'null',
|
|
41
|
-
mimetype:
|
|
41
|
+
mimetype: MIME.python,
|
|
42
42
|
smartIndent: true,
|
|
43
43
|
electricChars: true,
|
|
44
44
|
keyMap: 'default',
|
|
@@ -83,16 +83,12 @@ export var libroE2DefaultConfig = _objectSpread(_objectSpread({}, defaultConfig)
|
|
|
83
83
|
});
|
|
84
84
|
export var LibroE2EditorFactory = Symbol('LibroE2EditorFactory');
|
|
85
85
|
export var E2EditorClassname = 'libro-e2-editor';
|
|
86
|
-
export var LibroE2URIScheme = 'libro-e2';
|
|
87
86
|
export var e2StateFactory = function e2StateFactory(languageSpecRegistry) {
|
|
88
87
|
return function (options) {
|
|
89
88
|
var spec = languageSpecRegistry.languageSpecs.find(function (item) {
|
|
90
89
|
return item.mime === options.model.mimeType;
|
|
91
90
|
});
|
|
92
|
-
var uri = MonacoUri.
|
|
93
|
-
scheme: LibroE2URIScheme,
|
|
94
|
-
path: "".concat(options.uuid).concat(spec === null || spec === void 0 ? void 0 : spec.ext[0])
|
|
95
|
-
});
|
|
91
|
+
var uri = MonacoUri.parse(options.uuid);
|
|
96
92
|
var monacoModel = monaco.editor.createModel(options.model.value, spec === null || spec === void 0 ? void 0 : spec.language, uri);
|
|
97
93
|
return {
|
|
98
94
|
state: monacoModel,
|
|
@@ -105,18 +101,19 @@ export var e2StateFactory = function e2StateFactory(languageSpecRegistry) {
|
|
|
105
101
|
};
|
|
106
102
|
};
|
|
107
103
|
};
|
|
108
|
-
export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
104
|
+
export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
109
105
|
function LibroE2Editor(options, state, themeService, languageSpecRegistry) {
|
|
110
106
|
var _this = this;
|
|
111
107
|
_classCallCheck(this, LibroE2Editor);
|
|
112
108
|
this.editorReadyDeferred = new Deferred();
|
|
113
109
|
this.editorReady = this.editorReadyDeferred.promise;
|
|
114
110
|
_initializerDefineProperty(this, "commandRegistry", _descriptor, this);
|
|
115
|
-
_initializerDefineProperty(this, "lspContribution", _descriptor2, this);
|
|
116
111
|
this.defaultLineHeight = 20;
|
|
117
112
|
this.toDispose = new DisposableCollection();
|
|
118
113
|
this.oldDeltaDecorations = [];
|
|
119
114
|
this._uuid = '';
|
|
115
|
+
this.onModelContentChangedEmitter = new Emitter();
|
|
116
|
+
this.onModelContentChanged = this.onModelContentChangedEmitter.event;
|
|
120
117
|
this.isLayouting = false;
|
|
121
118
|
this.onThemeChange = function () {
|
|
122
119
|
var _this$monacoEditor;
|
|
@@ -326,6 +323,10 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
326
323
|
}
|
|
327
324
|
}
|
|
328
325
|
};
|
|
326
|
+
this.format = function () {
|
|
327
|
+
var _this$monacoEditor29;
|
|
328
|
+
(_this$monacoEditor29 = _this.monacoEditor) === null || _this$monacoEditor29 === void 0 || _this$monacoEditor29.trigger('libro-format', 'editor.action.formatDocument', '');
|
|
329
|
+
};
|
|
329
330
|
this._isDisposed = false;
|
|
330
331
|
this.dispose = function () {
|
|
331
332
|
if (_this.disposed) {
|
|
@@ -333,7 +334,6 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
333
334
|
}
|
|
334
335
|
_this.placeholder.dispose();
|
|
335
336
|
_this.disposeResizeObserver();
|
|
336
|
-
_this.disposeLSP();
|
|
337
337
|
_this.toDispose.dispose();
|
|
338
338
|
_this._isDisposed = true;
|
|
339
339
|
};
|
|
@@ -405,8 +405,8 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
405
405
|
}, {
|
|
406
406
|
key: "lineCount",
|
|
407
407
|
get: function get() {
|
|
408
|
-
var _this$
|
|
409
|
-
return ((_this$
|
|
408
|
+
var _this$monacoEditor30;
|
|
409
|
+
return ((_this$monacoEditor30 = this.monacoEditor) === null || _this$monacoEditor30 === void 0 || (_this$monacoEditor30 = _this$monacoEditor30.getModel()) === null || _this$monacoEditor30 === void 0 ? void 0 : _this$monacoEditor30.getLineCount()) || 0;
|
|
410
410
|
}
|
|
411
411
|
}, {
|
|
412
412
|
key: "languageSpec",
|
|
@@ -451,7 +451,7 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
451
451
|
*
|
|
452
452
|
*/
|
|
453
453
|
// overflowWidgetsDomNode: document.getElementById('monaco-editor-overflow-widgets-root')!,
|
|
454
|
-
|
|
454
|
+
fixedOverflowWidgets: true,
|
|
455
455
|
suggest: {
|
|
456
456
|
snippetsPreventQuickSuggestions: false
|
|
457
457
|
},
|
|
@@ -496,12 +496,12 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
496
496
|
var _this$languageSpec,
|
|
497
497
|
_this$languageSpec$be,
|
|
498
498
|
_this$monacoEditor$on,
|
|
499
|
-
_this$
|
|
499
|
+
_this$monacoEditor31,
|
|
500
500
|
_this3 = this,
|
|
501
501
|
_this$monacoEditor$on2,
|
|
502
|
-
_this$monacoEditor31,
|
|
503
|
-
_this$monacoEditor$on3,
|
|
504
502
|
_this$monacoEditor32,
|
|
503
|
+
_this$monacoEditor$on3,
|
|
504
|
+
_this$monacoEditor33,
|
|
505
505
|
_this$languageSpec2,
|
|
506
506
|
_this$languageSpec2$a;
|
|
507
507
|
var editorConfig, editorPorvider, model, options;
|
|
@@ -534,16 +534,23 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
534
534
|
model: getOrigin(model)
|
|
535
535
|
});
|
|
536
536
|
this._editor = editorPorvider.create(host, options);
|
|
537
|
-
this.toDispose.push((_this$monacoEditor$on = (_this$
|
|
537
|
+
this.toDispose.push((_this$monacoEditor$on = (_this$monacoEditor31 = this.monacoEditor) === null || _this$monacoEditor31 === void 0 ? void 0 : _this$monacoEditor31.onDidChangeModelContent(function (e) {
|
|
538
538
|
var _this3$monacoEditor;
|
|
539
539
|
var value = (_this3$monacoEditor = _this3.monacoEditor) === null || _this3$monacoEditor === void 0 ? void 0 : _this3$monacoEditor.getValue();
|
|
540
540
|
_this3.model.value = value !== null && value !== void 0 ? value : '';
|
|
541
|
-
|
|
541
|
+
_this3.onModelContentChangedEmitter.fire(e.changes.map(function (item) {
|
|
542
|
+
return {
|
|
543
|
+
range: _this3.toEditorRange(item.range),
|
|
544
|
+
rangeLength: item.rangeLength,
|
|
545
|
+
rangeOffset: item.rangeOffset,
|
|
546
|
+
text: item.text
|
|
547
|
+
};
|
|
548
|
+
}));
|
|
542
549
|
})) !== null && _this$monacoEditor$on !== void 0 ? _this$monacoEditor$on : Disposable.NONE);
|
|
543
|
-
this.toDispose.push((_this$monacoEditor$on2 = (_this$
|
|
550
|
+
this.toDispose.push((_this$monacoEditor$on2 = (_this$monacoEditor32 = this.monacoEditor) === null || _this$monacoEditor32 === void 0 ? void 0 : _this$monacoEditor32.onDidContentSizeChange(function () {
|
|
544
551
|
_this3.updateEditorSize();
|
|
545
552
|
})) !== null && _this$monacoEditor$on2 !== void 0 ? _this$monacoEditor$on2 : Disposable.NONE);
|
|
546
|
-
this.toDispose.push((_this$monacoEditor$on3 = (_this$
|
|
553
|
+
this.toDispose.push((_this$monacoEditor$on3 = (_this$monacoEditor33 = this.monacoEditor) === null || _this$monacoEditor33 === void 0 ? void 0 : _this$monacoEditor33.onDidBlurEditorText(function () {
|
|
547
554
|
_this3.blur();
|
|
548
555
|
})) !== null && _this$monacoEditor$on3 !== void 0 ? _this$monacoEditor$on3 : Disposable.NONE);
|
|
549
556
|
this.updateEditorSize();
|
|
@@ -560,11 +567,6 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
560
567
|
// this.monacoEditor._themeService,
|
|
561
568
|
// this.monacoEditor._themeService.getColorTheme(),
|
|
562
569
|
// );
|
|
563
|
-
|
|
564
|
-
// setTimeout(() => {
|
|
565
|
-
// this.monacoEditor?.trigger('editor', 'editor.action.formatDocument');
|
|
566
|
-
// console.log('trigger format');
|
|
567
|
-
// }, 5000);
|
|
568
570
|
case 22:
|
|
569
571
|
case "end":
|
|
570
572
|
return _context.stop();
|
|
@@ -596,16 +598,16 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
596
598
|
key: "updateEditorSize",
|
|
597
599
|
value: function updateEditorSize() {
|
|
598
600
|
try {
|
|
599
|
-
var _this$monacoEditor$ge, _this$
|
|
601
|
+
var _this$monacoEditor$ge, _this$monacoEditor34, _this$monacoEditor35;
|
|
600
602
|
this.isLayouting = true;
|
|
601
|
-
var contentHeight = (_this$monacoEditor$ge = (_this$
|
|
603
|
+
var contentHeight = (_this$monacoEditor$ge = (_this$monacoEditor34 = this.monacoEditor) === null || _this$monacoEditor34 === void 0 ? void 0 : _this$monacoEditor34.getContentHeight()) !== null && _this$monacoEditor$ge !== void 0 ? _this$monacoEditor$ge : this.defaultLineHeight;
|
|
602
604
|
if (this.editorContentHeight === contentHeight) {
|
|
603
605
|
return;
|
|
604
606
|
} else {
|
|
605
607
|
this.editorContentHeight = contentHeight;
|
|
606
608
|
}
|
|
607
609
|
this.host.style.height = "".concat(contentHeight + this.getOption('paddingTop') + this.getOption('paddingBottom'), "px");
|
|
608
|
-
(_this$
|
|
610
|
+
(_this$monacoEditor35 = this.monacoEditor) === null || _this$monacoEditor35 === void 0 || _this$monacoEditor35.layout({
|
|
609
611
|
width: this.host.offsetWidth,
|
|
610
612
|
height: contentHeight
|
|
611
613
|
});
|
|
@@ -621,42 +623,39 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
621
623
|
}, {
|
|
622
624
|
key: "handleCommand",
|
|
623
625
|
value: function handleCommand(commandRegistry) {
|
|
624
|
-
var _this$
|
|
626
|
+
var _this$monacoEditor36, _this$monacoEditor37, _this$monacoEditor38, _this$monacoEditor39, _this$monacoEditor40, _this$monacoEditor41;
|
|
625
627
|
// need monaco 0.34
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
// command: null,
|
|
641
|
-
// },
|
|
642
|
-
(_this$monacoEditor35 = this.monacoEditor) === null || _this$monacoEditor35 === void 0 || _this$monacoEditor35.addCommand(9, function () {
|
|
628
|
+
editor.addKeybindingRules([{
|
|
629
|
+
// disable show command center
|
|
630
|
+
keybinding: KeyCode.F1,
|
|
631
|
+
command: null
|
|
632
|
+
}, {
|
|
633
|
+
// disable show error command
|
|
634
|
+
keybinding: KeyCode.F8,
|
|
635
|
+
command: null
|
|
636
|
+
}, {
|
|
637
|
+
// disable toggle debugger breakpoint
|
|
638
|
+
keybinding: KeyCode.F9,
|
|
639
|
+
command: null
|
|
640
|
+
}]);
|
|
641
|
+
(_this$monacoEditor36 = this.monacoEditor) === null || _this$monacoEditor36 === void 0 || _this$monacoEditor36.addCommand(9, function () {
|
|
643
642
|
commandRegistry.executeCommand(NotebookCommands['EnterCommandMode'].id);
|
|
644
643
|
}, '!editorHasSelection && !editorHasSelection && !editorHasMultipleSelections');
|
|
645
|
-
(_this$
|
|
644
|
+
(_this$monacoEditor37 = this.monacoEditor) === null || _this$monacoEditor37 === void 0 || _this$monacoEditor37.addCommand(2048 | 3, function () {
|
|
646
645
|
commandRegistry.executeCommand(NotebookCommands['RunCell'].id);
|
|
647
646
|
}, '!findWidgetVisible && !referenceSearchVisible');
|
|
648
|
-
(_this$
|
|
647
|
+
(_this$monacoEditor38 = this.monacoEditor) === null || _this$monacoEditor38 === void 0 || _this$monacoEditor38.addCommand(1024 | 3, function () {
|
|
649
648
|
commandRegistry.executeCommand(NotebookCommands['RunCellAndSelectNext'].id);
|
|
650
649
|
}, '!findInputFocussed');
|
|
651
|
-
(_this$
|
|
650
|
+
(_this$monacoEditor39 = this.monacoEditor) === null || _this$monacoEditor39 === void 0 || _this$monacoEditor39.addCommand(512 | 3, function () {
|
|
652
651
|
commandRegistry.executeCommand(NotebookCommands['RunCellAndInsertBelow'].id);
|
|
653
652
|
}, '!findWidgetVisible');
|
|
654
|
-
(_this$
|
|
653
|
+
(_this$monacoEditor40 = this.monacoEditor) === null || _this$monacoEditor40 === void 0 || _this$monacoEditor40.addCommand(2048 | 1024 | 83, function () {
|
|
655
654
|
commandRegistry.executeCommand(NotebookCommands['SplitCellAntCursor'].id);
|
|
656
655
|
}
|
|
657
656
|
// '!findWidgetVisible',
|
|
658
657
|
);
|
|
659
|
-
(_this$
|
|
658
|
+
(_this$monacoEditor41 = this.monacoEditor) === null || _this$monacoEditor41 === void 0 || _this$monacoEditor41.addCommand(2048 | 36, function () {
|
|
660
659
|
commandRegistry.executeCommand('libro-search:toggle');
|
|
661
660
|
}
|
|
662
661
|
// '!findWidgetVisible',
|
|
@@ -681,8 +680,8 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
681
680
|
* cell 切换没走这里
|
|
682
681
|
*/
|
|
683
682
|
function onMimeTypeChanged() {
|
|
684
|
-
var _this$
|
|
685
|
-
var model = (_this$
|
|
683
|
+
var _this$monacoEditor42;
|
|
684
|
+
var model = (_this$monacoEditor42 = this.monacoEditor) === null || _this$monacoEditor42 === void 0 ? void 0 : _this$monacoEditor42.getModel();
|
|
686
685
|
if (this.languageSpec && model) {
|
|
687
686
|
editor.setModelLanguage(model, this.languageSpec.language);
|
|
688
687
|
}
|
|
@@ -723,6 +722,20 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
723
722
|
};
|
|
724
723
|
return monacoSelection;
|
|
725
724
|
}
|
|
725
|
+
}, {
|
|
726
|
+
key: "toEditorRange",
|
|
727
|
+
value: function toEditorRange(range) {
|
|
728
|
+
return {
|
|
729
|
+
start: {
|
|
730
|
+
line: range.startLineNumber - 1,
|
|
731
|
+
column: range.startColumn - 1
|
|
732
|
+
},
|
|
733
|
+
end: {
|
|
734
|
+
line: range.endLineNumber - 1,
|
|
735
|
+
column: range.endColumn - 1
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
}
|
|
726
739
|
}, {
|
|
727
740
|
key: "toMonacoMatch",
|
|
728
741
|
value: function toMonacoMatch(match) {
|
|
@@ -744,11 +757,6 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
744
757
|
function get() {
|
|
745
758
|
return this._isDisposed;
|
|
746
759
|
}
|
|
747
|
-
}, {
|
|
748
|
-
key: "disposeLSP",
|
|
749
|
-
value: function disposeLSP() {
|
|
750
|
-
this.lspContribution.disposeLanguageFeature();
|
|
751
|
-
}
|
|
752
760
|
}]);
|
|
753
761
|
return LibroE2Editor;
|
|
754
762
|
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "commandRegistry", [_dec2], {
|
|
@@ -756,9 +764,4 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
756
764
|
enumerable: true,
|
|
757
765
|
writable: true,
|
|
758
766
|
initializer: null
|
|
759
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "lspContribution", [_dec3], {
|
|
760
|
-
configurable: true,
|
|
761
|
-
enumerable: true,
|
|
762
|
-
writable: true,
|
|
763
|
-
initializer: null
|
|
764
767
|
})), _class2)) || _class);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-e2-preload.d.ts","sourceRoot":"","sources":["../src/libro-e2-preload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-e2-preload.d.ts","sourceRoot":"","sources":["../src/libro-e2-preload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAK7C,eAAO,MAAM,gBAAgB,gBAAuB,CAAC;AAErD,eAAO,MAAM,MAAM,mBAA0B,QAAQ,SAAS,kBAW7D,CAAC"}
|
package/es/libro-e2-preload.js
CHANGED
|
@@ -4,7 +4,6 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
4
4
|
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); }); }; }
|
|
5
5
|
import { MonacoEnvironment } from '@difizen/libro-cofine-editor-core';
|
|
6
6
|
import { Deferred } from '@difizen/mana-app';
|
|
7
|
-
import { LSPFeatureModule } from "./language/lsp/module.js";
|
|
8
7
|
import { PythonLanguageFeature } from "./language/python/module.js";
|
|
9
8
|
import { LibroE2ThemeModule } from "./theme/module.js";
|
|
10
9
|
export var E2LoadedDeferred = new Deferred();
|
|
@@ -29,8 +28,7 @@ export var loadE2 = /*#__PURE__*/function () {
|
|
|
29
28
|
container.load(textmate.TextmateModule);
|
|
30
29
|
container.load(PythonLanguageFeature);
|
|
31
30
|
container.load(LibroE2ThemeModule);
|
|
32
|
-
|
|
33
|
-
case 7:
|
|
31
|
+
case 6:
|
|
34
32
|
case "end":
|
|
35
33
|
return _context.stop();
|
|
36
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-cofine-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@difizen/monaco-editor-core": "0.39.4",
|
|
36
|
-
"@difizen/libro-cofine-editor-core": "^0.1.
|
|
37
|
-
"@difizen/libro-cofine-textmate": "^0.1.
|
|
38
|
-
"@difizen/libro-lsp": "^0.1.
|
|
39
|
-
"@difizen/libro-code-editor": "^0.1.
|
|
40
|
-
"@difizen/libro-common": "^0.1.
|
|
41
|
-
"@difizen/libro-core": "^0.1.
|
|
36
|
+
"@difizen/libro-cofine-editor-core": "^0.1.19",
|
|
37
|
+
"@difizen/libro-cofine-textmate": "^0.1.19",
|
|
38
|
+
"@difizen/libro-lsp": "^0.1.19",
|
|
39
|
+
"@difizen/libro-code-editor": "^0.1.19",
|
|
40
|
+
"@difizen/libro-common": "^0.1.19",
|
|
41
|
+
"@difizen/libro-core": "^0.1.19",
|
|
42
42
|
"@difizen/mana-app": "latest",
|
|
43
43
|
"resize-observer-polyfill": "^1.5.1",
|
|
44
44
|
"vscode-languageserver-protocol": "^3.17.4",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CodeEditorFactory, EditorStateFactory } from '@difizen/libro-code-editor';
|
|
2
2
|
import { CodeEditorContribution } from '@difizen/libro-code-editor';
|
|
3
|
+
import { MIME } from '@difizen/libro-common';
|
|
3
4
|
import { inject, singleton } from '@difizen/mana-app';
|
|
4
5
|
|
|
5
6
|
import { LanguageSpecRegistry } from './language-specs.js';
|
|
@@ -32,11 +33,7 @@ export class LibroE2EditorContribution implements CodeEditorContribution {
|
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
canHandle(mime: string): number {
|
|
35
|
-
const mimes = [
|
|
36
|
-
'application/vnd.libro.sql+json',
|
|
37
|
-
'text/x-python',
|
|
38
|
-
'application/vnd.libro.prompt+json',
|
|
39
|
-
];
|
|
36
|
+
const mimes = [MIME.odpssql, MIME.python, MIME.prompt] as string[];
|
|
40
37
|
if (mimes.includes(mime)) {
|
|
41
38
|
return 50 + 1;
|
|
42
39
|
}
|
|
@@ -189,35 +189,5 @@
|
|
|
189
189
|
"prefix": "async/with",
|
|
190
190
|
"body": ["async with ${1:expr} as ${2:var}:", "\t${3:block}"],
|
|
191
191
|
"description": "Code snippet for an async with statement"
|
|
192
|
-
},
|
|
193
|
-
"ipdb": {
|
|
194
|
-
"scope": "python",
|
|
195
|
-
"prefix": "ipdb",
|
|
196
|
-
"body": ["import ipdb; ipdb.set_trace()"],
|
|
197
|
-
"description": "Code snippet for ipdb debug"
|
|
198
|
-
},
|
|
199
|
-
"pdb": {
|
|
200
|
-
"scope": "python",
|
|
201
|
-
"prefix": "pdb",
|
|
202
|
-
"body": ["import pdb; pdb.set_trace()"],
|
|
203
|
-
"description": "Code snippet for pdb debug"
|
|
204
|
-
},
|
|
205
|
-
"pudb": {
|
|
206
|
-
"scope": "python",
|
|
207
|
-
"prefix": "pudb",
|
|
208
|
-
"body": ["import pudb; pudb.set_trace()"],
|
|
209
|
-
"description": "Code snippet for pudb debug"
|
|
210
|
-
},
|
|
211
|
-
"add/new/cell": {
|
|
212
|
-
"scope": "python",
|
|
213
|
-
"prefix": "add/new/cell",
|
|
214
|
-
"body": ["# %%"],
|
|
215
|
-
"description": "Code snippet to add a new cell"
|
|
216
|
-
},
|
|
217
|
-
"mark/markdown": {
|
|
218
|
-
"scope": "python",
|
|
219
|
-
"prefix": "mark/markdown",
|
|
220
|
-
"body": ["# %% [markdown]"],
|
|
221
|
-
"description": "Code snippet to add a new markdown cell"
|
|
222
192
|
}
|
|
223
193
|
}
|