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