markstream-vue2 0.0.44 → 0.0.46-beta.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/chunks/cssMode-2f534f78.cjs +1 -0
- package/dist/chunks/cssMode-3f97e3da.js +206 -0
- package/dist/chunks/htmlMode-341fd8a0.cjs +1 -0
- package/dist/chunks/htmlMode-980b2a3d.js +222 -0
- package/dist/chunks/{index-b8d5777d.cjs → index-11432088.cjs} +1 -1
- package/dist/chunks/{index-87cdc60f.js → index-12ec401a.js} +1 -0
- package/dist/chunks/{index-292bb72c.js → index-40b64c02.js} +1 -0
- package/dist/chunks/index-6013a5b2.cjs +1 -0
- package/dist/chunks/{index-e0a22210.js → index-6ae3630b.js} +1 -0
- package/dist/chunks/{index-2a7bea2c.js → index-754b8598.js} +1 -0
- package/dist/chunks/{index-42252d16.js → index-8dc37342.js} +1 -0
- package/dist/chunks/{index-8693b3db.cjs → index-a4867ea2.cjs} +1 -1
- package/dist/chunks/index-e0125777.cjs +1 -0
- package/dist/chunks/{index-91325ae4.cjs → index-fb457079.cjs} +1 -1
- package/dist/chunks/{index.legacy-1c6de434.js → index.legacy-1f634d9d.js} +174442 -100665
- package/dist/chunks/index.legacy-b598deaf.cjs +1 -0
- package/dist/chunks/jsonMode-9ba44ad3.js +921 -0
- package/dist/chunks/jsonMode-d32122b2.cjs +1 -0
- package/dist/chunks/lspLanguageFeatures-7b72a0c0.cjs +1 -0
- package/dist/chunks/{cssMode-32774a06.js → lspLanguageFeatures-8d6ce48e.js} +84 -286
- package/dist/chunks/{tsMode-6444eb2b.js → tsMode-eb76a00c.js} +165 -143
- package/dist/chunks/tsMode-fbe6879d.cjs +1 -0
- package/dist/chunks/workers-ac3ab4dd.cjs +1 -0
- package/dist/chunks/workers-c9c93e2c.js +71 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +25 -7
- package/dist/index.js +4984 -3981
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +30 -11
- package/dist/types/components/CodeBlockNode/HtmlPreviewFrame.vue.d.ts +2 -0
- package/dist/types/components/D2BlockNode/D2BlockNode.vue.d.ts +3 -3
- package/dist/types/components/D2BlockNode/d2.d.ts +13 -2
- package/dist/types/components/HeadingNode/HeadingNode.vue.d.ts +1 -1
- package/dist/types/components/HtmlBlockNode/HtmlBlockNode.vue.d.ts +19 -1
- package/dist/types/components/HtmlInlineNode/HtmlInlineNode.vue.d.ts +2 -0
- package/dist/types/components/ImageNode/ImageNode.vue.d.ts +3 -16
- package/dist/types/components/InfographicBlockNode/InfographicBlockNode.vue.d.ts +4 -3
- package/dist/types/components/InfographicBlockNode/infographic.d.ts +13 -1
- package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.vue.d.ts +54 -14
- package/dist/types/components/MarkdownRenderCompat.vue.d.ts +13 -2
- package/dist/types/components/MathInlineNode/katex.d.ts +5 -2
- package/dist/types/components/MermaidBlockNode/MermaidBlockNode.vue.d.ts +8 -3
- package/dist/types/components/MermaidBlockNode/mermaid.d.ts +16 -2
- package/dist/types/components/NestedRenderer/NestedRenderer.vue.d.ts +1 -1
- package/dist/types/components/NodeRenderer/LegacyNodesRenderer.vue.d.ts +32 -9
- package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +53 -17
- package/dist/types/components/ParagraphNode/ParagraphNode.vue.d.ts +1 -0
- package/dist/types/components/TableNode/TableNode.vue.d.ts +3 -1
- package/dist/types/components/TextNode/streamingTextState.d.ts +2 -11
- package/dist/types/composables/useSafeI18n.d.ts +3 -3
- package/dist/types/composables/useSmoothMarkdownStream.d.ts +21 -0
- package/dist/types/composables/viewportPriority.d.ts +4 -3
- package/dist/types/exports.d.ts +25 -7
- package/dist/types/types/component-props.d.ts +35 -11
- package/dist/types/types/index.d.ts +2 -6
- package/dist/types/utils/codeBlockExtraProps.d.ts +4 -0
- package/dist/types/utils/devEnv.d.ts +1 -0
- package/dist/types/utils/diagramHeight.d.ts +11 -0
- package/dist/types/utils/htmlRenderer.d.ts +5 -27
- package/dist/types/utils/nestedHtml.d.ts +2 -1
- package/dist/types/utils/nestedNodes.d.ts +6 -1
- package/dist/types/utils/normalizeKaTeXRenderInput.d.ts +1 -0
- package/dist/workers/css.worker.js +1 -0
- package/dist/workers/html.worker.js +1 -0
- package/dist/workers/json.worker.js +1 -0
- package/dist/workers/mermaidParser.worker.js +1 -1
- package/dist/workers/ts.worker.js +6 -0
- package/package.json +9 -6
- package/dist/chunks/cssMode-86e8d6e4.cjs +0 -1
- package/dist/chunks/htmlMode-076e483c.js +0 -2060
- package/dist/chunks/htmlMode-f84c7583.cjs +0 -1
- package/dist/chunks/index-c6f74f2d.cjs +0 -1
- package/dist/chunks/index-e1315bc2.cjs +0 -1
- package/dist/chunks/index.legacy-70f0e155.cjs +0 -1
- package/dist/chunks/jsonMode-186d141c.js +0 -2759
- package/dist/chunks/jsonMode-e60229b9.cjs +0 -1
- package/dist/chunks/tsMode-5b9a0ba1.cjs +0 -1
- package/dist/types/components/SoftBreakNode/SoftBreakNode.vue.d.ts +0 -17
- package/dist/types/components/SoftBreakNode/index.d.ts +0 -2
|
@@ -1,85 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "shiki";
|
|
3
|
-
/*!-----------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
6
|
-
* Released under the MIT license
|
|
7
|
-
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
8
|
-
*-----------------------------------------------------------------------------*/
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
22
|
-
var monaco_editor_core_exports = {};
|
|
23
|
-
__reExport(monaco_editor_core_exports, monaco_editor_core_star);
|
|
24
|
-
var STOP_WHEN_IDLE_FOR = 2 * 60 * 1e3;
|
|
25
|
-
var WorkerManager = class {
|
|
26
|
-
constructor(defaults) {
|
|
27
|
-
this._defaults = defaults;
|
|
28
|
-
this._worker = null;
|
|
29
|
-
this._client = null;
|
|
30
|
-
this._idleCheckInterval = window.setInterval(() => this._checkIfIdle(), 30 * 1e3);
|
|
31
|
-
this._lastUsedTime = 0;
|
|
32
|
-
this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());
|
|
33
|
-
}
|
|
34
|
-
_stopWorker() {
|
|
35
|
-
if (this._worker) {
|
|
36
|
-
this._worker.dispose();
|
|
37
|
-
this._worker = null;
|
|
38
|
-
}
|
|
39
|
-
this._client = null;
|
|
40
|
-
}
|
|
41
|
-
dispose() {
|
|
42
|
-
clearInterval(this._idleCheckInterval);
|
|
43
|
-
this._configChangeListener.dispose();
|
|
44
|
-
this._stopWorker();
|
|
45
|
-
}
|
|
46
|
-
_checkIfIdle() {
|
|
47
|
-
if (!this._worker) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
let timePassedSinceLastUsed = Date.now() - this._lastUsedTime;
|
|
51
|
-
if (timePassedSinceLastUsed > STOP_WHEN_IDLE_FOR) {
|
|
52
|
-
this._stopWorker();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
_getClient() {
|
|
56
|
-
this._lastUsedTime = Date.now();
|
|
57
|
-
if (!this._client) {
|
|
58
|
-
this._worker = monaco_editor_core_exports.editor.createWebWorker({
|
|
59
|
-
// module that exports the create() method and returns a `CSSWorker` instance
|
|
60
|
-
moduleId: "vs/language/css/cssWorker",
|
|
61
|
-
label: this._defaults.languageId,
|
|
62
|
-
// passed in to the create() method
|
|
63
|
-
createData: {
|
|
64
|
-
options: this._defaults.options,
|
|
65
|
-
languageId: this._defaults.languageId
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
this._client = this._worker.getProxy();
|
|
69
|
-
}
|
|
70
|
-
return this._client;
|
|
71
|
-
}
|
|
72
|
-
getLanguageServiceWorker(...resources) {
|
|
73
|
-
let _client;
|
|
74
|
-
return this._getClient().then((client) => {
|
|
75
|
-
_client = client;
|
|
76
|
-
}).then((_) => {
|
|
77
|
-
if (this._worker) {
|
|
78
|
-
return this._worker.withSyncedResources(resources);
|
|
79
|
-
}
|
|
80
|
-
}).then((_) => _client);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
1
|
+
import { e as editor, R as Range$1, l as languages, U as Uri, a as MarkerSeverity } from "./index.legacy-1f634d9d.js";
|
|
83
2
|
var DocumentUri;
|
|
84
3
|
(function(DocumentUri2) {
|
|
85
4
|
function is(value) {
|
|
@@ -113,7 +32,7 @@ var uinteger;
|
|
|
113
32
|
uinteger2.is = is;
|
|
114
33
|
})(uinteger || (uinteger = {}));
|
|
115
34
|
var Position;
|
|
116
|
-
(function(
|
|
35
|
+
(function(Position2) {
|
|
117
36
|
function create(line, character) {
|
|
118
37
|
if (line === Number.MAX_VALUE) {
|
|
119
38
|
line = uinteger.MAX_VALUE;
|
|
@@ -123,15 +42,15 @@ var Position;
|
|
|
123
42
|
}
|
|
124
43
|
return { line, character };
|
|
125
44
|
}
|
|
126
|
-
|
|
45
|
+
Position2.create = create;
|
|
127
46
|
function is(value) {
|
|
128
47
|
let candidate = value;
|
|
129
48
|
return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
|
|
130
49
|
}
|
|
131
|
-
|
|
50
|
+
Position2.is = is;
|
|
132
51
|
})(Position || (Position = {}));
|
|
133
52
|
var Range;
|
|
134
|
-
(function(
|
|
53
|
+
(function(Range2) {
|
|
135
54
|
function create(one, two, three, four) {
|
|
136
55
|
if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
|
|
137
56
|
return { start: Position.create(one, two), end: Position.create(three, four) };
|
|
@@ -141,12 +60,12 @@ var Range;
|
|
|
141
60
|
throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`);
|
|
142
61
|
}
|
|
143
62
|
}
|
|
144
|
-
|
|
63
|
+
Range2.create = create;
|
|
145
64
|
function is(value) {
|
|
146
65
|
let candidate = value;
|
|
147
66
|
return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
|
|
148
67
|
}
|
|
149
|
-
|
|
68
|
+
Range2.is = is;
|
|
150
69
|
})(Range || (Range = {}));
|
|
151
70
|
var Location;
|
|
152
71
|
(function(Location2) {
|
|
@@ -1127,7 +1046,7 @@ var TextDocument;
|
|
|
1127
1046
|
return data;
|
|
1128
1047
|
}
|
|
1129
1048
|
})(TextDocument || (TextDocument = {}));
|
|
1130
|
-
|
|
1049
|
+
class FullTextDocument {
|
|
1131
1050
|
constructor(uri, languageId, version, content) {
|
|
1132
1051
|
this._uri = uri;
|
|
1133
1052
|
this._languageId = languageId;
|
|
@@ -1212,7 +1131,7 @@ var FullTextDocument = class {
|
|
|
1212
1131
|
get lineCount() {
|
|
1213
1132
|
return this.getLineOffsets().length;
|
|
1214
1133
|
}
|
|
1215
|
-
}
|
|
1134
|
+
}
|
|
1216
1135
|
var Is;
|
|
1217
1136
|
(function(Is2) {
|
|
1218
1137
|
const toString = Object.prototype.toString;
|
|
@@ -1220,10 +1139,10 @@ var Is;
|
|
|
1220
1139
|
return typeof value !== "undefined";
|
|
1221
1140
|
}
|
|
1222
1141
|
Is2.defined = defined;
|
|
1223
|
-
function
|
|
1142
|
+
function undefined$1(value) {
|
|
1224
1143
|
return typeof value === "undefined";
|
|
1225
1144
|
}
|
|
1226
|
-
Is2.undefined =
|
|
1145
|
+
Is2.undefined = undefined$1;
|
|
1227
1146
|
function boolean(value) {
|
|
1228
1147
|
return value === true || value === false;
|
|
1229
1148
|
}
|
|
@@ -1261,7 +1180,7 @@ var Is;
|
|
|
1261
1180
|
}
|
|
1262
1181
|
Is2.typedArray = typedArray;
|
|
1263
1182
|
})(Is || (Is = {}));
|
|
1264
|
-
|
|
1183
|
+
class DiagnosticsAdapter {
|
|
1265
1184
|
constructor(_languageId, _worker, configChangeEvent) {
|
|
1266
1185
|
this._languageId = _languageId;
|
|
1267
1186
|
this._worker = _worker;
|
|
@@ -1280,7 +1199,7 @@ var DiagnosticsAdapter = class {
|
|
|
1280
1199
|
this._doValidate(model.uri, modeId);
|
|
1281
1200
|
};
|
|
1282
1201
|
const onModelRemoved = (model) => {
|
|
1283
|
-
|
|
1202
|
+
editor.setModelMarkers(model, this._languageId, []);
|
|
1284
1203
|
let uriStr = model.uri.toString();
|
|
1285
1204
|
let listener = this._listener[uriStr];
|
|
1286
1205
|
if (listener) {
|
|
@@ -1288,17 +1207,17 @@ var DiagnosticsAdapter = class {
|
|
|
1288
1207
|
delete this._listener[uriStr];
|
|
1289
1208
|
}
|
|
1290
1209
|
};
|
|
1291
|
-
this._disposables.push(
|
|
1292
|
-
this._disposables.push(
|
|
1210
|
+
this._disposables.push(editor.onDidCreateModel(onModelAdd));
|
|
1211
|
+
this._disposables.push(editor.onWillDisposeModel(onModelRemoved));
|
|
1293
1212
|
this._disposables.push(
|
|
1294
|
-
|
|
1213
|
+
editor.onDidChangeModelLanguage((event) => {
|
|
1295
1214
|
onModelRemoved(event.model);
|
|
1296
1215
|
onModelAdd(event.model);
|
|
1297
1216
|
})
|
|
1298
1217
|
);
|
|
1299
1218
|
this._disposables.push(
|
|
1300
1219
|
configChangeEvent((_) => {
|
|
1301
|
-
|
|
1220
|
+
editor.getModels().forEach((model) => {
|
|
1302
1221
|
if (model.getLanguageId() === this._languageId) {
|
|
1303
1222
|
onModelRemoved(model);
|
|
1304
1223
|
onModelAdd(model);
|
|
@@ -1308,13 +1227,13 @@ var DiagnosticsAdapter = class {
|
|
|
1308
1227
|
);
|
|
1309
1228
|
this._disposables.push({
|
|
1310
1229
|
dispose: () => {
|
|
1311
|
-
|
|
1230
|
+
editor.getModels().forEach(onModelRemoved);
|
|
1312
1231
|
for (let key in this._listener) {
|
|
1313
1232
|
this._listener[key].dispose();
|
|
1314
1233
|
}
|
|
1315
1234
|
}
|
|
1316
1235
|
});
|
|
1317
|
-
|
|
1236
|
+
editor.getModels().forEach(onModelAdd);
|
|
1318
1237
|
}
|
|
1319
1238
|
dispose() {
|
|
1320
1239
|
this._disposables.forEach((d) => d && d.dispose());
|
|
@@ -1325,27 +1244,27 @@ var DiagnosticsAdapter = class {
|
|
|
1325
1244
|
return worker.doValidation(resource.toString());
|
|
1326
1245
|
}).then((diagnostics) => {
|
|
1327
1246
|
const markers = diagnostics.map((d) => toDiagnostics(resource, d));
|
|
1328
|
-
let model =
|
|
1247
|
+
let model = editor.getModel(resource);
|
|
1329
1248
|
if (model && model.getLanguageId() === languageId) {
|
|
1330
|
-
|
|
1249
|
+
editor.setModelMarkers(model, languageId, markers);
|
|
1331
1250
|
}
|
|
1332
1251
|
}).then(void 0, (err) => {
|
|
1333
1252
|
console.error(err);
|
|
1334
1253
|
});
|
|
1335
1254
|
}
|
|
1336
|
-
}
|
|
1255
|
+
}
|
|
1337
1256
|
function toSeverity(lsSeverity) {
|
|
1338
1257
|
switch (lsSeverity) {
|
|
1339
1258
|
case DiagnosticSeverity.Error:
|
|
1340
|
-
return
|
|
1259
|
+
return MarkerSeverity.Error;
|
|
1341
1260
|
case DiagnosticSeverity.Warning:
|
|
1342
|
-
return
|
|
1261
|
+
return MarkerSeverity.Warning;
|
|
1343
1262
|
case DiagnosticSeverity.Information:
|
|
1344
|
-
return
|
|
1263
|
+
return MarkerSeverity.Info;
|
|
1345
1264
|
case DiagnosticSeverity.Hint:
|
|
1346
|
-
return
|
|
1265
|
+
return MarkerSeverity.Hint;
|
|
1347
1266
|
default:
|
|
1348
|
-
return
|
|
1267
|
+
return MarkerSeverity.Info;
|
|
1349
1268
|
}
|
|
1350
1269
|
}
|
|
1351
1270
|
function toDiagnostics(resource, diag) {
|
|
@@ -1361,7 +1280,7 @@ function toDiagnostics(resource, diag) {
|
|
|
1361
1280
|
source: diag.source
|
|
1362
1281
|
};
|
|
1363
1282
|
}
|
|
1364
|
-
|
|
1283
|
+
class CompletionAdapter {
|
|
1365
1284
|
constructor(_worker, _triggerCharacters) {
|
|
1366
1285
|
this._worker = _worker;
|
|
1367
1286
|
this._triggerCharacters = _triggerCharacters;
|
|
@@ -1378,7 +1297,7 @@ var CompletionAdapter = class {
|
|
|
1378
1297
|
return;
|
|
1379
1298
|
}
|
|
1380
1299
|
const wordInfo = model.getWordUntilPosition(position);
|
|
1381
|
-
const wordRange = new
|
|
1300
|
+
const wordRange = new Range$1(
|
|
1382
1301
|
position.lineNumber,
|
|
1383
1302
|
wordInfo.startColumn,
|
|
1384
1303
|
position.lineNumber,
|
|
@@ -1411,7 +1330,7 @@ var CompletionAdapter = class {
|
|
|
1411
1330
|
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
|
1412
1331
|
}
|
|
1413
1332
|
if (entry.insertTextFormat === InsertTextFormat.Snippet) {
|
|
1414
|
-
item.insertTextRules =
|
|
1333
|
+
item.insertTextRules = languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
|
1415
1334
|
}
|
|
1416
1335
|
return item;
|
|
1417
1336
|
});
|
|
@@ -1421,7 +1340,7 @@ var CompletionAdapter = class {
|
|
|
1421
1340
|
};
|
|
1422
1341
|
});
|
|
1423
1342
|
}
|
|
1424
|
-
}
|
|
1343
|
+
}
|
|
1425
1344
|
function fromPosition(position) {
|
|
1426
1345
|
if (!position) {
|
|
1427
1346
|
return void 0;
|
|
@@ -1444,7 +1363,7 @@ function toRange(range) {
|
|
|
1444
1363
|
if (!range) {
|
|
1445
1364
|
return void 0;
|
|
1446
1365
|
}
|
|
1447
|
-
return new
|
|
1366
|
+
return new Range$1(
|
|
1448
1367
|
range.start.line + 1,
|
|
1449
1368
|
range.start.character + 1,
|
|
1450
1369
|
range.end.line + 1,
|
|
@@ -1455,7 +1374,7 @@ function isInsertReplaceEdit(edit) {
|
|
|
1455
1374
|
return typeof edit.insert !== "undefined" && typeof edit.replace !== "undefined";
|
|
1456
1375
|
}
|
|
1457
1376
|
function toCompletionItemKind(kind) {
|
|
1458
|
-
const mItemKind =
|
|
1377
|
+
const mItemKind = languages.CompletionItemKind;
|
|
1459
1378
|
switch (kind) {
|
|
1460
1379
|
case CompletionItemKind.Text:
|
|
1461
1380
|
return mItemKind.Text;
|
|
@@ -1508,7 +1427,7 @@ function toTextEdit(textEdit) {
|
|
|
1508
1427
|
function toCommand(c) {
|
|
1509
1428
|
return c && c.command === "editor.action.triggerSuggest" ? { id: c.command, title: c.title, arguments: c.arguments } : void 0;
|
|
1510
1429
|
}
|
|
1511
|
-
|
|
1430
|
+
class HoverAdapter {
|
|
1512
1431
|
constructor(_worker) {
|
|
1513
1432
|
this._worker = _worker;
|
|
1514
1433
|
}
|
|
@@ -1526,7 +1445,7 @@ var HoverAdapter = class {
|
|
|
1526
1445
|
};
|
|
1527
1446
|
});
|
|
1528
1447
|
}
|
|
1529
|
-
}
|
|
1448
|
+
}
|
|
1530
1449
|
function isMarkupContent(thing) {
|
|
1531
1450
|
return thing && typeof thing === "object" && typeof thing.kind === "string";
|
|
1532
1451
|
}
|
|
@@ -1557,7 +1476,7 @@ function toMarkedStringArray(contents) {
|
|
|
1557
1476
|
}
|
|
1558
1477
|
return [toMarkdownString(contents)];
|
|
1559
1478
|
}
|
|
1560
|
-
|
|
1479
|
+
class DocumentHighlightAdapter {
|
|
1561
1480
|
constructor(_worker) {
|
|
1562
1481
|
this._worker = _worker;
|
|
1563
1482
|
}
|
|
@@ -1575,19 +1494,19 @@ var DocumentHighlightAdapter = class {
|
|
|
1575
1494
|
});
|
|
1576
1495
|
});
|
|
1577
1496
|
}
|
|
1578
|
-
}
|
|
1497
|
+
}
|
|
1579
1498
|
function toDocumentHighlightKind(kind) {
|
|
1580
1499
|
switch (kind) {
|
|
1581
1500
|
case DocumentHighlightKind.Read:
|
|
1582
|
-
return
|
|
1501
|
+
return languages.DocumentHighlightKind.Read;
|
|
1583
1502
|
case DocumentHighlightKind.Write:
|
|
1584
|
-
return
|
|
1503
|
+
return languages.DocumentHighlightKind.Write;
|
|
1585
1504
|
case DocumentHighlightKind.Text:
|
|
1586
|
-
return
|
|
1505
|
+
return languages.DocumentHighlightKind.Text;
|
|
1587
1506
|
}
|
|
1588
|
-
return
|
|
1507
|
+
return languages.DocumentHighlightKind.Text;
|
|
1589
1508
|
}
|
|
1590
|
-
|
|
1509
|
+
class DefinitionAdapter {
|
|
1591
1510
|
constructor(_worker) {
|
|
1592
1511
|
this._worker = _worker;
|
|
1593
1512
|
}
|
|
@@ -1602,14 +1521,14 @@ var DefinitionAdapter = class {
|
|
|
1602
1521
|
return [toLocation(definition)];
|
|
1603
1522
|
});
|
|
1604
1523
|
}
|
|
1605
|
-
}
|
|
1524
|
+
}
|
|
1606
1525
|
function toLocation(location) {
|
|
1607
1526
|
return {
|
|
1608
|
-
uri:
|
|
1527
|
+
uri: Uri.parse(location.uri),
|
|
1609
1528
|
range: toRange(location.range)
|
|
1610
1529
|
};
|
|
1611
1530
|
}
|
|
1612
|
-
|
|
1531
|
+
class ReferenceAdapter {
|
|
1613
1532
|
constructor(_worker) {
|
|
1614
1533
|
this._worker = _worker;
|
|
1615
1534
|
}
|
|
@@ -1624,8 +1543,8 @@ var ReferenceAdapter = class {
|
|
|
1624
1543
|
return entries.map(toLocation);
|
|
1625
1544
|
});
|
|
1626
1545
|
}
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1546
|
+
}
|
|
1547
|
+
class RenameAdapter {
|
|
1629
1548
|
constructor(_worker) {
|
|
1630
1549
|
this._worker = _worker;
|
|
1631
1550
|
}
|
|
@@ -1637,14 +1556,14 @@ var RenameAdapter = class {
|
|
|
1637
1556
|
return toWorkspaceEdit(edit);
|
|
1638
1557
|
});
|
|
1639
1558
|
}
|
|
1640
|
-
}
|
|
1559
|
+
}
|
|
1641
1560
|
function toWorkspaceEdit(edit) {
|
|
1642
1561
|
if (!edit || !edit.changes) {
|
|
1643
1562
|
return void 0;
|
|
1644
1563
|
}
|
|
1645
1564
|
let resourceEdits = [];
|
|
1646
1565
|
for (let uri in edit.changes) {
|
|
1647
|
-
const _uri =
|
|
1566
|
+
const _uri = Uri.parse(uri);
|
|
1648
1567
|
for (let e of edit.changes[uri]) {
|
|
1649
1568
|
resourceEdits.push({
|
|
1650
1569
|
resource: _uri,
|
|
@@ -1660,7 +1579,7 @@ function toWorkspaceEdit(edit) {
|
|
|
1660
1579
|
edits: resourceEdits
|
|
1661
1580
|
};
|
|
1662
1581
|
}
|
|
1663
|
-
|
|
1582
|
+
class DocumentSymbolAdapter {
|
|
1664
1583
|
constructor(_worker) {
|
|
1665
1584
|
this._worker = _worker;
|
|
1666
1585
|
}
|
|
@@ -1686,7 +1605,7 @@ var DocumentSymbolAdapter = class {
|
|
|
1686
1605
|
});
|
|
1687
1606
|
});
|
|
1688
1607
|
}
|
|
1689
|
-
}
|
|
1608
|
+
}
|
|
1690
1609
|
function isDocumentSymbol(symbol) {
|
|
1691
1610
|
return "children" in symbol;
|
|
1692
1611
|
}
|
|
@@ -1703,7 +1622,7 @@ function toDocumentSymbol(symbol) {
|
|
|
1703
1622
|
};
|
|
1704
1623
|
}
|
|
1705
1624
|
function toSymbolKind(kind) {
|
|
1706
|
-
let mKind =
|
|
1625
|
+
let mKind = languages.SymbolKind;
|
|
1707
1626
|
switch (kind) {
|
|
1708
1627
|
case SymbolKind.File:
|
|
1709
1628
|
return mKind.File;
|
|
@@ -1744,7 +1663,7 @@ function toSymbolKind(kind) {
|
|
|
1744
1663
|
}
|
|
1745
1664
|
return mKind.Function;
|
|
1746
1665
|
}
|
|
1747
|
-
|
|
1666
|
+
class DocumentLinkAdapter {
|
|
1748
1667
|
constructor(_worker) {
|
|
1749
1668
|
this._worker = _worker;
|
|
1750
1669
|
}
|
|
@@ -1762,8 +1681,8 @@ var DocumentLinkAdapter = class {
|
|
|
1762
1681
|
};
|
|
1763
1682
|
});
|
|
1764
1683
|
}
|
|
1765
|
-
}
|
|
1766
|
-
|
|
1684
|
+
}
|
|
1685
|
+
class DocumentFormattingEditProvider {
|
|
1767
1686
|
constructor(_worker) {
|
|
1768
1687
|
this._worker = _worker;
|
|
1769
1688
|
}
|
|
@@ -1778,8 +1697,8 @@ var DocumentFormattingEditProvider = class {
|
|
|
1778
1697
|
});
|
|
1779
1698
|
});
|
|
1780
1699
|
}
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1700
|
+
}
|
|
1701
|
+
class DocumentRangeFormattingEditProvider {
|
|
1783
1702
|
constructor(_worker) {
|
|
1784
1703
|
this._worker = _worker;
|
|
1785
1704
|
this.canFormatMultipleRanges = false;
|
|
@@ -1795,14 +1714,14 @@ var DocumentRangeFormattingEditProvider = class {
|
|
|
1795
1714
|
});
|
|
1796
1715
|
});
|
|
1797
1716
|
}
|
|
1798
|
-
}
|
|
1717
|
+
}
|
|
1799
1718
|
function fromFormattingOptions(options) {
|
|
1800
1719
|
return {
|
|
1801
1720
|
tabSize: options.tabSize,
|
|
1802
1721
|
insertSpaces: options.insertSpaces
|
|
1803
1722
|
};
|
|
1804
1723
|
}
|
|
1805
|
-
|
|
1724
|
+
class DocumentColorAdapter {
|
|
1806
1725
|
constructor(_worker) {
|
|
1807
1726
|
this._worker = _worker;
|
|
1808
1727
|
}
|
|
@@ -1840,8 +1759,8 @@ var DocumentColorAdapter = class {
|
|
|
1840
1759
|
});
|
|
1841
1760
|
});
|
|
1842
1761
|
}
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1762
|
+
}
|
|
1763
|
+
class FoldingRangeAdapter {
|
|
1845
1764
|
constructor(_worker) {
|
|
1846
1765
|
this._worker = _worker;
|
|
1847
1766
|
}
|
|
@@ -1863,19 +1782,19 @@ var FoldingRangeAdapter = class {
|
|
|
1863
1782
|
});
|
|
1864
1783
|
});
|
|
1865
1784
|
}
|
|
1866
|
-
}
|
|
1785
|
+
}
|
|
1867
1786
|
function toFoldingRangeKind(kind) {
|
|
1868
1787
|
switch (kind) {
|
|
1869
1788
|
case FoldingRangeKind.Comment:
|
|
1870
|
-
return
|
|
1789
|
+
return languages.FoldingRangeKind.Comment;
|
|
1871
1790
|
case FoldingRangeKind.Imports:
|
|
1872
|
-
return
|
|
1791
|
+
return languages.FoldingRangeKind.Imports;
|
|
1873
1792
|
case FoldingRangeKind.Region:
|
|
1874
|
-
return
|
|
1793
|
+
return languages.FoldingRangeKind.Region;
|
|
1875
1794
|
}
|
|
1876
1795
|
return void 0;
|
|
1877
1796
|
}
|
|
1878
|
-
|
|
1797
|
+
class SelectionRangeAdapter {
|
|
1879
1798
|
constructor(_worker) {
|
|
1880
1799
|
this._worker = _worker;
|
|
1881
1800
|
}
|
|
@@ -1900,145 +1819,24 @@ var SelectionRangeAdapter = class {
|
|
|
1900
1819
|
});
|
|
1901
1820
|
});
|
|
1902
1821
|
}
|
|
1903
|
-
};
|
|
1904
|
-
function setupMode(defaults) {
|
|
1905
|
-
const disposables = [];
|
|
1906
|
-
const providers = [];
|
|
1907
|
-
const client = new WorkerManager(defaults);
|
|
1908
|
-
disposables.push(client);
|
|
1909
|
-
const worker = (...uris) => {
|
|
1910
|
-
return client.getLanguageServiceWorker(...uris);
|
|
1911
|
-
};
|
|
1912
|
-
function registerProviders() {
|
|
1913
|
-
const { languageId, modeConfiguration } = defaults;
|
|
1914
|
-
disposeAll(providers);
|
|
1915
|
-
if (modeConfiguration.completionItems) {
|
|
1916
|
-
providers.push(
|
|
1917
|
-
monaco_editor_core_exports.languages.registerCompletionItemProvider(
|
|
1918
|
-
languageId,
|
|
1919
|
-
new CompletionAdapter(worker, ["/", "-", ":"])
|
|
1920
|
-
)
|
|
1921
|
-
);
|
|
1922
|
-
}
|
|
1923
|
-
if (modeConfiguration.hovers) {
|
|
1924
|
-
providers.push(
|
|
1925
|
-
monaco_editor_core_exports.languages.registerHoverProvider(languageId, new HoverAdapter(worker))
|
|
1926
|
-
);
|
|
1927
|
-
}
|
|
1928
|
-
if (modeConfiguration.documentHighlights) {
|
|
1929
|
-
providers.push(
|
|
1930
|
-
monaco_editor_core_exports.languages.registerDocumentHighlightProvider(
|
|
1931
|
-
languageId,
|
|
1932
|
-
new DocumentHighlightAdapter(worker)
|
|
1933
|
-
)
|
|
1934
|
-
);
|
|
1935
|
-
}
|
|
1936
|
-
if (modeConfiguration.definitions) {
|
|
1937
|
-
providers.push(
|
|
1938
|
-
monaco_editor_core_exports.languages.registerDefinitionProvider(
|
|
1939
|
-
languageId,
|
|
1940
|
-
new DefinitionAdapter(worker)
|
|
1941
|
-
)
|
|
1942
|
-
);
|
|
1943
|
-
}
|
|
1944
|
-
if (modeConfiguration.references) {
|
|
1945
|
-
providers.push(
|
|
1946
|
-
monaco_editor_core_exports.languages.registerReferenceProvider(
|
|
1947
|
-
languageId,
|
|
1948
|
-
new ReferenceAdapter(worker)
|
|
1949
|
-
)
|
|
1950
|
-
);
|
|
1951
|
-
}
|
|
1952
|
-
if (modeConfiguration.documentSymbols) {
|
|
1953
|
-
providers.push(
|
|
1954
|
-
monaco_editor_core_exports.languages.registerDocumentSymbolProvider(
|
|
1955
|
-
languageId,
|
|
1956
|
-
new DocumentSymbolAdapter(worker)
|
|
1957
|
-
)
|
|
1958
|
-
);
|
|
1959
|
-
}
|
|
1960
|
-
if (modeConfiguration.rename) {
|
|
1961
|
-
providers.push(
|
|
1962
|
-
monaco_editor_core_exports.languages.registerRenameProvider(languageId, new RenameAdapter(worker))
|
|
1963
|
-
);
|
|
1964
|
-
}
|
|
1965
|
-
if (modeConfiguration.colors) {
|
|
1966
|
-
providers.push(
|
|
1967
|
-
monaco_editor_core_exports.languages.registerColorProvider(
|
|
1968
|
-
languageId,
|
|
1969
|
-
new DocumentColorAdapter(worker)
|
|
1970
|
-
)
|
|
1971
|
-
);
|
|
1972
|
-
}
|
|
1973
|
-
if (modeConfiguration.foldingRanges) {
|
|
1974
|
-
providers.push(
|
|
1975
|
-
monaco_editor_core_exports.languages.registerFoldingRangeProvider(
|
|
1976
|
-
languageId,
|
|
1977
|
-
new FoldingRangeAdapter(worker)
|
|
1978
|
-
)
|
|
1979
|
-
);
|
|
1980
|
-
}
|
|
1981
|
-
if (modeConfiguration.diagnostics) {
|
|
1982
|
-
providers.push(
|
|
1983
|
-
new DiagnosticsAdapter(languageId, worker, defaults.onDidChange)
|
|
1984
|
-
);
|
|
1985
|
-
}
|
|
1986
|
-
if (modeConfiguration.selectionRanges) {
|
|
1987
|
-
providers.push(
|
|
1988
|
-
monaco_editor_core_exports.languages.registerSelectionRangeProvider(
|
|
1989
|
-
languageId,
|
|
1990
|
-
new SelectionRangeAdapter(worker)
|
|
1991
|
-
)
|
|
1992
|
-
);
|
|
1993
|
-
}
|
|
1994
|
-
if (modeConfiguration.documentFormattingEdits) {
|
|
1995
|
-
providers.push(
|
|
1996
|
-
monaco_editor_core_exports.languages.registerDocumentFormattingEditProvider(
|
|
1997
|
-
languageId,
|
|
1998
|
-
new DocumentFormattingEditProvider(worker)
|
|
1999
|
-
)
|
|
2000
|
-
);
|
|
2001
|
-
}
|
|
2002
|
-
if (modeConfiguration.documentRangeFormattingEdits) {
|
|
2003
|
-
providers.push(
|
|
2004
|
-
monaco_editor_core_exports.languages.registerDocumentRangeFormattingEditProvider(
|
|
2005
|
-
languageId,
|
|
2006
|
-
new DocumentRangeFormattingEditProvider(worker)
|
|
2007
|
-
)
|
|
2008
|
-
);
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
registerProviders();
|
|
2012
|
-
disposables.push(asDisposable(providers));
|
|
2013
|
-
return asDisposable(disposables);
|
|
2014
|
-
}
|
|
2015
|
-
function asDisposable(disposables) {
|
|
2016
|
-
return { dispose: () => disposeAll(disposables) };
|
|
2017
|
-
}
|
|
2018
|
-
function disposeAll(disposables) {
|
|
2019
|
-
while (disposables.length) {
|
|
2020
|
-
disposables.pop().dispose();
|
|
2021
|
-
}
|
|
2022
1822
|
}
|
|
2023
1823
|
export {
|
|
2024
|
-
CompletionAdapter,
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
toRange,
|
|
2043
|
-
toTextEdit
|
|
1824
|
+
CompletionAdapter as C,
|
|
1825
|
+
DocumentFormattingEditProvider as D,
|
|
1826
|
+
FoldingRangeAdapter as F,
|
|
1827
|
+
HoverAdapter as H,
|
|
1828
|
+
ReferenceAdapter as R,
|
|
1829
|
+
SelectionRangeAdapter as S,
|
|
1830
|
+
DocumentRangeFormattingEditProvider as a,
|
|
1831
|
+
DocumentSymbolAdapter as b,
|
|
1832
|
+
DocumentColorAdapter as c,
|
|
1833
|
+
DiagnosticsAdapter as d,
|
|
1834
|
+
DefinitionAdapter as e,
|
|
1835
|
+
DocumentHighlightAdapter as f,
|
|
1836
|
+
DocumentLinkAdapter as g,
|
|
1837
|
+
RenameAdapter as h,
|
|
1838
|
+
fromPosition as i,
|
|
1839
|
+
fromRange as j,
|
|
1840
|
+
toTextEdit as k,
|
|
1841
|
+
toRange as t
|
|
2044
1842
|
};
|