shareable-twoslash-comments 0.0.19 → 0.0.21
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/index.js +20 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -60,8 +60,8 @@ define(function () { 'use strict';
|
|
|
60
60
|
|
|
61
61
|
var twoSlashQueryRegex = /(^[ \t]*)(\/\/\s*\^\?)/gm;
|
|
62
62
|
var twoSlashArrowQueryRegex = /(^.*)\/\/=>/gm;
|
|
63
|
-
function fillTwoSlashQueries(
|
|
64
|
-
return __awaiter(this,
|
|
63
|
+
function fillTwoSlashQueries(sandbox_1) {
|
|
64
|
+
return __awaiter(this, arguments, void 0, function (sandbox, isUndoRedoChange) {
|
|
65
65
|
function getLeftMostQuickInfo(_a) {
|
|
66
66
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
67
67
|
var col, quickInfoPos, quickInfoOffset, quickInfo;
|
|
@@ -156,6 +156,7 @@ define(function () { 'use strict';
|
|
|
156
156
|
return prevQuickInfoLines.join(model.getEOL());
|
|
157
157
|
}
|
|
158
158
|
var multilineEnabled, truncationDisabled, compactOutputEnabled, pauseOnError, model, worker, versionId, diagnostics, text, editOperations, matches, _i, matches_1, _a, match, queryType, textBeforeQuery, commentPrefix, isInlineArrowQuery, lineNumber, column, caretOffset, caretPos, quickInfoLine, quickInfoString, quickInfoComment, prevQuickInfoComment, prevQuickInfoLines, prevQuickInfoEndLine;
|
|
159
|
+
if (isUndoRedoChange === void 0) { isUndoRedoChange = false; }
|
|
159
160
|
return __generator(this, function (_b) {
|
|
160
161
|
switch (_b.label) {
|
|
161
162
|
case 0:
|
|
@@ -240,7 +241,22 @@ define(function () { 'use strict';
|
|
|
240
241
|
return [2 /*return*/];
|
|
241
242
|
}
|
|
242
243
|
if (editOperations.length > 0) {
|
|
243
|
-
|
|
244
|
+
if (!isUndoRedoChange) {
|
|
245
|
+
model.popStackElement();
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
if (isUndoRedoChange) {
|
|
249
|
+
model.applyEdits(editOperations);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
sandbox.editor.executeEdits("shareable-twoslash-comments", editOperations);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
finally {
|
|
256
|
+
if (!isUndoRedoChange) {
|
|
257
|
+
model.pushStackElement();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
244
260
|
}
|
|
245
261
|
return [2 /*return*/];
|
|
246
262
|
}
|
|
@@ -267,7 +283,6 @@ define(function () { 'use strict';
|
|
|
267
283
|
function truncate(str, maxLength) {
|
|
268
284
|
return str.length > maxLength ? str.slice(0, maxLength) + "…" : str;
|
|
269
285
|
}
|
|
270
|
-
//# sourceMappingURL=utils.js.map
|
|
271
286
|
|
|
272
287
|
var debouncedFillTwoSlashQueries = debounce(fillTwoSlashQueries, 500);
|
|
273
288
|
var makePlugin = function (utils) {
|
|
@@ -366,7 +381,7 @@ define(function () { 'use strict';
|
|
|
366
381
|
fillTwoSlashQueries(sandbox);
|
|
367
382
|
model.onDidChangeContent(function (e) {
|
|
368
383
|
if (e.isRedoing || e.isUndoing) {
|
|
369
|
-
fillTwoSlashQueries(sandbox);
|
|
384
|
+
fillTwoSlashQueries(sandbox, true);
|
|
370
385
|
}
|
|
371
386
|
else {
|
|
372
387
|
debouncedFillTwoSlashQueries(sandbox);
|
|
@@ -392,7 +407,6 @@ define(function () { 'use strict';
|
|
|
392
407
|
};
|
|
393
408
|
return customPlugin;
|
|
394
409
|
};
|
|
395
|
-
//# sourceMappingURL=index.js.map
|
|
396
410
|
|
|
397
411
|
return makePlugin;
|
|
398
412
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shareable-twoslash-comments",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"description": "A TypeScript Playground plugin that embeds twoslash (// ^?) type hints as literal comments in your code, making them easy to copy and share.",
|
|
6
6
|
"license": "MIT",
|