@theia/monaco 1.77.0-next.0 → 1.77.0-next.101

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 (342) hide show
  1. package/lib/browser/content-hover-widget-patcher.js +6 -9
  2. package/lib/browser/content-hover-widget-patcher.js.map +1 -1
  3. package/lib/browser/default-content-hover-widget-patcher.d.ts +1 -1
  4. package/lib/browser/default-content-hover-widget-patcher.d.ts.map +1 -1
  5. package/lib/browser/default-content-hover-widget-patcher.js +7 -10
  6. package/lib/browser/default-content-hover-widget-patcher.js.map +1 -1
  7. package/lib/browser/index.d.ts +2 -2
  8. package/lib/browser/index.d.ts.map +1 -1
  9. package/lib/browser/index.js +2 -5
  10. package/lib/browser/index.js.map +1 -1
  11. package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts +4 -4
  12. package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts.map +1 -1
  13. package/lib/browser/markdown-renderer/monaco-markdown-renderer.js +29 -37
  14. package/lib/browser/markdown-renderer/monaco-markdown-renderer.js.map +1 -1
  15. package/lib/browser/monaco-bulk-edit-service.d.ts +4 -4
  16. package/lib/browser/monaco-bulk-edit-service.d.ts.map +1 -1
  17. package/lib/browser/monaco-bulk-edit-service.js +10 -14
  18. package/lib/browser/monaco-bulk-edit-service.js.map +1 -1
  19. package/lib/browser/monaco-code-action-save-participant.d.ts +3 -3
  20. package/lib/browser/monaco-code-action-save-participant.d.ts.map +1 -1
  21. package/lib/browser/monaco-code-action-save-participant.js +12 -16
  22. package/lib/browser/monaco-code-action-save-participant.js.map +1 -1
  23. package/lib/browser/monaco-code-action-service.d.ts +2 -2
  24. package/lib/browser/monaco-code-action-service.d.ts.map +1 -1
  25. package/lib/browser/monaco-code-action-service.js +25 -29
  26. package/lib/browser/monaco-code-action-service.js.map +1 -1
  27. package/lib/browser/monaco-color-registry.d.ts +4 -4
  28. package/lib/browser/monaco-color-registry.d.ts.map +1 -1
  29. package/lib/browser/monaco-color-registry.js +23 -26
  30. package/lib/browser/monaco-color-registry.js.map +1 -1
  31. package/lib/browser/monaco-command-registry.d.ts +2 -2
  32. package/lib/browser/monaco-command-registry.d.ts.map +1 -1
  33. package/lib/browser/monaco-command-registry.js +15 -21
  34. package/lib/browser/monaco-command-registry.js.map +1 -1
  35. package/lib/browser/monaco-command-service.d.ts +2 -2
  36. package/lib/browser/monaco-command-service.d.ts.map +1 -1
  37. package/lib/browser/monaco-command-service.js +17 -24
  38. package/lib/browser/monaco-command-service.js.map +1 -1
  39. package/lib/browser/monaco-command.d.ts +3 -3
  40. package/lib/browser/monaco-command.d.ts.map +1 -1
  41. package/lib/browser/monaco-command.js +62 -71
  42. package/lib/browser/monaco-command.js.map +1 -1
  43. package/lib/browser/monaco-context-key-service.d.ts +3 -3
  44. package/lib/browser/monaco-context-key-service.d.ts.map +1 -1
  45. package/lib/browser/monaco-context-key-service.js +17 -23
  46. package/lib/browser/monaco-context-key-service.js.map +1 -1
  47. package/lib/browser/monaco-context-menu.d.ts +5 -5
  48. package/lib/browser/monaco-context-menu.d.ts.map +1 -1
  49. package/lib/browser/monaco-context-menu.js +26 -30
  50. package/lib/browser/monaco-context-menu.js.map +1 -1
  51. package/lib/browser/monaco-diff-computer.js +10 -13
  52. package/lib/browser/monaco-diff-computer.js.map +1 -1
  53. package/lib/browser/monaco-diff-editor.d.ts +7 -7
  54. package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
  55. package/lib/browser/monaco-diff-editor.js +15 -19
  56. package/lib/browser/monaco-diff-editor.js.map +1 -1
  57. package/lib/browser/monaco-diff-navigator-factory.d.ts +1 -1
  58. package/lib/browser/monaco-diff-navigator-factory.d.ts.map +1 -1
  59. package/lib/browser/monaco-diff-navigator-factory.js +5 -8
  60. package/lib/browser/monaco-diff-navigator-factory.js.map +1 -1
  61. package/lib/browser/monaco-editor-content-menu.d.ts +2 -2
  62. package/lib/browser/monaco-editor-content-menu.d.ts.map +1 -1
  63. package/lib/browser/monaco-editor-content-menu.js +36 -43
  64. package/lib/browser/monaco-editor-content-menu.js.map +1 -1
  65. package/lib/browser/monaco-editor-model.d.ts +4 -4
  66. package/lib/browser/monaco-editor-model.d.ts.map +1 -1
  67. package/lib/browser/monaco-editor-model.js +46 -50
  68. package/lib/browser/monaco-editor-model.js.map +1 -1
  69. package/lib/browser/monaco-editor-overlay-button.d.ts +1 -1
  70. package/lib/browser/monaco-editor-overlay-button.d.ts.map +1 -1
  71. package/lib/browser/monaco-editor-overlay-button.js +11 -15
  72. package/lib/browser/monaco-editor-overlay-button.js.map +1 -1
  73. package/lib/browser/monaco-editor-peek-view-widget.d.ts +2 -2
  74. package/lib/browser/monaco-editor-peek-view-widget.d.ts.map +1 -1
  75. package/lib/browser/monaco-editor-peek-view-widget.js +17 -25
  76. package/lib/browser/monaco-editor-peek-view-widget.js.map +1 -1
  77. package/lib/browser/monaco-editor-provider.d.ts +10 -10
  78. package/lib/browser/monaco-editor-provider.d.ts.map +1 -1
  79. package/lib/browser/monaco-editor-provider.js +92 -108
  80. package/lib/browser/monaco-editor-provider.js.map +1 -1
  81. package/lib/browser/monaco-editor-service.d.ts +6 -6
  82. package/lib/browser/monaco-editor-service.d.ts.map +1 -1
  83. package/lib/browser/monaco-editor-service.js +47 -59
  84. package/lib/browser/monaco-editor-service.js.map +1 -1
  85. package/lib/browser/monaco-editor-zone-widget.js +10 -14
  86. package/lib/browser/monaco-editor-zone-widget.js.map +1 -1
  87. package/lib/browser/monaco-editor.d.ts +10 -7
  88. package/lib/browser/monaco-editor.d.ts.map +1 -1
  89. package/lib/browser/monaco-editor.js +102 -94
  90. package/lib/browser/monaco-editor.js.map +1 -1
  91. package/lib/browser/monaco-editor.spec.d.ts +2 -0
  92. package/lib/browser/monaco-editor.spec.d.ts.map +1 -0
  93. package/lib/browser/monaco-editor.spec.js +202 -0
  94. package/lib/browser/monaco-editor.spec.js.map +1 -0
  95. package/lib/browser/monaco-formatter-service.d.ts +3 -3
  96. package/lib/browser/monaco-formatter-service.d.ts.map +1 -1
  97. package/lib/browser/monaco-formatter-service.js +28 -37
  98. package/lib/browser/monaco-formatter-service.js.map +1 -1
  99. package/lib/browser/monaco-formatting-conflicts.d.ts +2 -2
  100. package/lib/browser/monaco-formatting-conflicts.d.ts.map +1 -1
  101. package/lib/browser/monaco-formatting-conflicts.js +19 -25
  102. package/lib/browser/monaco-formatting-conflicts.js.map +1 -1
  103. package/lib/browser/monaco-frontend-application-contribution.d.ts +4 -4
  104. package/lib/browser/monaco-frontend-application-contribution.d.ts.map +1 -1
  105. package/lib/browser/monaco-frontend-application-contribution.js +43 -56
  106. package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
  107. package/lib/browser/monaco-frontend-module.js +163 -167
  108. package/lib/browser/monaco-frontend-module.js.map +1 -1
  109. package/lib/browser/monaco-gotoline-quick-access.d.ts +2 -2
  110. package/lib/browser/monaco-gotoline-quick-access.d.ts.map +1 -1
  111. package/lib/browser/monaco-gotoline-quick-access.js +16 -20
  112. package/lib/browser/monaco-gotoline-quick-access.js.map +1 -1
  113. package/lib/browser/monaco-gotosymbol-quick-access.d.ts +5 -5
  114. package/lib/browser/monaco-gotosymbol-quick-access.d.ts.map +1 -1
  115. package/lib/browser/monaco-gotosymbol-quick-access.js +18 -22
  116. package/lib/browser/monaco-gotosymbol-quick-access.js.map +1 -1
  117. package/lib/browser/monaco-icon-registry.d.ts +1 -1
  118. package/lib/browser/monaco-icon-registry.d.ts.map +1 -1
  119. package/lib/browser/monaco-icon-registry.js +7 -10
  120. package/lib/browser/monaco-icon-registry.js.map +1 -1
  121. package/lib/browser/monaco-indexed-db.d.ts +1 -1
  122. package/lib/browser/monaco-indexed-db.d.ts.map +1 -1
  123. package/lib/browser/monaco-indexed-db.js +28 -35
  124. package/lib/browser/monaco-indexed-db.js.map +1 -1
  125. package/lib/browser/monaco-init.d.ts +1 -1
  126. package/lib/browser/monaco-init.d.ts.map +1 -1
  127. package/lib/browser/monaco-init.js +75 -95
  128. package/lib/browser/monaco-init.js.map +1 -1
  129. package/lib/browser/monaco-init.spec.js +45 -20
  130. package/lib/browser/monaco-init.spec.js.map +1 -1
  131. package/lib/browser/monaco-keybinding.d.ts +3 -2
  132. package/lib/browser/monaco-keybinding.d.ts.map +1 -1
  133. package/lib/browser/monaco-keybinding.js +47 -51
  134. package/lib/browser/monaco-keybinding.js.map +1 -1
  135. package/lib/browser/monaco-keybinding.spec.d.ts +2 -0
  136. package/lib/browser/monaco-keybinding.spec.d.ts.map +1 -0
  137. package/lib/browser/monaco-keybinding.spec.js +94 -0
  138. package/lib/browser/monaco-keybinding.spec.js.map +1 -0
  139. package/lib/browser/monaco-keycode-map.d.ts +1 -1
  140. package/lib/browser/monaco-keycode-map.d.ts.map +1 -1
  141. package/lib/browser/monaco-keycode-map.js +122 -125
  142. package/lib/browser/monaco-keycode-map.js.map +1 -1
  143. package/lib/browser/monaco-languages.d.ts +2 -2
  144. package/lib/browser/monaco-languages.d.ts.map +1 -1
  145. package/lib/browser/monaco-languages.js +33 -41
  146. package/lib/browser/monaco-languages.js.map +1 -1
  147. package/lib/browser/monaco-marker-collection.d.ts +1 -1
  148. package/lib/browser/monaco-marker-collection.d.ts.map +1 -1
  149. package/lib/browser/monaco-marker-collection.js +2 -6
  150. package/lib/browser/monaco-marker-collection.js.map +1 -1
  151. package/lib/browser/monaco-menu.d.ts +2 -2
  152. package/lib/browser/monaco-menu.d.ts.map +1 -1
  153. package/lib/browser/monaco-menu.js +44 -48
  154. package/lib/browser/monaco-menu.js.map +1 -1
  155. package/lib/browser/monaco-mime-service.js +16 -20
  156. package/lib/browser/monaco-mime-service.js.map +1 -1
  157. package/lib/browser/monaco-nls.d.ts +1 -1
  158. package/lib/browser/monaco-nls.d.ts.map +1 -1
  159. package/lib/browser/monaco-nls.js +9 -16
  160. package/lib/browser/monaco-nls.js.map +1 -1
  161. package/lib/browser/monaco-outline-contribution.d.ts +5 -2
  162. package/lib/browser/monaco-outline-contribution.d.ts.map +1 -1
  163. package/lib/browser/monaco-outline-contribution.js +35 -36
  164. package/lib/browser/monaco-outline-contribution.js.map +1 -1
  165. package/lib/browser/monaco-outline-decorator.d.ts +1 -1
  166. package/lib/browser/monaco-outline-decorator.d.ts.map +1 -1
  167. package/lib/browser/monaco-outline-decorator.js +18 -18
  168. package/lib/browser/monaco-outline-decorator.js.map +1 -1
  169. package/lib/browser/monaco-outline-decorator.spec.d.ts +2 -0
  170. package/lib/browser/monaco-outline-decorator.spec.d.ts.map +1 -0
  171. package/lib/browser/monaco-outline-decorator.spec.js +76 -0
  172. package/lib/browser/monaco-outline-decorator.spec.js.map +1 -0
  173. package/lib/browser/monaco-quick-access-registry.js +17 -21
  174. package/lib/browser/monaco-quick-access-registry.js.map +1 -1
  175. package/lib/browser/monaco-quick-input-service.d.ts +40 -8
  176. package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
  177. package/lib/browser/monaco-quick-input-service.js +169 -74
  178. package/lib/browser/monaco-quick-input-service.js.map +1 -1
  179. package/lib/browser/monaco-quick-input-service.spec.js +9 -11
  180. package/lib/browser/monaco-quick-input-service.spec.js.map +1 -1
  181. package/lib/browser/monaco-resolved-keybinding.d.ts +1 -1
  182. package/lib/browser/monaco-resolved-keybinding.d.ts.map +1 -1
  183. package/lib/browser/monaco-resolved-keybinding.js +35 -36
  184. package/lib/browser/monaco-resolved-keybinding.js.map +1 -1
  185. package/lib/browser/monaco-snippet-suggest-provider.js +31 -37
  186. package/lib/browser/monaco-snippet-suggest-provider.js.map +1 -1
  187. package/lib/browser/monaco-standalone-theme-service.d.ts +2 -2
  188. package/lib/browser/monaco-standalone-theme-service.d.ts.map +1 -1
  189. package/lib/browser/monaco-standalone-theme-service.js +2 -6
  190. package/lib/browser/monaco-standalone-theme-service.js.map +1 -1
  191. package/lib/browser/monaco-status-bar-contribution.js +26 -29
  192. package/lib/browser/monaco-status-bar-contribution.js.map +1 -1
  193. package/lib/browser/monaco-text-model-service.d.ts +6 -6
  194. package/lib/browser/monaco-text-model-service.d.ts.map +1 -1
  195. package/lib/browser/monaco-text-model-service.js +44 -58
  196. package/lib/browser/monaco-text-model-service.js.map +1 -1
  197. package/lib/browser/monaco-theming-service.d.ts +2 -2
  198. package/lib/browser/monaco-theming-service.d.ts.map +1 -1
  199. package/lib/browser/monaco-theming-service.js +30 -37
  200. package/lib/browser/monaco-theming-service.js.map +1 -1
  201. package/lib/browser/monaco-to-protocol-converter.js +8 -11
  202. package/lib/browser/monaco-to-protocol-converter.js.map +1 -1
  203. package/lib/browser/monaco-undo-redo-handler.d.ts +2 -2
  204. package/lib/browser/monaco-undo-redo-handler.d.ts.map +1 -1
  205. package/lib/browser/monaco-undo-redo-handler.js +15 -18
  206. package/lib/browser/monaco-undo-redo-handler.js.map +1 -1
  207. package/lib/browser/monaco-utilities.d.ts +1 -1
  208. package/lib/browser/monaco-utilities.d.ts.map +1 -1
  209. package/lib/browser/monaco-utilities.js +1 -4
  210. package/lib/browser/monaco-utilities.js.map +1 -1
  211. package/lib/browser/monaco-workspace-context-service.d.ts +7 -7
  212. package/lib/browser/monaco-workspace-context-service.d.ts.map +1 -1
  213. package/lib/browser/monaco-workspace-context-service.js +12 -15
  214. package/lib/browser/monaco-workspace-context-service.js.map +1 -1
  215. package/lib/browser/monaco-workspace.d.ts +5 -5
  216. package/lib/browser/monaco-workspace.d.ts.map +1 -1
  217. package/lib/browser/monaco-workspace.js +78 -92
  218. package/lib/browser/monaco-workspace.js.map +1 -1
  219. package/lib/browser/protocol-to-monaco-converter.js +6 -9
  220. package/lib/browser/protocol-to-monaco-converter.js.map +1 -1
  221. package/lib/browser/simple-monaco-editor.d.ts +4 -4
  222. package/lib/browser/simple-monaco-editor.d.ts.map +1 -1
  223. package/lib/browser/simple-monaco-editor.js +25 -29
  224. package/lib/browser/simple-monaco-editor.js.map +1 -1
  225. package/lib/browser/textmate/index.d.ts +4 -4
  226. package/lib/browser/textmate/index.d.ts.map +1 -1
  227. package/lib/browser/textmate/index.js +4 -7
  228. package/lib/browser/textmate/index.js.map +1 -1
  229. package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts +2 -2
  230. package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts.map +1 -1
  231. package/lib/browser/textmate/monaco-textmate-frontend-bindings.js +33 -37
  232. package/lib/browser/textmate/monaco-textmate-frontend-bindings.js.map +1 -1
  233. package/lib/browser/textmate/monaco-textmate-service.d.ts +5 -5
  234. package/lib/browser/textmate/monaco-textmate-service.d.ts.map +1 -1
  235. package/lib/browser/textmate/monaco-textmate-service.js +52 -63
  236. package/lib/browser/textmate/monaco-textmate-service.js.map +1 -1
  237. package/lib/browser/textmate/monaco-theme-registry.d.ts +2 -2
  238. package/lib/browser/textmate/monaco-theme-registry.d.ts.map +1 -1
  239. package/lib/browser/textmate/monaco-theme-registry.js +40 -35
  240. package/lib/browser/textmate/monaco-theme-registry.js.map +1 -1
  241. package/lib/browser/textmate/monaco-theme-types.d.ts +1 -1
  242. package/lib/browser/textmate/monaco-theme-types.d.ts.map +1 -1
  243. package/lib/browser/textmate/monaco-theme-types.js +4 -7
  244. package/lib/browser/textmate/monaco-theme-types.js.map +1 -1
  245. package/lib/browser/textmate/monaco-theme-types.spec.js +12 -14
  246. package/lib/browser/textmate/monaco-theme-types.spec.js.map +1 -1
  247. package/lib/browser/textmate/textmate-contribution.d.ts +1 -1
  248. package/lib/browser/textmate/textmate-contribution.d.ts.map +1 -1
  249. package/lib/browser/textmate/textmate-contribution.js +3 -7
  250. package/lib/browser/textmate/textmate-contribution.js.map +1 -1
  251. package/lib/browser/textmate/textmate-registry.d.ts +1 -1
  252. package/lib/browser/textmate/textmate-registry.d.ts.map +1 -1
  253. package/lib/browser/textmate/textmate-registry.js +13 -17
  254. package/lib/browser/textmate/textmate-registry.js.map +1 -1
  255. package/lib/browser/textmate/textmate-snippet-completion-provider.js +4 -8
  256. package/lib/browser/textmate/textmate-snippet-completion-provider.js.map +1 -1
  257. package/lib/browser/textmate/textmate-tokenizer.d.ts +1 -1
  258. package/lib/browser/textmate/textmate-tokenizer.d.ts.map +1 -1
  259. package/lib/browser/textmate/textmate-tokenizer.js +5 -9
  260. package/lib/browser/textmate/textmate-tokenizer.js.map +1 -1
  261. package/lib/browser/textmate/textmate-tokenizer.spec.js +10 -12
  262. package/lib/browser/textmate/textmate-tokenizer.spec.js.map +1 -1
  263. package/lib/browser/workspace-symbol-command.d.ts +1 -1
  264. package/lib/browser/workspace-symbol-command.d.ts.map +1 -1
  265. package/lib/browser/workspace-symbol-command.js +35 -44
  266. package/lib/browser/workspace-symbol-command.js.map +1 -1
  267. package/lib/package.spec.d.ts +1 -0
  268. package/lib/package.spec.js +1 -0
  269. package/package.json +18 -8
  270. package/src/browser/content-hover-widget-patcher.ts +2 -2
  271. package/src/browser/default-content-hover-widget-patcher.ts +2 -2
  272. package/src/browser/index.ts +2 -2
  273. package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +5 -5
  274. package/src/browser/monaco-bulk-edit-service.ts +4 -4
  275. package/src/browser/monaco-code-action-save-participant.ts +3 -3
  276. package/src/browser/monaco-code-action-service.ts +9 -9
  277. package/src/browser/monaco-color-registry.ts +5 -5
  278. package/src/browser/monaco-command-registry.ts +2 -2
  279. package/src/browser/monaco-command-service.ts +3 -3
  280. package/src/browser/monaco-command.ts +9 -9
  281. package/src/browser/monaco-context-key-service.ts +4 -4
  282. package/src/browser/monaco-context-menu.ts +6 -6
  283. package/src/browser/monaco-diff-computer.ts +2 -2
  284. package/src/browser/monaco-diff-editor.ts +16 -16
  285. package/src/browser/monaco-diff-navigator-factory.ts +1 -1
  286. package/src/browser/monaco-editor-content-menu.ts +5 -5
  287. package/src/browser/monaco-editor-model.ts +8 -8
  288. package/src/browser/monaco-editor-overlay-button.ts +1 -1
  289. package/src/browser/monaco-editor-peek-view-widget.ts +10 -10
  290. package/src/browser/monaco-editor-provider.ts +21 -21
  291. package/src/browser/monaco-editor-service.ts +9 -9
  292. package/src/browser/monaco-editor.spec.ts +227 -0
  293. package/src/browser/monaco-editor.ts +52 -32
  294. package/src/browser/monaco-formatter-service.ts +6 -6
  295. package/src/browser/monaco-formatting-conflicts.ts +5 -5
  296. package/src/browser/monaco-frontend-application-contribution.ts +10 -10
  297. package/src/browser/monaco-frontend-module.ts +46 -46
  298. package/src/browser/monaco-gotoline-quick-access.ts +6 -6
  299. package/src/browser/monaco-gotosymbol-quick-access.ts +7 -7
  300. package/src/browser/monaco-icon-registry.ts +1 -1
  301. package/src/browser/monaco-indexed-db.ts +1 -1
  302. package/src/browser/monaco-init.spec.ts +32 -5
  303. package/src/browser/monaco-init.ts +32 -32
  304. package/src/browser/monaco-keybinding.spec.ts +121 -0
  305. package/src/browser/monaco-keybinding.ts +21 -11
  306. package/src/browser/monaco-keycode-map.ts +2 -2
  307. package/src/browser/monaco-languages.ts +4 -4
  308. package/src/browser/monaco-marker-collection.ts +1 -1
  309. package/src/browser/monaco-menu.ts +3 -3
  310. package/src/browser/monaco-mime-service.ts +5 -5
  311. package/src/browser/monaco-nls.ts +1 -1
  312. package/src/browser/monaco-outline-contribution.ts +13 -6
  313. package/src/browser/monaco-outline-decorator.spec.ts +96 -0
  314. package/src/browser/monaco-outline-decorator.ts +9 -6
  315. package/src/browser/monaco-quick-access-registry.ts +5 -5
  316. package/src/browser/monaco-quick-input-service.spec.ts +2 -2
  317. package/src/browser/monaco-quick-input-service.ts +148 -25
  318. package/src/browser/monaco-resolved-keybinding.ts +12 -9
  319. package/src/browser/monaco-snippet-suggest-provider.ts +1 -1
  320. package/src/browser/monaco-standalone-theme-service.ts +2 -2
  321. package/src/browser/monaco-status-bar-contribution.ts +1 -1
  322. package/src/browser/monaco-text-model-service.ts +8 -8
  323. package/src/browser/monaco-theming-service.ts +2 -2
  324. package/src/browser/monaco-undo-redo-handler.ts +3 -3
  325. package/src/browser/monaco-utilities.ts +1 -1
  326. package/src/browser/monaco-workspace-context-service.ts +3 -3
  327. package/src/browser/monaco-workspace.ts +10 -10
  328. package/src/browser/simple-monaco-editor.ts +8 -8
  329. package/src/browser/style/index.css +1 -5
  330. package/src/browser/textmate/index.ts +4 -4
  331. package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +17 -15
  332. package/src/browser/textmate/monaco-textmate-service.ts +11 -11
  333. package/src/browser/textmate/monaco-theme-registry.ts +25 -15
  334. package/src/browser/textmate/monaco-theme-types.spec.ts +1 -1
  335. package/src/browser/textmate/monaco-theme-types.ts +1 -1
  336. package/src/browser/textmate/textmate-contribution.ts +1 -1
  337. package/src/browser/textmate/textmate-registry.ts +1 -1
  338. package/src/browser/textmate/textmate-snippet-completion-provider.ts +1 -1
  339. package/src/browser/textmate/textmate-tokenizer.spec.ts +1 -1
  340. package/src/browser/textmate/textmate-tokenizer.ts +3 -2
  341. package/src/browser/workspace-symbol-command.ts +1 -1
  342. package/src/typings/wasm.d.ts +21 -0
