custom-electron-titlebar 3.2.6 → 3.2.10

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 (239) hide show
  1. package/.github/FUNDING.yml +1 -0
  2. package/README.md +15 -24
  3. package/_config.yml +1 -0
  4. package/{lib → build}/browser/browser.d.ts +0 -0
  5. package/{lib → build}/browser/browser.js +0 -0
  6. package/{lib → build}/browser/browser.js.map +0 -0
  7. package/{lib → build}/browser/event.d.ts +0 -0
  8. package/{lib → build}/browser/event.js +2 -1
  9. package/{lib → build}/browser/event.js.map +1 -1
  10. package/{lib → build}/browser/iframe.d.ts +0 -0
  11. package/{lib → build}/browser/iframe.js +0 -0
  12. package/{lib → build}/browser/iframe.js.map +0 -0
  13. package/{lib → build}/browser/keyboardEvent.d.ts +0 -0
  14. package/{lib → build}/browser/keyboardEvent.js +0 -0
  15. package/{lib → build}/browser/keyboardEvent.js.map +0 -0
  16. package/{lib → build}/browser/mouseEvent.d.ts +0 -0
  17. package/{lib → build}/browser/mouseEvent.js +0 -0
  18. package/{lib → build}/browser/mouseEvent.js.map +0 -0
  19. package/{lib → build}/common/arrays.d.ts +0 -0
  20. package/{lib → build}/common/arrays.js +0 -0
  21. package/{lib → build}/common/arrays.js.map +0 -0
  22. package/{lib → build}/common/async.d.ts +0 -0
  23. package/{lib → build}/common/async.js +0 -0
  24. package/{lib → build}/common/async.js.map +0 -0
  25. package/{lib → build}/common/charCode.d.ts +0 -0
  26. package/{lib → build}/common/charCode.js +0 -0
  27. package/{lib → build}/common/charCode.js.map +0 -0
  28. package/{lib → build}/common/color.d.ts +0 -0
  29. package/{lib → build}/common/color.js +0 -0
  30. package/{lib → build}/common/color.js.map +0 -0
  31. package/{lib → build}/common/dom.d.ts +0 -0
  32. package/{lib → build}/common/dom.js +16 -14
  33. package/build/common/dom.js.map +1 -0
  34. package/{lib → build}/common/event.d.ts +0 -0
  35. package/{lib → build}/common/event.js +1 -1
  36. package/build/common/event.js.map +1 -0
  37. package/{lib → build}/common/iterator.d.ts +0 -0
  38. package/{lib → build}/common/iterator.js +0 -0
  39. package/{lib → build}/common/iterator.js.map +0 -0
  40. package/{lib → build}/common/keyCodes.d.ts +0 -0
  41. package/{lib → build}/common/keyCodes.js +0 -0
  42. package/{lib → build}/common/keyCodes.js.map +0 -0
  43. package/{lib → build}/common/lifecycle.d.ts +0 -0
  44. package/{lib → build}/common/lifecycle.js +0 -0
  45. package/{lib → build}/common/lifecycle.js.map +0 -0
  46. package/{lib → build}/common/linkedList.d.ts +0 -0
  47. package/{lib → build}/common/linkedList.js +0 -0
  48. package/{lib → build}/common/linkedList.js.map +0 -0
  49. package/{lib → build}/common/platform.d.ts +0 -0
  50. package/{lib → build}/common/platform.js +0 -0
  51. package/{lib → build}/common/platform.js.map +0 -0
  52. package/{lib → build}/index.d.ts +0 -0
  53. package/{lib → build}/index.js +0 -0
  54. package/{lib → build}/index.js.map +0 -0
  55. package/{lib → build}/menu/menu.d.ts +0 -0
  56. package/{lib → build}/menu/menu.js +38 -38
  57. package/build/menu/menu.js.map +1 -0
  58. package/{lib → build}/menu/menuitem.d.ts +10 -2
  59. package/{lib → build}/menu/menuitem.js +70 -34
  60. package/build/menu/menuitem.js.map +1 -0
  61. package/{lib → build}/menubar.d.ts +0 -0
  62. package/{lib → build}/menubar.js +29 -30
  63. package/build/menubar.js.map +1 -0
  64. package/{lib → build}/themebar.d.ts +0 -0
  65. package/{lib → build}/themebar.js +2 -2
  66. package/build/themebar.js.map +1 -0
  67. package/{lib → build}/titlebar.d.ts +0 -0
  68. package/{lib → build}/titlebar.js +61 -58
  69. package/build/titlebar.js.map +1 -0
  70. package/package.json +13 -7
  71. package/lib/common/dom.js.map +0 -1
  72. package/lib/common/enableNativeMenuCommands.d.ts +0 -1
  73. package/lib/common/enableNativeMenuCommands.js +0 -32
  74. package/lib/common/enableNativeMenuCommands.js.map +0 -1
  75. package/lib/common/event.js.map +0 -1
  76. package/lib/main.d.ts +0 -1
  77. package/lib/main.js +0 -14
  78. package/lib/main.js.map +0 -1
  79. package/lib/menu/menu.js.map +0 -1
  80. package/lib/menu/menuitem.js.map +0 -1
  81. package/lib/menubar.js.map +0 -1
  82. package/lib/themebar.js.map +0 -1
  83. package/lib/titlebar.js.map +0 -1
  84. package/lib/vs/base/browser/browser.js +0 -150
  85. package/lib/vs/base/browser/canIUse.js +0 -58
  86. package/lib/vs/base/browser/codicons.js +0 -37
  87. package/lib/vs/base/browser/contextmenu.js +0 -9
  88. package/lib/vs/base/browser/dnd.js +0 -113
  89. package/lib/vs/base/browser/dom.js +0 -1417
  90. package/lib/vs/base/browser/event.js +0 -36
  91. package/lib/vs/base/browser/fastDomNode.js +0 -265
  92. package/lib/vs/base/browser/formattedTextRenderer.js +0 -248
  93. package/lib/vs/base/browser/globalMouseMoveMonitor.js +0 -137
  94. package/lib/vs/base/browser/history.js +0 -9
  95. package/lib/vs/base/browser/iframe.js +0 -126
  96. package/lib/vs/base/browser/keyboardEvent.js +0 -599
  97. package/lib/vs/base/browser/mouseEvent.js +0 -155
  98. package/lib/vs/base/browser/touch.js +0 -315
  99. package/lib/vs/base/browser/ui/actionbar/actionViewItems.js +0 -397
  100. package/lib/vs/base/browser/ui/actionbar/actionbar.js +0 -583
  101. package/lib/vs/base/browser/ui/checkbox/checkbox.js +0 -251
  102. package/lib/vs/base/browser/ui/codicons/codiconLabel.js +0 -31
  103. package/lib/vs/base/browser/ui/codicons/codiconStyles.js +0 -47
  104. package/lib/vs/base/browser/ui/contextview/contextview.js +0 -367
  105. package/lib/vs/base/browser/ui/dropdown/dropdown.js +0 -256
  106. package/lib/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +0 -120
  107. package/lib/vs/base/browser/ui/keybindingLabel/keybindingLabel.js +0 -118
  108. package/lib/vs/base/browser/ui/list/list.js +0 -54
  109. package/lib/vs/base/browser/ui/list/listPaging.js +0 -322
  110. package/lib/vs/base/browser/ui/list/listView.js +0 -1388
  111. package/lib/vs/base/browser/ui/list/listWidget.js +0 -1709
  112. package/lib/vs/base/browser/ui/list/rangeMap.js +0 -223
  113. package/lib/vs/base/browser/ui/list/rowCache.js +0 -113
  114. package/lib/vs/base/browser/ui/list/splice.js +0 -23
  115. package/lib/vs/base/browser/ui/menu/menu.js +0 -1371
  116. package/lib/vs/base/browser/ui/menu/menubar.js +0 -1139
  117. package/lib/vs/base/browser/ui/scrollbar/abstractScrollbar.js +0 -278
  118. package/lib/vs/base/browser/ui/scrollbar/horizontalScrollbar.js +0 -115
  119. package/lib/vs/base/browser/ui/scrollbar/scrollableElement.js +0 -646
  120. package/lib/vs/base/browser/ui/scrollbar/scrollableElementOptions.js +0 -9
  121. package/lib/vs/base/browser/ui/scrollbar/scrollbarArrow.js +0 -106
  122. package/lib/vs/base/browser/ui/scrollbar/scrollbarState.js +0 -184
  123. package/lib/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js +0 -116
  124. package/lib/vs/base/browser/ui/scrollbar/verticalScrollbar.js +0 -114
  125. package/lib/vs/base/browser/ui/selectBox/selectBox.js +0 -85
  126. package/lib/vs/base/browser/ui/selectBox/selectBoxCustom.js +0 -985
  127. package/lib/vs/base/browser/ui/selectBox/selectBoxNative.js +0 -188
  128. package/lib/vs/base/browser/ui/toolbar/toolbar.js +0 -206
  129. package/lib/vs/base/browser/ui/widget.js +0 -69
  130. package/lib/vs/base/common/actions.js +0 -224
  131. package/lib/vs/base/common/amd.js +0 -31
  132. package/lib/vs/base/common/arrays.js +0 -641
  133. package/lib/vs/base/common/assert.js +0 -21
  134. package/lib/vs/base/common/async.js +0 -966
  135. package/lib/vs/base/common/buffer.js +0 -250
  136. package/lib/vs/base/common/cache.js +0 -40
  137. package/lib/vs/base/common/cancellation.js +0 -146
  138. package/lib/vs/base/common/charCode.js +0 -9
  139. package/lib/vs/base/common/codicon.js +0 -136
  140. package/lib/vs/base/common/codicons.js +0 -1378
  141. package/lib/vs/base/common/collections.js +0 -133
  142. package/lib/vs/base/common/color.js +0 -716
  143. package/lib/vs/base/common/comparers.js +0 -280
  144. package/lib/vs/base/common/console.js +0 -142
  145. package/lib/vs/base/common/date.js +0 -113
  146. package/lib/vs/base/common/decorators.js +0 -169
  147. package/lib/vs/base/common/errorMessage.js +0 -93
  148. package/lib/vs/base/common/errors.js +0 -213
  149. package/lib/vs/base/common/errorsWithActions.js +0 -28
  150. package/lib/vs/base/common/event.js +0 -873
  151. package/lib/vs/base/common/extpath.js +0 -401
  152. package/lib/vs/base/common/filters.js +0 -948
  153. package/lib/vs/base/common/functional.js +0 -28
  154. package/lib/vs/base/common/fuzzyScorer.js +0 -811
  155. package/lib/vs/base/common/glob.js +0 -696
  156. package/lib/vs/base/common/hash.js +0 -359
  157. package/lib/vs/base/common/history.js +0 -116
  158. package/lib/vs/base/common/htmlContent.js +0 -162
  159. package/lib/vs/base/common/idGenerator.js +0 -25
  160. package/lib/vs/base/common/iterator.js +0 -118
  161. package/lib/vs/base/common/json.js +0 -1624
  162. package/lib/vs/base/common/jsonEdit.js +0 -272
  163. package/lib/vs/base/common/jsonErrorMessages.js +0 -69
  164. package/lib/vs/base/common/jsonFormatter.js +0 -316
  165. package/lib/vs/base/common/jsonSchema.js +0 -9
  166. package/lib/vs/base/common/keyCodes.js +0 -591
  167. package/lib/vs/base/common/keybindingLabels.js +0 -231
  168. package/lib/vs/base/common/keybindingParser.js +0 -142
  169. package/lib/vs/base/common/labels.js +0 -430
  170. package/lib/vs/base/common/lazy.js +0 -71
  171. package/lib/vs/base/common/lifecycle.js +0 -308
  172. package/lib/vs/base/common/linkedList.js +0 -152
  173. package/lib/vs/base/common/linkedText.js +0 -73
  174. package/lib/vs/base/common/map.js +0 -1108
  175. package/lib/vs/base/common/marshalling.js +0 -80
  176. package/lib/vs/base/common/mime.js +0 -321
  177. package/lib/vs/base/common/navigator.js +0 -50
  178. package/lib/vs/base/common/network.js +0 -160
  179. package/lib/vs/base/common/normalization.js +0 -78
  180. package/lib/vs/base/common/numbers.js +0 -55
  181. package/lib/vs/base/common/objects.js +0 -268
  182. package/lib/vs/base/common/paging.js +0 -190
  183. package/lib/vs/base/common/parsers.js +0 -78
  184. package/lib/vs/base/common/path.js +0 -1550
  185. package/lib/vs/base/common/platform.js +0 -245
  186. package/lib/vs/base/common/process.js +0 -52
  187. package/lib/vs/base/common/processes.js +0 -32
  188. package/lib/vs/base/common/range.js +0 -79
  189. package/lib/vs/base/common/resourceTree.js +0 -185
  190. package/lib/vs/base/common/resources.js +0 -421
  191. package/lib/vs/base/common/scanCode.js +0 -1472
  192. package/lib/vs/base/common/scrollable.js +0 -397
  193. package/lib/vs/base/common/search.js +0 -55
  194. package/lib/vs/base/common/sequence.js +0 -64
  195. package/lib/vs/base/common/severity.js +0 -55
  196. package/lib/vs/base/common/skipList.js +0 -234
  197. package/lib/vs/base/common/stopwatch.js +0 -45
  198. package/lib/vs/base/common/stream.js +0 -418
  199. package/lib/vs/base/common/strings.js +0 -1283
  200. package/lib/vs/base/common/styler.js +0 -9
  201. package/lib/vs/base/common/types.js +0 -296
  202. package/lib/vs/base/common/uint.js +0 -46
  203. package/lib/vs/base/common/uri.js +0 -756
  204. package/lib/vs/base/common/uriIpc.js +0 -154
  205. package/lib/vs/base/common/uuid.js +0 -70
  206. package/lib/vs/nls.mock.js +0 -31
  207. package/lib/vs/platform/actions/browser/menuEntryActionViewItem.js +0 -342
  208. package/lib/vs/platform/actions/common/actions.js +0 -456
  209. package/lib/vs/platform/actions/common/menuService.js +0 -194
  210. package/lib/vs/platform/clipboard/browser/clipboardService.js +0 -99
  211. package/lib/vs/platform/clipboard/common/clipboardService.js +0 -14
  212. package/lib/vs/platform/contextkey/common/contextkey.js +0 -1210
  213. package/lib/vs/platform/contextkey/common/contextkeys.js +0 -23
  214. package/lib/vs/platform/contextview/browser/contextView.js +0 -15
  215. package/lib/vs/platform/contextview/browser/contextViewService.js +0 -96
  216. package/lib/vs/platform/environment/common/argv.js +0 -9
  217. package/lib/vs/platform/environment/common/environment.js +0 -15
  218. package/lib/vs/platform/instantiation/common/descriptors.js +0 -25
  219. package/lib/vs/platform/instantiation/common/extensions.js +0 -26
  220. package/lib/vs/platform/instantiation/common/graph.js +0 -93
  221. package/lib/vs/platform/instantiation/common/instantiation.js +0 -84
  222. package/lib/vs/platform/instantiation/common/instantiationService.js +0 -361
  223. package/lib/vs/platform/instantiation/common/serviceCollection.js +0 -39
  224. package/lib/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -73
  225. package/lib/vs/platform/keybinding/common/keybinding.js +0 -14
  226. package/lib/vs/platform/keybinding/common/keybindingResolver.js +0 -391
  227. package/lib/vs/platform/keybinding/common/keybindingsRegistry.js +0 -229
  228. package/lib/vs/platform/keybinding/common/resolvedKeybindingItem.js +0 -47
  229. package/lib/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js +0 -160
  230. package/lib/vs/platform/layout/browser/layoutService.js +0 -14
  231. package/lib/vs/platform/menubar/common/menubar.js +0 -34
  232. package/lib/vs/platform/registry/common/platform.js +0 -38
  233. package/lib/vs/platform/theme/browser/checkbox.js +0 -32
  234. package/lib/vs/platform/theme/common/colorRegistry.js +0 -1154
  235. package/lib/vs/platform/theme/common/styler.js +0 -290
  236. package/lib/vs/platform/theme/common/theme.js +0 -21
  237. package/lib/vs/platform/theme/common/themeService.js +0 -176
  238. package/lib/vs/platform/theme/common/tokenClassificationRegistry.js +0 -540
  239. package/lib/vs/platform/theme/test/common/testThemeService.js +0 -98
