@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
package/dist/services2.js DELETED
@@ -1,3467 +0,0 @@
1
- import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
2
- import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
3
- import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
4
- import { isMacintosh, isLinux, isWindows, isWeb, isEdge, isFirefox, isChrome, isSafari, OS } from 'monaco-editor/esm/vs/base/common/platform.js';
5
- import { joinPath, basename } from 'monaco-editor/esm/vs/base/common/resources.js';
6
- import { win32, posix } from 'monaco-editor/esm/vs/base/common/path.js';
7
- import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
8
- import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
9
- import { localize } from 'monaco-editor/esm/vs/nls.js';
10
- import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/ternarySearchTree.js';
11
- import { isString, isUndefinedOrNull } from 'monaco-editor/esm/vs/base/common/types.js';
12
- import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
13
- import { RawContextKey as RawContextKey$1 } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
14
- import { PauseableEmitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
15
- import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
16
- import { Disposable, MutableDisposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
17
- import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
18
- import { escapeRegExpCharacters, isFalsyOrWhitespace } from 'monaco-editor/esm/vs/base/common/strings.js';
19
- import { hash } from 'monaco-editor/esm/vs/base/common/hash.js';
20
- import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
21
- import { Promises, RunOnceScheduler, runWhenIdle } from 'monaco-editor/esm/vs/base/common/async.js';
22
- import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
23
- import { illegalArgument, illegalState } from 'monaco-editor/esm/vs/base/common/errors.js';
24
- const Emitter = monaco.Emitter;
25
- function refineServiceDecorator(serviceIdentifier) {
26
- return serviceIdentifier;
27
- }
28
- const WINDOWS_INVALID_FILE_CHARS = /[\\/:\*\?"<>\|]/g;
29
- const UNIX_INVALID_FILE_CHARS = /[\\/]/g;
30
- const WINDOWS_FORBIDDEN_NAMES = /^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;
31
- function isValidBasename(name, isWindowsOS = isWindows) {
32
- const invalidFileChars = isWindowsOS ? WINDOWS_INVALID_FILE_CHARS : UNIX_INVALID_FILE_CHARS;
33
- if (!name || name.length === 0 || /^\s+$/.test(name)) {
34
- return false;
35
- }
36
- invalidFileChars.lastIndex = 0;
37
- if (invalidFileChars.test(name)) {
38
- return false;
39
- }
40
- if (isWindowsOS && WINDOWS_FORBIDDEN_NAMES.test(name)) {
41
- return false;
42
- }
43
- if (name === '.' || name === '..') {
44
- return false;
45
- }
46
- if (isWindowsOS && name[name.length - 1] === '.') {
47
- return false;
48
- }
49
- if (isWindowsOS && name.length !== name.trim().length) {
50
- return false;
51
- }
52
- if (name.length > 255) {
53
- return false;
54
- }
55
- return true;
56
- }
57
- var NeverShowAgainScope;
58
- ( ((function(NeverShowAgainScope) {
59
- NeverShowAgainScope[NeverShowAgainScope["WORKSPACE"] = 0] = "WORKSPACE";
60
- NeverShowAgainScope[NeverShowAgainScope["PROFILE"] = 1] = "PROFILE";
61
- NeverShowAgainScope[NeverShowAgainScope["APPLICATION"] = 2] = "APPLICATION";
62
- })(NeverShowAgainScope || (NeverShowAgainScope = {}))));
63
- var NotificationsFilter;
64
- ( ((function(NotificationsFilter) {
65
- NotificationsFilter[NotificationsFilter["OFF"] = 0] = "OFF";
66
- NotificationsFilter[NotificationsFilter["SILENT"] = 1] = "SILENT";
67
- NotificationsFilter[NotificationsFilter["ERROR"] = 2] = "ERROR";
68
- })(NotificationsFilter || (NotificationsFilter = {}))));
69
- class NoOpNotification {
70
- constructor() {
71
- this.progress = ( (new NoOpProgress()));
72
- this.onDidClose = Event.None;
73
- this.onDidChangeVisibility = Event.None;
74
- }
75
- updateSeverity(severity) { }
76
- updateMessage(message) { }
77
- updateActions(actions) { }
78
- close() { }
79
- }
80
- class NoOpProgress {
81
- infinite() { }
82
- done() { }
83
- total(value) { }
84
- worked(value) { }
85
- }
86
- function __decorate(decorators, target, key, desc) {
87
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
88
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
89
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
90
- return c > 3 && r && Object.defineProperty(target, key, r), r;
91
- }
92
- function __param(paramIndex, decorator) {
93
- return function (target, key) { decorator(target, key, paramIndex); }
94
- }
95
- function __classPrivateFieldGet(receiver, state, kind, f) {
96
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
97
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
98
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
99
- }
100
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
101
- if (kind === "m") throw new TypeError("Private method is not writable");
102
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
103
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
104
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
105
- }
106
- class Scanner {
107
- constructor() {
108
- this._input = '';
109
- this._start = 0;
110
- this._current = 0;
111
- this._tokens = [];
112
- this._errorTokens = [];
113
- this.stringRe = /[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy;
114
- }
115
- static reportError(token) {
116
- if (token.type !== 19 ) {
117
- throw illegalArgument(`expected an error token but got ${JSON.stringify(token)}`);
118
- }
119
- switch (token.lexeme) {
120
- case '=': return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you mean '==' or '=~'?`;
121
- case '&': return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you mean '&&'?`;
122
- case '|': return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you mean '||'?`;
123
- default: {
124
- const lexeme = token.lexeme;
125
- if (lexeme && lexeme.length > 1 && lexeme.startsWith(`'`)) {
126
- return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you forget to close the string?`;
127
- }
128
- if (lexeme && lexeme.length > 1 && lexeme.endsWith(`'`)) {
129
- return `Unexpected token '${token.lexeme}' at offset ${token.offset}. Did you forget to open the string?`;
130
- }
131
- return `Unexpected token '${token.lexeme}' at offset ${token.offset}`;
132
- }
133
- }
134
- }
135
- static getLexeme(token) {
136
- switch (token.type) {
137
- case 0 :
138
- return '(';
139
- case 1 :
140
- return ')';
141
- case 2 :
142
- return '!';
143
- case 3 :
144
- return '==';
145
- case 4 :
146
- return '!=';
147
- case 5 :
148
- return '<';
149
- case 6 :
150
- return '<=';
151
- case 7 :
152
- return '>=';
153
- case 8 :
154
- return '>=';
155
- case 9 :
156
- return '=~';
157
- case 10 :
158
- return token.lexeme;
159
- case 11 :
160
- return 'true';
161
- case 12 :
162
- return 'false';
163
- case 13 :
164
- return 'in';
165
- case 14 :
166
- return 'not';
167
- case 15 :
168
- return '&&';
169
- case 16 :
170
- return '||';
171
- case 17 :
172
- return token.lexeme;
173
- case 18 :
174
- return token.lexeme;
175
- case 19 :
176
- return token.lexeme;
177
- case 20 :
178
- return 'EOF';
179
- default:
180
- throw illegalState(`unhandled token type: ${JSON.stringify(token)}; have you forgotten to add a case?`);
181
- }
182
- }
183
- get errorTokens() {
184
- return this._errorTokens;
185
- }
186
- reset(value) {
187
- this._input = value;
188
- this._start = 0;
189
- this._current = 0;
190
- this._tokens = [];
191
- this._errorTokens = [];
192
- return this;
193
- }
194
- scan() {
195
- while (!this._isAtEnd()) {
196
- this._start = this._current;
197
- const ch = this._advance();
198
- switch (ch) {
199
- case 40 :
200
- this._addToken(0 );
201
- break;
202
- case 41 :
203
- this._addToken(1 );
204
- break;
205
- case 33 :
206
- this._addToken(this._match(61 ) ? 4 : 2 );
207
- break;
208
- case 39 :
209
- this._quotedString();
210
- break;
211
- case 47 :
212
- this._regex();
213
- break;
214
- case 61 :
215
- if (this._match(61 )) {
216
- this._addToken(3 );
217
- }
218
- else if (this._match(126 )) {
219
- this._addToken(9 );
220
- }
221
- else {
222
- this._error();
223
- }
224
- break;
225
- case 60 :
226
- this._addToken(this._match(61 ) ? 6 : 5 );
227
- break;
228
- case 62 :
229
- this._addToken(this._match(61 ) ? 8 : 7 );
230
- break;
231
- case 38 :
232
- if (this._match(38 )) {
233
- this._addToken(15 );
234
- }
235
- else {
236
- this._error();
237
- }
238
- break;
239
- case 124 :
240
- if (this._match(124 )) {
241
- this._addToken(16 );
242
- }
243
- else {
244
- this._error();
245
- }
246
- break;
247
- case 32 :
248
- case 13 :
249
- case 9 :
250
- case 10 :
251
- case 160 :
252
- break;
253
- default:
254
- this._string();
255
- }
256
- }
257
- this._start = this._current;
258
- this._addToken(20 );
259
- return Array.from(this._tokens);
260
- }
261
- _match(expected) {
262
- if (this._isAtEnd()) {
263
- return false;
264
- }
265
- if (this._input.charCodeAt(this._current) !== expected) {
266
- return false;
267
- }
268
- this._current++;
269
- return true;
270
- }
271
- _advance() {
272
- return this._input.charCodeAt(this._current++);
273
- }
274
- _peek() {
275
- return this._isAtEnd() ? 0 : this._input.charCodeAt(this._current);
276
- }
277
- _addToken(type) {
278
- this._tokens.push({ type, offset: this._start });
279
- }
280
- _error() {
281
- const errToken = { type: 19 , offset: this._start, lexeme: this._input.substring(this._start, this._current) };
282
- this._errorTokens.push(errToken);
283
- this._tokens.push(errToken);
284
- }
285
- _string() {
286
- this.stringRe.lastIndex = this._start;
287
- const match = this.stringRe.exec(this._input);
288
- if (match) {
289
- this._current = this._start + match[0].length;
290
- const lexeme = this._input.substring(this._start, this._current);
291
- const keyword = Scanner._keywords.get(lexeme);
292
- if (keyword) {
293
- this._addToken(keyword);
294
- }
295
- else {
296
- this._tokens.push({ type: 17 , lexeme, offset: this._start });
297
- }
298
- }
299
- }
300
- _quotedString() {
301
- while (this._peek() !== 39 && !this._isAtEnd()) {
302
- this._advance();
303
- }
304
- if (this._isAtEnd()) {
305
- this._error();
306
- return;
307
- }
308
- this._advance();
309
- this._tokens.push({ type: 18 , lexeme: this._input.substring(this._start + 1, this._current - 1), offset: this._start + 1 });
310
- }
311
- _regex() {
312
- let p = this._current;
313
- let inEscape = false;
314
- let inCharacterClass = false;
315
- while (true) {
316
- if (p >= this._input.length) {
317
- this._current = p;
318
- this._error();
319
- return;
320
- }
321
- const ch = this._input.charCodeAt(p);
322
- if (inEscape) {
323
- inEscape = false;
324
- }
325
- else if (ch === 47 && !inCharacterClass) {
326
- p++;
327
- break;
328
- }
329
- else if (ch === 91 ) {
330
- inCharacterClass = true;
331
- }
332
- else if (ch === 92 ) {
333
- inEscape = true;
334
- }
335
- else if (ch === 93 ) {
336
- inCharacterClass = false;
337
- }
338
- p++;
339
- }
340
- while (p < this._input.length && Scanner._regexFlags.has(this._input.charCodeAt(p))) {
341
- p++;
342
- }
343
- this._current = p;
344
- const lexeme = this._input.substring(this._start, this._current);
345
- this._tokens.push({ type: 10 , lexeme, offset: this._start });
346
- }
347
- _isAtEnd() {
348
- return this._current >= this._input.length;
349
- }
350
- }
351
- Scanner._regexFlags = ( (new Set( (['i', 'g', 's', 'm', 'y', 'u'].map(ch => ch.charCodeAt(0))))));
352
- Scanner._keywords = ( (new Map([
353
- ['not', 14 ],
354
- ['in', 13 ],
355
- ['false', 12 ],
356
- ['true', 11 ],
357
- ])));
358
- const CONSTANT_VALUES = ( (new Map()));
359
- CONSTANT_VALUES.set('false', false);
360
- CONSTANT_VALUES.set('true', true);
361
- CONSTANT_VALUES.set('isMac', isMacintosh);
362
- CONSTANT_VALUES.set('isLinux', isLinux);
363
- CONSTANT_VALUES.set('isWindows', isWindows);
364
- CONSTANT_VALUES.set('isWeb', isWeb);
365
- CONSTANT_VALUES.set('isMacNative', isMacintosh && !isWeb);
366
- CONSTANT_VALUES.set('isEdge', isEdge);
367
- CONSTANT_VALUES.set('isFirefox', isFirefox);
368
- CONSTANT_VALUES.set('isChrome', isChrome);
369
- CONSTANT_VALUES.set('isSafari', isSafari);
370
- const hasOwnProperty = Object.prototype.hasOwnProperty;
371
- var ContextKeyExprType;
372
- ( ((function(ContextKeyExprType) {
373
- ContextKeyExprType[ContextKeyExprType["False"] = 0] = "False";
374
- ContextKeyExprType[ContextKeyExprType["True"] = 1] = "True";
375
- ContextKeyExprType[ContextKeyExprType["Defined"] = 2] = "Defined";
376
- ContextKeyExprType[ContextKeyExprType["Not"] = 3] = "Not";
377
- ContextKeyExprType[ContextKeyExprType["Equals"] = 4] = "Equals";
378
- ContextKeyExprType[ContextKeyExprType["NotEquals"] = 5] = "NotEquals";
379
- ContextKeyExprType[ContextKeyExprType["And"] = 6] = "And";
380
- ContextKeyExprType[ContextKeyExprType["Regex"] = 7] = "Regex";
381
- ContextKeyExprType[ContextKeyExprType["NotRegex"] = 8] = "NotRegex";
382
- ContextKeyExprType[ContextKeyExprType["Or"] = 9] = "Or";
383
- ContextKeyExprType[ContextKeyExprType["In"] = 10] = "In";
384
- ContextKeyExprType[ContextKeyExprType["NotIn"] = 11] = "NotIn";
385
- ContextKeyExprType[ContextKeyExprType["Greater"] = 12] = "Greater";
386
- ContextKeyExprType[ContextKeyExprType["GreaterEquals"] = 13] = "GreaterEquals";
387
- ContextKeyExprType[ContextKeyExprType["Smaller"] = 14] = "Smaller";
388
- ContextKeyExprType[ContextKeyExprType["SmallerEquals"] = 15] = "SmallerEquals";
389
- })(ContextKeyExprType || (ContextKeyExprType = {}))));
390
- class ContextKeyExpr {
391
- static false() {
392
- return ContextKeyFalseExpr.INSTANCE;
393
- }
394
- static true() {
395
- return ContextKeyTrueExpr.INSTANCE;
396
- }
397
- static has(key) {
398
- return (
399
- (ContextKeyDefinedExpr.create(key))
400
- );
401
- }
402
- static equals(key, value) {
403
- return ContextKeyEqualsExpr.create(key, value);
404
- }
405
- static notEquals(key, value) {
406
- return ContextKeyNotEqualsExpr.create(key, value);
407
- }
408
- static regex(key, value) {
409
- return ContextKeyRegexExpr.create(key, value);
410
- }
411
- static in(key, value) {
412
- return ContextKeyInExpr.create(key, value);
413
- }
414
- static notIn(key, value) {
415
- return ContextKeyNotInExpr.create(key, value);
416
- }
417
- static not(key) {
418
- return (
419
- (ContextKeyNotExpr.create(key))
420
- );
421
- }
422
- static and(...expr) {
423
- return ContextKeyAndExpr.create(expr, null, true);
424
- }
425
- static or(...expr) {
426
- return ContextKeyOrExpr.create(expr, null, true);
427
- }
428
- static greater(key, value) {
429
- return ContextKeyGreaterExpr.create(key, value);
430
- }
431
- static greaterEquals(key, value) {
432
- return ContextKeyGreaterEqualsExpr.create(key, value);
433
- }
434
- static smaller(key, value) {
435
- return ContextKeySmallerExpr.create(key, value);
436
- }
437
- static smallerEquals(key, value) {
438
- return ContextKeySmallerEqualsExpr.create(key, value);
439
- }
440
- static deserializeOrErrorNew(serialized) {
441
- if (!serialized) {
442
- return { type: 'error', lexingErrors: [], parsingErrors: [] };
443
- }
444
- const parser = ( (new Parser()));
445
- const expr = parser.parse(serialized);
446
- if (expr === undefined) {
447
- return { type: 'error', lexingErrors: ( (parser.lexingErrors.map(token => Scanner.reportError(token)))), parsingErrors: parser.parsingErrors };
448
- }
449
- else {
450
- return { type: 'ok', expr };
451
- }
452
- }
453
- static deserialize(serialized) {
454
- if (!serialized) {
455
- return undefined;
456
- }
457
- return this._deserializeOrExpression(serialized);
458
- }
459
- static _deserializeOrExpression(serialized) {
460
- const pieces = serialized.split('||');
461
- return ContextKeyOrExpr.create(( (pieces.map(p => this._deserializeAndExpression(p)))), null, true);
462
- }
463
- static _deserializeAndExpression(serialized) {
464
- const pieces = serialized.split('&&');
465
- return ContextKeyAndExpr.create(( (pieces.map(p => this._deserializeOne(p)))), null, true);
466
- }
467
- static _deserializeOne(serializedOne) {
468
- serializedOne = serializedOne.trim();
469
- if (serializedOne.indexOf('!=') >= 0) {
470
- const pieces = serializedOne.split('!=');
471
- return ContextKeyNotEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1]));
472
- }
473
- if (serializedOne.indexOf('==') >= 0) {
474
- const pieces = serializedOne.split('==');
475
- return ContextKeyEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1]));
476
- }
477
- if (serializedOne.indexOf('=~') >= 0) {
478
- const pieces = serializedOne.split('=~');
479
- return ContextKeyRegexExpr.create(pieces[0].trim(), this._deserializeRegexValue(pieces[1]));
480
- }
481
- if (serializedOne.indexOf(' not in ') >= 0) {
482
- const pieces = serializedOne.split(' not in ');
483
- return ContextKeyNotInExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1]));
484
- }
485
- if (serializedOne.indexOf(' in ') >= 0) {
486
- const pieces = serializedOne.split(' in ');
487
- return ContextKeyInExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1]));
488
- }
489
- if (/^[^<=>]+>=[^<=>]+$/.test(serializedOne)) {
490
- const pieces = serializedOne.split('>=');
491
- return ContextKeyGreaterEqualsExpr.create(pieces[0].trim(), pieces[1].trim());
492
- }
493
- if (/^[^<=>]+>[^<=>]+$/.test(serializedOne)) {
494
- const pieces = serializedOne.split('>');
495
- return ContextKeyGreaterExpr.create(pieces[0].trim(), pieces[1].trim());
496
- }
497
- if (/^[^<=>]+<=[^<=>]+$/.test(serializedOne)) {
498
- const pieces = serializedOne.split('<=');
499
- return ContextKeySmallerEqualsExpr.create(pieces[0].trim(), pieces[1].trim());
500
- }
501
- if (/^[^<=>]+<[^<=>]+$/.test(serializedOne)) {
502
- const pieces = serializedOne.split('<');
503
- return ContextKeySmallerExpr.create(pieces[0].trim(), pieces[1].trim());
504
- }
505
- if (/^\!\s*/.test(serializedOne)) {
506
- return (
507
- (ContextKeyNotExpr.create(serializedOne.substr(1).trim()))
508
- );
509
- }
510
- return (
511
- (ContextKeyDefinedExpr.create(serializedOne))
512
- );
513
- }
514
- static _deserializeValue(serializedValue) {
515
- serializedValue = serializedValue.trim();
516
- if (serializedValue === 'true') {
517
- return true;
518
- }
519
- if (serializedValue === 'false') {
520
- return false;
521
- }
522
- const m = /^'([^']*)'$/.exec(serializedValue);
523
- if (m) {
524
- return m[1].trim();
525
- }
526
- return serializedValue;
527
- }
528
- static _deserializeRegexValue(serializedValue) {
529
- if (isFalsyOrWhitespace(serializedValue)) {
530
- return null;
531
- }
532
- const start = serializedValue.indexOf('/');
533
- const end = serializedValue.lastIndexOf('/');
534
- if (start === end || start < 0) {
535
- return null;
536
- }
537
- const value = serializedValue.slice(start + 1, end);
538
- const caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';
539
- try {
540
- return (
541
- (new RegExp(value, caseIgnoreFlag))
542
- );
543
- }
544
- catch (_e) {
545
- return null;
546
- }
547
- }
548
- }
549
- class ParseError extends Error {
550
- }
551
- class Parser {
552
- constructor() {
553
- this._scanner = ( (new Scanner()));
554
- this._tokens = [];
555
- this._current = 0;
556
- this._parsingErrors = [];
557
- }
558
- get lexingErrors() {
559
- return this._scanner.errorTokens;
560
- }
561
- get parsingErrors() {
562
- return this._parsingErrors;
563
- }
564
- parse(input) {
565
- if (input === '') {
566
- this._parsingErrors.push('Expected an expression but got an empty string');
567
- return undefined;
568
- }
569
- this._tokens = this._scanner.reset(input).scan();
570
- this._current = 0;
571
- this._parsingErrors = [];
572
- try {
573
- const expr = this._expr();
574
- if (!this._isAtEnd()) {
575
- throw this._errUnexpected(this._peek());
576
- }
577
- return expr;
578
- }
579
- catch (e) {
580
- if (!(e instanceof ParseError)) {
581
- const token = this._peek();
582
- this._parsingErrors.push(`Unexpected error: ${e} for token ${Scanner.getLexeme(token)} at offset ${token.offset}.`);
583
- }
584
- return undefined;
585
- }
586
- }
587
- _expr() {
588
- return this._or();
589
- }
590
- _or() {
591
- const expr = [this._and()];
592
- while (this._matchOne(16 )) {
593
- const right = this._and();
594
- expr.push(right);
595
- }
596
- return expr.length === 1 ? expr[0] : ( (ContextKeyExpr.or(...expr)));
597
- }
598
- _and() {
599
- const expr = [this._term()];
600
- while (this._matchOne(15 )) {
601
- const right = this._term();
602
- expr.push(right);
603
- }
604
- return expr.length === 1 ? expr[0] : ( (ContextKeyExpr.and(...expr)));
605
- }
606
- _term() {
607
- if (this._matchOne(2 )) {
608
- const expr = this._peek();
609
- switch (expr.type) {
610
- case 17 :
611
- this._advance();
612
- return ContextKeyExpr.not(expr.lexeme);
613
- case 11 :
614
- this._advance();
615
- return ContextKeyExpr.false();
616
- case 12 :
617
- this._advance();
618
- return ContextKeyExpr.true();
619
- default:
620
- throw this._errExpectedButGot(`KEY, 'true', or 'false'`, expr);
621
- }
622
- }
623
- return this._primary();
624
- }
625
- _primary() {
626
- const peek = this._peek();
627
- switch (peek.type) {
628
- case 11 :
629
- this._advance();
630
- return ContextKeyExpr.true();
631
- case 12 :
632
- this._advance();
633
- return ContextKeyExpr.false();
634
- case 0 : {
635
- this._advance();
636
- const expr = this._expr();
637
- this._consume(1 , `')'`);
638
- return expr;
639
- }
640
- case 17 : {
641
- const key = peek.lexeme;
642
- this._advance();
643
- if (this._matchOne(9 )) {
644
- const expr = this._peek();
645
- switch (expr.type) {
646
- case 10 :
647
- case 19 : {
648
- const lexemeReconstruction = [expr.lexeme];
649
- this._advance();
650
- let followingToken = this._peek();
651
- let parenBalance = 0;
652
- for (let i = 0; i < expr.lexeme.length; i++) {
653
- if (expr.lexeme.charCodeAt(i) === 40 ) {
654
- parenBalance++;
655
- }
656
- else if (expr.lexeme.charCodeAt(i) === 41 ) {
657
- parenBalance--;
658
- }
659
- }
660
- while (!this._isAtEnd() && followingToken.type !== 15 && followingToken.type !== 16 ) {
661
- switch (followingToken.type) {
662
- case 0 :
663
- parenBalance++;
664
- break;
665
- case 1 :
666
- parenBalance--;
667
- break;
668
- case 10 :
669
- case 18 :
670
- for (let i = 0; i < followingToken.lexeme.length; i++) {
671
- if (followingToken.lexeme.charCodeAt(i) === 40 ) {
672
- parenBalance++;
673
- }
674
- else if (expr.lexeme.charCodeAt(i) === 41 ) {
675
- parenBalance--;
676
- }
677
- }
678
- }
679
- if (parenBalance < 0) {
680
- break;
681
- }
682
- lexemeReconstruction.push(Scanner.getLexeme(followingToken));
683
- this._advance();
684
- followingToken = this._peek();
685
- }
686
- const regexLexeme = lexemeReconstruction.join('');
687
- const closingSlashIndex = regexLexeme.lastIndexOf('/');
688
- const flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : regexLexeme.substring(closingSlashIndex + 1);
689
- const regexp = ( (new RegExp(regexLexeme.substring(1, closingSlashIndex), flags)));
690
- return ContextKeyExpr.regex(key, regexp);
691
- }
692
- case 18 : {
693
- const serializedValue = expr.lexeme;
694
- this._advance();
695
- let regex = null;
696
- if (!isFalsyOrWhitespace(serializedValue)) {
697
- const start = serializedValue.indexOf('/');
698
- const end = serializedValue.lastIndexOf('/');
699
- if (start !== end && start >= 0) {
700
- const value = serializedValue.slice(start + 1, end);
701
- const caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';
702
- try {
703
- regex = ( (new RegExp(value, caseIgnoreFlag)));
704
- }
705
- catch (_e) { }
706
- }
707
- }
708
- if (regex === null) {
709
- throw this._errExpectedButGot('REGEX', expr);
710
- }
711
- return ContextKeyRegexExpr.create(key, regex);
712
- }
713
- default:
714
- throw this._errExpectedButGot('REGEX', this._peek());
715
- }
716
- }
717
- if (this._matchOne(14 )) {
718
- this._consume(13 , `'in' after 'not'`);
719
- const right = this._value();
720
- return ContextKeyExpr.notIn(key, right);
721
- }
722
- const maybeOp = this._peek().type;
723
- switch (maybeOp) {
724
- case 3 : {
725
- this._advance();
726
- const right = this._value();
727
- switch (right) {
728
- case 'true':
729
- return ContextKeyExpr.has(key);
730
- case 'false':
731
- return ContextKeyExpr.not(key);
732
- default:
733
- return ContextKeyExpr.equals(key, right);
734
- }
735
- }
736
- case 4 : {
737
- this._advance();
738
- const right = this._value();
739
- switch (right) {
740
- case 'true':
741
- return ContextKeyExpr.not(key);
742
- case 'false':
743
- return ContextKeyExpr.has(key);
744
- default:
745
- return (
746
- (ContextKeyExpr.notEquals(key, right))
747
- );
748
- }
749
- }
750
- case 5 :
751
- this._advance();
752
- return ContextKeySmallerExpr.create(key, this._value());
753
- case 6 :
754
- this._advance();
755
- return ContextKeySmallerEqualsExpr.create(key, this._value());
756
- case 7 :
757
- this._advance();
758
- return ContextKeyGreaterExpr.create(key, this._value());
759
- case 8 :
760
- this._advance();
761
- return ContextKeyGreaterEqualsExpr.create(key, this._value());
762
- case 13 :
763
- this._advance();
764
- return ContextKeyExpr.in(key, this._value());
765
- default:
766
- return ContextKeyExpr.has(key);
767
- }
768
- }
769
- default:
770
- throw this._errExpectedButGot(`'true', 'false', '(', KEY, KEY '=~' regex, KEY [ ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value ]`, this._peek());
771
- }
772
- }
773
- _value() {
774
- const token = this._peek();
775
- switch (token.type) {
776
- case 17 :
777
- case 18 :
778
- this._advance();
779
- return token.lexeme;
780
- case 11 :
781
- this._advance();
782
- return 'true';
783
- case 12 :
784
- this._advance();
785
- return 'false';
786
- case 13 :
787
- this._advance();
788
- return 'in';
789
- default:
790
- return '';
791
- }
792
- }
793
- _previous() {
794
- return this._tokens[this._current - 1];
795
- }
796
- _matchOne(token) {
797
- if (this._check(token)) {
798
- this._advance();
799
- return true;
800
- }
801
- return false;
802
- }
803
- _advance() {
804
- if (!this._isAtEnd()) {
805
- this._current++;
806
- }
807
- return this._previous();
808
- }
809
- _consume(type, message) {
810
- if (this._check(type)) {
811
- return this._advance();
812
- }
813
- throw this._errExpectedButGot(message, this._peek());
814
- }
815
- _errExpectedButGot(expected, got) {
816
- return this._error(`Expected ${expected} but got '${Scanner.getLexeme(got)}' at offset ${got.offset}.`);
817
- }
818
- _errUnexpected(token) {
819
- return this._error(`Unexpected '${Scanner.getLexeme(token)}' at offset ${token.offset}.`);
820
- }
821
- _error(errMsg) {
822
- this._parsingErrors.push(errMsg);
823
- return (
824
- (new ParseError())
825
- );
826
- }
827
- _check(type) {
828
- return this._peek().type === type;
829
- }
830
- _peek() {
831
- return this._tokens[this._current];
832
- }
833
- _isAtEnd() {
834
- return this._peek().type === 20 ;
835
- }
836
- }
837
- function cmp(a, b) {
838
- return a.cmp(b);
839
- }
840
- class ContextKeyFalseExpr {
841
- constructor() {
842
- this.type = 0 ;
843
- }
844
- cmp(other) {
845
- return this.type - other.type;
846
- }
847
- equals(other) {
848
- return (other.type === this.type);
849
- }
850
- substituteConstants() {
851
- return this;
852
- }
853
- evaluate(context) {
854
- return false;
855
- }
856
- serialize() {
857
- return 'false';
858
- }
859
- keys() {
860
- return [];
861
- }
862
- map(mapFnc) {
863
- return this;
864
- }
865
- negate() {
866
- return ContextKeyTrueExpr.INSTANCE;
867
- }
868
- }
869
- ContextKeyFalseExpr.INSTANCE = ( (new ContextKeyFalseExpr()));
870
- class ContextKeyTrueExpr {
871
- constructor() {
872
- this.type = 1 ;
873
- }
874
- cmp(other) {
875
- return this.type - other.type;
876
- }
877
- equals(other) {
878
- return (other.type === this.type);
879
- }
880
- substituteConstants() {
881
- return this;
882
- }
883
- evaluate(context) {
884
- return true;
885
- }
886
- serialize() {
887
- return 'true';
888
- }
889
- keys() {
890
- return [];
891
- }
892
- map(mapFnc) {
893
- return this;
894
- }
895
- negate() {
896
- return ContextKeyFalseExpr.INSTANCE;
897
- }
898
- }
899
- ContextKeyTrueExpr.INSTANCE = ( (new ContextKeyTrueExpr()));
900
- class ContextKeyDefinedExpr {
901
- static create(key, negated = null) {
902
- const constantValue = CONSTANT_VALUES.get(key);
903
- if (typeof constantValue === 'boolean') {
904
- return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
905
- }
906
- return (
907
- (new ContextKeyDefinedExpr(key, negated))
908
- );
909
- }
910
- constructor(key, negated) {
911
- this.key = key;
912
- this.negated = negated;
913
- this.type = 2 ;
914
- }
915
- cmp(other) {
916
- if (other.type !== this.type) {
917
- return this.type - other.type;
918
- }
919
- return cmp1(this.key, other.key);
920
- }
921
- equals(other) {
922
- if (other.type === this.type) {
923
- return (this.key === other.key);
924
- }
925
- return false;
926
- }
927
- substituteConstants() {
928
- const constantValue = CONSTANT_VALUES.get(this.key);
929
- if (typeof constantValue === 'boolean') {
930
- return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
931
- }
932
- return this;
933
- }
934
- evaluate(context) {
935
- return (!!context.getValue(this.key));
936
- }
937
- serialize() {
938
- return this.key;
939
- }
940
- keys() {
941
- return [this.key];
942
- }
943
- map(mapFnc) {
944
- return mapFnc.mapDefined(this.key);
945
- }
946
- negate() {
947
- if (!this.negated) {
948
- this.negated = ( (ContextKeyNotExpr.create(this.key, this)));
949
- }
950
- return this.negated;
951
- }
952
- }
953
- class ContextKeyEqualsExpr {
954
- static create(key, value, negated = null) {
955
- if (typeof value === 'boolean') {
956
- return (value ? (ContextKeyDefinedExpr.create(key, negated)) : (ContextKeyNotExpr.create(key, negated)));
957
- }
958
- const constantValue = CONSTANT_VALUES.get(key);
959
- if (typeof constantValue === 'boolean') {
960
- const trueValue = constantValue ? 'true' : 'false';
961
- return (value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);
962
- }
963
- return (
964
- (new ContextKeyEqualsExpr(key, value, negated))
965
- );
966
- }
967
- constructor(key, value, negated) {
968
- this.key = key;
969
- this.value = value;
970
- this.negated = negated;
971
- this.type = 4 ;
972
- }
973
- cmp(other) {
974
- if (other.type !== this.type) {
975
- return this.type - other.type;
976
- }
977
- return cmp2(this.key, this.value, other.key, other.value);
978
- }
979
- equals(other) {
980
- if (other.type === this.type) {
981
- return (this.key === other.key && this.value === other.value);
982
- }
983
- return false;
984
- }
985
- substituteConstants() {
986
- const constantValue = CONSTANT_VALUES.get(this.key);
987
- if (typeof constantValue === 'boolean') {
988
- const trueValue = constantValue ? 'true' : 'false';
989
- return (this.value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);
990
- }
991
- return this;
992
- }
993
- evaluate(context) {
994
- return (context.getValue(this.key) == this.value);
995
- }
996
- serialize() {
997
- return `${this.key} == '${this.value}'`;
998
- }
999
- keys() {
1000
- return [this.key];
1001
- }
1002
- map(mapFnc) {
1003
- return mapFnc.mapEquals(this.key, this.value);
1004
- }
1005
- negate() {
1006
- if (!this.negated) {
1007
- this.negated = ContextKeyNotEqualsExpr.create(this.key, this.value, this);
1008
- }
1009
- return this.negated;
1010
- }
1011
- }
1012
- class ContextKeyInExpr {
1013
- static create(key, valueKey) {
1014
- return (
1015
- (new ContextKeyInExpr(key, valueKey))
1016
- );
1017
- }
1018
- constructor(key, valueKey) {
1019
- this.key = key;
1020
- this.valueKey = valueKey;
1021
- this.type = 10 ;
1022
- this.negated = null;
1023
- }
1024
- cmp(other) {
1025
- if (other.type !== this.type) {
1026
- return this.type - other.type;
1027
- }
1028
- return cmp2(this.key, this.valueKey, other.key, other.valueKey);
1029
- }
1030
- equals(other) {
1031
- if (other.type === this.type) {
1032
- return (this.key === other.key && this.valueKey === other.valueKey);
1033
- }
1034
- return false;
1035
- }
1036
- substituteConstants() {
1037
- return this;
1038
- }
1039
- evaluate(context) {
1040
- const source = context.getValue(this.valueKey);
1041
- const item = context.getValue(this.key);
1042
- if (Array.isArray(source)) {
1043
- return source.includes(item);
1044
- }
1045
- if (typeof item === 'string' && typeof source === 'object' && source !== null) {
1046
- return hasOwnProperty.call(source, item);
1047
- }
1048
- return false;
1049
- }
1050
- serialize() {
1051
- return `${this.key} in '${this.valueKey}'`;
1052
- }
1053
- keys() {
1054
- return [this.key, this.valueKey];
1055
- }
1056
- map(mapFnc) {
1057
- return mapFnc.mapIn(this.key, this.valueKey);
1058
- }
1059
- negate() {
1060
- if (!this.negated) {
1061
- this.negated = ContextKeyNotInExpr.create(this.key, this.valueKey);
1062
- }
1063
- return this.negated;
1064
- }
1065
- }
1066
- class ContextKeyNotInExpr {
1067
- static create(key, valueKey) {
1068
- return (
1069
- (new ContextKeyNotInExpr(key, valueKey))
1070
- );
1071
- }
1072
- constructor(key, valueKey) {
1073
- this.key = key;
1074
- this.valueKey = valueKey;
1075
- this.type = 11 ;
1076
- this._negated = ContextKeyInExpr.create(key, valueKey);
1077
- }
1078
- cmp(other) {
1079
- if (other.type !== this.type) {
1080
- return this.type - other.type;
1081
- }
1082
- return this._negated.cmp(other._negated);
1083
- }
1084
- equals(other) {
1085
- if (other.type === this.type) {
1086
- return this._negated.equals(other._negated);
1087
- }
1088
- return false;
1089
- }
1090
- substituteConstants() {
1091
- return this;
1092
- }
1093
- evaluate(context) {
1094
- return !this._negated.evaluate(context);
1095
- }
1096
- serialize() {
1097
- return `${this.key} not in '${this.valueKey}'`;
1098
- }
1099
- keys() {
1100
- return (
1101
- (this._negated.keys())
1102
- );
1103
- }
1104
- map(mapFnc) {
1105
- return mapFnc.mapNotIn(this.key, this.valueKey);
1106
- }
1107
- negate() {
1108
- return this._negated;
1109
- }
1110
- }
1111
- class ContextKeyNotEqualsExpr {
1112
- static create(key, value, negated = null) {
1113
- if (typeof value === 'boolean') {
1114
- if (value) {
1115
- return (
1116
- (ContextKeyNotExpr.create(key, negated))
1117
- );
1118
- }
1119
- return (
1120
- (ContextKeyDefinedExpr.create(key, negated))
1121
- );
1122
- }
1123
- const constantValue = CONSTANT_VALUES.get(key);
1124
- if (typeof constantValue === 'boolean') {
1125
- const falseValue = constantValue ? 'true' : 'false';
1126
- return (value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);
1127
- }
1128
- return (
1129
- (new ContextKeyNotEqualsExpr(key, value, negated))
1130
- );
1131
- }
1132
- constructor(key, value, negated) {
1133
- this.key = key;
1134
- this.value = value;
1135
- this.negated = negated;
1136
- this.type = 5 ;
1137
- }
1138
- cmp(other) {
1139
- if (other.type !== this.type) {
1140
- return this.type - other.type;
1141
- }
1142
- return cmp2(this.key, this.value, other.key, other.value);
1143
- }
1144
- equals(other) {
1145
- if (other.type === this.type) {
1146
- return (this.key === other.key && this.value === other.value);
1147
- }
1148
- return false;
1149
- }
1150
- substituteConstants() {
1151
- const constantValue = CONSTANT_VALUES.get(this.key);
1152
- if (typeof constantValue === 'boolean') {
1153
- const falseValue = constantValue ? 'true' : 'false';
1154
- return (this.value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);
1155
- }
1156
- return this;
1157
- }
1158
- evaluate(context) {
1159
- return (context.getValue(this.key) != this.value);
1160
- }
1161
- serialize() {
1162
- return `${this.key} != '${this.value}'`;
1163
- }
1164
- keys() {
1165
- return [this.key];
1166
- }
1167
- map(mapFnc) {
1168
- return mapFnc.mapNotEquals(this.key, this.value);
1169
- }
1170
- negate() {
1171
- if (!this.negated) {
1172
- this.negated = ContextKeyEqualsExpr.create(this.key, this.value, this);
1173
- }
1174
- return this.negated;
1175
- }
1176
- }
1177
- class ContextKeyNotExpr {
1178
- static create(key, negated = null) {
1179
- const constantValue = CONSTANT_VALUES.get(key);
1180
- if (typeof constantValue === 'boolean') {
1181
- return (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);
1182
- }
1183
- return (
1184
- (new ContextKeyNotExpr(key, negated))
1185
- );
1186
- }
1187
- constructor(key, negated) {
1188
- this.key = key;
1189
- this.negated = negated;
1190
- this.type = 3 ;
1191
- }
1192
- cmp(other) {
1193
- if (other.type !== this.type) {
1194
- return this.type - other.type;
1195
- }
1196
- return cmp1(this.key, other.key);
1197
- }
1198
- equals(other) {
1199
- if (other.type === this.type) {
1200
- return (this.key === other.key);
1201
- }
1202
- return false;
1203
- }
1204
- substituteConstants() {
1205
- const constantValue = CONSTANT_VALUES.get(this.key);
1206
- if (typeof constantValue === 'boolean') {
1207
- return (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);
1208
- }
1209
- return this;
1210
- }
1211
- evaluate(context) {
1212
- return (!context.getValue(this.key));
1213
- }
1214
- serialize() {
1215
- return `!${this.key}`;
1216
- }
1217
- keys() {
1218
- return [this.key];
1219
- }
1220
- map(mapFnc) {
1221
- return mapFnc.mapNot(this.key);
1222
- }
1223
- negate() {
1224
- if (!this.negated) {
1225
- this.negated = ( (ContextKeyDefinedExpr.create(this.key, this)));
1226
- }
1227
- return this.negated;
1228
- }
1229
- }
1230
- function withFloatOrStr(value, callback) {
1231
- if (typeof value === 'string') {
1232
- const n = parseFloat(value);
1233
- if (!isNaN(n)) {
1234
- value = n;
1235
- }
1236
- }
1237
- if (typeof value === 'string' || typeof value === 'number') {
1238
- return callback(value);
1239
- }
1240
- return ContextKeyFalseExpr.INSTANCE;
1241
- }
1242
- class ContextKeyGreaterExpr {
1243
- static create(key, _value, negated = null) {
1244
- return withFloatOrStr(_value, (value) => ( (new ContextKeyGreaterExpr(key, value, negated))));
1245
- }
1246
- constructor(key, value, negated) {
1247
- this.key = key;
1248
- this.value = value;
1249
- this.negated = negated;
1250
- this.type = 12 ;
1251
- }
1252
- cmp(other) {
1253
- if (other.type !== this.type) {
1254
- return this.type - other.type;
1255
- }
1256
- return cmp2(this.key, this.value, other.key, other.value);
1257
- }
1258
- equals(other) {
1259
- if (other.type === this.type) {
1260
- return (this.key === other.key && this.value === other.value);
1261
- }
1262
- return false;
1263
- }
1264
- substituteConstants() {
1265
- return this;
1266
- }
1267
- evaluate(context) {
1268
- if (typeof this.value === 'string') {
1269
- return false;
1270
- }
1271
- return (parseFloat(context.getValue(this.key)) > this.value);
1272
- }
1273
- serialize() {
1274
- return `${this.key} > ${this.value}`;
1275
- }
1276
- keys() {
1277
- return [this.key];
1278
- }
1279
- map(mapFnc) {
1280
- return mapFnc.mapGreater(this.key, this.value);
1281
- }
1282
- negate() {
1283
- if (!this.negated) {
1284
- this.negated = ContextKeySmallerEqualsExpr.create(this.key, this.value, this);
1285
- }
1286
- return this.negated;
1287
- }
1288
- }
1289
- class ContextKeyGreaterEqualsExpr {
1290
- static create(key, _value, negated = null) {
1291
- return withFloatOrStr(_value, (value) => ( (new ContextKeyGreaterEqualsExpr(key, value, negated))));
1292
- }
1293
- constructor(key, value, negated) {
1294
- this.key = key;
1295
- this.value = value;
1296
- this.negated = negated;
1297
- this.type = 13 ;
1298
- }
1299
- cmp(other) {
1300
- if (other.type !== this.type) {
1301
- return this.type - other.type;
1302
- }
1303
- return cmp2(this.key, this.value, other.key, other.value);
1304
- }
1305
- equals(other) {
1306
- if (other.type === this.type) {
1307
- return (this.key === other.key && this.value === other.value);
1308
- }
1309
- return false;
1310
- }
1311
- substituteConstants() {
1312
- return this;
1313
- }
1314
- evaluate(context) {
1315
- if (typeof this.value === 'string') {
1316
- return false;
1317
- }
1318
- return (parseFloat(context.getValue(this.key)) >= this.value);
1319
- }
1320
- serialize() {
1321
- return `${this.key} >= ${this.value}`;
1322
- }
1323
- keys() {
1324
- return [this.key];
1325
- }
1326
- map(mapFnc) {
1327
- return mapFnc.mapGreaterEquals(this.key, this.value);
1328
- }
1329
- negate() {
1330
- if (!this.negated) {
1331
- this.negated = ContextKeySmallerExpr.create(this.key, this.value, this);
1332
- }
1333
- return this.negated;
1334
- }
1335
- }
1336
- class ContextKeySmallerExpr {
1337
- static create(key, _value, negated = null) {
1338
- return withFloatOrStr(_value, (value) => ( (new ContextKeySmallerExpr(key, value, negated))));
1339
- }
1340
- constructor(key, value, negated) {
1341
- this.key = key;
1342
- this.value = value;
1343
- this.negated = negated;
1344
- this.type = 14 ;
1345
- }
1346
- cmp(other) {
1347
- if (other.type !== this.type) {
1348
- return this.type - other.type;
1349
- }
1350
- return cmp2(this.key, this.value, other.key, other.value);
1351
- }
1352
- equals(other) {
1353
- if (other.type === this.type) {
1354
- return (this.key === other.key && this.value === other.value);
1355
- }
1356
- return false;
1357
- }
1358
- substituteConstants() {
1359
- return this;
1360
- }
1361
- evaluate(context) {
1362
- if (typeof this.value === 'string') {
1363
- return false;
1364
- }
1365
- return (parseFloat(context.getValue(this.key)) < this.value);
1366
- }
1367
- serialize() {
1368
- return `${this.key} < ${this.value}`;
1369
- }
1370
- keys() {
1371
- return [this.key];
1372
- }
1373
- map(mapFnc) {
1374
- return mapFnc.mapSmaller(this.key, this.value);
1375
- }
1376
- negate() {
1377
- if (!this.negated) {
1378
- this.negated = ContextKeyGreaterEqualsExpr.create(this.key, this.value, this);
1379
- }
1380
- return this.negated;
1381
- }
1382
- }
1383
- class ContextKeySmallerEqualsExpr {
1384
- static create(key, _value, negated = null) {
1385
- return withFloatOrStr(_value, (value) => ( (new ContextKeySmallerEqualsExpr(key, value, negated))));
1386
- }
1387
- constructor(key, value, negated) {
1388
- this.key = key;
1389
- this.value = value;
1390
- this.negated = negated;
1391
- this.type = 15 ;
1392
- }
1393
- cmp(other) {
1394
- if (other.type !== this.type) {
1395
- return this.type - other.type;
1396
- }
1397
- return cmp2(this.key, this.value, other.key, other.value);
1398
- }
1399
- equals(other) {
1400
- if (other.type === this.type) {
1401
- return (this.key === other.key && this.value === other.value);
1402
- }
1403
- return false;
1404
- }
1405
- substituteConstants() {
1406
- return this;
1407
- }
1408
- evaluate(context) {
1409
- if (typeof this.value === 'string') {
1410
- return false;
1411
- }
1412
- return (parseFloat(context.getValue(this.key)) <= this.value);
1413
- }
1414
- serialize() {
1415
- return `${this.key} <= ${this.value}`;
1416
- }
1417
- keys() {
1418
- return [this.key];
1419
- }
1420
- map(mapFnc) {
1421
- return mapFnc.mapSmallerEquals(this.key, this.value);
1422
- }
1423
- negate() {
1424
- if (!this.negated) {
1425
- this.negated = ContextKeyGreaterExpr.create(this.key, this.value, this);
1426
- }
1427
- return this.negated;
1428
- }
1429
- }
1430
- class ContextKeyRegexExpr {
1431
- static create(key, regexp) {
1432
- return (
1433
- (new ContextKeyRegexExpr(key, regexp))
1434
- );
1435
- }
1436
- constructor(key, regexp) {
1437
- this.key = key;
1438
- this.regexp = regexp;
1439
- this.type = 7 ;
1440
- this.negated = null;
1441
- }
1442
- cmp(other) {
1443
- if (other.type !== this.type) {
1444
- return this.type - other.type;
1445
- }
1446
- if (this.key < other.key) {
1447
- return -1;
1448
- }
1449
- if (this.key > other.key) {
1450
- return 1;
1451
- }
1452
- const thisSource = this.regexp ? this.regexp.source : '';
1453
- const otherSource = other.regexp ? other.regexp.source : '';
1454
- if (thisSource < otherSource) {
1455
- return -1;
1456
- }
1457
- if (thisSource > otherSource) {
1458
- return 1;
1459
- }
1460
- return 0;
1461
- }
1462
- equals(other) {
1463
- if (other.type === this.type) {
1464
- const thisSource = this.regexp ? this.regexp.source : '';
1465
- const otherSource = other.regexp ? other.regexp.source : '';
1466
- return (this.key === other.key && thisSource === otherSource);
1467
- }
1468
- return false;
1469
- }
1470
- substituteConstants() {
1471
- return this;
1472
- }
1473
- evaluate(context) {
1474
- const value = context.getValue(this.key);
1475
- return this.regexp ? this.regexp.test(value) : false;
1476
- }
1477
- serialize() {
1478
- const value = this.regexp
1479
- ? `/${this.regexp.source}/${this.regexp.flags}`
1480
- : '/invalid/';
1481
- return `${this.key} =~ ${value}`;
1482
- }
1483
- keys() {
1484
- return [this.key];
1485
- }
1486
- map(mapFnc) {
1487
- return mapFnc.mapRegex(this.key, this.regexp);
1488
- }
1489
- negate() {
1490
- if (!this.negated) {
1491
- this.negated = ContextKeyNotRegexExpr.create(this);
1492
- }
1493
- return this.negated;
1494
- }
1495
- }
1496
- class ContextKeyNotRegexExpr {
1497
- static create(actual) {
1498
- return (
1499
- (new ContextKeyNotRegexExpr(actual))
1500
- );
1501
- }
1502
- constructor(_actual) {
1503
- this._actual = _actual;
1504
- this.type = 8 ;
1505
- }
1506
- cmp(other) {
1507
- if (other.type !== this.type) {
1508
- return this.type - other.type;
1509
- }
1510
- return this._actual.cmp(other._actual);
1511
- }
1512
- equals(other) {
1513
- if (other.type === this.type) {
1514
- return this._actual.equals(other._actual);
1515
- }
1516
- return false;
1517
- }
1518
- substituteConstants() {
1519
- return this;
1520
- }
1521
- evaluate(context) {
1522
- return !this._actual.evaluate(context);
1523
- }
1524
- serialize() {
1525
- throw new Error('Method not implemented.');
1526
- }
1527
- keys() {
1528
- return (
1529
- (this._actual.keys())
1530
- );
1531
- }
1532
- map(mapFnc) {
1533
- return (
1534
- (new ContextKeyNotRegexExpr( (this._actual.map(mapFnc))))
1535
- );
1536
- }
1537
- negate() {
1538
- return this._actual;
1539
- }
1540
- }
1541
- function eliminateConstantsInArray(arr) {
1542
- let newArr = null;
1543
- for (let i = 0, len = arr.length; i < len; i++) {
1544
- const newExpr = arr[i].substituteConstants();
1545
- if (arr[i] !== newExpr) {
1546
- if (newArr === null) {
1547
- newArr = [];
1548
- for (let j = 0; j < i; j++) {
1549
- newArr[j] = arr[j];
1550
- }
1551
- }
1552
- }
1553
- if (newArr !== null) {
1554
- newArr[i] = newExpr;
1555
- }
1556
- }
1557
- if (newArr === null) {
1558
- return arr;
1559
- }
1560
- return newArr;
1561
- }
1562
- class ContextKeyAndExpr {
1563
- static create(_expr, negated, extraRedundantCheck) {
1564
- return ContextKeyAndExpr._normalizeArr(_expr, negated, extraRedundantCheck);
1565
- }
1566
- constructor(expr, negated) {
1567
- this.expr = expr;
1568
- this.negated = negated;
1569
- this.type = 6 ;
1570
- }
1571
- cmp(other) {
1572
- if (other.type !== this.type) {
1573
- return this.type - other.type;
1574
- }
1575
- if (this.expr.length < other.expr.length) {
1576
- return -1;
1577
- }
1578
- if (this.expr.length > other.expr.length) {
1579
- return 1;
1580
- }
1581
- for (let i = 0, len = this.expr.length; i < len; i++) {
1582
- const r = cmp(this.expr[i], other.expr[i]);
1583
- if (r !== 0) {
1584
- return r;
1585
- }
1586
- }
1587
- return 0;
1588
- }
1589
- equals(other) {
1590
- if (other.type === this.type) {
1591
- if (this.expr.length !== other.expr.length) {
1592
- return false;
1593
- }
1594
- for (let i = 0, len = this.expr.length; i < len; i++) {
1595
- if (!this.expr[i].equals(other.expr[i])) {
1596
- return false;
1597
- }
1598
- }
1599
- return true;
1600
- }
1601
- return false;
1602
- }
1603
- substituteConstants() {
1604
- const exprArr = eliminateConstantsInArray(this.expr);
1605
- if (exprArr === this.expr) {
1606
- return this;
1607
- }
1608
- return ContextKeyAndExpr.create(exprArr, this.negated, false);
1609
- }
1610
- evaluate(context) {
1611
- for (let i = 0, len = this.expr.length; i < len; i++) {
1612
- if (!this.expr[i].evaluate(context)) {
1613
- return false;
1614
- }
1615
- }
1616
- return true;
1617
- }
1618
- static _normalizeArr(arr, negated, extraRedundantCheck) {
1619
- const expr = [];
1620
- let hasTrue = false;
1621
- for (const e of arr) {
1622
- if (!e) {
1623
- continue;
1624
- }
1625
- if (e.type === 1 ) {
1626
- hasTrue = true;
1627
- continue;
1628
- }
1629
- if (e.type === 0 ) {
1630
- return ContextKeyFalseExpr.INSTANCE;
1631
- }
1632
- if (e.type === 6 ) {
1633
- expr.push(...e.expr);
1634
- continue;
1635
- }
1636
- expr.push(e);
1637
- }
1638
- if (expr.length === 0 && hasTrue) {
1639
- return ContextKeyTrueExpr.INSTANCE;
1640
- }
1641
- if (expr.length === 0) {
1642
- return undefined;
1643
- }
1644
- if (expr.length === 1) {
1645
- return expr[0];
1646
- }
1647
- expr.sort(cmp);
1648
- for (let i = 1; i < expr.length; i++) {
1649
- if (expr[i - 1].equals(expr[i])) {
1650
- expr.splice(i, 1);
1651
- i--;
1652
- }
1653
- }
1654
- if (expr.length === 1) {
1655
- return expr[0];
1656
- }
1657
- while (expr.length > 1) {
1658
- const lastElement = expr[expr.length - 1];
1659
- if (lastElement.type !== 9 ) {
1660
- break;
1661
- }
1662
- expr.pop();
1663
- const secondToLastElement = expr.pop();
1664
- const isFinished = (expr.length === 0);
1665
- const resultElement = ContextKeyOrExpr.create(( (lastElement.expr.map(
1666
- el => ContextKeyAndExpr.create([el, secondToLastElement], null, extraRedundantCheck)
1667
- ))), null, isFinished);
1668
- if (resultElement) {
1669
- expr.push(resultElement);
1670
- expr.sort(cmp);
1671
- }
1672
- }
1673
- if (expr.length === 1) {
1674
- return expr[0];
1675
- }
1676
- if (extraRedundantCheck) {
1677
- for (let i = 0; i < expr.length; i++) {
1678
- for (let j = i + 1; j < expr.length; j++) {
1679
- if (expr[i].negate().equals(expr[j])) {
1680
- return ContextKeyFalseExpr.INSTANCE;
1681
- }
1682
- }
1683
- }
1684
- if (expr.length === 1) {
1685
- return expr[0];
1686
- }
1687
- }
1688
- return (
1689
- (new ContextKeyAndExpr(expr, negated))
1690
- );
1691
- }
1692
- serialize() {
1693
- return ( (this.expr.map(e => e.serialize()))).join(' && ');
1694
- }
1695
- keys() {
1696
- const result = [];
1697
- for (const expr of this.expr) {
1698
- result.push(...( (expr.keys())));
1699
- }
1700
- return result;
1701
- }
1702
- map(mapFnc) {
1703
- return (
1704
- (new ContextKeyAndExpr(
1705
- (this.expr.map(expr => ( (expr.map(mapFnc))))),
1706
- null
1707
- ))
1708
- );
1709
- }
1710
- negate() {
1711
- if (!this.negated) {
1712
- const result = [];
1713
- for (const expr of this.expr) {
1714
- result.push(expr.negate());
1715
- }
1716
- this.negated = ContextKeyOrExpr.create(result, this, true);
1717
- }
1718
- return this.negated;
1719
- }
1720
- }
1721
- class ContextKeyOrExpr {
1722
- static create(_expr, negated, extraRedundantCheck) {
1723
- return ContextKeyOrExpr._normalizeArr(_expr, negated, extraRedundantCheck);
1724
- }
1725
- constructor(expr, negated) {
1726
- this.expr = expr;
1727
- this.negated = negated;
1728
- this.type = 9 ;
1729
- }
1730
- cmp(other) {
1731
- if (other.type !== this.type) {
1732
- return this.type - other.type;
1733
- }
1734
- if (this.expr.length < other.expr.length) {
1735
- return -1;
1736
- }
1737
- if (this.expr.length > other.expr.length) {
1738
- return 1;
1739
- }
1740
- for (let i = 0, len = this.expr.length; i < len; i++) {
1741
- const r = cmp(this.expr[i], other.expr[i]);
1742
- if (r !== 0) {
1743
- return r;
1744
- }
1745
- }
1746
- return 0;
1747
- }
1748
- equals(other) {
1749
- if (other.type === this.type) {
1750
- if (this.expr.length !== other.expr.length) {
1751
- return false;
1752
- }
1753
- for (let i = 0, len = this.expr.length; i < len; i++) {
1754
- if (!this.expr[i].equals(other.expr[i])) {
1755
- return false;
1756
- }
1757
- }
1758
- return true;
1759
- }
1760
- return false;
1761
- }
1762
- substituteConstants() {
1763
- const exprArr = eliminateConstantsInArray(this.expr);
1764
- if (exprArr === this.expr) {
1765
- return this;
1766
- }
1767
- return ContextKeyOrExpr.create(exprArr, this.negated, false);
1768
- }
1769
- evaluate(context) {
1770
- for (let i = 0, len = this.expr.length; i < len; i++) {
1771
- if (this.expr[i].evaluate(context)) {
1772
- return true;
1773
- }
1774
- }
1775
- return false;
1776
- }
1777
- static _normalizeArr(arr, negated, extraRedundantCheck) {
1778
- let expr = [];
1779
- let hasFalse = false;
1780
- if (arr) {
1781
- for (let i = 0, len = arr.length; i < len; i++) {
1782
- const e = arr[i];
1783
- if (!e) {
1784
- continue;
1785
- }
1786
- if (e.type === 0 ) {
1787
- hasFalse = true;
1788
- continue;
1789
- }
1790
- if (e.type === 1 ) {
1791
- return ContextKeyTrueExpr.INSTANCE;
1792
- }
1793
- if (e.type === 9 ) {
1794
- expr = expr.concat(e.expr);
1795
- continue;
1796
- }
1797
- expr.push(e);
1798
- }
1799
- if (expr.length === 0 && hasFalse) {
1800
- return ContextKeyFalseExpr.INSTANCE;
1801
- }
1802
- expr.sort(cmp);
1803
- }
1804
- if (expr.length === 0) {
1805
- return undefined;
1806
- }
1807
- if (expr.length === 1) {
1808
- return expr[0];
1809
- }
1810
- for (let i = 1; i < expr.length; i++) {
1811
- if (expr[i - 1].equals(expr[i])) {
1812
- expr.splice(i, 1);
1813
- i--;
1814
- }
1815
- }
1816
- if (expr.length === 1) {
1817
- return expr[0];
1818
- }
1819
- if (extraRedundantCheck) {
1820
- for (let i = 0; i < expr.length; i++) {
1821
- for (let j = i + 1; j < expr.length; j++) {
1822
- if (expr[i].negate().equals(expr[j])) {
1823
- return ContextKeyTrueExpr.INSTANCE;
1824
- }
1825
- }
1826
- }
1827
- if (expr.length === 1) {
1828
- return expr[0];
1829
- }
1830
- }
1831
- return (
1832
- (new ContextKeyOrExpr(expr, negated))
1833
- );
1834
- }
1835
- serialize() {
1836
- return ( (this.expr.map(e => e.serialize()))).join(' || ');
1837
- }
1838
- keys() {
1839
- const result = [];
1840
- for (const expr of this.expr) {
1841
- result.push(...( (expr.keys())));
1842
- }
1843
- return result;
1844
- }
1845
- map(mapFnc) {
1846
- return (
1847
- (new ContextKeyOrExpr(
1848
- (this.expr.map(expr => ( (expr.map(mapFnc))))),
1849
- null
1850
- ))
1851
- );
1852
- }
1853
- negate() {
1854
- if (!this.negated) {
1855
- const result = [];
1856
- for (const expr of this.expr) {
1857
- result.push(expr.negate());
1858
- }
1859
- while (result.length > 1) {
1860
- const LEFT = result.shift();
1861
- const RIGHT = result.shift();
1862
- const all = [];
1863
- for (const left of getTerminals(LEFT)) {
1864
- for (const right of getTerminals(RIGHT)) {
1865
- all.push(ContextKeyAndExpr.create([left, right], null, false));
1866
- }
1867
- }
1868
- result.unshift(ContextKeyOrExpr.create(all, null, false));
1869
- }
1870
- this.negated = ContextKeyOrExpr.create(result, this, true);
1871
- }
1872
- return this.negated;
1873
- }
1874
- }
1875
- class RawContextKey extends ContextKeyDefinedExpr {
1876
- static all() {
1877
- return (
1878
- (RawContextKey._info.values())
1879
- );
1880
- }
1881
- constructor(key, defaultValue, metaOrHide) {
1882
- super(key, null);
1883
- this._defaultValue = defaultValue;
1884
- if (typeof metaOrHide === 'object') {
1885
- RawContextKey._info.push({ ...metaOrHide, key });
1886
- }
1887
- else if (metaOrHide !== true) {
1888
- RawContextKey._info.push({ key, description: metaOrHide, type: defaultValue !== null && defaultValue !== undefined ? typeof defaultValue : undefined });
1889
- }
1890
- }
1891
- bindTo(target) {
1892
- return target.createKey(this.key, this._defaultValue);
1893
- }
1894
- getValue(target) {
1895
- return target.getContextKeyValue(this.key);
1896
- }
1897
- toNegated() {
1898
- return this.negate();
1899
- }
1900
- isEqualTo(value) {
1901
- return ContextKeyEqualsExpr.create(this.key, value);
1902
- }
1903
- notEqualsTo(value) {
1904
- return ContextKeyNotEqualsExpr.create(this.key, value);
1905
- }
1906
- }
1907
- RawContextKey._info = [];
1908
- function cmp1(key1, key2) {
1909
- if (key1 < key2) {
1910
- return -1;
1911
- }
1912
- if (key1 > key2) {
1913
- return 1;
1914
- }
1915
- return 0;
1916
- }
1917
- function cmp2(key1, value1, key2, value2) {
1918
- if (key1 < key2) {
1919
- return -1;
1920
- }
1921
- if (key1 > key2) {
1922
- return 1;
1923
- }
1924
- if (value1 < value2) {
1925
- return -1;
1926
- }
1927
- if (value1 > value2) {
1928
- return 1;
1929
- }
1930
- return 0;
1931
- }
1932
- function getTerminals(node) {
1933
- if (node.type === 9 ) {
1934
- return node.expr;
1935
- }
1936
- return [node];
1937
- }
1938
- const mark = (name) => {
1939
- performance.mark(name);
1940
- };
1941
- const getMarks = () => {
1942
- let timeOrigin = performance.timeOrigin;
1943
- if (typeof timeOrigin !== 'number') {
1944
- timeOrigin = performance.timing.navigationStart || performance.timing.redirectStart || performance.timing.fetchStart;
1945
- }
1946
- const result = [{ name: 'code/timeOrigin', startTime: Math.round(timeOrigin) }];
1947
- for (const entry of performance.getEntriesByType('mark')) {
1948
- result.push({
1949
- name: entry.name,
1950
- startTime: Math.round(timeOrigin + entry.startTime)
1951
- });
1952
- }
1953
- return result;
1954
- };
1955
- const IFileService = ( (createDecorator('fileService')));
1956
- var FileType;
1957
- ( ((function(FileType) {
1958
- FileType[FileType["Unknown"] = 0] = "Unknown";
1959
- FileType[FileType["File"] = 1] = "File";
1960
- FileType[FileType["Directory"] = 2] = "Directory";
1961
- FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
1962
- })(FileType || (FileType = {}))));
1963
- var FilePermission;
1964
- ( ((function(FilePermission) {
1965
- FilePermission[FilePermission["Readonly"] = 1] = "Readonly";
1966
- })(FilePermission || (FilePermission = {}))));
1967
- function hasReadWriteCapability(provider) {
1968
- return !!((provider.capabilities & 2) );
1969
- }
1970
- function hasFileFolderCopyCapability(provider) {
1971
- return !!((provider.capabilities & 8) );
1972
- }
1973
- function hasFileCloneCapability(provider) {
1974
- return !!((provider.capabilities & 32768) );
1975
- }
1976
- function hasOpenReadWriteCloseCapability(provider) {
1977
- return !!((provider.capabilities & 4) );
1978
- }
1979
- function hasFileReadStreamCapability(provider) {
1980
- return !!((provider.capabilities & 16) );
1981
- }
1982
- function hasFileAtomicReadCapability(provider) {
1983
- if (!hasReadWriteCapability(provider)) {
1984
- return false;
1985
- }
1986
- return !!((provider.capabilities & 16384) );
1987
- }
1988
- var FileSystemProviderErrorCode;
1989
- ( ((function(FileSystemProviderErrorCode) {
1990
- FileSystemProviderErrorCode["FileExists"] = "EntryExists";
1991
- FileSystemProviderErrorCode["FileNotFound"] = "EntryNotFound";
1992
- FileSystemProviderErrorCode["FileNotADirectory"] = "EntryNotADirectory";
1993
- FileSystemProviderErrorCode["FileIsADirectory"] = "EntryIsADirectory";
1994
- FileSystemProviderErrorCode["FileExceedsMemoryLimit"] = "EntryExceedsMemoryLimit";
1995
- FileSystemProviderErrorCode["FileTooLarge"] = "EntryTooLarge";
1996
- FileSystemProviderErrorCode["FileWriteLocked"] = "EntryWriteLocked";
1997
- FileSystemProviderErrorCode["NoPermissions"] = "NoPermissions";
1998
- FileSystemProviderErrorCode["Unavailable"] = "Unavailable";
1999
- FileSystemProviderErrorCode["Unknown"] = "Unknown";
2000
- })(FileSystemProviderErrorCode || (FileSystemProviderErrorCode = {}))));
2001
- class FileSystemProviderError extends Error {
2002
- static create(error, code) {
2003
- const providerError = ( (new FileSystemProviderError( (error.toString()), code)));
2004
- markAsFileSystemProviderError(providerError, code);
2005
- return providerError;
2006
- }
2007
- constructor(message, code) {
2008
- super(message);
2009
- this.code = code;
2010
- }
2011
- }
2012
- function createFileSystemProviderError(error, code) {
2013
- return FileSystemProviderError.create(error, code);
2014
- }
2015
- function ensureFileSystemProviderError(error) {
2016
- if (!error) {
2017
- return createFileSystemProviderError(( (localize('unknownError', "Unknown Error"))), FileSystemProviderErrorCode.Unknown);
2018
- }
2019
- return error;
2020
- }
2021
- function markAsFileSystemProviderError(error, code) {
2022
- error.name = code ? `${code} (FileSystemError)` : `FileSystemError`;
2023
- return error;
2024
- }
2025
- function toFileSystemProviderErrorCode(error) {
2026
- if (!error) {
2027
- return FileSystemProviderErrorCode.Unknown;
2028
- }
2029
- if (error instanceof FileSystemProviderError) {
2030
- return error.code;
2031
- }
2032
- const match = /^(.+) \(FileSystemError\)$/.exec(error.name);
2033
- if (!match) {
2034
- return FileSystemProviderErrorCode.Unknown;
2035
- }
2036
- switch (match[1]) {
2037
- case FileSystemProviderErrorCode.FileExists: return FileSystemProviderErrorCode.FileExists;
2038
- case FileSystemProviderErrorCode.FileIsADirectory: return FileSystemProviderErrorCode.FileIsADirectory;
2039
- case FileSystemProviderErrorCode.FileNotADirectory: return FileSystemProviderErrorCode.FileNotADirectory;
2040
- case FileSystemProviderErrorCode.FileNotFound: return FileSystemProviderErrorCode.FileNotFound;
2041
- case FileSystemProviderErrorCode.FileExceedsMemoryLimit: return FileSystemProviderErrorCode.FileExceedsMemoryLimit;
2042
- case FileSystemProviderErrorCode.FileTooLarge: return FileSystemProviderErrorCode.FileTooLarge;
2043
- case FileSystemProviderErrorCode.FileWriteLocked: return FileSystemProviderErrorCode.FileWriteLocked;
2044
- case FileSystemProviderErrorCode.NoPermissions: return FileSystemProviderErrorCode.NoPermissions;
2045
- case FileSystemProviderErrorCode.Unavailable: return FileSystemProviderErrorCode.Unavailable;
2046
- }
2047
- return FileSystemProviderErrorCode.Unknown;
2048
- }
2049
- function toFileOperationResult(error) {
2050
- if (error instanceof FileOperationError) {
2051
- return error.fileOperationResult;
2052
- }
2053
- switch (toFileSystemProviderErrorCode(error)) {
2054
- case FileSystemProviderErrorCode.FileNotFound:
2055
- return 1 ;
2056
- case FileSystemProviderErrorCode.FileIsADirectory:
2057
- return 0 ;
2058
- case FileSystemProviderErrorCode.FileNotADirectory:
2059
- return 10 ;
2060
- case FileSystemProviderErrorCode.FileWriteLocked:
2061
- return 5 ;
2062
- case FileSystemProviderErrorCode.NoPermissions:
2063
- return 6 ;
2064
- case FileSystemProviderErrorCode.FileExists:
2065
- return 4 ;
2066
- case FileSystemProviderErrorCode.FileExceedsMemoryLimit:
2067
- return 9 ;
2068
- case FileSystemProviderErrorCode.FileTooLarge:
2069
- return 7 ;
2070
- default:
2071
- return 11 ;
2072
- }
2073
- }
2074
- class FileOperationEvent {
2075
- constructor(resource, operation, target) {
2076
- this.resource = resource;
2077
- this.operation = operation;
2078
- this.target = target;
2079
- }
2080
- isOperation(operation) {
2081
- return this.operation === operation;
2082
- }
2083
- }
2084
- class FileChangesEvent {
2085
- constructor(changes, ignorePathCasing) {
2086
- this.added = undefined;
2087
- this.updated = undefined;
2088
- this.deleted = undefined;
2089
- this.rawAdded = [];
2090
- this.rawUpdated = [];
2091
- this.rawDeleted = [];
2092
- const entriesByType = ( (new Map()));
2093
- for (const change of changes) {
2094
- const array = entriesByType.get(change.type);
2095
- if (array) {
2096
- array.push([change.resource, change]);
2097
- }
2098
- else {
2099
- entriesByType.set(change.type, [[change.resource, change]]);
2100
- }
2101
- switch (change.type) {
2102
- case 1 :
2103
- this.rawAdded.push(change.resource);
2104
- break;
2105
- case 0 :
2106
- this.rawUpdated.push(change.resource);
2107
- break;
2108
- case 2 :
2109
- this.rawDeleted.push(change.resource);
2110
- break;
2111
- }
2112
- }
2113
- for (const [key, value] of entriesByType) {
2114
- switch (key) {
2115
- case 1 :
2116
- this.added = TernarySearchTree.forUris(() => ignorePathCasing);
2117
- this.added.fill(value);
2118
- break;
2119
- case 0 :
2120
- this.updated = TernarySearchTree.forUris(() => ignorePathCasing);
2121
- this.updated.fill(value);
2122
- break;
2123
- case 2 :
2124
- this.deleted = TernarySearchTree.forUris(() => ignorePathCasing);
2125
- this.deleted.fill(value);
2126
- break;
2127
- }
2128
- }
2129
- }
2130
- contains(resource, ...types) {
2131
- return this.doContains(resource, { includeChildren: false }, ...types);
2132
- }
2133
- affects(resource, ...types) {
2134
- return this.doContains(resource, { includeChildren: true }, ...types);
2135
- }
2136
- doContains(resource, options, ...types) {
2137
- if (!resource) {
2138
- return false;
2139
- }
2140
- const hasTypesFilter = types.length > 0;
2141
- if (!hasTypesFilter || types.includes(1 )) {
2142
- if (this.added?.get(resource)) {
2143
- return true;
2144
- }
2145
- if (options.includeChildren && this.added?.findSuperstr(resource)) {
2146
- return true;
2147
- }
2148
- }
2149
- if (!hasTypesFilter || types.includes(0 )) {
2150
- if (this.updated?.get(resource)) {
2151
- return true;
2152
- }
2153
- if (options.includeChildren && this.updated?.findSuperstr(resource)) {
2154
- return true;
2155
- }
2156
- }
2157
- if (!hasTypesFilter || types.includes(2 )) {
2158
- if (this.deleted?.findSubstr(resource) ) {
2159
- return true;
2160
- }
2161
- if (options.includeChildren && this.deleted?.findSuperstr(resource)) {
2162
- return true;
2163
- }
2164
- }
2165
- return false;
2166
- }
2167
- gotAdded() {
2168
- return !!this.added;
2169
- }
2170
- gotDeleted() {
2171
- return !!this.deleted;
2172
- }
2173
- gotUpdated() {
2174
- return !!this.updated;
2175
- }
2176
- }
2177
- class FileOperationError extends Error {
2178
- constructor(message, fileOperationResult, options) {
2179
- super(message);
2180
- this.fileOperationResult = fileOperationResult;
2181
- this.options = options;
2182
- }
2183
- }
2184
- class TooLargeFileOperationError extends FileOperationError {
2185
- constructor(message, fileOperationResult, size, options) {
2186
- super(message, fileOperationResult, options);
2187
- this.fileOperationResult = fileOperationResult;
2188
- this.size = size;
2189
- }
2190
- }
2191
- class NotModifiedSinceFileOperationError extends FileOperationError {
2192
- constructor(message, stat, options) {
2193
- super(message, 2 , options);
2194
- this.stat = stat;
2195
- }
2196
- }
2197
- const AutoSaveConfiguration = {
2198
- OFF: 'off',
2199
- AFTER_DELAY: 'afterDelay',
2200
- ON_FOCUS_CHANGE: 'onFocusChange',
2201
- ON_WINDOW_CHANGE: 'onWindowChange'
2202
- };
2203
- const HotExitConfiguration = {
2204
- OFF: 'off',
2205
- ON_EXIT: 'onExit',
2206
- ON_EXIT_AND_WINDOW_CLOSE: 'onExitAndWindowClose'
2207
- };
2208
- const FILES_ASSOCIATIONS_CONFIG = 'files.associations';
2209
- const ETAG_DISABLED = '';
2210
- function etag(stat) {
2211
- if (typeof stat.size !== 'number' || typeof stat.mtime !== 'number') {
2212
- return undefined;
2213
- }
2214
- return ( (stat.mtime.toString(29))) + ( (stat.size.toString(31)));
2215
- }
2216
- const IUriIdentityService = ( (createDecorator('IUriIdentityService')));
2217
- function isUserDataProfile(thing) {
2218
- const candidate = thing;
2219
- return !!(candidate && typeof candidate === 'object'
2220
- && typeof candidate.id === 'string'
2221
- && typeof candidate.isDefault === 'boolean'
2222
- && typeof candidate.name === 'string'
2223
- && URI.isUri(candidate.location)
2224
- && URI.isUri(candidate.globalStorageHome)
2225
- && URI.isUri(candidate.settingsResource)
2226
- && URI.isUri(candidate.keybindingsResource)
2227
- && URI.isUri(candidate.tasksResource)
2228
- && URI.isUri(candidate.snippetsHome)
2229
- && URI.isUri(candidate.extensionsResource));
2230
- }
2231
- const IUserDataProfilesService = ( (createDecorator('IUserDataProfilesService')));
2232
- function toUserDataProfile(id, name, location, options) {
2233
- return {
2234
- id,
2235
- name,
2236
- location,
2237
- isDefault: false,
2238
- shortName: options?.shortName,
2239
- globalStorageHome: joinPath(location, 'globalStorage'),
2240
- settingsResource: joinPath(location, 'settings.json'),
2241
- keybindingsResource: joinPath(location, 'keybindings.json'),
2242
- tasksResource: joinPath(location, 'tasks.json'),
2243
- snippetsHome: joinPath(location, 'snippets'),
2244
- extensionsResource: joinPath(location, 'extensions.json'),
2245
- useDefaultFlags: options?.useDefaultFlags,
2246
- isTransient: options?.transient
2247
- };
2248
- }
2249
- let UserDataProfilesService = class UserDataProfilesService extends Disposable {
2250
- get defaultProfile() { return this.profiles[0]; }
2251
- get profiles() { return [...this.profilesObject.profiles, ...this.transientProfilesObject.profiles]; }
2252
- constructor(environmentService, fileService, uriIdentityService, logService) {
2253
- super();
2254
- this.environmentService = environmentService;
2255
- this.fileService = fileService;
2256
- this.uriIdentityService = uriIdentityService;
2257
- this.logService = logService;
2258
- this.enabled = true;
2259
- this._onDidChangeProfiles = this._register(( (new Emitter())));
2260
- this.onDidChangeProfiles = this._onDidChangeProfiles.event;
2261
- this._onWillCreateProfile = this._register(( (new Emitter())));
2262
- this.onWillCreateProfile = this._onWillCreateProfile.event;
2263
- this._onWillRemoveProfile = this._register(( (new Emitter())));
2264
- this.onWillRemoveProfile = this._onWillRemoveProfile.event;
2265
- this._onDidResetWorkspaces = this._register(( (new Emitter())));
2266
- this.onDidResetWorkspaces = this._onDidResetWorkspaces.event;
2267
- this.profileCreationPromises = ( (new Map()));
2268
- this.transientProfilesObject = {
2269
- profiles: [],
2270
- workspaces: ( (new ResourceMap())),
2271
- emptyWindows: ( (new Map()))
2272
- };
2273
- this.profilesHome = joinPath(this.environmentService.userRoamingDataHome, 'profiles');
2274
- }
2275
- init() {
2276
- this._profilesObject = undefined;
2277
- }
2278
- setEnablement(enabled) {
2279
- if (this.enabled !== enabled) {
2280
- this._profilesObject = undefined;
2281
- this.enabled = enabled;
2282
- }
2283
- }
2284
- isEnabled() {
2285
- return this.enabled;
2286
- }
2287
- get profilesObject() {
2288
- if (!this._profilesObject) {
2289
- const profiles = [];
2290
- if (this.enabled) {
2291
- try {
2292
- for (const storedProfile of this.getStoredProfiles()) {
2293
- if (!storedProfile.name || !isString(storedProfile.name) || !storedProfile.location) {
2294
- this.logService.warn('Skipping the invalid stored profile', storedProfile.location || storedProfile.name);
2295
- continue;
2296
- }
2297
- profiles.push(toUserDataProfile(basename(storedProfile.location), storedProfile.name, storedProfile.location, { shortName: storedProfile.shortName, useDefaultFlags: storedProfile.useDefaultFlags }));
2298
- }
2299
- }
2300
- catch (error) {
2301
- this.logService.error(error);
2302
- }
2303
- }
2304
- const workspaces = ( (new ResourceMap()));
2305
- const emptyWindows = ( (new Map()));
2306
- const defaultProfile = this.createDefaultProfile();
2307
- profiles.unshift({ ...defaultProfile, extensionsResource: this.getDefaultProfileExtensionsLocation() ?? defaultProfile.extensionsResource, isDefault: true });
2308
- if (profiles.length) {
2309
- try {
2310
- const profileAssociaitions = this.getStoredProfileAssociations();
2311
- if (profileAssociaitions.workspaces) {
2312
- for (const [workspacePath, profileId] of Object.entries(profileAssociaitions.workspaces)) {
2313
- const workspace = ( (URI.parse(workspacePath)));
2314
- const profile = profiles.find(p => p.id === profileId);
2315
- if (profile) {
2316
- workspaces.set(workspace, profile);
2317
- }
2318
- }
2319
- }
2320
- if (profileAssociaitions.emptyWindows) {
2321
- for (const [windowId, profileId] of Object.entries(profileAssociaitions.emptyWindows)) {
2322
- const profile = profiles.find(p => p.id === profileId);
2323
- if (profile) {
2324
- emptyWindows.set(windowId, profile);
2325
- }
2326
- }
2327
- }
2328
- }
2329
- catch (error) {
2330
- this.logService.error(error);
2331
- }
2332
- }
2333
- this._profilesObject = { profiles, workspaces, emptyWindows };
2334
- }
2335
- return this._profilesObject;
2336
- }
2337
- createDefaultProfile() {
2338
- return toUserDataProfile('__default__profile__', ( (localize('defaultProfile', "Default"))), this.environmentService.userRoamingDataHome);
2339
- }
2340
- async createTransientProfile(workspaceIdentifier) {
2341
- const namePrefix = `Temp`;
2342
- const nameRegEx = ( (new RegExp(`${escapeRegExpCharacters(namePrefix)}\\s(\\d+)`)));
2343
- let nameIndex = 0;
2344
- for (const profile of this.profiles) {
2345
- const matches = nameRegEx.exec(profile.name);
2346
- const index = matches ? parseInt(matches[1]) : 0;
2347
- nameIndex = index > nameIndex ? index : nameIndex;
2348
- }
2349
- const name = `${namePrefix} ${nameIndex + 1}`;
2350
- return this.createProfile(( (hash(generateUuid()).toString(16))), name, { transient: true }, workspaceIdentifier);
2351
- }
2352
- async createNamedProfile(name, options, workspaceIdentifier) {
2353
- return this.createProfile(( (hash(generateUuid()).toString(16))), name, options, workspaceIdentifier);
2354
- }
2355
- async createProfile(id, name, options, workspaceIdentifier) {
2356
- if (!this.enabled) {
2357
- throw new Error(`Profiles are disabled in the current environment.`);
2358
- }
2359
- const profile = await this.doCreateProfile(id, name, options);
2360
- if (workspaceIdentifier) {
2361
- await this.setProfileForWorkspace(workspaceIdentifier, profile);
2362
- }
2363
- return profile;
2364
- }
2365
- async doCreateProfile(id, name, options) {
2366
- if (!isString(name) || !name) {
2367
- throw new Error('Name of the profile is mandatory and must be of type `string`');
2368
- }
2369
- let profileCreationPromise = this.profileCreationPromises.get(name);
2370
- if (!profileCreationPromise) {
2371
- profileCreationPromise = (async () => {
2372
- try {
2373
- const existing = this.profiles.find(p => p.name === name || p.id === id);
2374
- if (existing) {
2375
- return existing;
2376
- }
2377
- const profile = toUserDataProfile(id, name, joinPath(this.profilesHome, id), options);
2378
- await this.fileService.createFolder(profile.location);
2379
- const joiners = [];
2380
- this._onWillCreateProfile.fire({
2381
- profile,
2382
- join(promise) {
2383
- joiners.push(promise);
2384
- }
2385
- });
2386
- await Promises.settled(joiners);
2387
- this.updateProfiles([profile], [], []);
2388
- return profile;
2389
- }
2390
- finally {
2391
- this.profileCreationPromises.delete(name);
2392
- }
2393
- })();
2394
- this.profileCreationPromises.set(name, profileCreationPromise);
2395
- }
2396
- return profileCreationPromise;
2397
- }
2398
- async updateProfile(profileToUpdate, options) {
2399
- if (!this.enabled) {
2400
- throw new Error(`Profiles are disabled in the current environment.`);
2401
- }
2402
- let profile = this.profiles.find(p => p.id === profileToUpdate.id);
2403
- if (!profile) {
2404
- throw new Error(`Profile '${profileToUpdate.name}' does not exist`);
2405
- }
2406
- profile = toUserDataProfile(profile.id, options.name ?? profile.name, profile.location, { shortName: options.shortName ?? profile.shortName, transient: options.transient ?? profile.isTransient, useDefaultFlags: options.useDefaultFlags ?? profile.useDefaultFlags });
2407
- this.updateProfiles([], [], [profile]);
2408
- return profile;
2409
- }
2410
- async removeProfile(profileToRemove) {
2411
- if (!this.enabled) {
2412
- throw new Error(`Profiles are disabled in the current environment.`);
2413
- }
2414
- if (profileToRemove.isDefault) {
2415
- throw new Error('Cannot remove default profile');
2416
- }
2417
- const profile = this.profiles.find(p => p.id === profileToRemove.id);
2418
- if (!profile) {
2419
- throw new Error(`Profile '${profileToRemove.name}' does not exist`);
2420
- }
2421
- const joiners = [];
2422
- this._onWillRemoveProfile.fire({
2423
- profile,
2424
- join(promise) {
2425
- joiners.push(promise);
2426
- }
2427
- });
2428
- try {
2429
- await Promise.allSettled(joiners);
2430
- }
2431
- catch (error) {
2432
- this.logService.error(error);
2433
- }
2434
- for (const windowId of [...( (this.profilesObject.emptyWindows.keys()))]) {
2435
- if (profile.id === this.profilesObject.emptyWindows.get(windowId)?.id) {
2436
- this.profilesObject.emptyWindows.delete(windowId);
2437
- }
2438
- }
2439
- for (const workspace of [...( (this.profilesObject.workspaces.keys()))]) {
2440
- if (profile.id === this.profilesObject.workspaces.get(workspace)?.id) {
2441
- this.profilesObject.workspaces.delete(workspace);
2442
- }
2443
- }
2444
- this.updateStoredProfileAssociations();
2445
- this.updateProfiles([], [profile], []);
2446
- try {
2447
- if (this.profiles.length === 1) {
2448
- await this.fileService.del(this.profilesHome, { recursive: true });
2449
- }
2450
- else {
2451
- await this.fileService.del(profile.location, { recursive: true });
2452
- }
2453
- }
2454
- catch (error) {
2455
- this.logService.error(error);
2456
- }
2457
- }
2458
- async setProfileForWorkspace(workspaceIdentifier, profileToSet) {
2459
- if (!this.enabled) {
2460
- throw new Error(`Profiles are disabled in the current environment.`);
2461
- }
2462
- const profile = this.profiles.find(p => p.id === profileToSet.id);
2463
- if (!profile) {
2464
- throw new Error(`Profile '${profileToSet.name}' does not exist`);
2465
- }
2466
- this.updateWorkspaceAssociation(workspaceIdentifier, profile);
2467
- }
2468
- unsetWorkspace(workspaceIdentifier, transient) {
2469
- if (!this.enabled) {
2470
- throw new Error(`Profiles are disabled in the current environment.`);
2471
- }
2472
- this.updateWorkspaceAssociation(workspaceIdentifier, undefined, transient);
2473
- }
2474
- async resetWorkspaces() {
2475
- this.transientProfilesObject.workspaces.clear();
2476
- this.transientProfilesObject.emptyWindows.clear();
2477
- this.profilesObject.workspaces.clear();
2478
- this.profilesObject.emptyWindows.clear();
2479
- this.updateStoredProfileAssociations();
2480
- this._onDidResetWorkspaces.fire();
2481
- }
2482
- async cleanUp() {
2483
- if (!this.enabled) {
2484
- return;
2485
- }
2486
- if (await this.fileService.exists(this.profilesHome)) {
2487
- const stat = await this.fileService.resolve(this.profilesHome);
2488
- await Promise.all(( ((stat.children || [])
2489
- .filter(child => child.isDirectory && this.profiles.every(p => !this.uriIdentityService.extUri.isEqual(p.location, child.resource)))
2490
- .map(child => this.fileService.del(child.resource, { recursive: true })))));
2491
- }
2492
- }
2493
- async cleanUpTransientProfiles() {
2494
- if (!this.enabled) {
2495
- return;
2496
- }
2497
- const unAssociatedTransientProfiles = this.transientProfilesObject.profiles.filter(p => !this.isProfileAssociatedToWorkspace(p));
2498
- await Promise.allSettled(( (unAssociatedTransientProfiles.map(p => this.removeProfile(p)))));
2499
- }
2500
- getProfileForWorkspace(workspaceIdentifier) {
2501
- const workspace = this.getWorkspace(workspaceIdentifier);
2502
- return URI.isUri(workspace) ? this.transientProfilesObject.workspaces.get(workspace) ?? this.profilesObject.workspaces.get(workspace) : this.transientProfilesObject.emptyWindows.get(workspace) ?? this.profilesObject.emptyWindows.get(workspace);
2503
- }
2504
- getWorkspace(workspaceIdentifier) {
2505
- if (isSingleFolderWorkspaceIdentifier(workspaceIdentifier)) {
2506
- return workspaceIdentifier.uri;
2507
- }
2508
- if (isWorkspaceIdentifier(workspaceIdentifier)) {
2509
- return workspaceIdentifier.configPath;
2510
- }
2511
- return workspaceIdentifier.id;
2512
- }
2513
- isProfileAssociatedToWorkspace(profile) {
2514
- if ([...( (this.transientProfilesObject.emptyWindows.values()))].some(windowProfile => this.uriIdentityService.extUri.isEqual(windowProfile.location, profile.location))) {
2515
- return true;
2516
- }
2517
- if ([...( (this.transientProfilesObject.workspaces.values()))].some(workspaceProfile => this.uriIdentityService.extUri.isEqual(workspaceProfile.location, profile.location))) {
2518
- return true;
2519
- }
2520
- if ([...( (this.profilesObject.emptyWindows.values()))].some(windowProfile => this.uriIdentityService.extUri.isEqual(windowProfile.location, profile.location))) {
2521
- return true;
2522
- }
2523
- if ([...( (this.profilesObject.workspaces.values()))].some(workspaceProfile => this.uriIdentityService.extUri.isEqual(workspaceProfile.location, profile.location))) {
2524
- return true;
2525
- }
2526
- return false;
2527
- }
2528
- updateProfiles(added, removed, updated) {
2529
- const allProfiles = [...this.profiles, ...added];
2530
- const storedProfiles = [];
2531
- this.transientProfilesObject.profiles = [];
2532
- for (let profile of allProfiles) {
2533
- if (profile.isDefault) {
2534
- continue;
2535
- }
2536
- if (removed.some(p => profile.id === p.id)) {
2537
- continue;
2538
- }
2539
- profile = updated.find(p => profile.id === p.id) ?? profile;
2540
- if (profile.isTransient) {
2541
- this.transientProfilesObject.profiles.push(profile);
2542
- }
2543
- else {
2544
- storedProfiles.push({ location: profile.location, name: profile.name, shortName: profile.shortName, useDefaultFlags: profile.useDefaultFlags });
2545
- }
2546
- }
2547
- this.saveStoredProfiles(storedProfiles);
2548
- this._profilesObject = undefined;
2549
- this.triggerProfilesChanges(added, removed, updated);
2550
- }
2551
- triggerProfilesChanges(added, removed, updated) {
2552
- this._onDidChangeProfiles.fire({ added, removed, updated, all: this.profiles });
2553
- }
2554
- updateWorkspaceAssociation(workspaceIdentifier, newProfile, transient) {
2555
- transient = newProfile?.isTransient ? true : transient;
2556
- if (!transient) {
2557
- this.updateWorkspaceAssociation(workspaceIdentifier, undefined, true);
2558
- }
2559
- const workspace = this.getWorkspace(workspaceIdentifier);
2560
- const profilesObject = transient ? this.transientProfilesObject : this.profilesObject;
2561
- if (URI.isUri(workspace)) {
2562
- profilesObject.workspaces.delete(workspace);
2563
- if (newProfile) {
2564
- profilesObject.workspaces.set(workspace, newProfile);
2565
- }
2566
- }
2567
- else {
2568
- profilesObject.emptyWindows.delete(workspace);
2569
- if (newProfile) {
2570
- profilesObject.emptyWindows.set(workspace, newProfile);
2571
- }
2572
- }
2573
- if (!transient) {
2574
- this.updateStoredProfileAssociations();
2575
- }
2576
- }
2577
- updateStoredProfileAssociations() {
2578
- const workspaces = {};
2579
- for (const [workspace, profile] of this.profilesObject.workspaces.entries()) {
2580
- workspaces[( (workspace.toString()))] = profile.id;
2581
- }
2582
- const emptyWindows = {};
2583
- for (const [windowId, profile] of this.profilesObject.emptyWindows.entries()) {
2584
- emptyWindows[( (windowId.toString()))] = profile.id;
2585
- }
2586
- this.saveStoredProfileAssociations({ workspaces, emptyWindows });
2587
- this._profilesObject = undefined;
2588
- }
2589
- migrateStoredProfileAssociations(storedProfileAssociations) {
2590
- const workspaces = {};
2591
- const defaultProfile = this.createDefaultProfile();
2592
- if (storedProfileAssociations.workspaces) {
2593
- for (const [workspace, location] of Object.entries(storedProfileAssociations.workspaces)) {
2594
- const uri = ( (URI.parse(location)));
2595
- workspaces[workspace] = this.uriIdentityService.extUri.isEqual(uri, defaultProfile.location) ? defaultProfile.id : this.uriIdentityService.extUri.basename(uri);
2596
- }
2597
- }
2598
- const emptyWindows = {};
2599
- if (storedProfileAssociations.emptyWindows) {
2600
- for (const [workspace, location] of Object.entries(storedProfileAssociations.emptyWindows)) {
2601
- const uri = ( (URI.parse(location)));
2602
- emptyWindows[workspace] = this.uriIdentityService.extUri.isEqual(uri, defaultProfile.location) ? defaultProfile.id : this.uriIdentityService.extUri.basename(uri);
2603
- }
2604
- }
2605
- return { workspaces, emptyWindows };
2606
- }
2607
- getStoredProfiles() { return []; }
2608
- saveStoredProfiles(storedProfiles) { throw new Error('not implemented'); }
2609
- getStoredProfileAssociations() { return {}; }
2610
- saveStoredProfileAssociations(storedProfileAssociations) { throw new Error('not implemented'); }
2611
- getDefaultProfileExtensionsLocation() { return undefined; }
2612
- };
2613
- UserDataProfilesService.PROFILES_KEY = 'userDataProfiles';
2614
- UserDataProfilesService.PROFILE_ASSOCIATIONS_KEY = 'profileAssociations';
2615
- UserDataProfilesService = ( (__decorate([
2616
- ( (__param(0, IEnvironmentService))),
2617
- ( (__param(1, IFileService))),
2618
- ( (__param(2, IUriIdentityService))),
2619
- ( (__param(3, ILogService)))
2620
- ], UserDataProfilesService)));
2621
- const IS_NEW_KEY = '__$__isNewStorageMarker';
2622
- const TARGET_KEY = '__$__targetStorageMarker';
2623
- var WillSaveStateReason;
2624
- ( ((function(WillSaveStateReason) {
2625
- WillSaveStateReason[WillSaveStateReason["NONE"] = 0] = "NONE";
2626
- WillSaveStateReason[WillSaveStateReason["SHUTDOWN"] = 1] = "SHUTDOWN";
2627
- })(WillSaveStateReason || (WillSaveStateReason = {}))));
2628
- var StorageScope;
2629
- ( ((function(StorageScope) {
2630
- StorageScope[StorageScope["APPLICATION"] = -1] = "APPLICATION";
2631
- StorageScope[StorageScope["PROFILE"] = 0] = "PROFILE";
2632
- StorageScope[StorageScope["WORKSPACE"] = 1] = "WORKSPACE";
2633
- })(StorageScope || (StorageScope = {}))));
2634
- var StorageTarget;
2635
- ( ((function(StorageTarget) {
2636
- StorageTarget[StorageTarget["USER"] = 0] = "USER";
2637
- StorageTarget[StorageTarget["MACHINE"] = 1] = "MACHINE";
2638
- })(StorageTarget || (StorageTarget = {}))));
2639
- function loadKeyTargets(storage) {
2640
- const keysRaw = storage.get(TARGET_KEY);
2641
- if (keysRaw) {
2642
- try {
2643
- return JSON.parse(keysRaw);
2644
- }
2645
- catch (error) {
2646
- }
2647
- }
2648
- return Object.create(null);
2649
- }
2650
- class AbstractStorageService extends Disposable {
2651
- constructor(options = { flushInterval: AbstractStorageService.DEFAULT_FLUSH_INTERVAL }) {
2652
- super();
2653
- this.options = options;
2654
- this._onDidChangeValue = this._register(( (new PauseableEmitter())));
2655
- this.onDidChangeValue = this._onDidChangeValue.event;
2656
- this._onDidChangeTarget = this._register(( (new PauseableEmitter())));
2657
- this.onDidChangeTarget = this._onDidChangeTarget.event;
2658
- this._onWillSaveState = this._register(( (new Emitter())));
2659
- this.onWillSaveState = this._onWillSaveState.event;
2660
- this.flushWhenIdleScheduler = this._register(( (new RunOnceScheduler(() => this.doFlushWhenIdle(), this.options.flushInterval))));
2661
- this.runFlushWhenIdle = this._register(( (new MutableDisposable())));
2662
- this._workspaceKeyTargets = undefined;
2663
- this._profileKeyTargets = undefined;
2664
- this._applicationKeyTargets = undefined;
2665
- }
2666
- doFlushWhenIdle() {
2667
- this.runFlushWhenIdle.value = runWhenIdle(() => {
2668
- if (this.shouldFlushWhenIdle()) {
2669
- this.flush();
2670
- }
2671
- this.flushWhenIdleScheduler.schedule();
2672
- });
2673
- }
2674
- shouldFlushWhenIdle() {
2675
- return true;
2676
- }
2677
- stopFlushWhenIdle() {
2678
- dispose([this.runFlushWhenIdle, this.flushWhenIdleScheduler]);
2679
- }
2680
- initialize() {
2681
- if (!this.initializationPromise) {
2682
- this.initializationPromise = (async () => {
2683
- mark('code/willInitStorage');
2684
- try {
2685
- await this.doInitialize();
2686
- }
2687
- finally {
2688
- mark('code/didInitStorage');
2689
- }
2690
- this.flushWhenIdleScheduler.schedule();
2691
- })();
2692
- }
2693
- return this.initializationPromise;
2694
- }
2695
- emitDidChangeValue(scope, key) {
2696
- if (key === TARGET_KEY) {
2697
- switch (scope) {
2698
- case -1 :
2699
- this._applicationKeyTargets = undefined;
2700
- break;
2701
- case 0 :
2702
- this._profileKeyTargets = undefined;
2703
- break;
2704
- case 1 :
2705
- this._workspaceKeyTargets = undefined;
2706
- break;
2707
- }
2708
- this._onDidChangeTarget.fire({ scope });
2709
- }
2710
- else {
2711
- this._onDidChangeValue.fire({ scope, key, target: this.getKeyTargets(scope)[key] });
2712
- }
2713
- }
2714
- emitWillSaveState(reason) {
2715
- this._onWillSaveState.fire({ reason });
2716
- }
2717
- get(key, scope, fallbackValue) {
2718
- return this.getStorage(scope)?.get(key, fallbackValue);
2719
- }
2720
- getBoolean(key, scope, fallbackValue) {
2721
- return this.getStorage(scope)?.getBoolean(key, fallbackValue);
2722
- }
2723
- getNumber(key, scope, fallbackValue) {
2724
- return this.getStorage(scope)?.getNumber(key, fallbackValue);
2725
- }
2726
- store(key, value, scope, target) {
2727
- if (isUndefinedOrNull(value)) {
2728
- this.remove(key, scope);
2729
- return;
2730
- }
2731
- this.withPausedEmitters(() => {
2732
- this.updateKeyTarget(key, scope, target);
2733
- this.getStorage(scope)?.set(key, value);
2734
- });
2735
- }
2736
- remove(key, scope) {
2737
- this.withPausedEmitters(() => {
2738
- this.updateKeyTarget(key, scope, undefined);
2739
- this.getStorage(scope)?.delete(key);
2740
- });
2741
- }
2742
- withPausedEmitters(fn) {
2743
- this._onDidChangeValue.pause();
2744
- this._onDidChangeTarget.pause();
2745
- try {
2746
- fn();
2747
- }
2748
- finally {
2749
- this._onDidChangeValue.resume();
2750
- this._onDidChangeTarget.resume();
2751
- }
2752
- }
2753
- keys(scope, target) {
2754
- const keys = [];
2755
- const keyTargets = this.getKeyTargets(scope);
2756
- for (const key of ( (Object.keys(keyTargets)))) {
2757
- const keyTarget = keyTargets[key];
2758
- if (keyTarget === target) {
2759
- keys.push(key);
2760
- }
2761
- }
2762
- return keys;
2763
- }
2764
- updateKeyTarget(key, scope, target) {
2765
- const keyTargets = this.getKeyTargets(scope);
2766
- if (typeof target === 'number') {
2767
- if (keyTargets[key] !== target) {
2768
- keyTargets[key] = target;
2769
- this.getStorage(scope)?.set(TARGET_KEY, JSON.stringify(keyTargets));
2770
- }
2771
- }
2772
- else {
2773
- if (typeof keyTargets[key] === 'number') {
2774
- delete keyTargets[key];
2775
- this.getStorage(scope)?.set(TARGET_KEY, JSON.stringify(keyTargets));
2776
- }
2777
- }
2778
- }
2779
- get workspaceKeyTargets() {
2780
- if (!this._workspaceKeyTargets) {
2781
- this._workspaceKeyTargets = this.loadKeyTargets(1 );
2782
- }
2783
- return this._workspaceKeyTargets;
2784
- }
2785
- get profileKeyTargets() {
2786
- if (!this._profileKeyTargets) {
2787
- this._profileKeyTargets = this.loadKeyTargets(0 );
2788
- }
2789
- return this._profileKeyTargets;
2790
- }
2791
- get applicationKeyTargets() {
2792
- if (!this._applicationKeyTargets) {
2793
- this._applicationKeyTargets = this.loadKeyTargets(-1 );
2794
- }
2795
- return this._applicationKeyTargets;
2796
- }
2797
- getKeyTargets(scope) {
2798
- switch (scope) {
2799
- case -1 :
2800
- return this.applicationKeyTargets;
2801
- case 0 :
2802
- return this.profileKeyTargets;
2803
- default:
2804
- return this.workspaceKeyTargets;
2805
- }
2806
- }
2807
- loadKeyTargets(scope) {
2808
- const storage = this.getStorage(scope);
2809
- return storage ? loadKeyTargets(storage) : Object.create(null);
2810
- }
2811
- isNew(scope) {
2812
- return this.getBoolean(IS_NEW_KEY, scope) === true;
2813
- }
2814
- async flush(reason = WillSaveStateReason.NONE) {
2815
- this._onWillSaveState.fire({ reason });
2816
- const applicationStorage = this.getStorage(-1 );
2817
- const profileStorage = this.getStorage(0 );
2818
- const workspaceStorage = this.getStorage(1 );
2819
- switch (reason) {
2820
- case WillSaveStateReason.NONE:
2821
- await Promises.settled([
2822
- applicationStorage?.whenFlushed() ?? Promise.resolve(),
2823
- profileStorage?.whenFlushed() ?? Promise.resolve(),
2824
- workspaceStorage?.whenFlushed() ?? Promise.resolve()
2825
- ]);
2826
- break;
2827
- case WillSaveStateReason.SHUTDOWN:
2828
- await Promises.settled([
2829
- applicationStorage?.flush(0) ?? Promise.resolve(),
2830
- profileStorage?.flush(0) ?? Promise.resolve(),
2831
- workspaceStorage?.flush(0) ?? Promise.resolve()
2832
- ]);
2833
- break;
2834
- }
2835
- }
2836
- async log() {
2837
- const applicationItems = this.getStorage(-1 )?.items ?? ( (new Map()));
2838
- const profileItems = this.getStorage(0 )?.items ?? ( (new Map()));
2839
- const workspaceItems = this.getStorage(1 )?.items ?? ( (new Map()));
2840
- return logStorage(applicationItems, profileItems, workspaceItems, this.getLogDetails(-1 ) ?? '', this.getLogDetails(0 ) ?? '', this.getLogDetails(1 ) ?? '');
2841
- }
2842
- async switch(to, preserveData) {
2843
- this.emitWillSaveState(WillSaveStateReason.NONE);
2844
- if (isUserDataProfile(to)) {
2845
- return this.switchToProfile(to, preserveData);
2846
- }
2847
- return this.switchToWorkspace(to, preserveData);
2848
- }
2849
- canSwitchProfile(from, to) {
2850
- if (from.id === to.id) {
2851
- return false;
2852
- }
2853
- if (isProfileUsingDefaultStorage(to) && isProfileUsingDefaultStorage(from)) {
2854
- return false;
2855
- }
2856
- return true;
2857
- }
2858
- switchData(oldStorage, newStorage, scope, preserveData) {
2859
- this.withPausedEmitters(() => {
2860
- if (preserveData) {
2861
- for (const [key, value] of oldStorage) {
2862
- newStorage.set(key, value);
2863
- }
2864
- }
2865
- else {
2866
- const handledkeys = ( (new Set()));
2867
- for (const [key, oldValue] of oldStorage) {
2868
- handledkeys.add(key);
2869
- const newValue = newStorage.get(key);
2870
- if (newValue !== oldValue) {
2871
- this.emitDidChangeValue(scope, key);
2872
- }
2873
- }
2874
- for (const [key] of newStorage.items) {
2875
- if (!handledkeys.has(key)) {
2876
- this.emitDidChangeValue(scope, key);
2877
- }
2878
- }
2879
- }
2880
- });
2881
- }
2882
- }
2883
- AbstractStorageService.DEFAULT_FLUSH_INTERVAL = 60 * 1000;
2884
- function isProfileUsingDefaultStorage(profile) {
2885
- return profile.isDefault || !!profile.useDefaultFlags?.uiState;
2886
- }
2887
- async function logStorage(application, profile, workspace, applicationPath, profilePath, workspacePath) {
2888
- const safeParse = (value) => {
2889
- try {
2890
- return JSON.parse(value);
2891
- }
2892
- catch (error) {
2893
- return value;
2894
- }
2895
- };
2896
- const applicationItems = ( (new Map()));
2897
- const applicationItemsParsed = ( (new Map()));
2898
- application.forEach((value, key) => {
2899
- applicationItems.set(key, value);
2900
- applicationItemsParsed.set(key, safeParse(value));
2901
- });
2902
- const profileItems = ( (new Map()));
2903
- const profileItemsParsed = ( (new Map()));
2904
- profile.forEach((value, key) => {
2905
- profileItems.set(key, value);
2906
- profileItemsParsed.set(key, safeParse(value));
2907
- });
2908
- const workspaceItems = ( (new Map()));
2909
- const workspaceItemsParsed = ( (new Map()));
2910
- workspace.forEach((value, key) => {
2911
- workspaceItems.set(key, value);
2912
- workspaceItemsParsed.set(key, safeParse(value));
2913
- });
2914
- if (applicationPath !== profilePath) {
2915
- console.group(`Storage: Application (path: ${applicationPath})`);
2916
- }
2917
- else {
2918
- console.group(`Storage: Application & Profile (path: ${applicationPath}, default profile)`);
2919
- }
2920
- const applicationValues = [];
2921
- applicationItems.forEach((value, key) => {
2922
- applicationValues.push({ key, value });
2923
- });
2924
- console.table(applicationValues);
2925
- console.groupEnd();
2926
- console.log(applicationItemsParsed);
2927
- if (applicationPath !== profilePath) {
2928
- console.group(`Storage: Profile (path: ${profilePath}, profile specific)`);
2929
- const profileValues = [];
2930
- profileItems.forEach((value, key) => {
2931
- profileValues.push({ key, value });
2932
- });
2933
- console.table(profileValues);
2934
- console.groupEnd();
2935
- console.log(profileItemsParsed);
2936
- }
2937
- console.group(`Storage: Workspace (path: ${workspacePath})`);
2938
- const workspaceValues = [];
2939
- workspaceItems.forEach((value, key) => {
2940
- workspaceValues.push({ key, value });
2941
- });
2942
- console.table(workspaceValues);
2943
- console.groupEnd();
2944
- console.log(workspaceItemsParsed);
2945
- }
2946
- const IProductService = ( (createDecorator('productService')));
2947
- const productSchemaId = 'vscode://schemas/vscode-product';
2948
- const IEditorGroupsService = ( (createDecorator('editorGroupsService')));
2949
- function isEditorGroup(obj) {
2950
- const group = obj;
2951
- return !!group && typeof group.id === 'number' && Array.isArray(group.editors);
2952
- }
2953
- function preferredSideBySideGroupDirection(configurationService) {
2954
- const openSideBySideDirection = configurationService.getValue('workbench.editor.openSideBySideDirection');
2955
- if (openSideBySideDirection === 'down') {
2956
- return 1 ;
2957
- }
2958
- return 3 ;
2959
- }
2960
- const IEditorService = ( (createDecorator('editorService')));
2961
- const ACTIVE_GROUP = -1;
2962
- const SIDE_GROUP = -2;
2963
- function isPreferredGroup(obj) {
2964
- const candidate = obj;
2965
- return typeof obj === 'number' || isEditorGroup(candidate);
2966
- }
2967
- const IWorkbenchEnvironmentService = refineServiceDecorator(IEnvironmentService);
2968
- const IHostService = ( (createDecorator('hostService')));
2969
- const ILanguageStatusService = ( (createDecorator('ILanguageStatusService')));
2970
- const IPaneCompositePartService = ( (createDecorator('paneCompositePartService')));
2971
- function isVirtualResource(resource) {
2972
- return resource.scheme !== Schemas.file && resource.scheme !== Schemas.vscodeRemote;
2973
- }
2974
- function getVirtualWorkspaceLocation(workspace) {
2975
- if (workspace.folders.length) {
2976
- return workspace.folders.every(f => isVirtualResource(f.uri)) ? workspace.folders[0].uri : undefined;
2977
- }
2978
- else if (workspace.configuration && isVirtualResource(workspace.configuration)) {
2979
- return workspace.configuration;
2980
- }
2981
- return undefined;
2982
- }
2983
- function getVirtualWorkspaceScheme(workspace) {
2984
- return getVirtualWorkspaceLocation(workspace)?.scheme;
2985
- }
2986
- const IRemoteAgentService = ( (createDecorator('remoteAgentService')));
2987
- const IPathService = ( (createDecorator('pathService')));
2988
- let AbstractPathService = class AbstractPathService {
2989
- constructor(localUserHome, remoteAgentService, environmentService, contextService) {
2990
- this.localUserHome = localUserHome;
2991
- this.remoteAgentService = remoteAgentService;
2992
- this.environmentService = environmentService;
2993
- this.contextService = contextService;
2994
- this.resolveOS = (async () => {
2995
- const env = await this.remoteAgentService.getEnvironment();
2996
- return env?.os || OS;
2997
- })();
2998
- this.resolveUserHome = (async () => {
2999
- const env = await this.remoteAgentService.getEnvironment();
3000
- const userHome = this.maybeUnresolvedUserHome = env?.userHome ?? localUserHome;
3001
- return userHome;
3002
- })();
3003
- }
3004
- hasValidBasename(resource, arg2, basename) {
3005
- if (typeof arg2 === 'string' || typeof arg2 === 'undefined') {
3006
- return this.resolveOS.then(os => this.doHasValidBasename(resource, os, arg2));
3007
- }
3008
- return this.doHasValidBasename(resource, arg2, basename);
3009
- }
3010
- doHasValidBasename(resource, os, name) {
3011
- if (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote) {
3012
- return isValidBasename(name ?? basename(resource), os === 1 );
3013
- }
3014
- return true;
3015
- }
3016
- get defaultUriScheme() {
3017
- return AbstractPathService.findDefaultUriScheme(this.environmentService, this.contextService);
3018
- }
3019
- static findDefaultUriScheme(environmentService, contextService) {
3020
- if (environmentService.remoteAuthority) {
3021
- return Schemas.vscodeRemote;
3022
- }
3023
- const virtualWorkspace = getVirtualWorkspaceScheme(contextService.getWorkspace());
3024
- if (virtualWorkspace) {
3025
- return virtualWorkspace;
3026
- }
3027
- const firstFolder = contextService.getWorkspace().folders[0];
3028
- if (firstFolder) {
3029
- return firstFolder.uri.scheme;
3030
- }
3031
- const configuration = contextService.getWorkspace().configuration;
3032
- if (configuration) {
3033
- return configuration.scheme;
3034
- }
3035
- return Schemas.file;
3036
- }
3037
- userHome(options) {
3038
- return options?.preferLocal ? this.localUserHome : this.resolveUserHome;
3039
- }
3040
- get resolvedUserHome() {
3041
- return this.maybeUnresolvedUserHome;
3042
- }
3043
- get path() {
3044
- return this.resolveOS.then(os => {
3045
- return os === 1 ?
3046
- win32 :
3047
- posix;
3048
- });
3049
- }
3050
- async fileURI(_path) {
3051
- let authority = '';
3052
- const os = await this.resolveOS;
3053
- if (os === 1 ) {
3054
- _path = _path.replace(/\\/g, '/');
3055
- }
3056
- if (_path[0] === '/' && _path[1] === '/') {
3057
- const idx = _path.indexOf('/', 2);
3058
- if (idx === -1) {
3059
- authority = _path.substring(2);
3060
- _path = '/';
3061
- }
3062
- else {
3063
- authority = _path.substring(2, idx);
3064
- _path = _path.substring(idx) || '/';
3065
- }
3066
- }
3067
- return (
3068
- (URI.from({
3069
- scheme: Schemas.file,
3070
- authority,
3071
- path: _path,
3072
- query: '',
3073
- fragment: ''
3074
- }))
3075
- );
3076
- }
3077
- };
3078
- AbstractPathService = ( (__decorate([
3079
- ( (__param(1, IRemoteAgentService))),
3080
- ( (__param(2, IWorkbenchEnvironmentService))),
3081
- ( (__param(3, IWorkspaceContextService)))
3082
- ], AbstractPathService)));
3083
- const ITextFileService = ( (createDecorator('textFileService')));
3084
- class TextFileOperationError extends FileOperationError {
3085
- static isTextFileOperationError(obj) {
3086
- return obj instanceof Error && !isUndefinedOrNull(obj.textFileOperationResult);
3087
- }
3088
- constructor(message, textFileOperationResult, options) {
3089
- super(message, 11 );
3090
- this.textFileOperationResult = textFileOperationResult;
3091
- this.options = options;
3092
- }
3093
- }
3094
- function stringToSnapshot(value) {
3095
- let done = false;
3096
- return {
3097
- read() {
3098
- if (!done) {
3099
- done = true;
3100
- return value;
3101
- }
3102
- return null;
3103
- }
3104
- };
3105
- }
3106
- function toBufferOrReadable(value) {
3107
- if (typeof value === 'undefined') {
3108
- return undefined;
3109
- }
3110
- if (typeof value === 'string') {
3111
- return VSBuffer.fromString(value);
3112
- }
3113
- return {
3114
- read: () => {
3115
- const chunk = value.read();
3116
- if (typeof chunk === 'string') {
3117
- return VSBuffer.fromString(chunk);
3118
- }
3119
- return null;
3120
- }
3121
- };
3122
- }
3123
- const IWorkingCopyFileService = ( (createDecorator('workingCopyFileService')));
3124
- const ISnippetsService = ( (createDecorator('snippetService')));
3125
- const VIEWLET_ID = 'workbench.view.debug';
3126
- const VARIABLES_VIEW_ID = 'workbench.debug.variablesView';
3127
- const CALLSTACK_VIEW_ID = 'workbench.debug.callStackView';
3128
- const BREAKPOINTS_VIEW_ID = 'workbench.debug.breakPointsView';
3129
- const REPL_VIEW_ID = 'workbench.panel.repl.view';
3130
- const CONTEXT_DEBUG_TYPE = ( (new RawContextKey$1(
3131
- 'debugType',
3132
- undefined,
3133
- { type: 'string', description: ( (localize(
3134
- 'debugType',
3135
- "Debug type of the active debug session. For example 'python'."
3136
- ))) }
3137
- )));
3138
- const CONTEXT_DEBUG_CONFIGURATION_TYPE = ( (new RawContextKey$1(
3139
- 'debugConfigurationType',
3140
- undefined,
3141
- { type: 'string', description: ( (localize(
3142
- 'debugConfigurationType',
3143
- "Debug type of the selected launch configuration. For example 'python'."
3144
- ))) }
3145
- )));
3146
- const CONTEXT_DEBUG_STATE = ( (new RawContextKey$1(
3147
- 'debugState',
3148
- 'inactive',
3149
- { type: 'string', description: ( (localize(
3150
- 'debugState',
3151
- "State that the focused debug session is in. One of the following: 'inactive', 'initializing', 'stopped' or 'running'."
3152
- ))) }
3153
- )));
3154
- const CONTEXT_DEBUG_UX_KEY = 'debugUx';
3155
- const CONTEXT_DEBUG_UX = ( (new RawContextKey$1(
3156
- CONTEXT_DEBUG_UX_KEY,
3157
- 'default',
3158
- { type: 'string', description: ( (localize(
3159
- 'debugUX',
3160
- "Debug UX state. When there are no debug configurations it is 'simple', otherwise 'default'. Used to decide when to show welcome views in the debug viewlet."
3161
- ))) }
3162
- )));
3163
- const CONTEXT_HAS_DEBUGGED = ( (new RawContextKey$1(
3164
- 'hasDebugged',
3165
- false,
3166
- { type: 'boolean', description: ( (localize(
3167
- 'hasDebugged',
3168
- "True when a debug session has been started at least once, false otherwise."
3169
- ))) }
3170
- )));
3171
- const CONTEXT_IN_DEBUG_MODE = ( (new RawContextKey$1(
3172
- 'inDebugMode',
3173
- false,
3174
- { type: 'boolean', description: ( (localize('inDebugMode', "True when debugging, false otherwise."))) }
3175
- )));
3176
- const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = ( (new RawContextKey$1(
3177
- 'breakpointWidgetVisible',
3178
- false,
3179
- { type: 'boolean', description: ( (localize(
3180
- 'breakpointWidgetVisibile',
3181
- "True when breakpoint editor zone widget is visible, false otherwise."
3182
- ))) }
3183
- )));
3184
- const CONTEXT_IN_BREAKPOINT_WIDGET = ( (new RawContextKey$1(
3185
- 'inBreakpointWidget',
3186
- false,
3187
- { type: 'boolean', description: ( (localize(
3188
- 'inBreakpointWidget',
3189
- "True when focus is in the breakpoint editor zone widget, false otherwise."
3190
- ))) }
3191
- )));
3192
- const CONTEXT_BREAKPOINTS_FOCUSED = ( (new RawContextKey$1(
3193
- 'breakpointsFocused',
3194
- true,
3195
- { type: 'boolean', description: ( (localize(
3196
- 'breakpointsFocused',
3197
- "True when the BREAKPOINTS view is focused, false otherwise."
3198
- ))) }
3199
- )));
3200
- const CONTEXT_WATCH_EXPRESSIONS_FOCUSED = ( (new RawContextKey$1(
3201
- 'watchExpressionsFocused',
3202
- true,
3203
- { type: 'boolean', description: ( (localize(
3204
- 'watchExpressionsFocused',
3205
- "True when the WATCH view is focused, false otherwsie."
3206
- ))) }
3207
- )));
3208
- const CONTEXT_VARIABLES_FOCUSED = ( (new RawContextKey$1(
3209
- 'variablesFocused',
3210
- true,
3211
- { type: 'boolean', description: ( (localize(
3212
- 'variablesFocused',
3213
- "True when the VARIABLES views is focused, false otherwsie"
3214
- ))) }
3215
- )));
3216
- const CONTEXT_EXPRESSION_SELECTED = ( (new RawContextKey$1(
3217
- 'expressionSelected',
3218
- false,
3219
- { type: 'boolean', description: ( (localize(
3220
- 'expressionSelected',
3221
- "True when an expression input box is open in either the WATCH or the VARIABLES view, false otherwise."
3222
- ))) }
3223
- )));
3224
- const CONTEXT_BREAKPOINT_INPUT_FOCUSED = ( (new RawContextKey$1(
3225
- 'breakpointInputFocused',
3226
- false,
3227
- { type: 'boolean', description: ( (localize(
3228
- 'breakpointInputFocused',
3229
- "True when the input box has focus in the BREAKPOINTS view."
3230
- ))) }
3231
- )));
3232
- const CONTEXT_CAN_VIEW_MEMORY = ( (new RawContextKey$1(
3233
- 'canViewMemory',
3234
- undefined,
3235
- { type: 'boolean', description: ( (localize(
3236
- 'canViewMemory',
3237
- "Indicates whether the item in the view has an associated memory refrence."
3238
- ))) }
3239
- )));
3240
- const CONTEXT_BREAKPOINT_ITEM_TYPE = ( (new RawContextKey$1(
3241
- 'breakpointItemType',
3242
- undefined,
3243
- { type: 'string', description: ( (localize(
3244
- 'breakpointItemType',
3245
- "Represents the item type of the focused element in the BREAKPOINTS view. For example: 'breakpoint', 'exceptionBreakppint', 'functionBreakpoint', 'dataBreakpoint'"
3246
- ))) }
3247
- )));
3248
- const CONTEXT_BREAKPOINT_SUPPORTS_CONDITION = ( (new RawContextKey$1(
3249
- 'breakpointSupportsCondition',
3250
- false,
3251
- { type: 'boolean', description: ( (localize(
3252
- 'breakpointSupportsCondition',
3253
- "True when the focused breakpoint supports conditions."
3254
- ))) }
3255
- )));
3256
- const CONTEXT_LOADED_SCRIPTS_SUPPORTED = ( (new RawContextKey$1(
3257
- 'loadedScriptsSupported',
3258
- false,
3259
- { type: 'boolean', description: ( (localize(
3260
- 'loadedScriptsSupported',
3261
- "True when the focused sessions supports the LOADED SCRIPTS view"
3262
- ))) }
3263
- )));
3264
- const CONTEXT_FOCUSED_SESSION_IS_ATTACH = ( (new RawContextKey$1(
3265
- 'focusedSessionIsAttach',
3266
- false,
3267
- { type: 'boolean', description: ( (localize('focusedSessionIsAttach', "True when the focused session is 'attach'."))) }
3268
- )));
3269
- const CONTEXT_STEP_BACK_SUPPORTED = ( (new RawContextKey$1(
3270
- 'stepBackSupported',
3271
- false,
3272
- { type: 'boolean', description: ( (localize(
3273
- 'stepBackSupported',
3274
- "True when the focused session supports 'stepBack' requests."
3275
- ))) }
3276
- )));
3277
- const CONTEXT_RESTART_FRAME_SUPPORTED = ( (new RawContextKey$1(
3278
- 'restartFrameSupported',
3279
- false,
3280
- { type: 'boolean', description: ( (localize(
3281
- 'restartFrameSupported',
3282
- "True when the focused session supports 'restartFrame' requests."
3283
- ))) }
3284
- )));
3285
- const CONTEXT_JUMP_TO_CURSOR_SUPPORTED = ( (new RawContextKey$1(
3286
- 'jumpToCursorSupported',
3287
- false,
3288
- { type: 'boolean', description: ( (localize(
3289
- 'jumpToCursorSupported',
3290
- "True when the focused session supports 'jumpToCursor' request."
3291
- ))) }
3292
- )));
3293
- const CONTEXT_STEP_INTO_TARGETS_SUPPORTED = ( (new RawContextKey$1(
3294
- 'stepIntoTargetsSupported',
3295
- false,
3296
- { type: 'boolean', description: ( (localize(
3297
- 'stepIntoTargetsSupported',
3298
- "True when the focused session supports 'stepIntoTargets' request."
3299
- ))) }
3300
- )));
3301
- const CONTEXT_BREAKPOINTS_EXIST = ( (new RawContextKey$1(
3302
- 'breakpointsExist',
3303
- false,
3304
- { type: 'boolean', description: ( (localize('breakpointsExist', "True when at least one breakpoint exists."))) }
3305
- )));
3306
- const CONTEXT_DEBUGGERS_AVAILABLE = ( (new RawContextKey$1(
3307
- 'debuggersAvailable',
3308
- false,
3309
- { type: 'boolean', description: ( (localize(
3310
- 'debuggersAvailable',
3311
- "True when there is at least one debug extensions active."
3312
- ))) }
3313
- )));
3314
- const CONTEXT_DEBUG_EXTENSION_AVAILABLE = ( (new RawContextKey$1(
3315
- 'debugExtensionAvailable',
3316
- true,
3317
- { type: 'boolean', description: ( (localize(
3318
- 'debugExtensionsAvailable',
3319
- "True when there is at least one debug extension installed and enabled."
3320
- ))) }
3321
- )));
3322
- const CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT = ( (new RawContextKey$1(
3323
- 'debugProtocolVariableMenuContext',
3324
- undefined,
3325
- { type: 'string', description: ( (localize(
3326
- 'debugProtocolVariableMenuContext',
3327
- "Represents the context the debug adapter sets on the focused variable in the VARIABLES view."
3328
- ))) }
3329
- )));
3330
- const CONTEXT_SET_VARIABLE_SUPPORTED = ( (new RawContextKey$1(
3331
- 'debugSetVariableSupported',
3332
- false,
3333
- { type: 'boolean', description: ( (localize(
3334
- 'debugSetVariableSupported',
3335
- "True when the focused session supports 'setVariable' request."
3336
- ))) }
3337
- )));
3338
- const CONTEXT_SET_EXPRESSION_SUPPORTED = ( (new RawContextKey$1(
3339
- 'debugSetExpressionSupported',
3340
- false,
3341
- { type: 'boolean', description: ( (localize(
3342
- 'debugSetExpressionSupported',
3343
- "True when the focused session supports 'setExpression' request."
3344
- ))) }
3345
- )));
3346
- const CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED = ( (new RawContextKey$1(
3347
- 'terminateDebuggeeSupported',
3348
- false,
3349
- { type: 'boolean', description: ( (localize(
3350
- 'terminateDebuggeeSupported',
3351
- "True when the focused session supports the terminate debuggee capability."
3352
- ))) }
3353
- )));
3354
- const CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED = ( (new RawContextKey$1(
3355
- 'suspendDebuggeeSupported',
3356
- false,
3357
- { type: 'boolean', description: ( (localize(
3358
- 'suspendDebuggeeSupported',
3359
- "True when the focused session supports the suspend debuggee capability."
3360
- ))) }
3361
- )));
3362
- const CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT = ( (new RawContextKey$1(
3363
- 'variableEvaluateNamePresent',
3364
- false,
3365
- { type: 'boolean', description: ( (localize(
3366
- 'variableEvaluateNamePresent',
3367
- "True when the focused variable has an 'evalauteName' field set."
3368
- ))) }
3369
- )));
3370
- const CONTEXT_VARIABLE_IS_READONLY = ( (new RawContextKey$1(
3371
- 'variableIsReadonly',
3372
- false,
3373
- { type: 'boolean', description: ( (localize('variableIsReadonly', "True when the focused variable is readonly."))) }
3374
- )));
3375
- const CONTEXT_EXCEPTION_WIDGET_VISIBLE = ( (new RawContextKey$1(
3376
- 'exceptionWidgetVisible',
3377
- false,
3378
- { type: 'boolean', description: ( (localize('exceptionWidgetVisible', "True when the exception widget is visible."))) }
3379
- )));
3380
- const CONTEXT_MULTI_SESSION_DEBUG = ( (new RawContextKey$1(
3381
- 'multiSessionDebug',
3382
- false,
3383
- { type: 'boolean', description: ( (localize(
3384
- 'multiSessionDebug',
3385
- "True when there is more than 1 active debug session."
3386
- ))) }
3387
- )));
3388
- const CONTEXT_DISASSEMBLE_REQUEST_SUPPORTED = ( (new RawContextKey$1(
3389
- 'disassembleRequestSupported',
3390
- false,
3391
- { type: 'boolean', description: ( (localize(
3392
- 'disassembleRequestSupported',
3393
- "True when the focused sessions supports disassemble request."
3394
- ))) }
3395
- )));
3396
- const CONTEXT_DISASSEMBLY_VIEW_FOCUS = ( (new RawContextKey$1(
3397
- 'disassemblyViewFocus',
3398
- false,
3399
- { type: 'boolean', description: ( (localize('disassemblyViewFocus', "True when the Disassembly View is focused."))) }
3400
- )));
3401
- const CONTEXT_FOCUSED_STACK_FRAME_HAS_INSTRUCTION_POINTER_REFERENCE = ( (new RawContextKey$1(
3402
- 'focusedStackFrameHasInstructionReference',
3403
- false,
3404
- { type: 'boolean', description: ( (localize(
3405
- 'focusedStackFrameHasInstructionReference',
3406
- "True when the focused stack frame has instruction pointer reference."
3407
- ))) }
3408
- )));
3409
- const debuggerDisabledMessage = (debugType) => ( (localize(
3410
- 'debuggerDisabled',
3411
- "Configured debug type '{0}' is installed but not supported in this environment.",
3412
- debugType
3413
- )));
3414
- const EDITOR_CONTRIBUTION_ID = 'editor.contrib.debug';
3415
- const BREAKPOINT_EDITOR_CONTRIBUTION_ID = 'editor.contrib.breakpoint';
3416
- const DEBUG_SCHEME = 'debug';
3417
- const INTERNAL_CONSOLE_OPTIONS_SCHEMA = {
3418
- enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart'],
3419
- default: 'openOnFirstSessionStart',
3420
- description: ( (localize(
3421
- 'internalConsoleOptions',
3422
- "Controls when the internal Debug Console should open."
3423
- )))
3424
- };
3425
- function getStateLabel(state) {
3426
- switch (state) {
3427
- case 1 : return 'initializing';
3428
- case 2 : return 'stopped';
3429
- case 3 : return 'running';
3430
- default: return 'inactive';
3431
- }
3432
- }
3433
- const DEBUG_MEMORY_SCHEME = 'vscode-debug-memory';
3434
- var DebugConfigurationProviderTriggerKind;
3435
- ( ((function(DebugConfigurationProviderTriggerKind) {
3436
- DebugConfigurationProviderTriggerKind[DebugConfigurationProviderTriggerKind["Initial"] = 1] = "Initial";
3437
- DebugConfigurationProviderTriggerKind[DebugConfigurationProviderTriggerKind["Dynamic"] = 2] = "Dynamic";
3438
- })(
3439
- DebugConfigurationProviderTriggerKind || (DebugConfigurationProviderTriggerKind = {})
3440
- )));
3441
- var DebuggerString;
3442
- ( ((function(DebuggerString) {
3443
- DebuggerString["UnverifiedBreakpoints"] = "unverifiedBreakpoints";
3444
- })(DebuggerString || (DebuggerString = {}))));
3445
- const IDebugService = ( (createDecorator('debugService')));
3446
- let services;
3447
- var Services;
3448
- ( (function(Services) {
3449
- Services.get = () => {
3450
- return services ?? {};
3451
- };
3452
- function install(_services) {
3453
- if (services != null) {
3454
- console.warn('Services have been overridden');
3455
- }
3456
- services = _services;
3457
- return {
3458
- dispose: () => {
3459
- if (services === _services) {
3460
- services = undefined;
3461
- }
3462
- }
3463
- };
3464
- }
3465
- Services.install = install;
3466
- })(Services || (Services = {})));
3467
- export { TooLargeFileOperationError as $, ACTIVE_GROUP as A, StorageTarget as B, ContextKeyExprType as C, DebugConfigurationProviderTriggerKind as D, Emitter as E, FileSystemProviderErrorCode as F, NeverShowAgainScope as G, isPreferredGroup as H, IEditorService as I, IUserDataProfilesService as J, toBufferOrReadable as K, stringToSnapshot as L, FileChangesEvent as M, NotificationsFilter as N, hasOpenReadWriteCloseCapability as O, hasReadWriteCapability as P, hasFileReadStreamCapability as Q, ensureFileSystemProviderError as R, Services as S, TextFileOperationError as T, etag as U, FileOperationEvent as V, toFileOperationResult as W, ETAG_DISABLED as X, hasFileAtomicReadCapability as Y, NotModifiedSinceFileOperationError as Z, __decorate as _, __param as a, NoOpNotification as a$, hasFileFolderCopyCapability as a0, hasFileCloneCapability as a1, createFileSystemProviderError as a2, FileSystemProviderError as a3, BREAKPOINTS_VIEW_ID as a4, CONTEXT_DEBUGGERS_AVAILABLE as a5, CONTEXT_BREAKPOINT_ITEM_TYPE as a6, CONTEXT_BREAKPOINTS_EXIST as a7, CONTEXT_IN_DEBUG_MODE as a8, CONTEXT_BREAKPOINT_SUPPORTS_CONDITION as a9, CONTEXT_STEP_BACK_SUPPORTED as aA, CONTEXT_MULTI_SESSION_DEBUG as aB, CONTEXT_BREAKPOINT_WIDGET_VISIBLE as aC, CONTEXT_IN_BREAKPOINT_WIDGET as aD, CONTEXT_EXCEPTION_WIDGET_VISIBLE as aE, CONTEXT_DEBUG_EXTENSION_AVAILABLE as aF, CONTEXT_DEBUG_CONFIGURATION_TYPE as aG, CONTEXT_LOADED_SCRIPTS_SUPPORTED as aH, CONTEXT_RESTART_FRAME_SUPPORTED as aI, CONTEXT_SET_VARIABLE_SUPPORTED as aJ, CONTEXT_SET_EXPRESSION_SUPPORTED as aK, CONTEXT_DISASSEMBLE_REQUEST_SUPPORTED as aL, CONTEXT_FOCUSED_STACK_FRAME_HAS_INSTRUCTION_POINTER_REFERENCE as aM, CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT as aN, CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT as aO, CONTEXT_CAN_VIEW_MEMORY as aP, CONTEXT_VARIABLE_IS_READONLY as aQ, DebuggerString as aR, FILES_ASSOCIATIONS_CONFIG as aS, productSchemaId as aT, AutoSaveConfiguration as aU, IRemoteAgentService as aV, AbstractPathService as aW, HotExitConfiguration as aX, markAsFileSystemProviderError as aY, RawContextKey as aZ, ContextKeyExpr as a_, BREAKPOINT_EDITOR_CONTRIBUTION_ID as aa, CONTEXT_DISASSEMBLY_VIEW_FOCUS as ab, CONTEXT_JUMP_TO_CURSOR_SUPPORTED as ac, CONTEXT_DEBUG_STATE as ad, CONTEXT_STEP_INTO_TARGETS_SUPPORTED as ae, CONTEXT_FOCUSED_SESSION_IS_ATTACH as af, REPL_VIEW_ID as ag, CONTEXT_BREAKPOINTS_FOCUSED as ah, CONTEXT_WATCH_EXPRESSIONS_FOCUSED as ai, CONTEXT_VARIABLES_FOCUSED as aj, CONTEXT_EXPRESSION_SELECTED as ak, CONTEXT_BREAKPOINT_INPUT_FOCUSED as al, VIEWLET_ID as am, CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED as an, CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED as ao, VARIABLES_VIEW_ID as ap, EDITOR_CONTRIBUTION_ID as aq, INTERNAL_CONSOLE_OPTIONS_SCHEMA as ar, DEBUG_MEMORY_SCHEME as as, DEBUG_SCHEME as at, CALLSTACK_VIEW_ID as au, CONTEXT_DEBUG_TYPE as av, CONTEXT_HAS_DEBUGGED as aw, CONTEXT_DEBUG_UX as ax, getStateLabel as ay, debuggerDisabledMessage as az, __classPrivateFieldSet as b, __classPrivateFieldGet as c, IEditorGroupsService as d, IProductService as e, FileType as f, getMarks as g, FilePermission as h, SIDE_GROUP as i, IUriIdentityService as j, IPaneCompositePartService as k, ITextFileService as l, mark as m, IFileService as n, IWorkbenchEnvironmentService as o, preferredSideBySideGroupDirection as p, IWorkingCopyFileService as q, IPathService as r, ILanguageStatusService as s, IHostService as t, IDebugService as u, FileOperationError as v, refineServiceDecorator as w, toFileSystemProviderErrorCode as x, ISnippetsService as y, StorageScope as z };