@@ -17,24 +17,24 @@
17
17
  import URI from '@theia/core/lib/common/uri';
18
18
  import { Disposable } from '@theia/core/lib/common';
19
19
  import { Dimension, DiffNavigator, DeltaDecorationParams } from '@theia/editor/lib/browser';
20
- import { MonacoEditorModel } from './monaco-editor-model';
21
- import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from './monaco-editor';
22
- import { MonacoDiffNavigatorFactory } from './monaco-diff-navigator-factory';
20
+ import { MonacoEditorModel } from './monaco-editor-model.js';
21
+ import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from './monaco-editor.js';
22
+ import { MonacoDiffNavigatorFactory } from './monaco-diff-navigator-factory.js';
23
23
  import { DiffUris } from '@theia/core/lib/browser/diff-uris';
24
24
  import * as monaco from '@theia/monaco-editor-core';
25
- import { ICodeEditor, IDiffEditorConstructionOptions } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
25
+ import { ICodeEditor, IDiffEditorConstructionOptions } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser.js';
26
26
  import { IActionDescriptor, IStandaloneCodeEditor, IStandaloneDiffEditor, StandaloneCodeEditor, StandaloneDiffEditor2 }
27
- from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
28
- import { IEditorConstructionOptions } from '@theia/monaco-editor-core/esm/vs/editor/browser/config/editorConfiguration';
29
- import { ICodeEditorWidgetOptions } from '@theia/monaco-editor-core/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget';
30
- import { EmbeddedDiffEditorWidget } from '@theia/monaco-editor-core/esm/vs/editor/browser/widget/diffEditor/embeddedDiffEditorWidget';
31
- import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';
32
- import { ContextKeyValue, IContextKey } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
33
- import { IDisposable } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
34
- import { ICommandHandler } from '@theia/monaco-editor-core/esm/vs/platform/commands/common/commands';
35
- import { EditorContextKeys } from '@theia/monaco-editor-core/esm/vs/editor/common/editorContextKeys';
36
- import { IEditorOptions } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions';
37
- import { ILineChange } from '@theia/monaco-editor-core/esm/vs/editor/common/diff/legacyLinesDiffComputer';
27
+ from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
28
+ import { IEditorConstructionOptions } from '@theia/monaco-editor-core/esm/vs/editor/browser/config/editorConfiguration.js';
29
+ import { ICodeEditorWidgetOptions } from '@theia/monaco-editor-core/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js';
30
+ import { EmbeddedDiffEditorWidget } from '@theia/monaco-editor-core/esm/vs/editor/browser/widget/diffEditor/embeddedDiffEditorWidget.js';
31
+ import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation.js';
32
+ import { ContextKeyValue, IContextKey } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey.js';
33
+ import { IDisposable } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle.js';
34
+ import { ICommandHandler } from '@theia/monaco-editor-core/esm/vs/platform/commands/common/commands.js';
35
+ import { EditorContextKeys } from '@theia/monaco-editor-core/esm/vs/editor/common/editorContextKeys.js';
36
+ import { IEditorOptions } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions.js';
37
+ import { ILineChange } from '@theia/monaco-editor-core/esm/vs/editor/common/diff/legacyLinesDiffComputer.js';
38
38
 