@@ -1,250 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.newWriteableBufferStream = exports.streamToBufferReadableStream = exports.bufferToStream = exports.bufferedStreamToBuffer = exports.streamToBuffer = exports.bufferToReadable = exports.readableToBuffer = exports.writeUInt8 = exports.readUInt8 = exports.writeUInt32LE = exports.readUInt32LE = exports.writeUInt32BE = exports.readUInt32BE = exports.writeUInt16LE = exports.readUInt16LE = exports.VSBuffer = void 0;
11
-
12
- const strings = require("./strings");
13
-
14
- const streams = require("./stream");
15
-
16
- const hasBuffer = typeof Buffer !== 'undefined';
17
- const hasTextEncoder = typeof TextEncoder !== 'undefined';
18
- const hasTextDecoder = typeof TextDecoder !== 'undefined';
19
- let textEncoder;
20
- let textDecoder;
21
-
22
- class VSBuffer {
23
- constructor(buffer) {
24
- this.buffer = buffer;
25
- this.byteLength = this.buffer.byteLength;
26
- }
27
-
28
- static alloc(byteLength) {
29
- if (hasBuffer) {
30
- return new VSBuffer(Buffer.allocUnsafe(byteLength));
31
- } else {
32
- return new VSBuffer(new Uint8Array(byteLength));
33
- }
34
- }
35
-
36
- static wrap(actual) {
37
- if (hasBuffer && !Buffer.isBuffer(actual)) {
38
- // https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length
39
- // Create a zero-copy Buffer wrapper around the ArrayBuffer pointed to by the Uint8Array
40
- actual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength);
41
- }
42
-
43
- return new VSBuffer(actual);
44
- }
45
-
46
- static fromString(source) {
47
- if (hasBuffer) {
48
- return new VSBuffer(Buffer.from(source));
49
- } else if (hasTextEncoder) {
50
- if (!textEncoder) {
51
- textEncoder = new TextEncoder();
52
- }
53
-
54
- return new VSBuffer(textEncoder.encode(source));
55
- } else {
56
- return new VSBuffer(strings.encodeUTF8(source));
57
- }
58
- }
59
-
60
- static concat(buffers, totalLength) {
61
- if (typeof totalLength === 'undefined') {
62
- totalLength = 0;
63
-
64
- for (let i = 0, len = buffers.length; i < len; i++) {
65
- totalLength += buffers[i].byteLength;
66
- }
67
- }
68
-
69
- const ret = VSBuffer.alloc(totalLength);
70
- let offset = 0;
71
-
72
- for (let i = 0, len = buffers.length; i < len; i++) {
73
- const element = buffers[i];
74
- ret.set(element, offset);
75
- offset += element.byteLength;
76
- }
77
-
78
- return ret;
79
- }
80
-
81
- toString() {
82
- if (hasBuffer) {
83
- return this.buffer.toString();
84
- } else if (hasTextDecoder) {
85
- if (!textDecoder) {
86
- textDecoder = new TextDecoder();
87
- }
88
-
89
- return textDecoder.decode(this.buffer);
90
- } else {
91
- return strings.decodeUTF8(this.buffer);
92
- }
93
- }
94
-
95
- slice(start, end) {
96
- // IMPORTANT: use subarray instead of slice because TypedArray#slice
97
- // creates shallow copy and NodeBuffer#slice doesn't. The use of subarray
98
- // ensures the same, performant, behaviour.
99
- return new VSBuffer(this.buffer.subarray(start
100
- /*bad lib.d.ts*/
101
- , end));
102
- }
103
-
104
- set(array, offset) {
105
- if (array instanceof VSBuffer) {
106
- this.buffer.set(array.buffer, offset);
107
- } else {
108
- this.buffer.set(array, offset);
109
- }
110
- }
111
-
112
- readUInt32BE(offset) {
113
- return readUInt32BE(this.buffer, offset);
114
- }
115
-
116
- writeUInt32BE(value, offset) {
117
- writeUInt32BE(this.buffer, value, offset);
118
- }
119
-
120
- readUInt32LE(offset) {
121
- return readUInt32LE(this.buffer, offset);
122
- }
123
-
124
- writeUInt32LE(value, offset) {
125
- writeUInt32LE(this.buffer, value, offset);
126
- }
127
-
128
- readUInt8(offset) {
129
- return readUInt8(this.buffer, offset);
130
- }
131
-
132
- writeUInt8(value, offset) {
133
- writeUInt8(this.buffer, value, offset);
134
- }
135
-
136
- }
137
-
138
- exports.VSBuffer = VSBuffer;
139
-
140
- function readUInt16LE(source, offset) {
141
- return source[offset + 0] << 0 >>> 0 | source[offset + 1] << 8 >>> 0;
142
- }
143
-
144
- exports.readUInt16LE = readUInt16LE;
145
-
146
- function writeUInt16LE(destination, value, offset) {
147
- destination[offset + 0] = value & 0b11111111;
148
- value = value >>> 8;
149
- destination[offset + 1] = value & 0b11111111;
150
- }
151
-
152
- exports.writeUInt16LE = writeUInt16LE;
153
-
154
- function readUInt32BE(source, offset) {
155
- return source[offset] * 2 ** 24 + source[offset + 1] * 2 ** 16 + source[offset + 2] * 2 ** 8 + source[offset + 3];
156
- }
157
-
158
- exports.readUInt32BE = readUInt32BE;
159
-
160
- function writeUInt32BE(destination, value, offset) {
161
- destination[offset + 3] = value;
162
- value = value >>> 8;
163
- destination[offset + 2] = value;
164
- value = value >>> 8;
165
- destination[offset + 1] = value;
166
- value = value >>> 8;
167
- destination[offset] = value;
168
- }
169
-
170
- exports.writeUInt32BE = writeUInt32BE;
171
-
172
- function readUInt32LE(source, offset) {
173
- return source[offset + 0] << 0 >>> 0 | source[offset + 1] << 8 >>> 0 | source[offset + 2] << 16 >>> 0 | source[offset + 3] << 24 >>> 0;
174
- }
175
-
176
- exports.readUInt32LE = readUInt32LE;
177
-
178
- function writeUInt32LE(destination, value, offset) {
179
- destination[offset + 0] = value & 0b11111111;
180
- value = value >>> 8;
181
- destination[offset + 1] = value & 0b11111111;
182
- value = value >>> 8;
183
- destination[offset + 2] = value & 0b11111111;
184
- value = value >>> 8;
185
- destination[offset + 3] = value & 0b11111111;
186
- }
187
-
188
- exports.writeUInt32LE = writeUInt32LE;
189
-
190
- function readUInt8(source, offset) {
191
- return source[offset];
192
- }
193
-
194
- exports.readUInt8 = readUInt8;
195
-
196
- function writeUInt8(destination, value, offset) {
197
- destination[offset] = value;
198
- }
199
-
200
- exports.writeUInt8 = writeUInt8;
201
-
202
- function readableToBuffer(readable) {
203
- return streams.consumeReadable(readable, chunks => VSBuffer.concat(chunks));
204
- }
205
-
206
- exports.readableToBuffer = readableToBuffer;
207
-
208
- function bufferToReadable(buffer) {
209
- return streams.toReadable(buffer);
210
- }
211
-
212
- exports.bufferToReadable = bufferToReadable;
213
-
214
- function streamToBuffer(stream) {
215
- return streams.consumeStream(stream, chunks => VSBuffer.concat(chunks));
216
- }
217
-
218
- exports.streamToBuffer = streamToBuffer;
219
-
220
- async function bufferedStreamToBuffer(bufferedStream) {
221
- if (bufferedStream.ended) {
222
- return VSBuffer.concat(bufferedStream.buffer);
223
- }
224
-
225
- return VSBuffer.concat([// Include already read chunks...
226
- ...bufferedStream.buffer, // ...and all additional chunks
227
- await streamToBuffer(bufferedStream.stream)]);
228
- }
229
-
230
- exports.bufferedStreamToBuffer = bufferedStreamToBuffer;
231
-
232
- function bufferToStream(buffer) {
233
- return streams.toStream(buffer, chunks => VSBuffer.concat(chunks));
234
- }
235
-
236
- exports.bufferToStream = bufferToStream;
237
-
238
- function streamToBufferReadableStream(stream) {
239
- return streams.transform(stream, {
240
- data: data => typeof data === 'string' ? VSBuffer.fromString(data) : VSBuffer.wrap(data)
241
- }, chunks => VSBuffer.concat(chunks));
242
- }
243
-
244
- exports.streamToBufferReadableStream = streamToBufferReadableStream;
245
-
246
- function newWriteableBufferStream(options) {
247
- return streams.newWriteableStream(chunks => VSBuffer.concat(chunks), options);
248
- }
249
-
250
- exports.newWriteableBufferStream = newWriteableBufferStream;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.Cache = void 0;
11
-
12
- const cancellation_1 = require("./cancellation");
13
-
14
- class Cache {
15
- constructor(task) {
16
- this.task = task;
17
- this.result = null;
18
- }
19
-
20
- get() {
21
- if (this.result) {
22
- return this.result;
23
- }
24
-
25
- const cts = new cancellation_1.CancellationTokenSource();
26
- const promise = this.task(cts.token);
27
- this.result = {
28
- promise,
29
- dispose: () => {
30
- this.result = null;
31
- cts.cancel();
32
- cts.dispose();
33
- }
34
- };
35
- return this.result;
36
- }
37
-
38
- }
39
-
40
- exports.Cache = Cache;
@@ -1,146 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.CancellationTokenSource = exports.CancellationToken = void 0;
11
-
12
- const event_1 = require("./event");
13
-
14
- const shortcutEvent = Object.freeze(function (callback, context) {
15
- const handle = setTimeout(callback.bind(context), 0);
16
- return {
17
- dispose() {
18
- clearTimeout(handle);
19
- }
20
-
21
- };
22
- });
23
- var CancellationToken;
24
-
25
- (function (CancellationToken) {
26
- function isCancellationToken(thing) {
27
- if (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {
28
- return true;
29
- }
30
-
31
- if (thing instanceof MutableToken) {
32
- return true;
33
- }
34
-
35
- if (!thing || typeof thing !== 'object') {
36
- return false;
37
- }
38
-
39
- return typeof thing.isCancellationRequested === 'boolean' && typeof thing.onCancellationRequested === 'function';
40
- }
41
-
42
- CancellationToken.isCancellationToken = isCancellationToken;
43
- CancellationToken.None = Object.freeze({
44
- isCancellationRequested: false,
45
- onCancellationRequested: event_1.Event.None
46
- });
47
- CancellationToken.Cancelled = Object.freeze({
48
- isCancellationRequested: true,
49
- onCancellationRequested: shortcutEvent
50
- });
51
- })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
52
-
53
- class MutableToken {
54
- constructor() {
55
- this._isCancelled = false;
56
- this._emitter = null;
57
- }
58
-
59
- cancel() {
60
- if (!this._isCancelled) {
61
- this._isCancelled = true;
62
-
63
- if (this._emitter) {
64
- this._emitter.fire(undefined);
65
-
66
- this.dispose();
67
- }
68
- }
69
- }
70
-
71
- get isCancellationRequested() {
72
- return this._isCancelled;
73
- }
74
-
75
- get onCancellationRequested() {
76
- if (this._isCancelled) {
77
- return shortcutEvent;
78
- }
79
-
80
- if (!this._emitter) {
81
- this._emitter = new event_1.Emitter();
82
- }
83
-
84
- return this._emitter.event;
85
- }
86
-
87
- dispose() {
88
- if (this._emitter) {
89
- this._emitter.dispose();
90
-
91
- this._emitter = null;
92
- }
93
- }
94
-
95
- }
96
-
97
- class CancellationTokenSource {
98
- constructor(parent) {
99
- this._token = undefined;
100
- this._parentListener = undefined;
101
- this._parentListener = parent && parent.onCancellationRequested(this.cancel, this);
102
- }
103
-
104
- get token() {
105
- if (!this._token) {
106
- // be lazy and create the token only when
107
- // actually needed
108
- this._token = new MutableToken();
109
- }
110
-
111
- return this._token;
112
- }
113
-
114
- cancel() {
115
- if (!this._token) {
116
- // save an object by returning the default
117
- // cancelled token when cancellation happens
118
- // before someone asks for the token
119
- this._token = CancellationToken.Cancelled;
120
- } else if (this._token instanceof MutableToken) {
121
- // actually cancel
122
- this._token.cancel();
123
- }
124
- }
125
-
126
- dispose(cancel = false) {
127
- if (cancel) {
128
- this.cancel();
129
- }
130
-
131
- if (this._parentListener) {
132
- this._parentListener.dispose();
133
- }
134
-
135
- if (!this._token) {
136
- // ensure to initialize with an empty token if we had none
137
- this._token = CancellationToken.None;
138
- } else if (this._token instanceof MutableToken) {
139
- // actually dispose
140
- this._token.dispose();
141
- }
142
- }
143
-
144
- }
145
-
146
- exports.CancellationTokenSource = CancellationTokenSource;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
@@ -1,136 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.matchesFuzzyCodiconAware = exports.parseCodicons = exports.codiconStartMarker = void 0;
11
-
12
- const filters_1 = require("./filters");
13
-
14
- const strings_1 = require("./strings");
15
-
16
- exports.codiconStartMarker = '$(';
17
-
18
- function parseCodicons(text) {
19
- const firstCodiconIndex = text.indexOf(exports.codiconStartMarker);
20
-
21
- if (firstCodiconIndex === -1) {
22
- return {
23
- text
24
- }; // return early if the word does not include an codicon
25
- }
26
-
27
- return doParseCodicons(text, firstCodiconIndex);
28
- }
29
-
30
- exports.parseCodicons = parseCodicons;
31
-
32
- function doParseCodicons(text, firstCodiconIndex) {
33
- const codiconOffsets = [];
34
- let textWithoutCodicons = '';
35
-
36
- function appendChars(chars) {
37
- if (chars) {
38
- textWithoutCodicons += chars;
39
-
40
- for (const _ of chars) {
41
- codiconOffsets.push(codiconsOffset); // make sure to fill in codicon offsets
42
- }
43
- }
44
- }
45
-
46
- let currentCodiconStart = -1;
47
- let currentCodiconValue = '';
48
- let codiconsOffset = 0;
49
- let char;
50
- let nextChar;
51
- let offset = firstCodiconIndex;
52
- const length = text.length; // Append all characters until the first codicon
53
-
54
- appendChars(text.substr(0, firstCodiconIndex)); // example: $(file-symlink-file) my cool $(other-codicon) entry
55
-
56
- while (offset < length) {
57
- char = text[offset];
58
- nextChar = text[offset + 1]; // beginning of codicon: some value $( <--
59
-
60
- if (char === exports.codiconStartMarker[0] && nextChar === exports.codiconStartMarker[1]) {
61
- currentCodiconStart = offset; // if we had a previous potential codicon value without
62
- // the closing ')', it was actually not an codicon and
63
- // so we have to add it to the actual value
64
-
65
- appendChars(currentCodiconValue);
66
- currentCodiconValue = exports.codiconStartMarker;
67
- offset++; // jump over '('
68
- } // end of codicon: some value $(some-codicon) <--
69
- else if (char === ')' && currentCodiconStart !== -1) {
70
- const currentCodiconLength = offset - currentCodiconStart + 1; // +1 to include the closing ')'
71
-
72
- codiconsOffset += currentCodiconLength;
73
- currentCodiconStart = -1;
74
- currentCodiconValue = '';
75
- } // within codicon
76
- else if (currentCodiconStart !== -1) {
77
- // Make sure this is a real codicon name
78
- if (/^[a-z0-9\-]$/i.test(char)) {
79
- currentCodiconValue += char;
80
- } else {
81
- // This is not a real codicon, treat it as text
82
- appendChars(currentCodiconValue);
83
- currentCodiconStart = -1;
84
- currentCodiconValue = '';
85
- }
86
- } // any value outside of codicons
87
- else {
88
- appendChars(char);
89
- }
90
-
91
- offset++;
92
- } // if we had a previous potential codicon value without
93
- // the closing ')', it was actually not an codicon and
94
- // so we have to add it to the actual value
95
-
96
-
97
- appendChars(currentCodiconValue);
98
- return {
99
- text: textWithoutCodicons,
100
- codiconOffsets
101
- };
102
- }
103
-
104
- function matchesFuzzyCodiconAware(query, target, enableSeparateSubstringMatching = false) {
105
- const {
106
- text,
107
- codiconOffsets
108
- } = target; // Return early if there are no codicon markers in the word to match against
109
-
110
- if (!codiconOffsets || codiconOffsets.length === 0) {
111
- return filters_1.matchesFuzzy(query, text, enableSeparateSubstringMatching);
112
- } // Trim the word to match against because it could have leading
113
- // whitespace now if the word started with an codicon
114
-
115
-
116
- const wordToMatchAgainstWithoutCodiconsTrimmed = strings_1.ltrim(text, ' ');
117
- const leadingWhitespaceOffset = text.length - wordToMatchAgainstWithoutCodiconsTrimmed.length; // match on value without codicons
118
-
119
- const matches = filters_1.matchesFuzzy(query, wordToMatchAgainstWithoutCodiconsTrimmed, enableSeparateSubstringMatching); // Map matches back to offsets with codicons and trimming
120
-
121
- if (matches) {
122
- for (const match of matches) {
123
- const codiconOffset = codiconOffsets[match.start + leadingWhitespaceOffset]
124
- /* codicon offsets at index */
125
- + leadingWhitespaceOffset
126
- /* overall leading whitespace offset */
127
- ;
128
- match.start += codiconOffset;
129
- match.end += codiconOffset;
130
- }
131
- }
132
-
133
- return matches;
134
- }
135
-
136
- exports.matchesFuzzyCodiconAware = matchesFuzzyCodiconAware;