@codingame/monaco-vscode-api 1.76.9 → 1.78.0-next.0

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 (332) hide show
  1. package/README.md +87 -49
  2. package/dist/Bibtex.tmLanguage.js +2 -0
  3. package/dist/Handlebars.tmLanguage.js +2 -0
  4. package/dist/JSON.tmLanguage.js +2 -0
  5. package/dist/JSONC.tmLanguage.js +2 -0
  6. package/dist/JavaScript.tmLanguage.js +2 -0
  7. package/dist/JavaScriptReact.tmLanguage.js +2 -0
  8. package/dist/LaTeX.tmLanguage.js +2 -0
  9. package/dist/MagicPython.tmLanguage.js +2 -0
  10. package/dist/MagicRegExp.tmLanguage.js +2 -0
  11. package/dist/Red-color-theme.js +2 -0
  12. package/dist/Regular Expressions (JavaScript).js +2 -0
  13. package/dist/TeX.tmLanguage.js +2 -0
  14. package/dist/TypeScript.tmLanguage.js +2 -0
  15. package/dist/TypeScriptReact.tmLanguage.js +2 -0
  16. package/dist/_.contribution.js +1 -1
  17. package/dist/abyss-color-theme.js +2 -0
  18. package/dist/api.js +1 -3
  19. package/dist/api2.js +421 -18091
  20. package/dist/asp-vb-net.tmlanguage.js +2 -0
  21. package/dist/assets/diffLineDeleted.mp3 +0 -0
  22. package/dist/assets/diffLineInserted.mp3 +0 -0
  23. package/dist/assets/diffLineModified.mp3 +0 -0
  24. package/dist/audioCue.js +108 -478
  25. package/dist/bat.js +9 -0
  26. package/dist/batchfile.js +2 -0
  27. package/dist/batchfile.tmLanguage.js +2 -0
  28. package/dist/button.js +35 -8
  29. package/dist/c.js +2 -0
  30. package/dist/c.tmLanguage.js +2 -0
  31. package/dist/clojure.js +8 -0
  32. package/dist/clojure.tmLanguage.js +2 -0
  33. package/dist/coffeescript.js +9 -0
  34. package/dist/coffeescript.tmLanguage.js +2 -0
  35. package/dist/coffeescript2.js +2 -0
  36. package/dist/configuration.d.ts +269 -4
  37. package/dist/configuration.js +4326 -328
  38. package/dist/configuration2.js +14 -324
  39. package/dist/cpp-grammar-bailout.tmLanguage.js +2 -0
  40. package/dist/cpp.embedded.macro.tmLanguage.js +2 -0
  41. package/dist/cpp.js +16 -0
  42. package/dist/cpp.tmLanguage.js +2 -0
  43. package/dist/cpp2.js +2 -0
  44. package/dist/csharp.js +9 -0
  45. package/dist/csharp.tmLanguage.js +2 -0
  46. package/dist/csharp2.js +2 -0
  47. package/dist/cshtml.tmLanguage.js +2 -0
  48. package/dist/css.js +8 -0
  49. package/dist/css.tmLanguage.js +2 -0
  50. package/dist/cuda-cpp.tmLanguage.js +2 -0
  51. package/dist/dark_plus.js +2 -0
  52. package/dist/dark_plus_experimental.js +2 -0
  53. package/dist/dark_vs.js +2 -0
  54. package/dist/dart.js +8 -0
  55. package/dist/dart.tmLanguage.js +2 -0
  56. package/dist/debug.js +12115 -12209
  57. package/dist/default-extensions/bat.js +12 -0
  58. package/dist/default-extensions/clojure.js +11 -0
  59. package/dist/default-extensions/coffeescript.js +12 -0
  60. package/dist/default-extensions/cpp.js +19 -0
  61. package/dist/default-extensions/csharp.js +12 -0
  62. package/dist/default-extensions/css.js +11 -0
  63. package/dist/default-extensions/dart.js +11 -0
  64. package/dist/default-extensions/diff.js +11 -0
  65. package/dist/default-extensions/docker.js +11 -0
  66. package/dist/default-extensions/fsharp.js +12 -0
  67. package/dist/default-extensions/go.js +11 -0
  68. package/dist/default-extensions/groovy.js +12 -0
  69. package/dist/default-extensions/handlebars.js +11 -0
  70. package/dist/default-extensions/hlsl.js +11 -0
  71. package/dist/default-extensions/html.js +13 -0
  72. package/dist/default-extensions/ini.js +13 -0
  73. package/dist/default-extensions/java.js +12 -0
  74. package/dist/default-extensions/javascript.js +17 -0
  75. package/dist/default-extensions/json.js +13 -0
  76. package/dist/default-extensions/julia.js +11 -0
  77. package/dist/default-extensions/latex.js +14 -0
  78. package/dist/default-extensions/less.js +11 -0
  79. package/dist/default-extensions/log.js +10 -0
  80. package/dist/default-extensions/lua.js +11 -0
  81. package/dist/default-extensions/make.js +11 -0
  82. package/dist/default-extensions/markdown-basics.js +12 -0
  83. package/dist/default-extensions/objective-c.js +13 -0
  84. package/dist/default-extensions/perl.js +13 -0
  85. package/dist/default-extensions/php.js +13 -0
  86. package/dist/default-extensions/powershell.js +11 -0
  87. package/dist/default-extensions/pug.js +11 -0
  88. package/dist/default-extensions/python.js +12 -0
  89. package/dist/default-extensions/r.js +11 -0
  90. package/dist/default-extensions/razor.js +11 -0
  91. package/dist/default-extensions/ruby.js +11 -0
  92. package/dist/default-extensions/rust.js +11 -0
  93. package/dist/default-extensions/scss.js +12 -0
  94. package/dist/default-extensions/shaderlab.js +11 -0
  95. package/dist/default-extensions/shellscript.js +11 -0
  96. package/dist/default-extensions/sql.js +11 -0
  97. package/dist/default-extensions/swift.js +12 -0
  98. package/dist/default-extensions/theme-abyss.js +10 -0
  99. package/dist/default-extensions/theme-defaults.js +18 -0
  100. package/dist/default-extensions/theme-kimbie-dark.js +10 -0
  101. package/dist/default-extensions/theme-monokai-dimmed.js +10 -0
  102. package/dist/default-extensions/theme-monokai.js +10 -0
  103. package/dist/default-extensions/theme-quietlight.js +10 -0
  104. package/dist/default-extensions/theme-red.js +10 -0
  105. package/dist/default-extensions/theme-seti.js +10 -0
  106. package/dist/default-extensions/theme-solarized-dark.js +10 -0
  107. package/dist/default-extensions/theme-solarized-light.js +10 -0
  108. package/dist/default-extensions/theme-tomorrow-night-blue.js +10 -0
  109. package/dist/default-extensions/typescript-basics.js +17 -0
  110. package/dist/default-extensions/vb.js +12 -0
  111. package/dist/default-extensions/xml.js +13 -0
  112. package/dist/default-extensions/yaml.js +13 -0
  113. package/dist/dialogs.js +12 -216
  114. package/dist/diff.js +8 -0
  115. package/dist/diff.tmLanguage.js +2 -0
  116. package/dist/dimmed-monokai-color-theme.js +2 -0
  117. package/dist/docker.js +8 -0
  118. package/dist/docker.tmLanguage.js +2 -0
  119. package/dist/dom.js +101 -0
  120. package/dist/extensionManagement.js +4 -0
  121. package/dist/extensions.d.ts +368 -23
  122. package/dist/extensions.js +4 -85
  123. package/dist/extensionsRegistry.js +63 -64
  124. package/dist/files.d.ts +845 -0
  125. package/dist/files.js +1805 -1151
  126. package/dist/files2.js +32 -0
  127. package/dist/fsharp.js +9 -0
  128. package/dist/fsharp.tmLanguage.js +2 -0
  129. package/dist/fsharp2.js +2 -0
  130. package/dist/go.js +8 -0
  131. package/dist/go.tmLanguage.js +2 -0
  132. package/dist/groovy.js +9 -0
  133. package/dist/groovy.tmLanguage.js +2 -0
  134. package/dist/groovy2.js +2 -0
  135. package/dist/handlebars.js +8 -0
  136. package/dist/hc_black.js +2 -0
  137. package/dist/hc_light.js +2 -0
  138. package/dist/hlsl.js +8 -0
  139. package/dist/hlsl.tmLanguage.js +2 -0
  140. package/dist/html-derivative.tmLanguage.js +2 -0
  141. package/dist/html.js +10 -0
  142. package/dist/html.tmLanguage.js +2 -0
  143. package/dist/html.tmLanguage2.js +2 -0
  144. package/dist/html2.js +2 -0
  145. package/dist/ini.js +10 -0
  146. package/dist/ini.language-configuration.js +2 -0
  147. package/dist/ini.tmLanguage.js +2 -0
  148. package/dist/injection.js +1 -1
  149. package/dist/java.js +9 -0
  150. package/dist/java.tmLanguage.js +2 -0
  151. package/dist/java2.js +2 -0
  152. package/dist/javascript-language-configuration.js +2 -0
  153. package/dist/javascript.js +14 -0
  154. package/dist/javascript2.js +2 -0
  155. package/dist/jsdoc.js.injection.tmLanguage.js +2 -0
  156. package/dist/jsdoc.ts.injection.tmLanguage.js +2 -0
  157. package/dist/json.js +10 -0
  158. package/dist/jsonErrorMessages.js +1 -1
  159. package/dist/julia.js +8 -0
  160. package/dist/julia.tmLanguage.js +2 -0
  161. package/dist/keybindings.d.ts +1 -10
  162. package/dist/keybindings.js +291 -353
  163. package/dist/kimbie-dark-color-theme.js +2 -0
  164. package/dist/language-configuration.js +2 -0
  165. package/dist/language-configuration10.js +2 -0
  166. package/dist/language-configuration11.js +2 -0
  167. package/dist/language-configuration12.js +2 -0
  168. package/dist/language-configuration13.js +2 -0
  169. package/dist/language-configuration14.js +2 -0
  170. package/dist/language-configuration15.js +2 -0
  171. package/dist/language-configuration16.js +2 -0
  172. package/dist/language-configuration17.js +2 -0
  173. package/dist/language-configuration18.js +2 -0
  174. package/dist/language-configuration19.js +2 -0
  175. package/dist/language-configuration2.js +2 -0
  176. package/dist/language-configuration20.js +2 -0
  177. package/dist/language-configuration21.js +2 -0
  178. package/dist/language-configuration22.js +2 -0
  179. package/dist/language-configuration23.js +2 -0
  180. package/dist/language-configuration24.js +2 -0
  181. package/dist/language-configuration25.js +2 -0
  182. package/dist/language-configuration26.js +2 -0
  183. package/dist/language-configuration27.js +2 -0
  184. package/dist/language-configuration28.js +2 -0
  185. package/dist/language-configuration29.js +2 -0
  186. package/dist/language-configuration3.js +2 -0
  187. package/dist/language-configuration30.js +2 -0
  188. package/dist/language-configuration31.js +2 -0
  189. package/dist/language-configuration32.js +2 -0
  190. package/dist/language-configuration33.js +2 -0
  191. package/dist/language-configuration34.js +2 -0
  192. package/dist/language-configuration35.js +2 -0
  193. package/dist/language-configuration36.js +2 -0
  194. package/dist/language-configuration37.js +2 -0
  195. package/dist/language-configuration38.js +2 -0
  196. package/dist/language-configuration39.js +2 -0
  197. package/dist/language-configuration4.js +2 -0
  198. package/dist/language-configuration5.js +2 -0
  199. package/dist/language-configuration6.js +2 -0
  200. package/dist/language-configuration7.js +2 -0
  201. package/dist/language-configuration8.js +2 -0
  202. package/dist/language-configuration9.js +2 -0
  203. package/dist/languageService.js +5 -6
  204. package/dist/languages.d.ts +66 -1
  205. package/dist/languages.js +924 -5
  206. package/dist/latex.js +11 -0
  207. package/dist/layout.contribution.darwin.js +1 -1
  208. package/dist/layout.contribution.linux.js +1 -1
  209. package/dist/layout.contribution.win.js +1 -1
  210. package/dist/layout.js +4 -10
  211. package/dist/layoutService.js +10 -2
  212. package/dist/less.js +8 -0
  213. package/dist/less.tmLanguage.js +2 -0
  214. package/dist/light_plus.js +2 -0
  215. package/dist/light_plus_experimental.js +2 -0
  216. package/dist/light_vs.js +2 -0
  217. package/dist/log.js +7 -0
  218. package/dist/log.tmLanguage.js +2 -0
  219. package/dist/lua.js +8 -0
  220. package/dist/lua.tmLanguage.js +2 -0
  221. package/dist/make.js +8 -0
  222. package/dist/make.tmLanguage.js +2 -0
  223. package/dist/markdown-basics.js +9 -0
  224. package/dist/markdown-latex-combined.tmLanguage.js +2 -0
  225. package/dist/markdown.js +2 -0
  226. package/dist/markdown.tmLanguage.js +2 -0
  227. package/dist/memento.js +91 -0
  228. package/dist/modelEditor.d.ts +1480 -138
  229. package/dist/modelEditor.js +8700 -326
  230. package/dist/monaco.d.ts +987 -15
  231. package/dist/monaco.js +40 -10
  232. package/dist/monokai-color-theme.js +2 -0
  233. package/dist/notifications.js +86 -64
  234. package/dist/objective-c.js +10 -0
  235. package/dist/objective-c.tmLanguage.js +2 -0
  236. package/dist/objective-c__.tmLanguage.js +2 -0
  237. package/dist/perl.js +10 -0
  238. package/dist/perl.language-configuration.js +2 -0
  239. package/dist/perl.tmLanguage.js +2 -0
  240. package/dist/perl6.language-configuration.js +2 -0
  241. package/dist/perl6.tmLanguage.js +2 -0
  242. package/dist/php.js +10 -0
  243. package/dist/php.tmLanguage.js +2 -0
  244. package/dist/php2.js +2 -0
  245. package/dist/platform.js +105 -0
  246. package/dist/platform.tmLanguage.js +2 -0
  247. package/dist/polyfill.js +51923 -11069
  248. package/dist/powershell.js +8 -0
  249. package/dist/powershell.tmLanguage.js +2 -0
  250. package/dist/preferences.js +2532 -0
  251. package/dist/properties.language-configuration.js +2 -0
  252. package/dist/pug.js +8 -0
  253. package/dist/pug.tmLanguage.js +2 -0
  254. package/dist/python.js +9 -0
  255. package/dist/quietlight-color-theme.js +2 -0
  256. package/dist/r.js +8 -0
  257. package/dist/r.tmLanguage.js +2 -0
  258. package/dist/razor.js +8 -0
  259. package/dist/rollup-vsix-plugin.d.ts +8 -0
  260. package/dist/rollup-vsix-plugin.js +104 -0
  261. package/dist/ruby.js +8 -0
  262. package/dist/ruby.tmLanguage.js +2 -0
  263. package/dist/rust.js +8 -0
  264. package/dist/rust.tmLanguage.js +2 -0
  265. package/dist/sassdoc.tmLanguage.js +2 -0
  266. package/dist/scss.js +9 -0
  267. package/dist/scss.tmLanguage.js +2 -0
  268. package/dist/services.d.ts +12988 -12840
  269. package/dist/services.js +1 -1
  270. package/dist/shaderlab.js +8 -0
  271. package/dist/shaderlab.tmLanguage.js +2 -0
  272. package/dist/shell-unix-bash.tmLanguage.js +2 -0
  273. package/dist/shellscript.js +8 -0
  274. package/dist/snippets.js +6 -11
  275. package/dist/snippetsService.js +7 -10
  276. package/dist/solarized-dark-color-theme.js +2 -0
  277. package/dist/solarized-light-color-theme.js +2 -0
  278. package/dist/sql.js +8 -0
  279. package/dist/sql.tmLanguage.js +2 -0
  280. package/dist/swift.js +9 -0
  281. package/dist/swift.tmLanguage.js +2 -0
  282. package/dist/swift2.js +2 -0
  283. package/dist/tags-language-configuration.js +2 -0
  284. package/dist/textmate.d.ts +0 -264
  285. package/dist/textmate.js +402 -66
  286. package/dist/theme-abyss.js +7 -0
  287. package/dist/theme-defaults.js +15 -0
  288. package/dist/theme-kimbie-dark.js +7 -0
  289. package/dist/theme-monokai-dimmed.js +7 -0
  290. package/dist/theme-monokai.js +7 -0
  291. package/dist/theme-quietlight.js +7 -0
  292. package/dist/theme-red.js +7 -0
  293. package/dist/theme-seti.js +7 -0
  294. package/dist/theme-solarized-dark.js +7 -0
  295. package/dist/theme-solarized-light.js +7 -0
  296. package/dist/theme-tomorrow-night-blue.js +7 -0
  297. package/dist/theme.js +6 -11
  298. package/dist/{contextkeys.js → theme2.js} +165 -143
  299. package/dist/tokenClassificationRegistry.js +46 -2
  300. package/dist/tomorrow-night-blue-color-theme.js +2 -0
  301. package/dist/typescript-basics.js +14 -0
  302. package/dist/typescript.js +2 -0
  303. package/dist/unboundCommands.js +41 -0
  304. package/dist/utils.js +345 -0
  305. package/dist/vb.js +9 -0
  306. package/dist/vb2.js +2 -0
  307. package/dist/vs-seti-icon-theme.js +2 -0
  308. package/dist/vs_minimal-icon-theme.js +2 -0
  309. package/dist/xml.js +10 -0
  310. package/dist/xml.language-configuration.js +2 -0
  311. package/dist/xml.tmLanguage.js +2 -0
  312. package/dist/xsl.language-configuration.js +2 -0
  313. package/dist/xsl.tmLanguage.js +2 -0
  314. package/dist/yaml.js +10 -0
  315. package/dist/yaml.tmLanguage.js +2 -0
  316. package/package.json +50 -33
  317. package/dist/async.js +0 -301
  318. package/dist/cancellation.js +0 -3
  319. package/dist/configurationRegistry.js +0 -441
  320. package/dist/extensionResourceLoader.js +0 -96
  321. package/dist/labels.js +0 -14
  322. package/dist/languageConfiguration.js +0 -919
  323. package/dist/missing-services.js +0 -5554
  324. package/dist/resources.js +0 -197
  325. package/dist/services2.js +0 -3467
  326. package/dist/textFileEditorModel.js +0 -2985
  327. package/dist/tokenClassification.d.ts +0 -7
  328. package/dist/tokenClassification.js +0 -277
  329. package/dist/variableResolver.js +0 -1711
  330. package/dist/workbenchThemeService.js +0 -46
  331. package/dist/workspaceContext.js +0 -50
  332. /package/dist/{languageConfiguration.d.ts → preferences.d.ts} +0 -0