39
39
  export namespace MonacoDiffEditor {
40
40
  export interface IOptions extends MonacoEditor.ICommonOptions, IDiffEditorConstructionOptions {
@@ -126,7 +126,7 @@ export class MonacoDiffEditor extends MonacoEditor {
126
126
  }
127
127
 
128
128
  override handleVisibilityChanged(nowVisible: boolean): void {
129
- const isFirstShow = nowVisible && !this.savedViewState;
129
+ const isFirstShow = nowVisible && this.detachModelOnHide && !this.savedViewState;
130
130
  super.handleVisibilityChanged(nowVisible);
131
131
  if (isFirstShow) {
132
132
  this._diffEditor.revealFirstDiff();
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { injectable } from '@theia/core/shared/inversify';
18
18
  import { DiffNavigator } from '@theia/editor/lib/browser';
19
- import { IDiffEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
19
+ import { IDiffEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser.js';
20
20
 
21
21
  @injectable()
22
22
  export class MonacoDiffNavigatorFactory {
@@ -20,11 +20,11 @@ import { ObservableFromEvent, ObservableUtils } from '@theia/core/lib/common/obs
20
20
  import { FrontendApplicationContribution } from '@theia/core/lib/browser';
21
21
  import { Context } from '@theia/core/lib/browser/context-key-service';
22
22
  import { EditorManager, EDITOR_CONTENT_MENU, EditorWidget } from '@theia/editor/lib/browser';
23
- import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
24
- import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
25
- import { MonacoContextKeyService } from './monaco-context-key-service';
26
- import { MonacoEditor } from './monaco-editor';
27
- import { MonacoEditorOverlayButton } from './monaco-editor-overlay-button';
23
+ import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser.js';
24
+ import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey.js';
25
+ import { MonacoContextKeyService } from './monaco-context-key-service.js';
26
+ import { MonacoEditor } from './monaco-editor.js';
27
+ import { MonacoEditorOverlayButton } from './monaco-editor-overlay-button.js';
28
28
 
29
29
  /**
30
30
  * Implements {@link EDITOR_CONTENT_MENU} for {@link MonacoEditor}s.
@@ -21,16 +21,16 @@ import { Emitter, Event } from '@theia/core/lib/common/event';
21
21
  import { CancellationTokenSource, CancellationToken } from '@theia/core/lib/common/cancellation';
22
22
  import { Resource, ResourceError, ResourceVersion } from '@theia/core/lib/common/resource';
23
23
  import { Saveable, SaveOptions, SaveReason } from '@theia/core/lib/browser/saveable';
24
- import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
25
- import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
24
+ import { MonacoToProtocolConverter } from './monaco-to-protocol-converter.js';
25
+ import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter.js';
26
26
  import { ILogger, Loggable, Log } from '@theia/core/lib/common/logger';
27
- import { ITextBufferFactory, ITextModel, ITextSnapshot } from '@theia/monaco-editor-core/esm/vs/editor/common/model';
28
- import { IResolvedTextEditorModel } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService';
27
+ import { ITextBufferFactory, ITextModel, ITextSnapshot } from '@theia/monaco-editor-core/esm/vs/editor/common/model.js';
28
+ import { IResolvedTextEditorModel } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService.js';
29
29
  import * as monaco from '@theia/monaco-editor-core';
30
- import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
31
- import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language';
32
- import { IModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/model';
33
- import { createTextBufferFactoryFromStream } from '@theia/monaco-editor-core/esm/vs/editor/common/model/textModel';
30
+ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices.js';
31
+ import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language.js';
32
+ import { IModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/model.js';
33
+ import { createTextBufferFactoryFromStream } from '@theia/monaco-editor-core/esm/vs/editor/common/model/textModel.js';
34
34
  import { editorGeneratedPreferenceProperties } from '@theia/editor/lib/common/editor-generated-preference-schema';
35
35
  import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
36
36
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
@@ -17,7 +17,7 @@
17
17
  import { Disposable, DisposableCollection, Emitter } from '@theia/core';
18
18
  import { DISABLED_CLASS, onDomEvent } from '@theia/core/lib/browser';
19
19
  import * as monaco from '@theia/monaco-editor-core';
20
- import { MonacoEditor } from './monaco-editor';
20
+ import { MonacoEditor } from './monaco-editor.js';
21
21
 
22
22
  export class MonacoEditorOverlayButton implements Disposable {
23
23
 
@@ -16,19 +16,19 @@
16
16
 
17
17
  import { Position, Range } from '@theia/core/shared/vscode-languageserver-protocol';
18
18
  import { DisposableCollection } from '@theia/core';
19
- import { MonacoEditor } from './monaco-editor';
19
+ import { MonacoEditor } from './monaco-editor.js';
20
20
  import * as monaco from '@theia/monaco-editor-core';
21
- import { PeekViewWidget, IPeekViewOptions, IPeekViewStyles } from '@theia/monaco-editor-core/esm/vs/editor/contrib/peekView/browser/peekView';
22
- import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
23
- import { ActionBar } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/actionbar/actionbar';
24
- import { Action } from '@theia/monaco-editor-core/esm/vs/base/common/actions';
25
- import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
26
- import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';
27
- import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
28
- import { Color } from '@theia/monaco-editor-core/esm/vs/base/common/color';
21
+ import { PeekViewWidget, IPeekViewOptions, IPeekViewStyles } from '@theia/monaco-editor-core/esm/vs/editor/contrib/peekView/browser/peekView.js';
22
+ import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser.js';
23
+ import { ActionBar } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/actionbar/actionbar.js';
24
+ import { Action } from '@theia/monaco-editor-core/esm/vs/base/common/actions.js';
25
+ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices.js';
26
+ import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation.js';
27
+ import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService.js';
28
+ import { Color } from '@theia/monaco-editor-core/esm/vs/base/common/color.js';
29
29
 
30
30
  export { peekViewBorder, peekViewTitleBackground, peekViewTitleForeground, peekViewTitleInfoForeground }
31
- from '@theia/monaco-editor-core/esm/vs/editor/contrib/peekView/browser/peekView';
31
+ from '@theia/monaco-editor-core/esm/vs/editor/contrib/peekView/browser/peekView.js';
32
32
 
33
33
  export namespace MonacoEditorPeekViewWidget {
34
34
  export interface Styles {
@@ -20,33 +20,33 @@ import { TextEditor, DiffNavigator } from '@theia/editor/lib/browser';
20
20
  import { DiffUris } from '@theia/core/lib/browser/diff-uris';
21
21
  import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
22
22
  import { DisposableCollection, deepClone, Disposable, CancellationToken } from '@theia/core/lib/common';
23
- import { MonacoDiffEditor } from './monaco-diff-editor';
24
- import { MonacoDiffNavigatorFactory } from './monaco-diff-navigator-factory';
25
- import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from './monaco-editor';
26
- import { MonacoEditorModel, TextDocumentSaveReason } from './monaco-editor-model';
27
- import { MonacoWorkspace } from './monaco-workspace';
23
+ import { MonacoDiffEditor } from './monaco-diff-editor.js';
24
+ import { MonacoDiffNavigatorFactory } from './monaco-diff-navigator-factory.js';
25
+ import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from './monaco-editor.js';
26
+ import { MonacoEditorModel, TextDocumentSaveReason } from './monaco-editor-model.js';
27
+ import { MonacoWorkspace } from './monaco-workspace.js';
28
28
  import { ContributionProvider, ILogger } from '@theia/core';
29
29
  import { KeybindingRegistry, OpenerService, open, WidgetOpenerOptions, SaveOptions, FormatType } from '@theia/core/lib/browser';
30
- import { MonacoResolvedKeybinding } from './monaco-resolved-keybinding';
30
+ import { MonacoResolvedKeybinding } from './monaco-resolved-keybinding.js';
31
31
  import { HttpOpenHandlerOptions } from '@theia/core/lib/browser/http-open-handler';
32
- import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
33
- import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
32
+ import { MonacoToProtocolConverter } from './monaco-to-protocol-converter.js';
33
+ import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter.js';
34
34
  import * as monaco from '@theia/monaco-editor-core';
35
- import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
36
- import { IOpenerService, OpenExternalOptions, OpenInternalOptions } from '@theia/monaco-editor-core/esm/vs/platform/opener/common/opener';
37
- import { IKeybindingService } from '@theia/monaco-editor-core/esm/vs/platform/keybinding/common/keybinding';
38
- import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView';
39
- import { Event } from '@theia/monaco-editor-core/esm/vs/base/common/event';
40
- import { KeyCodeChord } from '@theia/monaco-editor-core/esm/vs/base/common/keybindings';
41
- import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
42
- import { ITextModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService';
43
- import { IReference } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
35
+ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices.js';
36
+ import { IOpenerService, OpenExternalOptions, OpenInternalOptions } from '@theia/monaco-editor-core/esm/vs/platform/opener/common/opener.js';
37
+ import { IKeybindingService } from '@theia/monaco-editor-core/esm/vs/platform/keybinding/common/keybinding.js';
38
+ import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView.js';
39
+ import { Event } from '@theia/monaco-editor-core/esm/vs/base/common/event.js';
40
+ import { KeyCodeChord } from '@theia/monaco-editor-core/esm/vs/base/common/keybindings.js';
41
+ import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey.js';
42
+ import { ITextModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService.js';
43
+ import { IReference } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle.js';
44
44
  import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
45
- import { SimpleMonacoEditor } from './simple-monaco-editor';
46
- import { ICodeEditorWidgetOptions } from '@theia/monaco-editor-core/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget';
45
+ import { SimpleMonacoEditor } from './simple-monaco-editor.js';
46
+ import { ICodeEditorWidgetOptions } from '@theia/monaco-editor-core/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js';
47
47
  import { timeoutReject } from '@theia/core/lib/common/promise-util';
48
48
  import { FileSystemPreferences } from '@theia/filesystem/lib/common';
49
- import { insertFinalNewline } from './monaco-utilities';
49
+ import { insertFinalNewline } from './monaco-utilities.js';
50
50
  import { EditorPreferenceChange, EditorPreferences } from '@theia/editor/lib/common/editor-preferences';
51
51
 
52
52
  export const MonacoEditorFactory = Symbol('MonacoEditorFactory');
@@ -311,7 +311,7 @@ export class MonacoEditorProvider {
311
311
  protected createOptions(prefixes: string[], uri: string, overrideIdentifier?: string): Record<string, any> {
312
312
  const flat: Record<string, any> = {};
313
313
  for (const preferenceName of Object.keys(this.editorPreferences)) {
314
- flat[preferenceName] = (<any>this.editorPreferences).get({ preferenceName, overrideIdentifier }, undefined, uri);
314
+ flat[preferenceName] = (this.editorPreferences as any).get({ preferenceName, overrideIdentifier }, undefined, uri);
315
315
  }
316
316
  return Object.entries(flat).reduce((tree, [preferenceName, value]) => this.setOption(preferenceName, deepClone(value), prefixes, tree), {});
317
317
  }
@@ -18,15 +18,15 @@ import { injectable, inject, decorate, named } from '@theia/core/shared/inversif
18
18
  import URI from '@theia/core/lib/common/uri';
19
19
  import { OpenerService, open, WidgetOpenMode, ApplicationShell } from '@theia/core/lib/browser';
20
20
  import { EditorWidget, EditorOpenerOptions, EditorManager, CustomEditorWidget } from '@theia/editor/lib/browser';
21
- import { MonacoEditor } from './monaco-editor';
22
- import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
23
- import { MonacoEditorModel } from './monaco-editor-model';
24
- import { IResourceEditorInput, ITextResourceEditorInput } from '@theia/monaco-editor-core/esm/vs/platform/editor/common/editor';
25
- import { StandaloneCodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService';
26
- import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
27
- import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
28
- import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
29
- import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
21
+ import { MonacoEditor } from './monaco-editor.js';
22
+ import { MonacoToProtocolConverter } from './monaco-to-protocol-converter.js';
23
+ import { MonacoEditorModel } from './monaco-editor-model.js';
24
+ import { IResourceEditorInput, ITextResourceEditorInput } from '@theia/monaco-editor-core/esm/vs/platform/editor/common/editor.js';
25
+ import { StandaloneCodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService.js';
26
+ import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
27
+ import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser.js';
28
+ import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey.js';
29
+ import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService.js';
30
30
  import { ContributionProvider, PreferenceService } from '@theia/core';
31
31
 
32
32
  decorate(injectable(), StandaloneCodeEditorService);
@@ -0,0 +1,227 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 EclipseSource and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom';
18
+ let disableJSDOM = enableJSDOM();
19
+
20
+ import { expect } from 'chai';
21
+ import * as sinon from 'sinon';
22
+ import { Disposable, Event } from '@theia/core/lib/common';
23
+ import URI from '@theia/core/lib/common/uri';
24
+ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices.js';
25
+ import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation.js';
26
+ import type { MonacoEditor as MonacoEditorType, MonacoEditorServices } from './monaco-editor.js';
27
+ import type { MonacoEditorModel } from './monaco-editor-model.js';
28
+ import type { MonacoDiffEditor as MonacoDiffEditorType } from './monaco-diff-editor.js';
29
+ import type { MonacoToProtocolConverter as MonacoToProtocolConverterType } from './monaco-to-protocol-converter.js';
30
+ import type { ProtocolToMonacoConverter as ProtocolToMonacoConverterType } from './protocol-to-monaco-converter.js';
31
+
32
+ disableJSDOM();
33
+
34
+ describe('MonacoEditor visibility', () => {
35
+ let MonacoEditor: typeof MonacoEditorType;
36
+ let MonacoDiffEditor: typeof MonacoDiffEditorType;
37
+ let MonacoToProtocolConverter: typeof MonacoToProtocolConverterType;
38
+ let ProtocolToMonacoConverter: typeof ProtocolToMonacoConverterType;
39
+
40
+ before(async () => {
41
+ disableJSDOM = enableJSDOM();
42
+ // Initialize baseline services before editor imports register additional services requiring browser CSS globals.
43
+ StandaloneServices.get(IInstantiationService);
44
+ ({ MonacoEditor } = await import('./monaco-editor.js'));
45
+ ({ MonacoDiffEditor } = await import('./monaco-diff-editor.js'));
46
+ ({ MonacoToProtocolConverter } = await import('./monaco-to-protocol-converter.js'));
47
+ ({ ProtocolToMonacoConverter } = await import('./protocol-to-monaco-converter.js'));
48
+ });
49
+ after(() => disableJSDOM());
50
+
51
+ const model = {
52
+ validatePosition: (position: object) => position,
53
+ getLineContent: () => '\tfoo',
54
+ getOptions: () => ({ tabSize: 4 })
55
+ };
56
+ const viewState = {
57
+ cursorState: [{ inSelectionMode: false, selectionStart: { lineNumber: 1, column: 3 }, position: { lineNumber: 1, column: 3 } }]
58
+ };
59
+ let editor: MonacoEditorType;
60
+ let control: ReturnType<typeof createControl>;
61
+
62
+ const createControl = (initiallyAttached = true) => {
63
+ let currentModel: object | undefined = initiallyAttached ? model : undefined;
64
+ return {
65
+ createContextKey: sinon.spy(),
66
+ setModel: sinon.spy((value: object | undefined) => currentModel = value),
67
+ getModel: () => currentModel,
68
+ getPosition: () => currentModel ? { lineNumber: 1, column: 1 } : undefined,
69
+ getVisibleColumnFromPosition: sinon.stub().returns(1),
70
+ saveViewState: sinon.stub().returns(viewState),
71
+ restoreViewState: sinon.spy(),
72
+ focus: sinon.spy(),
73
+ render: sinon.spy()
74
+ };
75
+ };
76
+
77
+ beforeEach(() => {
78
+ control = createControl();
79
+ editor = new class extends MonacoEditor {
80
+ constructor() {
81
+ super(new URI('file:///test.ts'), {
82
+ textEditorModel: model,
83
+ onDidChangeReadOnly: Event.None,
84
+ onDidChangeEncoding: Event.None
85
+ } as unknown as MonacoEditorModel, document.createElement('div'), {
86
+ m2p: new MonacoToProtocolConverter(),
87
+ p2m: new ProtocolToMonacoConverter()
88
+ } as unknown as MonacoEditorServices);
89
+ }
90
+
91
+ protected override create(): Disposable {
92
+ this.editor = control as unknown as typeof this.editor;
93
+ return Disposable.NULL;
94
+ }
95
+
96
+ protected override addHandlers(): void { }
97
+ }();
98
+ });
99
+ afterEach(() => editor.dispose());
100
+
101
+ it('should detach on hide and restore the model and view state without focusing on show', () => {
102
+ expect(editor.detachModelOnHide).to.be.true;
103
+ editor.handleVisibilityChanged(false);
104
+ expect(control.saveViewState.calledOnce).to.be.true;
105
+ expect(control.setModel.calledOnce).to.be.true;
106
+ expect(control.getModel()).to.not.exist;
107
+ expect(control.focus.called).to.be.false;
108
+
109
+ editor.handleVisibilityChanged(true);
110
+ expect(control.setModel.secondCall.calledWithExactly(model)).to.be.true;
111
+ expect(control.restoreViewState.calledOnceWithExactly(viewState)).to.be.true;
112
+ expect(control.focus.called).to.be.false;
113
+ expect(control.setModel.secondCall.calledBefore(control.restoreViewState.firstCall)).to.be.true;
114
+ });
115
+
116
+ it('should read the cursor and its visible column from the saved view state and the document while hidden', () => {
117
+ editor.handleVisibilityChanged(false);
118
+ const cursor = editor.cursor;
119
+ expect(cursor).to.deep.equal({ line: 0, character: 2 });
120
+ // the tab before the cursor takes up 4 columns
121
+ expect(editor.getVisibleColumn(cursor)).to.equal(6);
122
+ expect(control.getVisibleColumnFromPosition.called).to.be.false;
123
+ });
124
+
125
+ it('should retain the model and view state without focusing when opting out', () => {
126
+ editor.detachModelOnHide = false;
127
+ for (let index = 0; index < 2; index++) {
128
+ editor.handleVisibilityChanged(false);
129
+ expect(control.getModel()).to.equal(model);
130
+ editor.handleVisibilityChanged(true);
131
+ }
132
+ expect(control.setModel.called).to.be.false;
133
+ expect(control.saveViewState.called).to.be.false;
134
+ expect(control.restoreViewState.called).to.be.false;
135
+ expect(control.focus.called).to.be.false;
136
+ });
137
+
138
+ it('should stage and unstage a hidden editor for preview without focusing it', () => {
139
+ editor.handleVisibilityChanged(false);
140
+ editor.stageForPreview();
141
+ expect(control.getModel()).to.equal(model);
142
+ expect(control.restoreViewState.calledOnceWithExactly(viewState)).to.be.true;
143
+ expect(control.render.calledOnceWithExactly(true)).to.be.true;
144
+ editor.unstagePreview();
145
+ expect(control.getModel()).to.not.exist;
146
+ expect(control.saveViewState.calledTwice).to.be.true;
147
+ expect(control.focus.called).to.be.false;
148
+ });
149
+
150
+ it('should keep the model attached when showing an editor staged for preview', () => {
151
+ editor.handleVisibilityChanged(false);
152
+ editor.stageForPreview();
153
+ editor.handleVisibilityChanged(true);
154
+ editor.unstagePreview();
155
+ expect(control.getModel()).to.equal(model);
156
+ expect(control.setModel.callCount).to.equal(3);
157
+ expect(control.focus.called).to.be.false;
158
+ });
159
+
160
+ it('should not stage or unstage an attached model when opting out', () => {
161
+ editor.detachModelOnHide = false;
162
+ editor.handleVisibilityChanged(false);
163
+ editor.stageForPreview();
164
+ editor.unstagePreview();
165
+ expect(control.getModel()).to.equal(model);
166
+ expect(control.setModel.called).to.be.false;
167
+ expect(control.saveViewState.called).to.be.false;
168
+ expect(control.restoreViewState.called).to.be.false;
169
+ expect(control.render.called).to.be.false;
170
+ });
171
+
172
+ it('should reveal the first diff only on the initial show by default', () => {
173
+ const diffControl = { ...control, revealFirstDiff: sinon.spy() };
174
+ const diffEditor = Object.assign(Object.create(MonacoDiffEditor.prototype) as MonacoDiffEditorType, {
175
+ _diffEditor: diffControl,
176
+ diffEditorModel: model,
177
+ detachModelOnHide: true
178
+ });
179
+ diffEditor.handleVisibilityChanged(true);
180
+ expect(diffControl.revealFirstDiff.calledOnce).to.be.true;
181
+ diffEditor.handleVisibilityChanged(false);
182
+ diffEditor.handleVisibilityChanged(true);
183
+ expect(diffControl.revealFirstDiff.calledOnce).to.be.true;
184
+ expect(control.setModel.callCount).to.equal(3);
185
+ expect(control.restoreViewState.secondCall.calledWithExactly(viewState)).to.be.true;
186
+ });
187
+
188
+ it('should initially attach a model-less diff editor without focusing when opting out', () => {
189
+ const diffControl = { ...createControl(false), revealFirstDiff: sinon.spy() };
190
+ const diffEditor = Object.assign(Object.create(MonacoDiffEditor.prototype) as MonacoDiffEditorType, {
191
+ _diffEditor: diffControl,
192
+ diffEditorModel: model,
193
+ detachModelOnHide: false
194
+ });
195
+ expect(diffControl.getModel()).to.be.undefined;
196
+ diffEditor.handleVisibilityChanged(true);
197
+ expect(diffControl.getModel()).to.equal(model);
198
+ expect(diffControl.setModel.calledOnceWithExactly(model)).to.be.true;
199
+
200
+ for (let index = 0; index < 2; index++) {
201
+ diffEditor.handleVisibilityChanged(false);
202
+ expect(diffControl.getModel()).to.equal(model);
203
+ diffEditor.handleVisibilityChanged(true);
204
+ }
205
+ expect(diffControl.setModel.calledOnceWithExactly(model)).to.be.true;
206
+ expect(diffControl.saveViewState.called).to.be.false;
207
+ expect(diffControl.restoreViewState.called).to.be.false;
208
+ expect(diffControl.revealFirstDiff.called).to.be.false;
209
+ expect(diffControl.focus.called).to.be.false;
210
+ });
211
+
212
+ it('should not reveal the first diff on each show when opting out', () => {
213
+ const diffControl = { ...control, revealFirstDiff: sinon.spy() };
214
+ const diffEditor = Object.assign(Object.create(MonacoDiffEditor.prototype) as MonacoDiffEditorType, {
215
+ _diffEditor: diffControl,
216
+ diffEditorModel: model,
217
+ detachModelOnHide: false
218
+ });
219
+ diffEditor.handleVisibilityChanged(false);
220
+ diffEditor.handleVisibilityChanged(true);
221
+ diffEditor.handleVisibilityChanged(false);
222
+ diffEditor.handleVisibilityChanged(true);
223
+ expect(diffControl.revealFirstDiff.called).to.be.false;
224
+ expect(control.setModel.called).to.be.false;
225
+ expect(control.restoreViewState.called).to.be.false;
226
+ });
227
+ });
@@ -38,35 +38,36 @@ import {
38
38
  EditorDecorationOptions,
39
39
  MouseTargetType
40
40
  } from '@theia/editor/lib/browser';
41
- import { MonacoEditorModel } from './monaco-editor-model';
42
- import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
43
- import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
41
+ import { MonacoEditorModel } from './monaco-editor-model.js';
42
+ import { MonacoToProtocolConverter } from './monaco-to-protocol-converter.js';
43
+ import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter.js';
44
44
  import { TextEdit } from '@theia/core/shared/vscode-languageserver-protocol';
45
45
  import { UTF8 } from '@theia/core/lib/common/encodings';
46
46
  import * as monaco from '@theia/monaco-editor-core';
47
- import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
48
- import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language';
49
- import { IInstantiationService, ServiceIdentifier } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';
50
- import { ICodeEditor, IMouseTargetMargin } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
51
- import { IStandaloneEditorConstructionOptions, StandaloneCodeEditor, StandaloneEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
52
- import { ServiceCollection } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/serviceCollection';
47
+ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices.js';
48
+ import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language.js';
49
+ import { IInstantiationService, ServiceIdentifier } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation.js';
50
+ import { ICodeEditor, IMouseTargetMargin } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser.js';
51
+ import { IStandaloneEditorConstructionOptions, StandaloneCodeEditor, StandaloneEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
52
+ import { ServiceCollection } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/serviceCollection.js';
53
53
  import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
54
- import { ConfigurationChangedEvent, IEditorOptions, ShowLightbulbIconMode } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions';
55
- import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
56
- import { ICommandService } from '@theia/monaco-editor-core/esm/vs/platform/commands/common/commands';
57
- import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
58
- import { IKeybindingService } from '@theia/monaco-editor-core/esm/vs/platform/keybinding/common/keybinding';
59
- import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
60
- import { INotificationService } from '@theia/monaco-editor-core/esm/vs/platform/notification/common/notification';
61
- import { IAccessibilityService } from '@theia/monaco-editor-core/esm/vs/platform/accessibility/common/accessibility';
62
- import { ILanguageConfigurationService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/languageConfigurationRegistry';
63
- import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures';
64
- import * as objects from '@theia/monaco-editor-core/esm/vs/base/common/objects';
54
+ import { ConfigurationChangedEvent, IEditorOptions, ShowLightbulbIconMode } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions.js';
55
+ import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService.js';
56
+ import { CursorColumns } from '@theia/monaco-editor-core/esm/vs/editor/common/core/cursorColumns.js';
57
+ import { ICommandService } from '@theia/monaco-editor-core/esm/vs/platform/commands/common/commands.js';
58
+ import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey.js';
59
+ import { IKeybindingService } from '@theia/monaco-editor-core/esm/vs/platform/keybinding/common/keybinding.js';
60
+ import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService.js';
61
+ import { INotificationService } from '@theia/monaco-editor-core/esm/vs/platform/notification/common/notification.js';
62
+ import { IAccessibilityService } from '@theia/monaco-editor-core/esm/vs/platform/accessibility/common/accessibility.js';
63
+ import { ILanguageConfigurationService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/languageConfigurationRegistry.js';
64
+ import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures.js';
65
+ import * as objects from '@theia/monaco-editor-core/esm/vs/base/common/objects.js';
65
66
  import { Selection } from '@theia/editor/lib/browser/editor';
66
- import { IHoverService, WorkbenchHoverDelegate } from '@theia/monaco-editor-core/esm/vs/platform/hover/browser/hover';
67
- import { setHoverDelegateFactory } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/hover/hoverDelegateFactory';
68
- import { IMarkdownRendererService } from '@theia/monaco-editor-core/esm/vs/platform/markdown/browser/markdownRenderer';
69
- import { MonacoTextModelService } from './monaco-text-model-service';
67
+ import { IHoverService, WorkbenchHoverDelegate } from '@theia/monaco-editor-core/esm/vs/platform/hover/browser/hover.js';
68
+ import { setHoverDelegateFactory } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/hover/hoverDelegateFactory.js';
69
+ import { IMarkdownRendererService } from '@theia/monaco-editor-core/esm/vs/platform/markdown/browser/markdownRenderer.js';
70
+ import { MonacoTextModelService } from './monaco-text-model-service.js';
70
71
 
71
72
  export type ServicePair<T> = [ServiceIdentifier<T>, T];
72
73
 
@@ -106,6 +107,9 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
106
107
  return instance;
107
108
  }
108
109
 
110
+ /** Whether hiding the editor should detach its model and save its view state for restoration on show. */
111
+ detachModelOnHide = true;
112
+
109
113
  protected readonly toDispose = new DisposableCollection();
110
114
 
111
115
  protected readonly autoSizing: boolean;
@@ -265,13 +269,15 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
265
269
  }
266
270
 
267
271
  handleVisibilityChanged(nowVisible: boolean): void {
272
+ this._stagedForPreview = false;
268
273
  if (nowVisible) {
269
- this._stagedForPreview = false;
270
- this.baseEditor.setModel(this.baseModel);
271
- this.baseEditor.restoreViewState(this.savedViewState);
272
- this.baseEditor.focus();
273
- } else {
274
- this._stagedForPreview = false;
274
+ if (this.detachModelOnHide || !this.baseEditor.getModel()) {
275
+ this.baseEditor.setModel(this.baseModel);
276
+ }
277
+ if (this.detachModelOnHide) {
278
+ this.baseEditor.restoreViewState(this.savedViewState);
279
+ }
280
+ } else if (this.detachModelOnHide) {
275
281
  this.savedViewState = this.baseEditor.saveViewState();
276
282
 
277
283
  // eslint-disable-next-line no-null/no-null
@@ -354,10 +360,17 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
354
360
  }
355
361
 
356
362
  get cursor(): Position {
357
- const { lineNumber, column } = this.editor.getPosition()!;
363
+ // a hidden editor has no model, see `handleVisibilityChanged`, its cursor is kept in the saved view state then
364
+ const { lineNumber, column } = this.editor.getPosition() ?? this.getSavedCursorPosition() ?? { lineNumber: 1, column: 1 };
358
365
  return this.m2p.asPosition(lineNumber, column);
359
366
  }
360
367
 
368
+ protected getSavedCursorPosition(): monaco.IPosition | undefined {
369
+ const viewState = this.savedViewState;
370
+ const codeEditorViewState = viewState && 'modified' in viewState ? viewState.modified : viewState;
371
+ return codeEditorViewState?.cursorState[0]?.position;
372
+ }
373
+
361
374
  set cursor(cursor: Position) {
362
375
  const position = this.p2m.asPosition(cursor);
363
376
  this.editor.setPosition(position);
@@ -628,7 +641,14 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
628
641
  }
629
642
 
630
643
  getVisibleColumn(position: Position): number {
631
- return this.editor.getVisibleColumnFromPosition(this.p2m.asPosition(position));
644
+ const monacoPosition = this.p2m.asPosition(position);
645
+ if (this.editor.getModel()) {
646
+ return this.editor.getVisibleColumnFromPosition(monacoPosition);
647
+ }
648
+ // a hidden editor has no model, see `handleVisibilityChanged`, compute the column from the document like Monaco does
649
+ const model = this.document.textEditorModel;
650
+ const { lineNumber, column } = model.validatePosition(monacoPosition);
651
+ return CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, model.getOptions().tabSize) + 1;
632
652
  }
633
653
 
634
654
  async replaceText(params: ReplaceTextParams): Promise<boolean> {