shareable-twoslash-comments 0.0.16 → 0.0.18

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -22
  2. 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(sandbox_1) {
64
- return __awaiter(this, arguments, void 0, function (sandbox, isUndoRedoChange) {
63
+ function fillTwoSlashQueries(sandbox) {
64
+ return __awaiter(this, void 0, void 0, function () {
65
65
  function getLeftMostQuickInfo(_a) {
66
66
  return __awaiter(this, arguments, void 0, function (_b) {
67
67
  var col, quickInfoPos, quickInfoOffset, quickInfo;
@@ -156,7 +156,6 @@ 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; }
160
159
  return __generator(this, function (_b) {
161
160
  switch (_b.label) {
162
161
  case 0:
@@ -227,7 +226,7 @@ define(function () { 'use strict';
227
226
  prevQuickInfoEndLine = lineNumber + prevQuickInfoLines - 1;
228
227
  if (prevQuickInfoComment !== quickInfoComment) {
229
228
  editOperations.push({
230
- range: new sandbox.monaco.Range(lineNumber, 0, prevQuickInfoEndLine, model.getLineContent(prevQuickInfoEndLine).length + 1),
229
+ range: new sandbox.monaco.Range(lineNumber, 1, prevQuickInfoEndLine, model.getLineContent(prevQuickInfoEndLine).length + 1),
231
230
  text: quickInfoComment,
232
231
  });
233
232
  }
@@ -241,22 +240,7 @@ define(function () { 'use strict';
241
240
  return [2 /*return*/];
242
241
  }
243
242
  if (editOperations.length > 0) {
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
- }
243
+ model.applyEdits(editOperations);
260
244
  }
261
245
  return [2 /*return*/];
262
246
  }
@@ -291,7 +275,7 @@ define(function () { 'use strict';
291
275
  id: "shareable-twoslash-comments",
292
276
  displayName: "Shareable Twoslash Comments",
293
277
  data: { firstMount: true },
294
- shouldBeSelected: function () { return true; },
278
+ shouldBeSelected: function () { return false; },
295
279
  didMount: function (sandbox, container) {
296
280
  container.style.paddingRight = "8px";
297
281
  var sponsorBanner = document.createElement("a");
@@ -382,7 +366,7 @@ define(function () { 'use strict';
382
366
  fillTwoSlashQueries(sandbox);
383
367
  model.onDidChangeContent(function (e) {
384
368
  if (e.isRedoing || e.isUndoing) {
385
- fillTwoSlashQueries(sandbox, true);
369
+ fillTwoSlashQueries(sandbox);
386
370
  }
387
371
  else {
388
372
  debouncedFillTwoSlashQueries(sandbox);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareable-twoslash-comments",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
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",