@difizen/libro-cofine-editor 0.1.2 → 0.1.4
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/language/lsp/diagnostic-provider.d.ts +6 -1
- package/es/language/lsp/diagnostic-provider.d.ts.map +1 -1
- package/es/language/lsp/diagnostic-provider.js +17 -2
- package/es/language/lsp/lsp-contribution.d.ts +1 -1
- package/es/language/lsp/lsp-contribution.d.ts.map +1 -1
- package/es/language/lsp/lsp-contribution.js +8 -5
- package/es/libro-e2-editor.d.ts +4 -2
- package/es/libro-e2-editor.d.ts.map +1 -1
- package/es/libro-e2-editor.js +38 -27
- package/package.json +7 -7
- package/src/language/lsp/diagnostic-provider.ts +77 -64
- package/src/language/lsp/lsp-contribution.ts +10 -4
- package/src/libro-e2-editor.ts +38 -20
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { LibroService } from '@difizen/libro-core';
|
|
2
2
|
import type { LSPConnection, VirtualDocument } from '@difizen/libro-lsp';
|
|
3
|
+
import { DisposableCollection } from '@difizen/mana-app';
|
|
4
|
+
import type { Disposable } from '@difizen/mana-app';
|
|
3
5
|
import * as monaco from '@difizen/monaco-editor-core';
|
|
4
6
|
import { LangaugeFeatureProvider } from './language-feature-provider.js';
|
|
5
7
|
export declare enum MarkerSeverity {
|
|
@@ -8,7 +10,8 @@ export declare enum MarkerSeverity {
|
|
|
8
10
|
Warning = 4,
|
|
9
11
|
Error = 8
|
|
10
12
|
}
|
|
11
|
-
export declare class DiagnosticProvider extends LangaugeFeatureProvider {
|
|
13
|
+
export declare class DiagnosticProvider extends LangaugeFeatureProvider implements Disposable {
|
|
14
|
+
protected toDispose: DisposableCollection;
|
|
12
15
|
constructor(libroService: LibroService, lspConnection: LSPConnection, virtualDocument: VirtualDocument);
|
|
13
16
|
protected diagnosticList: {
|
|
14
17
|
model: monaco.editor.ITextModel;
|
|
@@ -18,5 +21,7 @@ export declare class DiagnosticProvider extends LangaugeFeatureProvider {
|
|
|
18
21
|
protected clearDiagnostic(): void;
|
|
19
22
|
protected displayDiagnostic(): void;
|
|
20
23
|
processDiagnostic(): Promise<void>;
|
|
24
|
+
disposed: boolean;
|
|
25
|
+
dispose(): void;
|
|
21
26
|
}
|
|
22
27
|
//# sourceMappingURL=diagnostic-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic-provider.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/diagnostic-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AAKtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,oBAAY,cAAc;IACxB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,OAAO,IAAI;IACX,KAAK,IAAI;CACV;AASD,qBAAa,kBAAmB,SAAQ,
|
|
1
|
+
{"version":3,"file":"diagnostic-provider.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/diagnostic-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AAKtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,oBAAY,cAAc;IACxB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,OAAO,IAAI;IACX,KAAK,IAAI;CACV;AASD,qBAAa,kBAAmB,SAAQ,uBAAwB,YAAW,UAAU;IACnF,SAAS,CAAC,SAAS,uBAA8B;gBAE/C,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe;IAMlC,SAAS,CAAC,cAAc,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;QAChC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;KACtC,EAAE,CAAM;IAET,SAAS,CAAC,aAAa,CACrB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW;IAgBnC,SAAS,CAAC,eAAe;IAazB,SAAS,CAAC,iBAAiB;IAOrB,iBAAiB;IAuEvB,QAAQ,UAAS;IACjB,OAAO;CAQR"}
|
|
@@ -15,6 +15,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
15
15
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
16
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
17
17
|
import { EditorCellView } from '@difizen/libro-core';
|
|
18
|
+
import { DisposableCollection } from '@difizen/mana-app';
|
|
18
19
|
import * as monaco from '@difizen/monaco-editor-core';
|
|
19
20
|
import { LibroE2Editor } from "../../libro-e2-editor.js";
|
|
20
21
|
import { MonacoRange, MonacoUri } from "../../types.js";
|
|
@@ -39,7 +40,9 @@ export var DiagnosticProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
|
39
40
|
var _this;
|
|
40
41
|
_classCallCheck(this, DiagnosticProvider);
|
|
41
42
|
_this = _super.call(this, libroService, lspConnection, virtualDocument);
|
|
43
|
+
_this.toDispose = new DisposableCollection();
|
|
42
44
|
_this.diagnosticList = [];
|
|
45
|
+
_this.disposed = false;
|
|
43
46
|
_this.processDiagnostic();
|
|
44
47
|
return _this;
|
|
45
48
|
}
|
|
@@ -89,10 +92,11 @@ export var DiagnosticProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
|
89
92
|
value: function () {
|
|
90
93
|
var _processDiagnostic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
91
94
|
var _this2 = this;
|
|
95
|
+
var toDispose;
|
|
92
96
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
93
97
|
while (1) switch (_context.prev = _context.next) {
|
|
94
98
|
case 0:
|
|
95
|
-
this.lspConnection.serverNotifications['textDocument/publishDiagnostics'].event(function (e) {
|
|
99
|
+
toDispose = this.lspConnection.serverNotifications['textDocument/publishDiagnostics'].event(function (e) {
|
|
96
100
|
_this2.diagnosticList = [];
|
|
97
101
|
e.diagnostics.forEach(function (diagnostic) {
|
|
98
102
|
var _editor$monacoEditor, _diagnostic$relatedIn;
|
|
@@ -145,7 +149,8 @@ export var DiagnosticProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
|
145
149
|
});
|
|
146
150
|
_this2.displayDiagnostic();
|
|
147
151
|
});
|
|
148
|
-
|
|
152
|
+
this.toDispose.push(toDispose);
|
|
153
|
+
case 2:
|
|
149
154
|
case "end":
|
|
150
155
|
return _context.stop();
|
|
151
156
|
}
|
|
@@ -156,6 +161,16 @@ export var DiagnosticProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
|
156
161
|
}
|
|
157
162
|
return processDiagnostic;
|
|
158
163
|
}()
|
|
164
|
+
}, {
|
|
165
|
+
key: "dispose",
|
|
166
|
+
value: function dispose() {
|
|
167
|
+
if (this.disposed) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
this.toDispose.dispose();
|
|
171
|
+
this.clearDiagnostic();
|
|
172
|
+
this.disposed = true;
|
|
173
|
+
}
|
|
159
174
|
}]);
|
|
160
175
|
return DiagnosticProvider;
|
|
161
176
|
}(LangaugeFeatureProvider);
|
|
@@ -19,7 +19,7 @@ export declare class LSPContribution implements EditorHandlerContribution {
|
|
|
19
19
|
registerLSPFeature(editor: monaco.editor.IStandaloneCodeEditor): void;
|
|
20
20
|
protected isDisposed: boolean;
|
|
21
21
|
get disposed(): boolean;
|
|
22
|
-
|
|
22
|
+
disposeLanguageFeature(): void;
|
|
23
23
|
dispose(): void;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=lsp-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-contribution.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/lsp-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"lsp-contribution.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/lsp-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAc,oBAAoB,EAAqB,MAAM,mBAAmB,CAAC;AACxF,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AAStD,qBAGa,eAAgB,YAAW,yBAAyB;IAE/D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;IAEvC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAGpE,SAAS,CAAC,QAAQ,CAAC,4BAA4B,EAAE,6BAA6B,CAAC;IAE/E,SAAS,CAAC,SAAS,uBAA8B;IAEjD,SAAS,CAAC,QAAQ,WAAc;IAEhC,YAAY;IAGZ,WAAW,CAAC,MAAM,EAAE,GAAG;IAGvB,SAAS,CAAC,QAAQ,EAAE,MAAM;IAI1B,mBAAmB,CACjB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,GAC9B,MAAM,CAAC,SAAS,CAAC,cAAc;IAO5B,kBAAkB;IAkBlB,gBAAgB;IActB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB;IAkE9D,SAAS,CAAC,UAAU,UAAS;IAE7B,IAAI,QAAQ,YAEX;IAED,sBAAsB;IAItB,OAAO;CAIR"}
|
|
@@ -20,7 +20,7 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decor
|
|
|
20
20
|
import { EditorHandlerContribution, LanguageOptionsRegistry } from '@difizen/libro-cofine-editor-core';
|
|
21
21
|
import { LibroService } from '@difizen/libro-core';
|
|
22
22
|
import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
|
|
23
|
-
import { DisposableCollection, inject, singleton } from '@difizen/mana-app';
|
|
23
|
+
import { Disposable, DisposableCollection, inject, singleton } from '@difizen/mana-app';
|
|
24
24
|
import * as monaco from '@difizen/monaco-editor-core';
|
|
25
25
|
import { LibroE2URIScheme } from "../../libro-e2-editor.js";
|
|
26
26
|
import { CompletionProvider } from "./completion-provider.js";
|
|
@@ -153,7 +153,10 @@ export var LSPContribution = (_dec = singleton({
|
|
|
153
153
|
}
|
|
154
154
|
_this.toDispose.push(monaco.languages.registerCompletionItemProvider(_this.getLanguageSelector(model), new CompletionProvider(_this.libroService, lspConnection, virtualDocument)));
|
|
155
155
|
_this.toDispose.push(monaco.languages.registerHoverProvider(_this.getLanguageSelector(model), new HoverProvider(_this.libroService, lspConnection, virtualDocument)));
|
|
156
|
-
new DiagnosticProvider(_this.libroService, lspConnection, virtualDocument);
|
|
156
|
+
var provider = new DiagnosticProvider(_this.libroService, lspConnection, virtualDocument);
|
|
157
|
+
_this.toDispose.push(Disposable.create(function () {
|
|
158
|
+
return provider.dispose();
|
|
159
|
+
}));
|
|
157
160
|
_this.toDispose.push(monaco.languages.registerSignatureHelpProvider(_this.getLanguageSelector(model), new SignatureHelpProvider(_this.libroService, lspConnection, virtualDocument)));
|
|
158
161
|
// const formatProvider = new FormatProvider(
|
|
159
162
|
// this.libroService,
|
|
@@ -183,14 +186,14 @@ export var LSPContribution = (_dec = singleton({
|
|
|
183
186
|
return this.isDisposed;
|
|
184
187
|
}
|
|
185
188
|
}, {
|
|
186
|
-
key: "
|
|
187
|
-
value: function
|
|
189
|
+
key: "disposeLanguageFeature",
|
|
190
|
+
value: function disposeLanguageFeature() {
|
|
188
191
|
this.toDispose.dispose();
|
|
189
192
|
}
|
|
190
193
|
}, {
|
|
191
194
|
key: "dispose",
|
|
192
195
|
value: function dispose() {
|
|
193
|
-
this.
|
|
196
|
+
this.disposeLanguageFeature();
|
|
194
197
|
this.isDisposed = false;
|
|
195
198
|
}
|
|
196
199
|
}]);
|
package/es/libro-e2-editor.d.ts
CHANGED
|
@@ -178,6 +178,7 @@ export declare class LibroE2Editor implements IEditor {
|
|
|
178
178
|
protected oldDeltaDecorations: string[];
|
|
179
179
|
protected _config: LibroE2EditorConfig;
|
|
180
180
|
private resizeObserver;
|
|
181
|
+
private editorContentHeight;
|
|
181
182
|
protected _uuid: string;
|
|
182
183
|
/**
|
|
183
184
|
* The uuid of this editor;
|
|
@@ -271,7 +272,8 @@ export declare class LibroE2Editor implements IEditor {
|
|
|
271
272
|
* Tests whether the editor is disposed.
|
|
272
273
|
*/
|
|
273
274
|
get disposed(): boolean;
|
|
274
|
-
dispose()
|
|
275
|
-
|
|
275
|
+
dispose: () => void;
|
|
276
|
+
disposeLSP(): void;
|
|
277
|
+
disposeResizeObserver: () => void;
|
|
276
278
|
}
|
|
277
279
|
//# 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,OAAO,EACP,aAAa,EACb,cAAc,EACd,MAAM,EACN,SAAS,EACT,MAAM,EACN,WAAW,EACX,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,eAAe,EAEf,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAc,oBAAoB,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,0BAA0B,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErF,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IA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AkB,mBAA0B;IACtD,IAAI,aAAa,+CAEhB;IAED,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM;;;;;;IAWrC,iBAAiB,WAAY,MAAM,GAAG,SAAS,wBAK7C;IAEF,aAAa,WAAY,MAAM,KAAG,SAAS,GAAG,SAAS,CAGrD;IAEF,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;IAexD,gBAAgB,SAAU,MAAM,SAAS,MAAM,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,SAAS,CAAC,WAAW,UAAS;IAC9B;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,OAAO,aASL;IAEF,UAAU;IAIV,qBAAqB,aAInB;CACH"}
|
package/es/libro-e2-editor.js
CHANGED
|
@@ -301,8 +301,20 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
301
301
|
}
|
|
302
302
|
};
|
|
303
303
|
this._isDisposed = false;
|
|
304
|
+
this.dispose = function () {
|
|
305
|
+
if (_this.disposed) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
_this.placeholder.dispose();
|
|
309
|
+
_this.disposeResizeObserver();
|
|
310
|
+
_this.disposeLSP();
|
|
311
|
+
_this.toDispose.dispose();
|
|
312
|
+
_this._isDisposed = true;
|
|
313
|
+
};
|
|
304
314
|
this.disposeResizeObserver = function () {
|
|
305
|
-
_this.resizeObserver
|
|
315
|
+
if (_this.resizeObserver) {
|
|
316
|
+
_this.resizeObserver.disconnect();
|
|
317
|
+
}
|
|
306
318
|
};
|
|
307
319
|
this.themeService = themeService;
|
|
308
320
|
this.languageSpecRegistry = languageSpecRegistry;
|
|
@@ -431,7 +443,9 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
431
443
|
matchBrackets: editorConfig.matchBrackets ? 'always' : 'never',
|
|
432
444
|
rulers: editorConfig.rulers,
|
|
433
445
|
wordWrapColumn: editorConfig.wordWrapColumn,
|
|
434
|
-
'semanticHighlighting.enabled': true
|
|
446
|
+
'semanticHighlighting.enabled': true,
|
|
447
|
+
maxTokenizationLineLength: 10000
|
|
448
|
+
// wrappingStrategy: 'advanced',
|
|
435
449
|
};
|
|
436
450
|
}
|
|
437
451
|
}, {
|
|
@@ -488,7 +502,7 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
488
502
|
var _this3$monacoEditor;
|
|
489
503
|
var value = (_this3$monacoEditor = _this3.monacoEditor) === null || _this3$monacoEditor === void 0 ? void 0 : _this3$monacoEditor.getValue();
|
|
490
504
|
_this3.model.value = value !== null && value !== void 0 ? value : '';
|
|
491
|
-
|
|
505
|
+
// this.updateEditorSize();
|
|
492
506
|
})) !== null && _this$monacoEditor$on !== void 0 ? _this$monacoEditor$on : Disposable.NONE);
|
|
493
507
|
this.toDispose.push((_this$monacoEditor$on2 = (_this$monacoEditor31 = this.monacoEditor) === null || _this$monacoEditor31 === void 0 ? void 0 : _this$monacoEditor31.onDidContentSizeChange(function () {
|
|
494
508
|
_this3.updateEditorSize();
|
|
@@ -528,16 +542,16 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
528
542
|
}, {
|
|
529
543
|
key: "inspectResize",
|
|
530
544
|
value: function inspectResize() {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
});
|
|
540
|
-
this.resizeObserver.observe(this.host);
|
|
545
|
+
// this.resizeObserver = new ResizeObserver((entries) => {
|
|
546
|
+
// entries.forEach((entry) => {
|
|
547
|
+
// const isVisible =
|
|
548
|
+
// entry.contentRect.width !== 0 && entry.contentRect.height !== 0;
|
|
549
|
+
// if (isVisible) {
|
|
550
|
+
// this.updateEditorSize();
|
|
551
|
+
// }
|
|
552
|
+
// });
|
|
553
|
+
// });
|
|
554
|
+
// this.resizeObserver.observe(this.host);
|
|
541
555
|
}
|
|
542
556
|
}, {
|
|
543
557
|
key: "getEditorNode",
|
|
@@ -547,12 +561,16 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
547
561
|
}, {
|
|
548
562
|
key: "updateEditorSize",
|
|
549
563
|
value: function updateEditorSize() {
|
|
550
|
-
var _this$monacoEditor$ge, _this$monacoEditor33;
|
|
551
|
-
var contentHeight = (_this$monacoEditor$ge = (_this$monacoEditor33 = this.monacoEditor) === null || _this$monacoEditor33 === void 0 ? void 0 : _this$monacoEditor33.getContentHeight()) !== null && _this$monacoEditor$ge !== void 0 ? _this$monacoEditor$ge : 20;
|
|
552
|
-
this.host.style.height = "".concat(contentHeight + 30, "px");
|
|
553
564
|
try {
|
|
554
|
-
var _this$monacoEditor34;
|
|
565
|
+
var _this$monacoEditor$ge, _this$monacoEditor33, _this$monacoEditor34;
|
|
555
566
|
this.isLayouting = true;
|
|
567
|
+
var contentHeight = (_this$monacoEditor$ge = (_this$monacoEditor33 = this.monacoEditor) === null || _this$monacoEditor33 === void 0 ? void 0 : _this$monacoEditor33.getContentHeight()) !== null && _this$monacoEditor$ge !== void 0 ? _this$monacoEditor$ge : this.defaultLineHeight;
|
|
568
|
+
if (this.editorContentHeight === contentHeight) {
|
|
569
|
+
return;
|
|
570
|
+
} else {
|
|
571
|
+
this.editorContentHeight = contentHeight;
|
|
572
|
+
}
|
|
573
|
+
this.host.style.height = "".concat(contentHeight + this.getOption('paddingTop') + this.getOption('paddingBottom'), "px");
|
|
556
574
|
(_this$monacoEditor34 = this.monacoEditor) === null || _this$monacoEditor34 === void 0 || _this$monacoEditor34.layout({
|
|
557
575
|
width: this.host.offsetWidth,
|
|
558
576
|
height: contentHeight
|
|
@@ -694,16 +712,9 @@ export var LibroE2Editor = (_dec = transient(), _dec2 = inject(CommandRegistry),
|
|
|
694
712
|
return this._isDisposed;
|
|
695
713
|
}
|
|
696
714
|
}, {
|
|
697
|
-
key: "
|
|
698
|
-
value: function
|
|
699
|
-
|
|
700
|
-
return;
|
|
701
|
-
}
|
|
702
|
-
this.placeholder.dispose();
|
|
703
|
-
this.toDispose.dispose();
|
|
704
|
-
this.disposeResizeObserver();
|
|
705
|
-
this.lspContribution.beforeDestory();
|
|
706
|
-
this._isDisposed = true;
|
|
715
|
+
key: "disposeLSP",
|
|
716
|
+
value: function disposeLSP() {
|
|
717
|
+
this.lspContribution.disposeLanguageFeature();
|
|
707
718
|
}
|
|
708
719
|
}]);
|
|
709
720
|
return LibroE2Editor;
|
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.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@difizen/monaco-editor-core": "latest",
|
|
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.4",
|
|
37
|
+
"@difizen/libro-cofine-textmate": "^0.1.4",
|
|
38
|
+
"@difizen/libro-lsp": "^0.1.4",
|
|
39
|
+
"@difizen/libro-code-editor": "^0.1.4",
|
|
40
|
+
"@difizen/libro-common": "^0.1.4",
|
|
41
|
+
"@difizen/libro-core": "^0.1.4",
|
|
42
42
|
"@difizen/mana-app": "latest",
|
|
43
43
|
"resize-observer-polyfill": "^1.5.1",
|
|
44
44
|
"vscode-languageserver-protocol": "^3.17.4",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { LibroService } from '@difizen/libro-core';
|
|
2
2
|
import { EditorCellView } from '@difizen/libro-core';
|
|
3
3
|
import type { LSPConnection, VirtualDocument } from '@difizen/libro-lsp';
|
|
4
|
+
import { DisposableCollection } from '@difizen/mana-app';
|
|
5
|
+
import type { Disposable } from '@difizen/mana-app';
|
|
4
6
|
import * as monaco from '@difizen/monaco-editor-core';
|
|
5
7
|
|
|
6
8
|
import { LibroE2Editor } from '../../libro-e2-editor.js';
|
|
@@ -22,7 +24,8 @@ const vererityMap = {
|
|
|
22
24
|
4: MarkerSeverity.Hint,
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
export class DiagnosticProvider extends LangaugeFeatureProvider {
|
|
27
|
+
export class DiagnosticProvider extends LangaugeFeatureProvider implements Disposable {
|
|
28
|
+
protected toDispose = new DisposableCollection();
|
|
26
29
|
constructor(
|
|
27
30
|
libroService: LibroService,
|
|
28
31
|
lspConnection: LSPConnection,
|
|
@@ -76,73 +79,83 @@ export class DiagnosticProvider extends LangaugeFeatureProvider {
|
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
async processDiagnostic() {
|
|
79
|
-
this.lspConnection.serverNotifications[
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
const toDispose = this.lspConnection.serverNotifications[
|
|
83
|
+
'textDocument/publishDiagnostics'
|
|
84
|
+
].event((e) => {
|
|
85
|
+
this.diagnosticList = [];
|
|
86
|
+
e.diagnostics.forEach((diagnostic) => {
|
|
87
|
+
const { range } = diagnostic;
|
|
88
|
+
// the diagnostic range must be in current editor
|
|
89
|
+
const editor = this.getEditorFromLSPPosition(range);
|
|
90
|
+
if (!editor || editor.getOption('lspEnabled') !== true) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const model = editor?.monacoEditor?.getModel();
|
|
94
|
+
if (!model) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
const editorStart = this.virtualDocument.transformVirtualToEditor({
|
|
99
|
+
line: range.start.line,
|
|
100
|
+
ch: range.start.character,
|
|
101
|
+
isVirtual: true,
|
|
102
|
+
});
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
const editorEnd = this.virtualDocument.transformVirtualToEditor({
|
|
105
|
+
line: range.end.line,
|
|
106
|
+
ch: range.end.character,
|
|
107
|
+
isVirtual: true,
|
|
108
|
+
});
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
if (!editorStart || !editorEnd) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
109
113
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
114
|
+
const markerRange = new MonacoRange(
|
|
115
|
+
editorStart.line + 1,
|
|
116
|
+
editorStart.ch,
|
|
117
|
+
editorEnd.line + 1,
|
|
118
|
+
editorEnd.ch,
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const marker: monaco.editor.IMarkerData = {
|
|
122
|
+
source: diagnostic.source,
|
|
123
|
+
tags: diagnostic.tags,
|
|
124
|
+
message: diagnostic.message,
|
|
125
|
+
code: String(diagnostic.code),
|
|
126
|
+
severity: diagnostic.severity
|
|
127
|
+
? vererityMap[diagnostic.severity]
|
|
128
|
+
: monaco.MarkerSeverity.Info,
|
|
129
|
+
relatedInformation: diagnostic.relatedInformation?.map((item) => {
|
|
130
|
+
return {
|
|
131
|
+
message: item.message,
|
|
132
|
+
resource: MonacoUri.parse(item.location.uri),
|
|
133
|
+
startLineNumber: markerRange.startLineNumber,
|
|
134
|
+
startColumn: markerRange.startColumn,
|
|
135
|
+
endLineNumber: markerRange.endLineNumber,
|
|
136
|
+
endColumn: markerRange.endColumn,
|
|
137
|
+
};
|
|
138
|
+
}),
|
|
139
|
+
startLineNumber: editorStart.line + 1,
|
|
140
|
+
startColumn: editorStart.ch + 1,
|
|
141
|
+
endLineNumber: editorEnd.line + 1,
|
|
142
|
+
endColumn: editorEnd.ch + 1,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
this.addDiagnostic(model, marker);
|
|
146
|
+
});
|
|
143
147
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
);
|
|
148
|
+
this.displayDiagnostic();
|
|
149
|
+
});
|
|
150
|
+
this.toDispose.push(toDispose);
|
|
151
|
+
}
|
|
152
|
+
disposed = false;
|
|
153
|
+
dispose() {
|
|
154
|
+
if (this.disposed) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this.toDispose.dispose();
|
|
158
|
+
this.clearDiagnostic();
|
|
159
|
+
this.disposed = true;
|
|
147
160
|
}
|
|
148
161
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import { LibroService } from '@difizen/libro-core';
|
|
6
6
|
import type { LSPConnection } from '@difizen/libro-lsp';
|
|
7
7
|
import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
|
|
8
|
-
import { DisposableCollection, inject, singleton } from '@difizen/mana-app';
|
|
8
|
+
import { Disposable, DisposableCollection, inject, singleton } from '@difizen/mana-app';
|
|
9
9
|
import * as monaco from '@difizen/monaco-editor-core';
|
|
10
10
|
|
|
11
11
|
import { LibroE2URIScheme } from '../../libro-e2-editor.js';
|
|
@@ -107,7 +107,12 @@ export class LSPContribution implements EditorHandlerContribution {
|
|
|
107
107
|
),
|
|
108
108
|
);
|
|
109
109
|
|
|
110
|
-
new DiagnosticProvider(
|
|
110
|
+
const provider = new DiagnosticProvider(
|
|
111
|
+
this.libroService,
|
|
112
|
+
lspConnection,
|
|
113
|
+
virtualDocument,
|
|
114
|
+
);
|
|
115
|
+
this.toDispose.push(Disposable.create(() => provider.dispose()));
|
|
111
116
|
|
|
112
117
|
this.toDispose.push(
|
|
113
118
|
monaco.languages.registerSignatureHelpProvider(
|
|
@@ -144,16 +149,17 @@ export class LSPContribution implements EditorHandlerContribution {
|
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
protected isDisposed = false;
|
|
152
|
+
|
|
147
153
|
get disposed() {
|
|
148
154
|
return this.isDisposed;
|
|
149
155
|
}
|
|
150
156
|
|
|
151
|
-
|
|
157
|
+
disposeLanguageFeature() {
|
|
152
158
|
this.toDispose.dispose();
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
dispose() {
|
|
156
|
-
this.
|
|
162
|
+
this.disposeLanguageFeature();
|
|
157
163
|
this.isDisposed = false;
|
|
158
164
|
}
|
|
159
165
|
}
|
package/src/libro-e2-editor.ts
CHANGED
|
@@ -301,6 +301,8 @@ export class LibroE2Editor implements IEditor {
|
|
|
301
301
|
|
|
302
302
|
private resizeObserver: ResizeObserver;
|
|
303
303
|
|
|
304
|
+
private editorContentHeight: number;
|
|
305
|
+
|
|
304
306
|
protected _uuid = '';
|
|
305
307
|
/**
|
|
306
308
|
* The uuid of this editor;
|
|
@@ -437,6 +439,8 @@ export class LibroE2Editor implements IEditor {
|
|
|
437
439
|
rulers: editorConfig.rulers,
|
|
438
440
|
wordWrapColumn: editorConfig.wordWrapColumn,
|
|
439
441
|
'semanticHighlighting.enabled': true,
|
|
442
|
+
maxTokenizationLineLength: 10000,
|
|
443
|
+
// wrappingStrategy: 'advanced',
|
|
440
444
|
};
|
|
441
445
|
}
|
|
442
446
|
|
|
@@ -477,7 +481,7 @@ export class LibroE2Editor implements IEditor {
|
|
|
477
481
|
this.monacoEditor?.onDidChangeModelContent(() => {
|
|
478
482
|
const value = this.monacoEditor?.getValue();
|
|
479
483
|
this.model.value = value ?? '';
|
|
480
|
-
this.updateEditorSize();
|
|
484
|
+
// this.updateEditorSize();
|
|
481
485
|
}) ?? Disposable.NONE,
|
|
482
486
|
);
|
|
483
487
|
this.toDispose.push(
|
|
@@ -513,18 +517,16 @@ export class LibroE2Editor implements IEditor {
|
|
|
513
517
|
}
|
|
514
518
|
|
|
515
519
|
protected inspectResize() {
|
|
516
|
-
this.resizeObserver = new ResizeObserver((entries) => {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
this.resizeObserver.observe(this.host);
|
|
520
|
+
// this.resizeObserver = new ResizeObserver((entries) => {
|
|
521
|
+
// entries.forEach((entry) => {
|
|
522
|
+
// const isVisible =
|
|
523
|
+
// entry.contentRect.width !== 0 && entry.contentRect.height !== 0;
|
|
524
|
+
// if (isVisible) {
|
|
525
|
+
// this.updateEditorSize();
|
|
526
|
+
// }
|
|
527
|
+
// });
|
|
528
|
+
// });
|
|
529
|
+
// this.resizeObserver.observe(this.host);
|
|
528
530
|
}
|
|
529
531
|
|
|
530
532
|
protected getEditorNode() {
|
|
@@ -534,10 +536,19 @@ export class LibroE2Editor implements IEditor {
|
|
|
534
536
|
}
|
|
535
537
|
|
|
536
538
|
protected updateEditorSize() {
|
|
537
|
-
const contentHeight = this.monacoEditor?.getContentHeight() ?? 20;
|
|
538
|
-
this.host.style.height = `${contentHeight + 30}px`;
|
|
539
539
|
try {
|
|
540
540
|
this.isLayouting = true;
|
|
541
|
+
const contentHeight =
|
|
542
|
+
this.monacoEditor?.getContentHeight() ?? this.defaultLineHeight;
|
|
543
|
+
if (this.editorContentHeight === contentHeight) {
|
|
544
|
+
return;
|
|
545
|
+
} else {
|
|
546
|
+
this.editorContentHeight = contentHeight;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
this.host.style.height = `${
|
|
550
|
+
contentHeight + this.getOption('paddingTop') + this.getOption('paddingBottom')
|
|
551
|
+
}px`;
|
|
541
552
|
this.monacoEditor?.layout({
|
|
542
553
|
width: this.host.offsetWidth,
|
|
543
554
|
height: contentHeight,
|
|
@@ -906,17 +917,24 @@ export class LibroE2Editor implements IEditor {
|
|
|
906
917
|
get disposed(): boolean {
|
|
907
918
|
return this._isDisposed;
|
|
908
919
|
}
|
|
909
|
-
dispose() {
|
|
920
|
+
dispose = () => {
|
|
910
921
|
if (this.disposed) {
|
|
911
922
|
return;
|
|
912
923
|
}
|
|
913
924
|
this.placeholder.dispose();
|
|
914
|
-
this.toDispose.dispose();
|
|
915
925
|
this.disposeResizeObserver();
|
|
916
|
-
this.
|
|
926
|
+
this.disposeLSP();
|
|
927
|
+
this.toDispose.dispose();
|
|
917
928
|
this._isDisposed = true;
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
disposeLSP() {
|
|
932
|
+
this.lspContribution.disposeLanguageFeature();
|
|
918
933
|
}
|
|
919
|
-
|
|
920
|
-
|
|
934
|
+
|
|
935
|
+
disposeResizeObserver = () => {
|
|
936
|
+
if (this.resizeObserver) {
|
|
937
|
+
this.resizeObserver.disconnect();
|
|
938
|
+
}
|
|
921
939
|
};
|
|
922
940
|
}
|