@@ -48,6 +48,27 @@ interface IReference<T> extends IDisposable {
48
48
  readonly object: T;
49
49
  }
50
50
 
51
+ interface CancellationToken {
52
+ /**
53
+ * A flag signalling is cancellation has been requested.
54
+ */
55
+ readonly isCancellationRequested: boolean;
56
+ /**
57
+ * An event which fires when cancellation is requested. This event
58
+ * only ever fires `once` as cancellation can only happen once. Listeners
59
+ * that are registered after cancellation will be called (next event loop run),
60
+ * but also only once.
61
+ *
62
+ * @event
63
+ */
64
+ readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;
65
+ }
66
+ declare namespace CancellationToken {
67
+ function isCancellationToken(thing: unknown): thing is CancellationToken;
68
+ const None: Readonly<CancellationToken>;
69
+ const Cancelled: Readonly<CancellationToken>;
70
+ }
71
+
51
72
  interface IObservable<T, TChange = void> {
52
73
  readonly TChange: TChange;
53
74
  /**
@@ -149,15 +170,28 @@ declare namespace Event {
149
170
  */
150
171
  function map<I, O>(event: Event<I>, map: (i: I) => O, disposable?: DisposableStore): Event<O>;
151
172
  /**
173
+ * Wraps an event in another event that performs some function on the event object before firing.
174
+ *
152
175
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
153
176
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
154
177
  * returned event causes this utility to leak a listener on the original event.
178
+ *
179
+ * @param event The event source for the new event.
180
+ * @param each The function to perform on the event object.
181
+ * @param disposable A disposable store to add the new EventEmitter to.
155
182
  */
156
183
  function forEach<I>(event: Event<I>, each: (i: I) => void, disposable?: DisposableStore): Event<I>;
157
184
  /**
185
+ * Wraps an event in another event that fires only when some condition is met.
186
+ *
158
187
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
159
188
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
160
189
  * returned event causes this utility to leak a listener on the original event.
190
+ *
191
+ * @param event The event source for the new event.
192
+ * @param filter The filter function that defines the condition. The event will fire for the object if this function
193
+ * returns true.
194
+ * @param disposable A disposable store to add the new EventEmitter to.
161
195
  */
162
196
  function filter<T, U>(event: Event<T | U>, filter: (e: T | U) => e is T, disposable?: DisposableStore): Event<T>;
163
197
  function filter<T>(event: Event<T>, filter: (e: T) => boolean, disposable?: DisposableStore): Event<T>;
@@ -167,8 +201,7 @@ declare namespace Event {
167
201
  */
168
202
  function signal<T>(event: Event<T>): Event<void>;
169
203
  /**
170
- * Given a collection of events, returns a single event which emits
171
- * whenever any of the provided events emit.
204
+ * Given a collection of events, returns a single event which emits whenever any of the provided events emit.
172
205
  */
173
206
  function any<T>(...events: Event<T>[]): Event<T>;
174
207
  function any(...events: Event<any>[]): Event<void>;
@@ -207,9 +240,22 @@ declare namespace Event {
207
240
  */
208
241
  function accumulate<T>(event: Event<T>, delay?: number, disposable?: DisposableStore): Event<T[]>;
209
242
  /**
243
+ * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate
244
+ * event objects from different sources do not fire the same event object.
245
+ *
210
246
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
211
247
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
212
248
  * returned event causes this utility to leak a listener on the original event.
249
+ *
250
+ * @param event The event source for the new event.
251
+ * @param equals The equality condition.
252
+ * @param disposable A disposable store to add the new EventEmitter to.
253
+ *
254
+ * @example
255
+ * ```
256
+ * // Fire only one time when a single window is opened or focused
257
+ * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow))
258
+ * ```
213
259
  */
214
260
  function latch<T>(event: Event<T>, equals?: (a: T, b: T) => boolean, disposable?: DisposableStore): Event<T>;
215
261
  /**
@@ -231,9 +277,24 @@ declare namespace Event {
231
277
  */
232
278
  function split<T, U>(event: Event<T | U>, isT: (e: T | U) => e is T, disposable?: DisposableStore): [Event<T>, Event<U>];
233
279
  /**
280
+ * Buffers an event until it has a listener attached.
281
+ *
234
282
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
235
283
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
236
284
  * returned event causes this utility to leak a listener on the original event.
285
+ *
286
+ * @param event The event source for the new event.
287
+ * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a
288
+ * `setTimeout` when the first event listener is added.
289
+ * @param _buffer Internal: A source event array used for tests.
290
+ *
291
+ * @example
292
+ * ```
293
+ * // Start accumulating events, when the first listener is attached, flush
294
+ * // the event after a timeout such that multiple listeners attached before
295
+ * // the timeout would receive the event
296
+ * this.onInstallExtension = Event.buffer(service.onInstallExtension, true);
297
+ * ```
237
298
  */
238
299
  function buffer<T>(event: Event<T>, flushAfterTimeout?: boolean, _buffer?: T[]): Event<T>;
239
300
  interface IChainableEvent<T> extends IDisposable {
@@ -249,234 +310,1515 @@ declare namespace Event {
249
310
  on(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;
250
311
  once(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
251
312
  }
313
+ /**
314
+ * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style.
315
+ *
316
+ * @example
317
+ * ```
318
+ * // Normal
319
+ * const onEnterPressNormal = Event.filter(
320
+ * Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)),
321
+ * e.keyCode === KeyCode.Enter
322
+ * ).event;
323
+ *
324
+ * // Using chain
325
+ * const onEnterPressChain = Event.chain(onKeyPress.event)
326
+ * .map(e => new StandardKeyboardEvent(e))
327
+ * .filter(e => e.keyCode === KeyCode.Enter)
328
+ * .event;
329
+ * ```
330
+ */
252
331
  function chain<T>(event: Event<T>): IChainableEvent<T>;
253
332
  interface NodeEventEmitter {
254
333
  on(event: string | symbol, listener: Function): unknown;
255
334
  removeListener(event: string | symbol, listener: Function): unknown;
256
335
  }
336
+ /**
337
+ * Creates an {@link Event} from a node event emitter.
338
+ */
257
339
  function fromNodeEventEmitter<T>(emitter: NodeEventEmitter, eventName: string, map?: (...args: any[]) => T): Event<T>;
258
340
  interface DOMEventEmitter {
259
341
  addEventListener(event: string | symbol, listener: Function): void;
260
342
  removeEventListener(event: string | symbol, listener: Function): void;
261
343
  }
344
+ /**
345
+ * Creates an {@link Event} from a DOM event emitter.
346
+ */
262
347
  function fromDOMEventEmitter<T>(emitter: DOMEventEmitter, eventName: string, map?: (...args: any[]) => T): Event<T>;
348
+ /**
349
+ * Creates a promise out of an event, using the {@link Event.once} helper.
350
+ */
263
351
  function toPromise<T>(event: Event<T>): Promise<T>;
352
+ /**
353
+ * Adds a listener to an event and calls the listener immediately with undefined as the event object.
354
+ *
355
+ * @example
356
+ * ```
357
+ * // Initialize the UI and update it when dataChangeEvent fires
358
+ * runAndSubscribe(dataChangeEvent, () => this._updateUI());
359
+ * ```
360
+ */
264
361
  function runAndSubscribe<T>(event: Event<T>, handler: (e: T | undefined) => any): IDisposable;
362
+ /**
363
+ * Adds a listener to an event and calls the listener immediately with undefined as the event object. A new
364
+ * {@link DisposableStore} is passed to the listener which is disposed when the returned disposable is disposed.
365
+ */
265
366
  function runAndSubscribeWithStore<T>(event: Event<T>, handler: (e: T | undefined, disposableStore: DisposableStore) => any): IDisposable;
266
367
  function fromObservable<T>(obs: IObservable<T, any>, store?: DisposableStore): Event<T>;
267
368
  }
268
369
 
269
370
  /**
270
- * Text snapshot that works like an iterator.
271
- * Will try to return chunks of roughly ~64KB size.
272
- * Will return null when finished.
273
- */
274
- interface ITextSnapshot {
275
- read(): string | null;
276
- }
277
- /**
278
- * A model.
279
- */
280
- type ITextModel = monaco.editor.ITextModel
281
-
282
- /**
283
- * A rich code editor.
371
+ * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.
372
+ * This class is a simple parser which creates the basic component parts
373
+ * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
374
+ * and encoding.
375
+ *
376
+ * ```txt
377
+ * foo://example.com:8042/over/there?name=ferret#nose
378
+ * \_/ \______________/\_________/ \_________/ \__/
379
+ * | | | | |
380
+ * scheme authority path query fragment
381
+ * | _____________________|__
382
+ * / \ / \
383
+ * urn:example:animal:ferret:nose
384
+ * ```
284
385
  */
285
- type ICodeEditor = monaco.editor.ICodeEditor
286
-
287
- interface IEditorModel {
386
+ declare class URI implements UriComponents {
387
+ static isUri(thing: any): thing is URI;
288
388
  /**
289
- * Emitted when the model is about to be disposed.
389
+ * scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'.
390
+ * The part before the first colon.
290
391
  */
291
- readonly onWillDispose: Event<void>;
392
+ readonly scheme: string;
292
393
  /**
293
- * Resolves the model.
394
+ * authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'.
395
+ * The part between the first double slashes and the next slash.
294
396
  */
295
- resolve(): Promise<void>;
397
+ readonly authority: string;
296
398
  /**
297
- * Find out if the editor model was resolved or not.
399
+ * path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'.
298
400
  */
299
- isResolved(): boolean;
401
+ readonly path: string;
300
402
  /**
301
- * Find out if this model has been disposed.
403
+ * query is the 'query' part of 'http://www.example.com/some/path?query#fragment'.
302
404
  */
303
- isDisposed(): boolean;
405
+ readonly query: string;
304
406
  /**
305
- * Dispose associated resources
407
+ * fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'.
306
408
  */
307
- dispose(): void;
308
- }
309
- declare enum EditorActivation {
409
+ readonly fragment: string;
310
410
  /**
311
- * Activate the editor after it opened. This will automatically restore
312
- * the editor if it is minimized.
411
+ * @internal
313
412
  */
314
- ACTIVATE = 1,
413
+ protected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);
315
414
  /**
316
- * Only restore the editor if it is minimized but do not activate it.
415
+ * @internal
416
+ */
417
+ protected constructor(components: UriComponents);
418
+ /**
419
+ * Returns a string representing the corresponding file system path of this URI.
420
+ * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
421
+ * platform specific path separator.
317
422
  *
318
- * Note: will only work in combination with the `preserveFocus: true` option.
319
- * Otherwise, if focus moves into the editor, it will activate and restore
320
- * automatically.
423
+ * * Will *not* validate the path for invalid characters and semantics.
424
+ * * Will *not* look at the scheme of this URI.
425
+ * * The result shall *not* be used for display purposes but for accessing a file on disk.
426
+ *
427
+ *
428
+ * The *difference* to `URI#path` is the use of the platform specific separator and the handling
429
+ * of UNC paths. See the below sample of a file-uri with an authority (UNC path).
430
+ *
431
+ * ```ts
432
+ const u = URI.parse('file://server/c$/folder/file.txt')
433
+ u.authority === 'server'
434
+ u.path === '/shares/c$/file.txt'
435
+ u.fsPath === '\\server\c$\folder\file.txt'
436
+ ```
437
+ *
438
+ * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,
439
+ * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working
440
+ * with URIs that represent files on disk (`file` scheme).
321
441
  */
322
- RESTORE = 2,
442
+ get fsPath(): string;
443
+ with(change: {
444
+ scheme?: string;
445
+ authority?: string | null;
446
+ path?: string | null;
447
+ query?: string | null;
448
+ fragment?: string | null;
449
+ }): URI;
323
450
  /**
324
- * Preserve the current active editor.
451
+ * Creates a new URI from a string, e.g. `http://www.example.com/some/path`,
452
+ * `file:///usr/home`, or `scheme:with/path`.
325
453
  *
326
- * Note: will only work in combination with the `preserveFocus: true` option.
327
- * Otherwise, if focus moves into the editor, it will activate and restore
328
- * automatically.
454
+ * @param value A string which represents an URI (see `URI#toString`).
329
455
  */
330
- PRESERVE = 3
331
- }
332
- declare enum EditorResolution {
456
+ static parse(value: string, _strict?: boolean): URI;
333
457
  /**
334
- * Displays a picker and allows the user to decide which editor to use.
458
+ * Creates a new URI from a file system path, e.g. `c:\my\files`,
459
+ * `/usr/home`, or `\\server\share\some\path`.
460
+ *
461
+ * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument
462
+ * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**
463
+ * `URI.parse('file://' + path)` because the path might contain characters that are
464
+ * interpreted (# and ?). See the following sample:
465
+ * ```ts
466
+ const good = URI.file('/coding/c#/project1');
467
+ good.scheme === 'file';
468
+ good.path === '/coding/c#/project1';
469
+ good.fragment === '';
470
+ const bad = URI.parse('file://' + '/coding/c#/project1');
471
+ bad.scheme === 'file';
472
+ bad.path === '/coding/c'; // path is now broken
473
+ bad.fragment === '/project1';
474
+ ```
475
+ *
476
+ * @param path A file system path (see `URI#fsPath`)
335
477
  */
336
- PICK = 0,
478
+ static file(path: string): URI;
479
+ static from(components: {
480
+ scheme: string;
481
+ authority?: string;
482
+ path?: string;
483
+ query?: string;
484
+ fragment?: string;
485
+ }): URI;
337
486
  /**
338
- * Only exclusive editors are considered.
487
+ * Join a URI path with path fragments and normalizes the resulting path.
488
+ *
489
+ * @param uri The input URI.
490
+ * @param pathFragment The path fragment to add to the URI path.
491
+ * @returns The resulting URI.
339
492
  */
340
- EXCLUSIVE_ONLY = 1
493
+ static joinPath(uri: URI, ...pathFragment: string[]): URI;
494
+ /**
495
+ * Creates a string representation for this URI. It's guaranteed that calling
496
+ * `URI.parse` with the result of this function creates an URI which is equal
497
+ * to this URI.
498
+ *
499
+ * * The result shall *not* be used for display purposes but for externalization or transport.
500
+ * * The result will be encoded using the percentage encoding and encoding happens mostly
501
+ * ignore the scheme-specific encoding rules.
502
+ *
503
+ * @param skipEncoding Do not encode the result, default is `false`
504
+ */
505
+ toString(skipEncoding?: boolean): string;
506
+ toJSON(): UriComponents;
507
+ static revive(data: UriComponents | URI): URI;
508
+ static revive(data: UriComponents | URI | undefined): URI | undefined;
509
+ static revive(data: UriComponents | URI | null): URI | null;
510
+ static revive(data: UriComponents | URI | undefined | null): URI | undefined | null;
341
511
  }
342
- declare enum EditorOpenSource {
512
+ interface UriComponents {
513
+ scheme: string;
514
+ authority: string;
515
+ path: string;
516
+ query: string;
517
+ fragment: string;
518
+ }
519
+
520
+ /**
521
+ * A position in the editor. This interface is suitable for serialization.
522
+ */
523
+ interface IPosition {
343
524
  /**
344
- * Default: the editor is opening via a programmatic call
345
- * to the editor service API.
525
+ * line number (starts at 1)
346
526
  */
347
- API = 0,
527
+ readonly lineNumber: number;
348
528
  /**
349
- * Indicates that a user action triggered the opening, e.g.
350
- * via mouse or keyboard use.
529
+ * column (the first character in a line is between column 1 and column 2)
351
530
  */
352
- USER = 1
531
+ readonly column: number;
353
532
  }
354
- interface IEditorOptions {
533
+ /**
534
+ * A position in the editor.
535
+ */
536
+ declare class Position {
355
537
  /**
356
- * Tells the editor to not receive keyboard focus when the editor is being opened.
357
- *
358
- * Will also not activate the group the editor opens in unless the group is already
359
- * the active one. This behaviour can be overridden via the `activation` option.
538
+ * line number (starts at 1)
360
539
  */
361
- preserveFocus?: boolean;
540
+ readonly lineNumber: number;
362
541
  /**
363
- * This option is only relevant if an editor is opened into a group that is not active
364
- * already and allows to control if the inactive group should become active, restored
365
- * or preserved.
366
- *
367
- * By default, the editor group will become active unless `preserveFocus` or `inactive`
368
- * is specified.
542
+ * column (the first character in a line is between column 1 and column 2)
369
543
  */
370
- activation?: EditorActivation;
544
+ readonly column: number;
545
+ constructor(lineNumber: number, column: number);
371
546
  /**
372
- * Tells the editor to reload the editor input in the editor even if it is identical to the one
373
- * already showing. By default, the editor will not reload the input if it is identical to the
374
- * one showing.
547
+ * Create a new position from this position.
548
+ *
549
+ * @param newLineNumber new line number
550
+ * @param newColumn new column
375
551
  */
376
- forceReload?: boolean;
552
+ with(newLineNumber?: number, newColumn?: number): Position;
377
553
  /**
378
- * Will reveal the editor if it is already opened and visible in any of the opened editor groups.
554
+ * Derive a new position from this position.
379
555
  *
380
- * Note that this option is just a hint that might be ignored if the user wants to open an editor explicitly
381
- * to the side of another one or into a specific editor group.
556
+ * @param deltaLineNumber line number delta
557
+ * @param deltaColumn column delta
382
558
  */
383
- revealIfVisible?: boolean;
559
+ delta(deltaLineNumber?: number, deltaColumn?: number): Position;
384
560
  /**
385
- * Will reveal the editor if it is already opened (even when not visible) in any of the opened editor groups.
386
- *
387
- * Note that this option is just a hint that might be ignored if the user wants to open an editor explicitly
388
- * to the side of another one or into a specific editor group.
561
+ * Test if this position equals other position
389
562
  */
390
- revealIfOpened?: boolean;
563
+ equals(other: IPosition): boolean;
391
564
  /**
392
- * An editor that is pinned remains in the editor stack even when another editor is being opened.
393
- * An editor that is not pinned will always get replaced by another editor that is not pinned.
565
+ * Test if position `a` equals position `b`
394
566
  */
395
- pinned?: boolean;
567
+ static equals(a: IPosition | null, b: IPosition | null): boolean;
396
568
  /**
397
- * An editor that is sticky moves to the beginning of the editors list within the group and will remain
398
- * there unless explicitly closed. Operations such as "Close All" will not close sticky editors.
569
+ * Test if this position is before other position.
570
+ * If the two positions are equal, the result will be false.
399
571
  */
400
- sticky?: boolean;
572
+ isBefore(other: IPosition): boolean;
401
573
  /**
402
- * The index in the document stack where to insert the editor into when opening.
574
+ * Test if position `a` is before position `b`.
575
+ * If the two positions are equal, the result will be false.
403
576
  */
404
- index?: number;
577
+ static isBefore(a: IPosition, b: IPosition): boolean;
405
578
  /**
406
- * An active editor that is opened will show its contents directly. Set to true to open an editor
407
- * in the background without loading its contents.
408
- *
409
- * Will also not activate the group the editor opens in unless the group is already
410
- * the active one. This behaviour can be overridden via the `activation` option.
579
+ * Test if this position is before other position.
580
+ * If the two positions are equal, the result will be true.
411
581
  */
412
- inactive?: boolean;
582
+ isBeforeOrEqual(other: IPosition): boolean;
413
583
  /**
414
- * Will not show an error in case opening the editor fails and thus allows to show a custom error
415
- * message as needed. By default, an error will be presented as notification if opening was not possible.
584
+ * Test if position `a` is before position `b`.
585
+ * If the two positions are equal, the result will be true.
416
586
  */
587
+ static isBeforeOrEqual(a: IPosition, b: IPosition): boolean;
417
588
  /**
418
- * In case of an error opening the editor, will not present this error to the user (e.g. by showing
419
- * a generic placeholder in the editor area). So it is up to the caller to provide error information
420
- * in that case.
421
- *
422
- * By default, an error when opening an editor will result in a placeholder editor that shows the error.
423
- * In certain cases a modal dialog may be presented to ask the user for further action.
589
+ * A function that compares positions, useful for sorting
424
590
  */
425
- ignoreError?: boolean;
591
+ static compare(a: IPosition, b: IPosition): number;
426
592
  /**
427
- * Allows to override the editor that should be used to display the input:
428
- * - `undefined`: let the editor decide for itself
429
- * - `string`: specific override by id
430
- * - `EditorResolution`: specific override handling
593
+ * Clone this position.
431
594
  */
432
- override?: string | EditorResolution;
595
+ clone(): Position;
433
596
  /**
434
- * A optional hint to signal in which context the editor opens.
435
- *
436
- * If configured to be `EditorOpenSource.USER`, this hint can be
437
- * used in various places to control the experience. For example,
438
- * if the editor to open fails with an error, a notification could
439
- * inform about this in a modal dialog. If the editor opened through
440
- * some background task, the notification would show in the background,
441
- * not as a modal dialog.
597
+ * Convert to a human-readable representation.
442
598
  */
443
- source?: EditorOpenSource;
599
+ toString(): string;
444
600
  /**
445
- * An optional property to signal that certain view state should be
446
- * applied when opening the editor.
601
+ * Create a `Position` from an `IPosition`.
447
602
  */
448
- viewState?: object;
603
+ static lift(pos: IPosition): Position;
604
+ /**
605
+ * Test if `obj` is an `IPosition`.
606
+ */
607
+ static isIPosition(obj: any): obj is IPosition;
449
608
  }
450
609
 
451
- type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
452
-
453
- interface ITextEditorModel extends IEditorModel {
610
+ /**
611
+ * A range in the editor. This interface is suitable for serialization.
612
+ */
613
+ interface IRange {
454
614
  /**
455
- * Provides access to the underlying `ITextModel`.
615
+ * Line number on which the range starts (starts at 1).
456
616
  */
457
- readonly textEditorModel: ITextModel | null;
617
+ readonly startLineNumber: number;
458
618
  /**
459
- * Creates a snapshot of the model's contents.
619
+ * Column on which the range starts in line `startLineNumber` (starts at 1).
460
620
  */
461
- createSnapshot(this: IResolvedTextEditorModel): ITextSnapshot;
462
- createSnapshot(this: ITextEditorModel): ITextSnapshot | null;
621
+ readonly startColumn: number;
463
622
  /**
464
- * Signals if this model is readonly or not.
623
+ * Line number on which the range ends.
465
624
  */
466
- isReadonly(): boolean;
625
+ readonly endLineNumber: number;
467
626
  /**
468
- * The language id of the text model if known.
627
+ * Column on which the range ends in line `endLineNumber`.
469
628
  */
470
- getLanguageId(): string | undefined;
629
+ readonly endColumn: number;
471
630
  }
472
- interface IResolvedTextEditorModel extends ITextEditorModel {
631
+ /**
632
+ * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
633
+ */
634
+ declare class Range {
473
635
  /**
474
- * Same as ITextEditorModel#textEditorModel, but never null.
636
+ * Line number on which the range starts (starts at 1).
637
+ */
638
+ readonly startLineNumber: number;
639
+ /**
640
+ * Column on which the range starts in line `startLineNumber` (starts at 1).
641
+ */
642
+ readonly startColumn: number;
643
+ /**
644
+ * Line number on which the range ends.
645
+ */
646
+ readonly endLineNumber: number;
647
+ /**
648
+ * Column on which the range ends in line `endLineNumber`.
649
+ */
650
+ readonly endColumn: number;
651
+ constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number);
652
+ /**
653
+ * Test if this range is empty.
654
+ */
655
+ isEmpty(): boolean;
656
+ /**
657
+ * Test if `range` is empty.
658
+ */
659
+ static isEmpty(range: IRange): boolean;
660
+ /**
661
+ * Test if position is in this range. If the position is at the edges, will return true.
662
+ */
663
+ containsPosition(position: IPosition): boolean;
664
+ /**
665
+ * Test if `position` is in `range`. If the position is at the edges, will return true.
666
+ */
667
+ static containsPosition(range: IRange, position: IPosition): boolean;
668
+ /**
669
+ * Test if `position` is in `range`. If the position is at the edges, will return false.
670
+ * @internal
671
+ */
672
+ static strictContainsPosition(range: IRange, position: IPosition): boolean;
673
+ /**
674
+ * Test if range is in this range. If the range is equal to this range, will return true.
675
+ */
676
+ containsRange(range: IRange): boolean;
677
+ /**
678
+ * Test if `otherRange` is in `range`. If the ranges are equal, will return true.
679
+ */
680
+ static containsRange(range: IRange, otherRange: IRange): boolean;
681
+ /**
682
+ * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
683
+ */
684
+ strictContainsRange(range: IRange): boolean;
685
+ /**
686
+ * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.
687
+ */
688
+ static strictContainsRange(range: IRange, otherRange: IRange): boolean;
689
+ /**
690
+ * A reunion of the two ranges.
691
+ * The smallest position will be used as the start point, and the largest one as the end point.
692
+ */
693
+ plusRange(range: IRange): Range;
694
+ /**
695
+ * A reunion of the two ranges.
696
+ * The smallest position will be used as the start point, and the largest one as the end point.
697
+ */
698
+ static plusRange(a: IRange, b: IRange): Range;
699
+ /**
700
+ * A intersection of the two ranges.
701
+ */
702
+ intersectRanges(range: IRange): Range | null;
703
+ /**
704
+ * A intersection of the two ranges.
705
+ */
706
+ static intersectRanges(a: IRange, b: IRange): Range | null;
707
+ /**
708
+ * Test if this range equals other.
709
+ */
710
+ equalsRange(other: IRange | null | undefined): boolean;
711
+ /**
712
+ * Test if range `a` equals `b`.
713
+ */
714
+ static equalsRange(a: IRange | null | undefined, b: IRange | null | undefined): boolean;
715
+ /**
716
+ * Return the end position (which will be after or equal to the start position)
717
+ */
718
+ getEndPosition(): Position;
719
+ /**
720
+ * Return the end position (which will be after or equal to the start position)
721
+ */
722
+ static getEndPosition(range: IRange): Position;
723
+ /**
724
+ * Return the start position (which will be before or equal to the end position)
475
725
  */
726
+ getStartPosition(): Position;
727
+ /**
728
+ * Return the start position (which will be before or equal to the end position)
729
+ */
730
+ static getStartPosition(range: IRange): Position;
731
+ /**
732
+ * Transform to a user presentable string representation.
733
+ */
734
+ toString(): string;
735
+ /**
736
+ * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
737
+ */
738
+ setEndPosition(endLineNumber: number, endColumn: number): Range;
739
+ /**
740
+ * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
741
+ */
742
+ setStartPosition(startLineNumber: number, startColumn: number): Range;
743
+ /**
744
+ * Create a new empty range using this range's start position.
745
+ */
746
+ collapseToStart(): Range;
747
+ /**
748
+ * Create a new empty range using this range's start position.
749
+ */
750
+ static collapseToStart(range: IRange): Range;
751
+ /**
752
+ * Create a new empty range using this range's end position.
753
+ */
754
+ collapseToEnd(): Range;
755
+ /**
756
+ * Create a new empty range using this range's end position.
757
+ */
758
+ static collapseToEnd(range: IRange): Range;
759
+ /**
760
+ * Moves the range by the given amount of lines.
761
+ */
762
+ delta(lineCount: number): Range;
763
+ static fromPositions(start: IPosition, end?: IPosition): Range;
764
+ /**
765
+ * Create a `Range` from an `IRange`.
766
+ */
767
+ static lift(range: undefined | null): null;
768
+ static lift(range: IRange): Range;
769
+ static lift(range: IRange | undefined | null): Range | null;
770
+ /**
771
+ * Test if `obj` is an `IRange`.
772
+ */
773
+ static isIRange(obj: any): obj is IRange;
774
+ /**
775
+ * Test if the two ranges are touching in any way.
776
+ */
777
+ static areIntersectingOrTouching(a: IRange, b: IRange): boolean;
778
+ /**
779
+ * Test if the two ranges are intersecting. If the ranges are touching it returns true.
780
+ */
781
+ static areIntersecting(a: IRange, b: IRange): boolean;
782
+ /**
783
+ * A function that compares ranges, useful for sorting ranges
784
+ * It will first compare ranges on the startPosition and then on the endPosition
785
+ */
786
+ static compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number;
787
+ /**
788
+ * A function that compares ranges, useful for sorting ranges
789
+ * It will first compare ranges on the endPosition and then on the startPosition
790
+ */
791
+ static compareRangesUsingEnds(a: IRange, b: IRange): number;
792
+ /**
793
+ * Test if the range spans multiple lines.
794
+ */
795
+ static spansMultipleLines(range: IRange): boolean;
796
+ toJSON(): IRange;
797
+ }
798
+
799
+ /**
800
+ * A single edit operation, that acts as a simple replace.
801
+ * i.e. Replace text at `range` with `text` in model.
802
+ */
803
+ interface ISingleEditOperation {
804
+ /**
805
+ * The range to replace. This can be empty to emulate a simple insert.
806
+ */
807
+ range: IRange;
808
+ /**
809
+ * The text to replace with. This can be null to emulate a simple delete.
810
+ */
811
+ text: string | null;
812
+ /**
813
+ * This indicates that this operation has "insert" semantics.
814
+ * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved.
815
+ */
816
+ forceMoveMarkers?: boolean;
817
+ }
818
+
819
+ declare class TextChange {
820
+ readonly oldPosition: number;
821
+ readonly oldText: string;
822
+ readonly newPosition: number;
823
+ readonly newText: string;
824
+ get oldLength(): number;
825
+ get oldEnd(): number;
826
+ get newLength(): number;
827
+ get newEnd(): number;
828
+ constructor(oldPosition: number, oldText: string, newPosition: number, newText: string);
829
+ toString(): string;
830
+ private static _writeStringSize;
831
+ private static _writeString;
832
+ private static _readString;
833
+ writeSize(): number;
834
+ write(b: Uint8Array, offset: number): number;
835
+ static read(b: Uint8Array, offset: number, dest: TextChange[]): number;
836
+ }
837
+
838
+ /**
839
+ * A fast character classifier that uses a compact array for ASCII values.
840
+ */
841
+ declare class CharacterClassifier<T extends number> {
842
+ /**
843
+ * Maintain a compact (fully initialized ASCII map for quickly classifying ASCII characters - used more often in code).
844
+ */
845
+ protected readonly _asciiMap: Uint8Array;
846
+ /**
847
+ * The entire map (sparse array).
848
+ */
849
+ protected readonly _map: Map<number, number>;
850
+ protected readonly _defaultValue: number;
851
+ constructor(_defaultValue: T);
852
+ private static _createAsciiMap;
853
+ set(charCode: number, _value: T): void;
854
+ get(charCode: number): T;
855
+ clear(): void;
856
+ }
857
+
858
+ declare const enum WordCharacterClass {
859
+ Regular = 0,
860
+ Whitespace = 1,
861
+ WordSeparator = 2
862
+ }
863
+ declare class WordCharacterClassifier extends CharacterClassifier<WordCharacterClass> {
864
+ constructor(wordSeparators: string);
865
+ }
866
+
867
+ interface IModelContentChange {
868
+ /**
869
+ * The range that got replaced.
870
+ */
871
+ readonly range: IRange;
872
+ /**
873
+ * The offset of the range that got replaced.
874
+ */
875
+ readonly rangeOffset: number;
876
+ /**
877
+ * The length of the range that got replaced.
878
+ */
879
+ readonly rangeLength: number;
880
+ /**
881
+ * The new text for the range.
882
+ */
883
+ readonly text: string;
884
+ }
885
+
886
+ /**
887
+ * End of line character preference.
888
+ */
889
+ declare const enum EndOfLinePreference {
890
+ /**
891
+ * Use the end of line character identified in the text buffer.
892
+ */
893
+ TextDefined = 0,
894
+ /**
895
+ * Use line feed (\n) as the end of line character.
896
+ */
897
+ LF = 1,
898
+ /**
899
+ * Use carriage return and line feed (\r\n) as the end of line character.
900
+ */
901
+ CRLF = 2
902
+ }
903
+ /**
904
+ * The default end of line to use when instantiating models.
905
+ */
906
+ declare const enum DefaultEndOfLine {
907
+ /**
908
+ * Use line feed (\n) as the end of line character.
909
+ */
910
+ LF = 1,
911
+ /**
912
+ * Use carriage return and line feed (\r\n) as the end of line character.
913
+ */
914
+ CRLF = 2
915
+ }
916
+ /**
917
+ * An identifier for a single edit operation.
918
+ * @internal
919
+ */
920
+ interface ISingleEditOperationIdentifier {
921
+ /**
922
+ * Identifier major
923
+ */
924
+ major: number;
925
+ /**
926
+ * Identifier minor
927
+ */
928
+ minor: number;
929
+ }
930
+ /**
931
+ * A single edit operation, that has an identifier.
932
+ */
933
+ interface IIdentifiedSingleEditOperation extends ISingleEditOperation {
934
+ /**
935
+ * An identifier associated with this single edit operation.
936
+ * @internal
937
+ */
938
+ identifier?: ISingleEditOperationIdentifier | null;
939
+ /**
940
+ * This indicates that this operation is inserting automatic whitespace
941
+ * that can be removed on next model edit operation if `config.trimAutoWhitespace` is true.
942
+ * @internal
943
+ */
944
+ isAutoWhitespaceEdit?: boolean;
945
+ /**
946
+ * This indicates that this operation is in a set of operations that are tracked and should not be "simplified".
947
+ * @internal
948
+ */
949
+ _isTracked?: boolean;
950
+ }
951
+ interface IValidEditOperation {
952
+ /**
953
+ * An identifier associated with this single edit operation.
954
+ * @internal
955
+ */
956
+ identifier: ISingleEditOperationIdentifier | null;
957
+ /**
958
+ * The range to replace. This can be empty to emulate a simple insert.
959
+ */
960
+ range: Range;
961
+ /**
962
+ * The text to replace with. This can be empty to emulate a simple delete.
963
+ */
964
+ text: string;
965
+ /**
966
+ * @internal
967
+ */
968
+ textChange: TextChange;
969
+ }
970
+ declare class FindMatch {
971
+ _findMatchBrand: void;
972
+ readonly range: Range;
973
+ readonly matches: string[] | null;
974
+ /**
975
+ * @internal
976
+ */
977
+ constructor(range: Range, matches: string[] | null);
978
+ }
979
+ /**
980
+ * Text snapshot that works like an iterator.
981
+ * Will try to return chunks of roughly ~64KB size.
982
+ * Will return null when finished.
983
+ */
984
+ interface ITextSnapshot {
985
+ read(): string | null;
986
+ }
987
+ /**
988
+ * A model.
989
+ */
990
+ type ITextModel = monaco.editor.ITextModel
991
+ /**
992
+ * @internal
993
+ */
994
+ interface ITextBufferFactory {
995
+ create(defaultEOL: DefaultEndOfLine): {
996
+ textBuffer: ITextBuffer;
997
+ disposable: IDisposable;
998
+ };
999
+ getFirstLineText(lengthLimit: number): string;
1000
+ }
1001
+ /**
1002
+ * @internal
1003
+ */
1004
+ declare class ValidAnnotatedEditOperation implements IIdentifiedSingleEditOperation {
1005
+ readonly identifier: ISingleEditOperationIdentifier | null;
1006
+ readonly range: Range;
1007
+ readonly text: string | null;
1008
+ readonly forceMoveMarkers: boolean;
1009
+ readonly isAutoWhitespaceEdit: boolean;
1010
+ readonly _isTracked: boolean;
1011
+ constructor(identifier: ISingleEditOperationIdentifier | null, range: Range, text: string | null, forceMoveMarkers: boolean, isAutoWhitespaceEdit: boolean, _isTracked: boolean);
1012
+ }
1013
+ /**
1014
+ * @internal
1015
+ *
1016
+ * `lineNumber` is 1 based.
1017
+ */
1018
+ interface IReadonlyTextBuffer {
1019
+ onDidChangeContent: Event<void>;
1020
+ equals(other: ITextBuffer): boolean;
1021
+ mightContainRTL(): boolean;
1022
+ mightContainUnusualLineTerminators(): boolean;
1023
+ resetMightContainUnusualLineTerminators(): void;
1024
+ mightContainNonBasicASCII(): boolean;
1025
+ getBOM(): string;
1026
+ getEOL(): string;
1027
+ getOffsetAt(lineNumber: number, column: number): number;
1028
+ getPositionAt(offset: number): Position;
1029
+ getRangeAt(offset: number, length: number): Range;
1030
+ getValueInRange(range: Range, eol: EndOfLinePreference): string;
1031
+ createSnapshot(preserveBOM: boolean): ITextSnapshot;
1032
+ getValueLengthInRange(range: Range, eol: EndOfLinePreference): number;
1033
+ getCharacterCountInRange(range: Range, eol: EndOfLinePreference): number;
1034
+ getLength(): number;
1035
+ getLineCount(): number;
1036
+ getLinesContent(): string[];
1037
+ getLineContent(lineNumber: number): string;
1038
+ getLineCharCode(lineNumber: number, index: number): number;
1039
+ getCharCode(offset: number): number;
1040
+ getLineLength(lineNumber: number): number;
1041
+ getLineFirstNonWhitespaceColumn(lineNumber: number): number;
1042
+ getLineLastNonWhitespaceColumn(lineNumber: number): number;
1043
+ findMatchesLineByLine(searchRange: Range, searchData: SearchData, captureMatches: boolean, limitResultCount: number): FindMatch[];
1044
+ }
1045
+ /**
1046
+ * @internal
1047
+ */
1048
+ declare class SearchData {
1049
+ /**
1050
+ * The regex to search for. Always defined.
1051
+ */
1052
+ readonly regex: RegExp;
1053
+ /**
1054
+ * The word separator classifier.
1055
+ */
1056
+ readonly wordSeparators: WordCharacterClassifier | null;
1057
+ /**
1058
+ * The simple string to search for (if possible).
1059
+ */
1060
+ readonly simpleSearch: string | null;
1061
+ constructor(regex: RegExp, wordSeparators: WordCharacterClassifier | null, simpleSearch: string | null);
1062
+ }
1063
+ /**
1064
+ * @internal
1065
+ */
1066
+ interface ITextBuffer extends IReadonlyTextBuffer {
1067
+ setEOL(newEOL: '\r\n' | '\n'): void;
1068
+ applyEdits(rawOperations: ValidAnnotatedEditOperation[], recordTrimAutoWhitespace: boolean, computeUndoEdits: boolean): ApplyEditsResult;
1069
+ }
1070
+ /**
1071
+ * @internal
1072
+ */
1073
+ declare class ApplyEditsResult {
1074
+ readonly reverseEdits: IValidEditOperation[] | null;
1075
+ readonly changes: IInternalModelContentChange[];
1076
+ readonly trimAutoWhitespaceLineNumbers: number[] | null;
1077
+ constructor(reverseEdits: IValidEditOperation[] | null, changes: IInternalModelContentChange[], trimAutoWhitespaceLineNumbers: number[] | null);
1078
+ }
1079
+ /**
1080
+ * @internal
1081
+ */
1082
+ interface IInternalModelContentChange extends IModelContentChange {
1083
+ range: Range;
1084
+ forceMoveMarkers: boolean;
1085
+ }
1086
+
1087
+ /**
1088
+ * A rich code editor.
1089
+ */
1090
+ type ICodeEditor = monaco.editor.ICodeEditor
1091
+
1092
+ interface IEditorModel {
1093
+ /**
1094
+ * Emitted when the model is about to be disposed.
1095
+ */
1096
+ readonly onWillDispose: Event<void>;
1097
+ /**
1098
+ * Resolves the model.
1099
+ */
1100
+ resolve(): Promise<void>;
1101
+ /**
1102
+ * Find out if the editor model was resolved or not.
1103
+ */
1104
+ isResolved(): boolean;
1105
+ /**
1106
+ * Find out if this model has been disposed.
1107
+ */
1108
+ isDisposed(): boolean;
1109
+ /**
1110
+ * Dispose associated resources
1111
+ */
1112
+ dispose(): void;
1113
+ }
1114
+ declare enum EditorActivation {
1115
+ /**
1116
+ * Activate the editor after it opened. This will automatically restore
1117
+ * the editor if it is minimized.
1118
+ */
1119
+ ACTIVATE = 1,
1120
+ /**
1121
+ * Only restore the editor if it is minimized but do not activate it.
1122
+ *
1123
+ * Note: will only work in combination with the `preserveFocus: true` option.
1124
+ * Otherwise, if focus moves into the editor, it will activate and restore
1125
+ * automatically.
1126
+ */
1127
+ RESTORE = 2,
1128
+ /**
1129
+ * Preserve the current active editor.
1130
+ *
1131
+ * Note: will only work in combination with the `preserveFocus: true` option.
1132
+ * Otherwise, if focus moves into the editor, it will activate and restore
1133
+ * automatically.
1134
+ */
1135
+ PRESERVE = 3
1136
+ }
1137
+ declare enum EditorResolution {
1138
+ /**
1139
+ * Displays a picker and allows the user to decide which editor to use.
1140
+ */
1141
+ PICK = 0,
1142
+ /**
1143
+ * Only exclusive editors are considered.
1144
+ */
1145
+ EXCLUSIVE_ONLY = 1
1146
+ }
1147
+ declare enum EditorOpenSource {
1148
+ /**
1149
+ * Default: the editor is opening via a programmatic call
1150
+ * to the editor service API.
1151
+ */
1152
+ API = 0,
1153
+ /**
1154
+ * Indicates that a user action triggered the opening, e.g.
1155
+ * via mouse or keyboard use.
1156
+ */
1157
+ USER = 1
1158
+ }
1159
+ interface IEditorOptions {
1160
+ /**
1161
+ * Tells the editor to not receive keyboard focus when the editor is being opened.
1162
+ *
1163
+ * Will also not activate the group the editor opens in unless the group is already
1164
+ * the active one. This behaviour can be overridden via the `activation` option.
1165
+ */
1166
+ preserveFocus?: boolean;
1167
+ /**
1168
+ * This option is only relevant if an editor is opened into a group that is not active
1169
+ * already and allows to control if the inactive group should become active, restored
1170
+ * or preserved.
1171
+ *
1172
+ * By default, the editor group will become active unless `preserveFocus` or `inactive`
1173
+ * is specified.
1174
+ */
1175
+ activation?: EditorActivation;
1176
+ /**
1177
+ * Tells the editor to reload the editor input in the editor even if it is identical to the one
1178
+ * already showing. By default, the editor will not reload the input if it is identical to the
1179
+ * one showing.
1180
+ */
1181
+ forceReload?: boolean;
1182
+ /**
1183
+ * Will reveal the editor if it is already opened and visible in any of the opened editor groups.
1184
+ *
1185
+ * Note that this option is just a hint that might be ignored if the user wants to open an editor explicitly
1186
+ * to the side of another one or into a specific editor group.
1187
+ */
1188
+ revealIfVisible?: boolean;
1189
+ /**
1190
+ * Will reveal the editor if it is already opened (even when not visible) in any of the opened editor groups.
1191
+ *
1192
+ * Note that this option is just a hint that might be ignored if the user wants to open an editor explicitly
1193
+ * to the side of another one or into a specific editor group.
1194
+ */
1195
+ revealIfOpened?: boolean;
1196
+ /**
1197
+ * An editor that is pinned remains in the editor stack even when another editor is being opened.
1198
+ * An editor that is not pinned will always get replaced by another editor that is not pinned.
1199
+ */
1200
+ pinned?: boolean;
1201
+ /**
1202
+ * An editor that is sticky moves to the beginning of the editors list within the group and will remain
1203
+ * there unless explicitly closed. Operations such as "Close All" will not close sticky editors.
1204
+ */
1205
+ sticky?: boolean;
1206
+ /**
1207
+ * The index in the document stack where to insert the editor into when opening.
1208
+ */
1209
+ index?: number;
1210
+ /**
1211
+ * An active editor that is opened will show its contents directly. Set to true to open an editor
1212
+ * in the background without loading its contents.
1213
+ *
1214
+ * Will also not activate the group the editor opens in unless the group is already
1215
+ * the active one. This behaviour can be overridden via the `activation` option.
1216
+ */
1217
+ inactive?: boolean;
1218
+ /**
1219
+ * Will not show an error in case opening the editor fails and thus allows to show a custom error
1220
+ * message as needed. By default, an error will be presented as notification if opening was not possible.
1221
+ */
1222
+ /**
1223
+ * In case of an error opening the editor, will not present this error to the user (e.g. by showing
1224
+ * a generic placeholder in the editor area). So it is up to the caller to provide error information
1225
+ * in that case.
1226
+ *
1227
+ * By default, an error when opening an editor will result in a placeholder editor that shows the error.
1228
+ * In certain cases a modal dialog may be presented to ask the user for further action.
1229
+ */
1230
+ ignoreError?: boolean;
1231
+ /**
1232
+ * Allows to override the editor that should be used to display the input:
1233
+ * - `undefined`: let the editor decide for itself
1234
+ * - `string`: specific override by id
1235
+ * - `EditorResolution`: specific override handling
1236
+ */
1237
+ override?: string | EditorResolution;
1238
+ /**
1239
+ * A optional hint to signal in which context the editor opens.
1240
+ *
1241
+ * If configured to be `EditorOpenSource.USER`, this hint can be
1242
+ * used in various places to control the experience. For example,
1243
+ * if the editor to open fails with an error, a notification could
1244
+ * inform about this in a modal dialog. If the editor opened through
1245
+ * some background task, the notification would show in the background,
1246
+ * not as a modal dialog.
1247
+ */
1248
+ source?: EditorOpenSource;
1249
+ /**
1250
+ * An optional property to signal that certain view state should be
1251
+ * applied when opening the editor.
1252
+ */
1253
+ viewState?: object;
1254
+ }
1255
+
1256
+ type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
1257
+
1258
+ interface ITextEditorModel extends IEditorModel {
1259
+ /**
1260
+ * Provides access to the underlying `ITextModel`.
1261
+ */
1262
+ readonly textEditorModel: ITextModel | null;
1263
+ /**
1264
+ * Creates a snapshot of the model's contents.
1265
+ */
1266
+ createSnapshot(this: IResolvedTextEditorModel): ITextSnapshot;
1267
+ createSnapshot(this: ITextEditorModel): ITextSnapshot | null;
1268
+ /**
1269
+ * Signals if this model is readonly or not.
1270
+ */
1271
+ isReadonly(): boolean;
1272
+ /**
1273
+ * The language id of the text model if known.
1274
+ */
1275
+ getLanguageId(): string | undefined;
1276
+ }
1277
+ interface IResolvedTextEditorModel extends ITextEditorModel {
1278
+ /**
1279
+ * Same as ITextEditorModel#textEditorModel, but never null.
1280
+ */
1281
+ readonly textEditorModel: ITextModel;
1282
+ }
1283
+
1284
+ interface ReadableStreamEvents<T> {
1285
+ /**
1286
+ * The 'data' event is emitted whenever the stream is
1287
+ * relinquishing ownership of a chunk of data to a consumer.
1288
+ *
1289
+ * NOTE: PLEASE UNDERSTAND THAT ADDING A DATA LISTENER CAN
1290
+ * TURN THE STREAM INTO FLOWING MODE. IT IS THEREFOR THE
1291
+ * LAST LISTENER THAT SHOULD BE ADDED AND NOT THE FIRST
1292
+ *
1293
+ * Use `listenStream` as a helper method to listen to
1294
+ * stream events in the right order.
1295
+ */
1296
+ on(event: 'data', callback: (data: T) => void): void;
1297
+ /**
1298
+ * Emitted when any error occurs.
1299
+ */
1300
+ on(event: 'error', callback: (err: Error) => void): void;
1301
+ /**
1302
+ * The 'end' event is emitted when there is no more data
1303
+ * to be consumed from the stream. The 'end' event will
1304
+ * not be emitted unless the data is completely consumed.
1305
+ */
1306
+ on(event: 'end', callback: () => void): void;
1307
+ }
1308
+ /**
1309
+ * A interface that emulates the API shape of a node.js readable
1310
+ * stream for use in native and web environments.
1311
+ */
1312
+ interface ReadableStream<T> extends ReadableStreamEvents<T> {
1313
+ /**
1314
+ * Stops emitting any events until resume() is called.
1315
+ */
1316
+ pause(): void;
1317
+ /**
1318
+ * Starts emitting events again after pause() was called.
1319
+ */
1320
+ resume(): void;
1321
+ /**
1322
+ * Destroys the stream and stops emitting any event.
1323
+ */
1324
+ destroy(): void;
1325
+ /**
1326
+ * Allows to remove a listener that was previously added.
1327
+ */
1328
+ removeListener(event: string, callback: Function): void;
1329
+ }
1330
+ /**
1331
+ * A interface that emulates the API shape of a node.js readable
1332
+ * for use in native and web environments.
1333
+ */
1334
+ interface Readable<T> {
1335
+ /**
1336
+ * Read data from the underlying source. Will return
1337
+ * null to indicate that no more data can be read.
1338
+ */
1339
+ read(): T | null;
1340
+ }
1341
+
1342
+ declare class VSBuffer {
1343
+ /**
1344
+ * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
1345
+ * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
1346
+ */
1347
+ static alloc(byteLength: number): VSBuffer;
1348
+ /**
1349
+ * When running in a nodejs context, if `actual` is not a nodejs Buffer, the backing store for
1350
+ * the returned `VSBuffer` instance might use a nodejs Buffer allocated from node's Buffer pool,
1351
+ * which is not transferrable.
1352
+ */
1353
+ static wrap(actual: Uint8Array): VSBuffer;
1354
+ /**
1355
+ * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
1356
+ * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
1357
+ */
1358
+ static fromString(source: string, options?: {
1359
+ dontUseNodeBuffer?: boolean;
1360
+ }): VSBuffer;
1361
+ /**
1362
+ * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
1363
+ * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
1364
+ */
1365
+ static fromByteArray(source: number[]): VSBuffer;
1366
+ /**
1367
+ * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
1368
+ * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
1369
+ */
1370
+ static concat(buffers: VSBuffer[], totalLength?: number): VSBuffer;
1371
+ readonly buffer: Uint8Array;
1372
+ readonly byteLength: number;
1373
+ private constructor();
1374
+ /**
1375
+ * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
1376
+ * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
1377
+ */
1378
+ clone(): VSBuffer;
1379
+ toString(): string;
1380
+ slice(start?: number, end?: number): VSBuffer;
1381
+ set(array: VSBuffer, offset?: number): void;
1382
+ set(array: Uint8Array, offset?: number): void;
1383
+ set(array: ArrayBuffer, offset?: number): void;
1384
+ set(array: ArrayBufferView, offset?: number): void;
1385
+ set(array: VSBuffer | Uint8Array | ArrayBuffer | ArrayBufferView, offset?: number): void;
1386
+ readUInt32BE(offset: number): number;
1387
+ writeUInt32BE(value: number, offset: number): void;
1388
+ readUInt32LE(offset: number): number;
1389
+ writeUInt32LE(value: number, offset: number): void;
1390
+ readUInt8(offset: number): number;
1391
+ writeUInt8(value: number, offset: number): void;
1392
+ }
1393
+ interface VSBufferReadable extends Readable<VSBuffer> {
1394
+ }
1395
+ interface VSBufferReadableStream extends ReadableStream<VSBuffer> {
1396
+ }
1397
+
1398
+ interface IFileReadLimits {
1399
+ /**
1400
+ * If the file exceeds the given size, an error of kind
1401
+ * `FILE_TOO_LARGE` will be thrown.
1402
+ */
1403
+ size?: number;
1404
+ /**
1405
+ * If the file exceeds the given size, an error of kind
1406
+ * `FILE_EXCEEDS_MEMORY_LIMIT` will be thrown.
1407
+ */
1408
+ memory?: number;
1409
+ }
1410
+ interface IBaseFileStat {
1411
+ /**
1412
+ * The unified resource identifier of this file or folder.
1413
+ */
1414
+ readonly resource: URI;
1415
+ /**
1416
+ * The name which is the last segment
1417
+ * of the {{path}}.
1418
+ */
1419
+ readonly name: string;
1420
+ /**
1421
+ * The size of the file.
1422
+ *
1423
+ * The value may or may not be resolved as
1424
+ * it is optional.
1425
+ */
1426
+ readonly size?: number;
1427
+ /**
1428
+ * The last modification date represented as millis from unix epoch.
1429
+ *
1430
+ * The value may or may not be resolved as
1431
+ * it is optional.
1432
+ */
1433
+ readonly mtime?: number;
1434
+ /**
1435
+ * The creation date represented as millis from unix epoch.
1436
+ *
1437
+ * The value may or may not be resolved as
1438
+ * it is optional.
1439
+ */
1440
+ readonly ctime?: number;
1441
+ /**
1442
+ * A unique identifier that represents the
1443
+ * current state of the file or directory.
1444
+ *
1445
+ * The value may or may not be resolved as
1446
+ * it is optional.
1447
+ */
1448
+ readonly etag?: string;
1449
+ /**
1450
+ * The file is read-only.
1451
+ */
1452
+ readonly readonly?: boolean;
1453
+ }
1454
+ interface IBaseFileStatWithMetadata extends Required<IBaseFileStat> {
1455
+ }
1456
+ /**
1457
+ * A file resource with meta information and resolved children if any.
1458
+ */
1459
+ interface IFileStat extends IBaseFileStat {
1460
+ /**
1461
+ * The resource is a file.
1462
+ */
1463
+ readonly isFile: boolean;
1464
+ /**
1465
+ * The resource is a directory.
1466
+ */
1467
+ readonly isDirectory: boolean;
1468
+ /**
1469
+ * The resource is a symbolic link. Note: even when the
1470
+ * file is a symbolic link, you can test for `FileType.File`
1471
+ * and `FileType.Directory` to know the type of the target
1472
+ * the link points to.
1473
+ */
1474
+ readonly isSymbolicLink: boolean;
1475
+ /**
1476
+ * The children of the file stat or undefined if none.
1477
+ */
1478
+ children: IFileStat[] | undefined;
1479
+ }
1480
+ interface IFileStatWithMetadata extends IFileStat, IBaseFileStatWithMetadata {
1481
+ readonly mtime: number;
1482
+ readonly ctime: number;
1483
+ readonly etag: string;
1484
+ readonly size: number;
1485
+ readonly readonly: boolean;
1486
+ readonly children: IFileStatWithMetadata[] | undefined;
1487
+ }
1488
+
1489
+ declare const enum SaveReason {
1490
+ /**
1491
+ * Explicit user gesture.
1492
+ */
1493
+ EXPLICIT = 1,
1494
+ /**
1495
+ * Auto save after a timeout.
1496
+ */
1497
+ AUTO = 2,
1498
+ /**
1499
+ * Auto save after editor focus change.
1500
+ */
1501
+ FOCUS_CHANGE = 3,
1502
+ /**
1503
+ * Auto save after window change.
1504
+ */
1505
+ WINDOW_CHANGE = 4
1506
+ }
1507
+ type SaveSource = string;
1508
+ interface ISaveOptions {
1509
+ /**
1510
+ * An indicator how the save operation was triggered.
1511
+ */
1512
+ reason?: SaveReason;
1513
+ /**
1514
+ * An indicator about the source of the save operation.
1515
+ *
1516
+ * Must use `SaveSourceRegistry.registerSource()` to obtain.
1517
+ */
1518
+ readonly source?: SaveSource;
1519
+ /**
1520
+ * Forces to save the contents of the working copy
1521
+ * again even if the working copy is not dirty.
1522
+ */
1523
+ readonly force?: boolean;
1524
+ /**
1525
+ * Instructs the save operation to skip any save participants.
1526
+ */
1527
+ readonly skipSaveParticipants?: boolean;
1528
+ /**
1529
+ * A hint as to which file systems should be available for saving.
1530
+ */
1531
+ readonly availableFileSystems?: string[];
1532
+ }
1533
+ interface IRevertOptions {
1534
+ /**
1535
+ * Forces to load the contents of the working copy
1536
+ * again even if the working copy is not dirty.
1537
+ */
1538
+ readonly force?: boolean;
1539
+ /**
1540
+ * A soft revert will clear dirty state of a working copy
1541
+ * but will not attempt to load it from its persisted state.
1542
+ *
1543
+ * This option may be used in scenarios where an editor is
1544
+ * closed and where we do not require to load the contents.
1545
+ */
1546
+ readonly soft?: boolean;
1547
+ }
1548
+
1549
+ declare const enum WorkingCopyCapabilities {
1550
+ /**
1551
+ * Signals no specific capability for the working copy.
1552
+ */
1553
+ None = 0,
1554
+ /**
1555
+ * Signals that the working copy requires
1556
+ * additional input when saving, e.g. an
1557
+ * associated path to save to.
1558
+ */
1559
+ Untitled = 2
1560
+ }
1561
+ /**
1562
+ * Data to be associated with working copy backups. Use
1563
+ * `IWorkingCopyBackupService.resolve(workingCopy)` to
1564
+ * retrieve the backup when loading the working copy.
1565
+ */
1566
+ interface IWorkingCopyBackup {
1567
+ /**
1568
+ * Any serializable metadata to be associated with the backup.
1569
+ */
1570
+ meta?: IWorkingCopyBackupMeta;
1571
+ /**
1572
+ * The actual snapshot of the contents of the working copy at
1573
+ * the time the backup was made.
1574
+ */
1575
+ content?: VSBufferReadable | VSBufferReadableStream;
1576
+ }
1577
+ /**
1578
+ * Working copy backup metadata that can be associated
1579
+ * with the backup.
1580
+ *
1581
+ * Some properties may be reserved as outlined here and
1582
+ * cannot be used.
1583
+ */
1584
+ interface IWorkingCopyBackupMeta {
1585
+ /**
1586
+ * Any property needs to be serializable through JSON.
1587
+ */
1588
+ [key: string]: unknown;
1589
+ /**
1590
+ * `typeId` is a reserved property that cannot be used
1591
+ * as backup metadata.
1592
+ */
1593
+ typeId?: never;
1594
+ }
1595
+ /**
1596
+ * Every working copy has in common that it is identified by
1597
+ * a resource `URI` and a `typeId`. There can only be one
1598
+ * working copy registered with the same `URI` and `typeId`.
1599
+ */
1600
+ interface IWorkingCopyIdentifier {
1601
+ /**
1602
+ * The type identifier of the working copy for grouping
1603
+ * working copies of the same domain together.
1604
+ *
1605
+ * There can only be one working copy for a given resource
1606
+ * and type identifier.
1607
+ */
1608
+ readonly typeId: string;
1609
+ /**
1610
+ * The resource of the working copy must be unique for
1611
+ * working copies of the same `typeId`.
1612
+ */
1613
+ readonly resource: URI;
1614
+ }
1615
+ interface IWorkingCopySaveEvent {
1616
+ /**
1617
+ * The reason why the working copy was saved.
1618
+ */
1619
+ readonly reason?: SaveReason;
1620
+ /**
1621
+ * The source of the working copy save request.
1622
+ */
1623
+ readonly source?: SaveSource;
1624
+ }
1625
+ /**
1626
+ * A working copy is an abstract concept to unify handling of
1627
+ * data that can be worked on (e.g. edited) in an editor.
1628
+ *
1629
+ *
1630
+ * A working copy resource may be the backing store of the data
1631
+ * (e.g. a file on disk), but that is not a requirement. If
1632
+ * your working copy is file based, consider to use the
1633
+ * `IFileWorkingCopy` instead that simplifies a lot of things
1634
+ * when working with file based working copies.
1635
+ */
1636
+ interface IWorkingCopy extends IWorkingCopyIdentifier {
1637
+ /**
1638
+ * Human readable name of the working copy.
1639
+ */
1640
+ readonly name: string;
1641
+ /**
1642
+ * The capabilities of the working copy.
1643
+ */
1644
+ readonly capabilities: WorkingCopyCapabilities;
1645
+ /**
1646
+ * Used by the workbench to signal if the working copy
1647
+ * is dirty or not. Typically a working copy is dirty
1648
+ * once changed until saved or reverted.
1649
+ */
1650
+ readonly onDidChangeDirty: Event<void>;
1651
+ /**
1652
+ * Used by the workbench e.g. to trigger auto-save
1653
+ * (unless this working copy is untitled) and backups.
1654
+ */
1655
+ readonly onDidChangeContent: Event<void>;
1656
+ /**
1657
+ * Used by the workbench e.g. to track local history
1658
+ * (unless this working copy is untitled).
1659
+ */
1660
+ readonly onDidSave: Event<IWorkingCopySaveEvent>;
1661
+ isDirty(): boolean;
1662
+ /**
1663
+ * The workbench may call this method often after it receives
1664
+ * the `onDidChangeContent` event for the working copy. The motivation
1665
+ * is to allow to quit VSCode with dirty working copies present.
1666
+ *
1667
+ * Providers of working copies should use `IWorkingCopyBackupService.resolve(workingCopy)`
1668
+ * to retrieve the backup metadata associated when loading the working copy.
1669
+ *
1670
+ * @param token support for cancellation
1671
+ */
1672
+ backup(token: CancellationToken): Promise<IWorkingCopyBackup>;
1673
+ /**
1674
+ * Asks the working copy to save. If the working copy was dirty, it is
1675
+ * expected to be non-dirty after this operation has finished.
1676
+ *
1677
+ * @returns `true` if the operation was successful and `false` otherwise.
1678
+ */
1679
+ save(options?: ISaveOptions): Promise<boolean>;
1680
+ /**
1681
+ * Asks the working copy to revert. If the working copy was dirty, it is
1682
+ * expected to be non-dirty after this operation has finished.
1683
+ */
1684
+ revert(options?: IRevertOptions): Promise<void>;
1685
+ }
1686
+
1687
+ /**
1688
+ * States the text file editor model can be in.
1689
+ */
1690
+ declare const enum TextFileEditorModelState {
1691
+ /**
1692
+ * A model is saved.
1693
+ */
1694
+ SAVED = 0,
1695
+ /**
1696
+ * A model is dirty.
1697
+ */
1698
+ DIRTY = 1,
1699
+ /**
1700
+ * A model is currently being saved but this operation has not completed yet.
1701
+ */
1702
+ PENDING_SAVE = 2,
1703
+ /**
1704
+ * A model is in conflict mode when changes cannot be saved because the
1705
+ * underlying file has changed. Models in conflict mode are always dirty.
1706
+ */
1707
+ CONFLICT = 3,
1708
+ /**
1709
+ * A model is in orphan state when the underlying file has been deleted.
1710
+ */
1711
+ ORPHAN = 4,
1712
+ /**
1713
+ * Any error that happens during a save that is not causing the CONFLICT state.
1714
+ * Models in error mode are always dirty.
1715
+ */
1716
+ ERROR = 5
1717
+ }
1718
+ declare const enum TextFileResolveReason {
1719
+ EDITOR = 1,
1720
+ REFERENCE = 2,
1721
+ OTHER = 3
1722
+ }
1723
+ interface ITextFileSaveOptions extends ISaveOptions {
1724
+ /**
1725
+ * Save the file with an attempt to unlock it.
1726
+ */
1727
+ readonly writeUnlock?: boolean;
1728
+ /**
1729
+ * Save the file with elevated privileges.
1730
+ *
1731
+ * Note: This may not be supported in all environments.
1732
+ */
1733
+ readonly writeElevated?: boolean;
1734
+ /**
1735
+ * Allows to write to a file even if it has been modified on disk.
1736
+ */
1737
+ readonly ignoreModifiedSince?: boolean;
1738
+ /**
1739
+ * If set, will bubble up the error to the caller instead of handling it.
1740
+ */
1741
+ readonly ignoreErrorHandler?: boolean;
1742
+ }
1743
+ interface ITextFileResolveOptions {
1744
+ /**
1745
+ * The contents to use for the model if known. If not
1746
+ * provided, the contents will be retrieved from the
1747
+ * underlying resource or backup if present.
1748
+ */
1749
+ readonly contents?: ITextBufferFactory;
1750
+ /**
1751
+ * Go to file bypassing any cache of the model if any.
1752
+ */
1753
+ readonly forceReadFromFile?: boolean;
1754
+ /**
1755
+ * Allow to resolve a model even if we think it is a binary file.
1756
+ */
1757
+ readonly allowBinary?: boolean;
1758
+ /**
1759
+ * Context why the model is being resolved.
1760
+ */
1761
+ readonly reason?: TextFileResolveReason;
1762
+ /**
1763
+ * If provided, the size of the file will be checked against the limits
1764
+ * and an error will be thrown if any limit is exceeded.
1765
+ */
1766
+ readonly limits?: IFileReadLimits;
1767
+ }
1768
+ declare const enum EncodingMode {
1769
+ /**
1770
+ * Instructs the encoding support to encode the object with the provided encoding
1771
+ */
1772
+ Encode = 0,
1773
+ /**
1774
+ * Instructs the encoding support to decode the object with the provided encoding
1775
+ */
1776
+ Decode = 1
1777
+ }
1778
+ interface IEncodingSupport {
1779
+ /**
1780
+ * Gets the encoding of the object if known.
1781
+ */
1782
+ getEncoding(): string | undefined;
1783
+ /**
1784
+ * Sets the encoding for the object for saving.
1785
+ */
1786
+ setEncoding(encoding: string, mode: EncodingMode): Promise<void>;
1787
+ }
1788
+ interface ILanguageSupport {
1789
+ /**
1790
+ * Sets the language id of the object.
1791
+ */
1792
+ setLanguageId(languageId: string, source?: string): void;
1793
+ }
1794
+ interface ITextFileEditorModelSaveEvent extends IWorkingCopySaveEvent {
1795
+ /**
1796
+ * The resolved stat from the save operation.
1797
+ */
1798
+ readonly stat: IFileStatWithMetadata;
1799
+ }
1800
+ interface ITextFileEditorModel extends ITextEditorModel, IEncodingSupport, ILanguageSupport, IWorkingCopy {
1801
+ readonly onDidSave: Event<ITextFileEditorModelSaveEvent>;
1802
+ readonly onDidSaveError: Event<void>;
1803
+ readonly onDidChangeOrphaned: Event<void>;
1804
+ readonly onDidChangeReadonly: Event<void>;
1805
+ readonly onDidChangeEncoding: Event<void>;
1806
+ hasState(state: TextFileEditorModelState): boolean;
1807
+ joinState(state: TextFileEditorModelState.PENDING_SAVE): Promise<void>;
1808
+ updatePreferredEncoding(encoding: string | undefined): void;
1809
+ save(options?: ITextFileSaveOptions): Promise<boolean>;
1810
+ revert(options?: IRevertOptions): Promise<void>;
1811
+ resolve(options?: ITextFileResolveOptions): Promise<void>;
1812
+ isDirty(): this is IResolvedTextFileEditorModel;
1813
+ getLanguageId(): string | undefined;
1814
+ isResolved(): this is IResolvedTextFileEditorModel;
1815
+ }
1816
+ interface IResolvedTextFileEditorModel extends ITextFileEditorModel {
476
1817
  readonly textEditorModel: ITextModel;
1818
+ createSnapshot(): ITextSnapshot;
477
1819
  }
478
1820
 
479
1821
  type OpenEditor = (modelRef: IReference<IResolvedTextEditorModel>, options: IEditorOptions | undefined, sideBySide?: boolean) => Promise<ICodeEditor | undefined>;
480
1822
  declare function getServiceOverride(openEditor: OpenEditor): IEditorOverrideServices;
481
1823
 
482
- export { IEditorOptions, IReference, IResolvedTextEditorModel, OpenEditor, getServiceOverride as default };
1824
+ export { IEditorOptions, IReference, IResolvedTextEditorModel, ITextFileEditorModel, OpenEditor, getServiceOverride as default };