shareable-twoslash-comments 0.0.14 → 0.0.16

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 CHANGED
@@ -215,9 +215,13 @@ define(function () { 'use strict';
215
215
  return [4 /*yield*/, getLeftMostQuickInfo({ line: quickInfoLine, column: column })];
216
216
  case 5:
217
217
  quickInfoString = _b.sent();
218
- quickInfoComment = "".concat(match[0]).concat(quickInfoString.length > 0 ? " " : "").concat(multilineEnabled
218
+ quickInfoString = multilineEnabled
219
219
  ? quickInfoString.replace(/\r?\n/g, model.getEOL() + commentPrefix)
220
- : truncate(quickInfoString.replace(/\r?\n\s*/g, " "), truncationDisabled ? Number.POSITIVE_INFINITY : 100));
220
+ : quickInfoString.replace(/\r?\n\s*/g, " ");
221
+ if (!truncationDisabled && !quickInfoString.includes("\n")) {
222
+ quickInfoString = truncate(quickInfoString, 100);
223
+ }
224
+ quickInfoComment = match[0] + (quickInfoString.length > 0 ? " " : "") + quickInfoString;
221
225
  prevQuickInfoComment = getPreviousQuickInfoComment({ lineNumber: lineNumber });
222
226
  prevQuickInfoLines = prevQuickInfoComment.split("\n").length;
223
227
  prevQuickInfoEndLine = lineNumber + prevQuickInfoLines - 1;
@@ -279,6 +283,7 @@ define(function () { 'use strict';
279
283
  function truncate(str, maxLength) {
280
284
  return str.length > maxLength ? str.slice(0, maxLength) + "…" : str;
281
285
  }
286
+ //# sourceMappingURL=utils.js.map
282
287
 
283
288
  var debouncedFillTwoSlashQueries = debounce(fillTwoSlashQueries, 500);
284
289
  var makePlugin = function (utils) {
@@ -374,7 +379,7 @@ define(function () { 'use strict';
374
379
  });
375
380
  var model = sandbox.getModel();
376
381
  if (customPlugin.data.firstMount) {
377
- debouncedFillTwoSlashQueries(sandbox);
382
+ fillTwoSlashQueries(sandbox);
378
383
  model.onDidChangeContent(function (e) {
379
384
  if (e.isRedoing || e.isUndoing) {
380
385
  fillTwoSlashQueries(sandbox, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareable-twoslash-comments",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
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",