shareable-twoslash-comments 0.0.13 → 0.0.15
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 +11 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -155,7 +155,7 @@ define(function () { 'use strict';
|
|
|
155
155
|
}
|
|
156
156
|
return prevQuickInfoLines.join(model.getEOL());
|
|
157
157
|
}
|
|
158
|
-
var multilineEnabled, truncationDisabled, compactOutputEnabled, pauseOnError, model, worker, diagnostics, text, editOperations, matches, _i, matches_1, _a, match, queryType, textBeforeQuery, commentPrefix, isInlineArrowQuery, lineNumber, column, caretOffset, caretPos, quickInfoLine, quickInfoString, quickInfoComment, prevQuickInfoComment, prevQuickInfoLines, prevQuickInfoEndLine;
|
|
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
159
|
if (isUndoRedoChange === void 0) { isUndoRedoChange = false; }
|
|
160
160
|
return __generator(this, function (_b) {
|
|
161
161
|
switch (_b.label) {
|
|
@@ -168,6 +168,7 @@ define(function () { 'use strict';
|
|
|
168
168
|
return [4 /*yield*/, sandbox.getWorkerProcess()];
|
|
169
169
|
case 1:
|
|
170
170
|
worker = _b.sent();
|
|
171
|
+
versionId = model.getVersionId();
|
|
171
172
|
if (!pauseOnError) return [3 /*break*/, 3];
|
|
172
173
|
return [4 /*yield*/, Promise.all([
|
|
173
174
|
worker.getSyntacticDiagnostics("file://" + model.uri.path),
|
|
@@ -216,7 +217,10 @@ define(function () { 'use strict';
|
|
|
216
217
|
quickInfoString = _b.sent();
|
|
217
218
|
quickInfoComment = "".concat(match[0]).concat(quickInfoString.length > 0 ? " " : "").concat(multilineEnabled
|
|
218
219
|
? quickInfoString.replace(/\r?\n/g, model.getEOL() + commentPrefix)
|
|
219
|
-
:
|
|
220
|
+
: quickInfoString.replace(/\r?\n\s*/g, " "));
|
|
221
|
+
if (!truncationDisabled && !quickInfoComment.includes("\n")) {
|
|
222
|
+
quickInfoComment = truncate(quickInfoComment, 100);
|
|
223
|
+
}
|
|
220
224
|
prevQuickInfoComment = getPreviousQuickInfoComment({ lineNumber: lineNumber });
|
|
221
225
|
prevQuickInfoLines = prevQuickInfoComment.split("\n").length;
|
|
222
226
|
prevQuickInfoEndLine = lineNumber + prevQuickInfoLines - 1;
|
|
@@ -231,6 +235,10 @@ define(function () { 'use strict';
|
|
|
231
235
|
_i++;
|
|
232
236
|
return [3 /*break*/, 4];
|
|
233
237
|
case 7:
|
|
238
|
+
if (model.getVersionId() !== versionId) {
|
|
239
|
+
console.log("Skipping stale edits");
|
|
240
|
+
return [2 /*return*/];
|
|
241
|
+
}
|
|
234
242
|
if (editOperations.length > 0) {
|
|
235
243
|
if (!isUndoRedoChange) {
|
|
236
244
|
model.popStackElement();
|
|
@@ -369,7 +377,7 @@ define(function () { 'use strict';
|
|
|
369
377
|
});
|
|
370
378
|
var model = sandbox.getModel();
|
|
371
379
|
if (customPlugin.data.firstMount) {
|
|
372
|
-
|
|
380
|
+
fillTwoSlashQueries(sandbox);
|
|
373
381
|
model.onDidChangeContent(function (e) {
|
|
374
382
|
if (e.isRedoing || e.isUndoing) {
|
|
375
383
|
fillTwoSlashQueries(sandbox, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shareable-twoslash-comments",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
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",
|