shareable-twoslash-comments 0.0.4 → 0.0.6
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 +12 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -158,11 +158,13 @@ define(function () { 'use strict';
|
|
|
158
158
|
};
|
|
159
159
|
//# sourceMappingURL=utils.js.map
|
|
160
160
|
|
|
161
|
-
var debouncedFillTwoSlashQueries = debounce(fillTwoSlashQueries,
|
|
161
|
+
var debouncedFillTwoSlashQueries = debounce(fillTwoSlashQueries, 500);
|
|
162
162
|
var makePlugin = function (utils) {
|
|
163
163
|
var customPlugin = {
|
|
164
164
|
id: "shareable-twoslash-comments",
|
|
165
165
|
displayName: "Shareable Twoslash Comments",
|
|
166
|
+
data: { firstMount: true },
|
|
167
|
+
shouldBeSelected: function () { return true; },
|
|
166
168
|
didMount: function (sandbox, container) {
|
|
167
169
|
// Create a design system object to handle
|
|
168
170
|
// making DOM elements which fit the playground (and handle mobile/light/dark etc)
|
|
@@ -184,14 +186,21 @@ define(function () { 'use strict';
|
|
|
184
186
|
], {
|
|
185
187
|
style: "separated",
|
|
186
188
|
});
|
|
189
|
+
var model = sandbox.getModel();
|
|
190
|
+
if (customPlugin.data.firstMount) {
|
|
191
|
+
debouncedFillTwoSlashQueries(sandbox);
|
|
192
|
+
model.onDidChangeContent(function () {
|
|
193
|
+
debouncedFillTwoSlashQueries(sandbox);
|
|
194
|
+
});
|
|
195
|
+
customPlugin.data.firstMount = false;
|
|
196
|
+
}
|
|
187
197
|
},
|
|
188
198
|
// This is called occasionally as text changes in monaco,
|
|
189
199
|
// it does not directly map 1 keyup to once run of the function
|
|
190
200
|
// because it is intentionally called at most once every 0.3 seconds
|
|
191
201
|
// and then will always run at the end.
|
|
192
|
-
modelChangedDebounce: function (
|
|
202
|
+
modelChangedDebounce: function (_sandbox, _model) { return __awaiter(void 0, void 0, void 0, function () {
|
|
193
203
|
return __generator(this, function (_a) {
|
|
194
|
-
debouncedFillTwoSlashQueries(sandbox);
|
|
195
204
|
return [2 /*return*/];
|
|
196
205
|
});
|
|
197
206
|
}); },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shareable-twoslash-comments",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
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",
|