@theia/core 1.71.0-next.8 → 1.71.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 (257) hide show
  1. package/README.md +19 -19
  2. package/i18n/nls.cs.json +97 -51
  3. package/i18n/nls.de.json +97 -51
  4. package/i18n/nls.es.json +97 -51
  5. package/i18n/nls.fr.json +97 -51
  6. package/i18n/nls.hu.json +97 -51
  7. package/i18n/nls.it.json +97 -51
  8. package/i18n/nls.ja.json +97 -51
  9. package/i18n/nls.json +101 -55
  10. package/i18n/nls.ko.json +97 -51
  11. package/i18n/nls.pl.json +97 -51
  12. package/i18n/nls.pt-br.json +97 -51
  13. package/i18n/nls.ru.json +97 -51
  14. package/i18n/nls.tr.json +97 -51
  15. package/i18n/nls.zh-cn.json +97 -51
  16. package/i18n/nls.zh-tw.json +97 -51
  17. package/lib/browser/catalog.json +169 -10
  18. package/lib/browser/common-frontend-contribution.js +2 -2
  19. package/lib/browser/common-frontend-contribution.js.map +1 -1
  20. package/lib/browser/components/card.d.ts.map +1 -1
  21. package/lib/browser/components/card.js +11 -3
  22. package/lib/browser/components/card.js.map +1 -1
  23. package/lib/browser/connection-status-service.js +1 -1
  24. package/lib/browser/connection-status-service.js.map +1 -1
  25. package/lib/browser/frontend-application-contribution.d.ts +2 -2
  26. package/lib/browser/frontend-application-contribution.d.ts.map +1 -1
  27. package/lib/browser/frontend-application.d.ts +2 -0
  28. package/lib/browser/frontend-application.d.ts.map +1 -1
  29. package/lib/browser/frontend-application.js +15 -6
  30. package/lib/browser/frontend-application.js.map +1 -1
  31. package/lib/browser/keyboard/index.d.ts +1 -0
  32. package/lib/browser/keyboard/index.d.ts.map +1 -1
  33. package/lib/browser/keyboard/index.js +1 -0
  34. package/lib/browser/keyboard/index.js.map +1 -1
  35. package/lib/browser/keyboard/keyboard-utils.d.ts +17 -0
  36. package/lib/browser/keyboard/keyboard-utils.d.ts.map +1 -0
  37. package/lib/browser/keyboard/keyboard-utils.js +40 -0
  38. package/lib/browser/keyboard/keyboard-utils.js.map +1 -0
  39. package/lib/browser/menu/browser-menu-plugin.d.ts.map +1 -1
  40. package/lib/browser/menu/browser-menu-plugin.js +8 -1
  41. package/lib/browser/menu/browser-menu-plugin.js.map +1 -1
  42. package/lib/browser/messaging/connection-source.d.ts +2 -1
  43. package/lib/browser/messaging/connection-source.d.ts.map +1 -1
  44. package/lib/browser/messaging/connection-source.js.map +1 -1
  45. package/lib/browser/messaging/messaging-frontend-module.d.ts.map +1 -1
  46. package/lib/browser/messaging/messaging-frontend-module.js +3 -0
  47. package/lib/browser/messaging/messaging-frontend-module.js.map +1 -1
  48. package/lib/browser/messaging/service-connection-provider.d.ts +2 -2
  49. package/lib/browser/messaging/service-connection-provider.d.ts.map +1 -1
  50. package/lib/browser/messaging/service-connection-provider.js +2 -2
  51. package/lib/browser/messaging/service-connection-provider.js.map +1 -1
  52. package/lib/browser/messaging/ws-connection-provider.d.ts +1 -1
  53. package/lib/browser/messaging/ws-connection-provider.d.ts.map +1 -1
  54. package/lib/browser/messaging/ws-connection-provider.js +3 -3
  55. package/lib/browser/messaging/ws-connection-provider.js.map +1 -1
  56. package/lib/browser/messaging/ws-connection-source.d.ts +4 -2
  57. package/lib/browser/messaging/ws-connection-source.d.ts.map +1 -1
  58. package/lib/browser/messaging/ws-connection-source.js +15 -10
  59. package/lib/browser/messaging/ws-connection-source.js.map +1 -1
  60. package/lib/browser/performance/frontend-stopwatch.js +1 -1
  61. package/lib/browser/performance/frontend-stopwatch.js.map +1 -1
  62. package/lib/browser/preload/i18n-preload-contribution.d.ts +1 -1
  63. package/lib/browser/preload/i18n-preload-contribution.d.ts.map +1 -1
  64. package/lib/browser/preload/i18n-preload-contribution.js +2 -2
  65. package/lib/browser/preload/i18n-preload-contribution.js.map +1 -1
  66. package/lib/browser/preload/os-preload-contribution.d.ts +1 -1
  67. package/lib/browser/preload/os-preload-contribution.d.ts.map +1 -1
  68. package/lib/browser/preload/os-preload-contribution.js +6 -6
  69. package/lib/browser/preload/os-preload-contribution.js.map +1 -1
  70. package/lib/browser/saveable-service.d.ts +9 -2
  71. package/lib/browser/saveable-service.d.ts.map +1 -1
  72. package/lib/browser/saveable-service.js +34 -25
  73. package/lib/browser/saveable-service.js.map +1 -1
  74. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts +1 -0
  75. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts.map +1 -1
  76. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js +10 -1
  77. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js.map +1 -1
  78. package/lib/browser/shell/tab-bar-toolbar/tab-toolbar-item.d.ts +2 -0
  79. package/lib/browser/shell/tab-bar-toolbar/tab-toolbar-item.d.ts.map +1 -1
  80. package/lib/browser/shell/tab-bar-toolbar/tab-toolbar-item.js +11 -2
  81. package/lib/browser/shell/tab-bar-toolbar/tab-toolbar-item.js.map +1 -1
  82. package/lib/browser/window/browser-window-module.d.ts.map +1 -1
  83. package/lib/browser/window/browser-window-module.js +2 -0
  84. package/lib/browser/window/browser-window-module.js.map +1 -1
  85. package/lib/browser/window/default-secondary-window-service.d.ts +2 -0
  86. package/lib/browser/window/default-secondary-window-service.d.ts.map +1 -1
  87. package/lib/browser/window/default-secondary-window-service.js +7 -0
  88. package/lib/browser/window/default-secondary-window-service.js.map +1 -1
  89. package/lib/browser/window/window-focus-service.d.ts +71 -0
  90. package/lib/browser/window/window-focus-service.d.ts.map +1 -0
  91. package/lib/browser/window/window-focus-service.js +173 -0
  92. package/lib/browser/window/window-focus-service.js.map +1 -0
  93. package/lib/common/event.d.ts +16 -0
  94. package/lib/common/event.d.ts.map +1 -1
  95. package/lib/common/event.js +20 -2
  96. package/lib/common/event.js.map +1 -1
  97. package/lib/common/event.spec.js +63 -0
  98. package/lib/common/event.spec.js.map +1 -1
  99. package/lib/common/glob.d.ts +2 -0
  100. package/lib/common/glob.d.ts.map +1 -1
  101. package/lib/common/glob.js +8 -7
  102. package/lib/common/glob.js.map +1 -1
  103. package/lib/common/message-rpc/channel.d.ts +1 -1
  104. package/lib/common/message-rpc/channel.d.ts.map +1 -1
  105. package/lib/common/message-rpc/channel.js +20 -12
  106. package/lib/common/message-rpc/channel.js.map +1 -1
  107. package/lib/common/message-rpc/channel.spec.d.ts.map +1 -1
  108. package/lib/common/message-rpc/channel.spec.js +94 -0
  109. package/lib/common/message-rpc/channel.spec.js.map +1 -1
  110. package/lib/common/message-rpc/rpc-protocol.d.ts.map +1 -1
  111. package/lib/common/message-rpc/rpc-protocol.js +13 -3
  112. package/lib/common/message-rpc/rpc-protocol.js.map +1 -1
  113. package/lib/common/message-rpc/uint8-array-message-buffer.d.ts.map +1 -1
  114. package/lib/common/message-rpc/uint8-array-message-buffer.js +1 -1
  115. package/lib/common/message-rpc/uint8-array-message-buffer.js.map +1 -1
  116. package/lib/common/messaging/index.d.ts +1 -0
  117. package/lib/common/messaging/index.d.ts.map +1 -1
  118. package/lib/common/messaging/index.js +1 -0
  119. package/lib/common/messaging/index.js.map +1 -1
  120. package/lib/common/messaging/socket-write-buffer.d.ts +4 -3
  121. package/lib/common/messaging/socket-write-buffer.d.ts.map +1 -1
  122. package/lib/common/messaging/socket-write-buffer.js +14 -4
  123. package/lib/common/messaging/socket-write-buffer.js.map +1 -1
  124. package/lib/common/performance/index.d.ts +1 -0
  125. package/lib/common/performance/index.d.ts.map +1 -1
  126. package/lib/common/performance/index.js +1 -0
  127. package/lib/common/performance/index.js.map +1 -1
  128. package/lib/common/performance/simple-stopwatch.d.ts +18 -0
  129. package/lib/common/performance/simple-stopwatch.d.ts.map +1 -0
  130. package/lib/common/performance/simple-stopwatch.js +80 -0
  131. package/lib/common/performance/simple-stopwatch.js.map +1 -0
  132. package/lib/common/performance/stopwatch.d.ts +41 -0
  133. package/lib/common/performance/stopwatch.d.ts.map +1 -1
  134. package/lib/common/performance/stopwatch.js +89 -3
  135. package/lib/common/performance/stopwatch.js.map +1 -1
  136. package/lib/common/performance/stopwatch.spec.d.ts +2 -0
  137. package/lib/common/performance/stopwatch.spec.d.ts.map +1 -0
  138. package/lib/common/performance/stopwatch.spec.js +256 -0
  139. package/lib/common/performance/stopwatch.spec.js.map +1 -0
  140. package/lib/common/preferences/index.d.ts +1 -0
  141. package/lib/common/preferences/index.d.ts.map +1 -1
  142. package/lib/common/preferences/index.js +1 -0
  143. package/lib/common/preferences/index.js.map +1 -1
  144. package/lib/common/preferences/preference-utils.d.ts +6 -0
  145. package/lib/common/preferences/preference-utils.d.ts.map +1 -0
  146. package/lib/common/preferences/preference-utils.js +29 -0
  147. package/lib/common/preferences/preference-utils.js.map +1 -0
  148. package/lib/common/resource.d.ts +2 -0
  149. package/lib/common/resource.d.ts.map +1 -1
  150. package/lib/common/resource.js +7 -3
  151. package/lib/common/resource.js.map +1 -1
  152. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
  153. package/lib/electron-browser/menu/electron-main-menu-factory.js +5 -1
  154. package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
  155. package/lib/electron-browser/messaging/electron-messaging-frontend-module.d.ts.map +1 -1
  156. package/lib/electron-browser/messaging/electron-messaging-frontend-module.js +3 -0
  157. package/lib/electron-browser/messaging/electron-messaging-frontend-module.js.map +1 -1
  158. package/lib/electron-browser/window/electron-window-module.d.ts.map +1 -1
  159. package/lib/electron-browser/window/electron-window-module.js +2 -0
  160. package/lib/electron-browser/window/electron-window-module.js.map +1 -1
  161. package/lib/electron-main/electron-api-main.d.ts.map +1 -1
  162. package/lib/electron-main/electron-api-main.js +4 -2
  163. package/lib/electron-main/electron-api-main.js.map +1 -1
  164. package/lib/electron-main/electron-main-application-module.d.ts.map +1 -1
  165. package/lib/electron-main/electron-main-application-module.js +3 -0
  166. package/lib/electron-main/electron-main-application-module.js.map +1 -1
  167. package/lib/electron-main/electron-main-application.d.ts +2 -0
  168. package/lib/electron-main/electron-main-application.d.ts.map +1 -1
  169. package/lib/electron-main/electron-main-application.js +14 -5
  170. package/lib/electron-main/electron-main-application.js.map +1 -1
  171. package/lib/electron-main/theia-electron-window.d.ts.map +1 -1
  172. package/lib/electron-main/theia-electron-window.js +3 -0
  173. package/lib/electron-main/theia-electron-window.js.map +1 -1
  174. package/lib/node/backend-application.d.ts +2 -0
  175. package/lib/node/backend-application.d.ts.map +1 -1
  176. package/lib/node/backend-application.js +17 -5
  177. package/lib/node/backend-application.js.map +1 -1
  178. package/lib/node/messaging/default-messaging-service.d.ts.map +1 -1
  179. package/lib/node/messaging/default-messaging-service.js +1 -0
  180. package/lib/node/messaging/default-messaging-service.js.map +1 -1
  181. package/lib/node/messaging/index.d.ts +1 -0
  182. package/lib/node/messaging/index.d.ts.map +1 -1
  183. package/lib/node/messaging/index.js +1 -0
  184. package/lib/node/messaging/index.js.map +1 -1
  185. package/lib/node/messaging/messaging-backend-module.d.ts.map +1 -1
  186. package/lib/node/messaging/messaging-backend-module.js +4 -0
  187. package/lib/node/messaging/messaging-backend-module.js.map +1 -1
  188. package/lib/node/messaging/test/default-messaging-service.spec.d.ts +2 -0
  189. package/lib/node/messaging/test/default-messaging-service.spec.d.ts.map +1 -0
  190. package/lib/node/messaging/test/default-messaging-service.spec.js +81 -0
  191. package/lib/node/messaging/test/default-messaging-service.spec.js.map +1 -0
  192. package/lib/node/messaging/websocket-frontend-connection-service.d.ts +9 -5
  193. package/lib/node/messaging/websocket-frontend-connection-service.d.ts.map +1 -1
  194. package/lib/node/messaging/websocket-frontend-connection-service.js +21 -5
  195. package/lib/node/messaging/websocket-frontend-connection-service.js.map +1 -1
  196. package/lib/node/performance/node-stopwatch.js +1 -1
  197. package/lib/node/performance/node-stopwatch.js.map +1 -1
  198. package/lib/node/process-utils.d.ts.map +1 -1
  199. package/lib/node/process-utils.js +9 -1
  200. package/lib/node/process-utils.js.map +1 -1
  201. package/package.json +34 -34
  202. package/src/browser/common-frontend-contribution.ts +2 -2
  203. package/src/browser/components/card.tsx +13 -2
  204. package/src/browser/connection-status-service.ts +1 -1
  205. package/src/browser/frontend-application-contribution.ts +2 -2
  206. package/src/browser/frontend-application.ts +26 -17
  207. package/src/browser/keyboard/index.ts +1 -0
  208. package/src/browser/keyboard/keyboard-utils.ts +37 -0
  209. package/src/browser/menu/browser-menu-plugin.ts +8 -1
  210. package/src/browser/messaging/connection-source.ts +2 -1
  211. package/src/browser/messaging/messaging-frontend-module.ts +3 -0
  212. package/src/browser/messaging/service-connection-provider.ts +2 -2
  213. package/src/browser/messaging/ws-connection-provider.ts +1 -1
  214. package/src/browser/messaging/ws-connection-source.ts +7 -4
  215. package/src/browser/performance/frontend-stopwatch.ts +1 -1
  216. package/src/browser/preload/i18n-preload-contribution.ts +1 -1
  217. package/src/browser/preload/os-preload-contribution.ts +1 -1
  218. package/src/browser/saveable-service.ts +34 -27
  219. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx +14 -1
  220. package/src/browser/shell/tab-bar-toolbar/tab-toolbar-item.tsx +13 -2
  221. package/src/browser/style/card.css +4 -2
  222. package/src/browser/style/hover-service.css +7 -0
  223. package/src/browser/window/browser-window-module.ts +2 -0
  224. package/src/browser/window/default-secondary-window-service.ts +6 -0
  225. package/src/browser/window/window-focus-service.ts +187 -0
  226. package/src/common/event.spec.ts +80 -0
  227. package/src/common/event.ts +31 -2
  228. package/src/common/glob.ts +2 -2
  229. package/src/common/i18n/nls.metadata.json +4254 -1058
  230. package/src/common/message-rpc/channel.spec.ts +116 -0
  231. package/src/common/message-rpc/channel.ts +15 -11
  232. package/src/common/message-rpc/rpc-protocol.ts +12 -3
  233. package/src/common/message-rpc/uint8-array-message-buffer.ts +1 -1
  234. package/src/common/messaging/index.ts +1 -0
  235. package/src/common/messaging/socket-write-buffer.ts +10 -4
  236. package/src/common/performance/index.ts +1 -0
  237. package/src/common/performance/simple-stopwatch.ts +91 -0
  238. package/src/common/performance/stopwatch.spec.ts +321 -0
  239. package/src/common/performance/stopwatch.ts +103 -2
  240. package/src/common/preferences/index.ts +1 -0
  241. package/src/common/preferences/preference-utils.ts +28 -0
  242. package/src/common/resource.ts +8 -2
  243. package/src/electron-browser/menu/electron-main-menu-factory.ts +5 -1
  244. package/src/electron-browser/messaging/electron-messaging-frontend-module.ts +3 -0
  245. package/src/electron-browser/window/electron-window-module.ts +2 -0
  246. package/src/electron-main/electron-api-main.ts +4 -2
  247. package/src/electron-main/electron-main-application-module.ts +3 -0
  248. package/src/electron-main/electron-main-application.ts +21 -5
  249. package/src/electron-main/theia-electron-window.ts +3 -0
  250. package/src/node/backend-application.ts +27 -10
  251. package/src/node/messaging/default-messaging-service.ts +1 -0
  252. package/src/node/messaging/index.ts +1 -0
  253. package/src/node/messaging/messaging-backend-module.ts +5 -1
  254. package/src/node/messaging/test/default-messaging-service.spec.ts +85 -0
  255. package/src/node/messaging/websocket-frontend-connection-service.ts +20 -7
  256. package/src/node/performance/node-stopwatch.ts +1 -1
  257. package/src/node/process-utils.ts +9 -1
@@ -15,10 +15,10 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { inject, injectable, interfaces, postConstruct } from 'inversify';
18
- import { Channel, RpcProxy, RpcProxyFactory } from '../../common';
19
- import { ChannelMultiplexer } from '../../common/message-rpc/channel';
18
+ import { Channel, ChannelMultiplexer } from '../../common/message-rpc/channel';
20
19
  import { Deferred } from '../../common/promise-util';
21
20
  import { ConnectionSource } from './connection-source';
21
+ import { RpcProxy, RpcProxyFactory } from '../../common/messaging/proxy-factory';
22
22
 
23
23
  /**
24
24
  * Service id for the local connection provider
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { injectable, interfaces, decorate, unmanaged, inject } from 'inversify';
18
- import { RpcProxyFactory, RpcProxy } from '../../common';
18
+ import { RpcProxy, RpcProxyFactory } from '../../common/messaging/proxy-factory';
19
19
  import { RemoteConnectionProvider, ServiceConnectionProvider } from './service-connection-provider';
20
20
 
21
21
  decorate(injectable(), RpcProxyFactory);
@@ -14,17 +14,19 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { AbstractChannel, Channel, Disposable, DisposableCollection, Emitter, Event, servicesPath } from '../../common';
17
+ import { Emitter, Event } from '../../common/event';
18
18
  import { ConnectionSource } from './connection-source';
19
19
  import { Socket, io } from 'socket.io-client';
20
20
  import { Endpoint } from '../endpoint';
21
- import { ForwardingChannel } from '../../common/message-rpc/channel';
21
+ import { AbstractChannel, Channel, ForwardingChannel } from '../../common/message-rpc/channel';
22
22
  import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '../../common/message-rpc/uint8-array-message-buffer';
23
23
  import { inject, injectable, postConstruct } from 'inversify';
24
24
  import { FrontendIdProvider } from './frontend-id-provider';
25
25
  import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider';
26
26
  import { SocketWriteBuffer } from '../../common/messaging/socket-write-buffer';
27
27
  import { ConnectionManagementMessages } from '../../common/messaging/connection-management';
28
+ import { servicesPath } from '../../common/messaging/handler';
29
+ import { Disposable, DisposableCollection } from '../../common/disposable';
28
30
 
29
31
  @injectable()
30
32
  export class WebSocketConnectionSource implements ConnectionSource {
@@ -33,7 +35,8 @@ export class WebSocketConnectionSource implements ConnectionSource {
33
35
  @inject(FrontendIdProvider)
34
36
  protected readonly frontendIdProvider: FrontendIdProvider;
35
37
 
36
- private readonly writeBuffer = new SocketWriteBuffer();
38
+ @inject(SocketWriteBuffer)
39
+ protected readonly writeBuffer: SocketWriteBuffer;
37
40
 
38
41
  private _socket: Socket;
39
42
  get socket(): Socket {
@@ -135,8 +138,8 @@ export class WebSocketConnectionSource implements ConnectionSource {
135
138
 
136
139
  connectNewChannel(): void {
137
140
  if (this.currentChannel) {
138
- this.currentChannel.close();
139
141
  this.currentChannel.onCloseEmitter.fire({ reason: 'reconnecting channel' });
142
+ this.currentChannel.close();
140
143
  }
141
144
  this.writeBuffer.drain();
142
145
  this.currentChannel = this.createChannel();
@@ -22,7 +22,7 @@ export class FrontendStopwatch extends Stopwatch {
22
22
 
23
23
  constructor() {
24
24
  super({
25
- owner: 'frontend',
25
+ owner: 'frontend page',
26
26
  now: () => performance.now(),
27
27
  });
28
28
  }
@@ -19,7 +19,7 @@ import { FrontendApplicationConfigProvider } from '../frontend-application-confi
19
19
  import { nls } from '../../common/nls';
20
20
  import { inject, injectable, named } from 'inversify';
21
21
  import { LocalizationServer } from '../../common/i18n/localization-server';
22
- import { ContributionProvider } from '../../common';
22
+ import { ContributionProvider } from '../../common/contribution-provider';
23
23
  import { TextReplacementContribution } from './text-replacement-contribution';
24
24
 
25
25
  @injectable()
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { inject, injectable } from 'inversify';
18
- import { OS, OSBackendProvider } from '../../common';
18
+ import { OS, OSBackendProvider } from '../../common/os';
19
19
  import { PreloadContribution } from './preloader';
20
20
 
21
21
  @injectable()
@@ -22,6 +22,7 @@ import { AutoSaveMode, Saveable, SaveableSource, SaveableWidget, SaveOptions, Sa
22
22
  import { waitForClosed, Widget } from './widgets';
23
23
  import { FrontendApplicationContribution } from './frontend-application-contribution';
24
24
  import { FrontendApplication } from './frontend-application';
25
+ import { WindowFocusService } from './window/window-focus-service';
25
26
  import throttle = require('lodash.throttle');
26
27
 
27
28
  export const SaveErrorChecker = Symbol('SaveErrorChecker');
@@ -49,6 +50,9 @@ export class SaveableService implements FrontendApplicationContribution {
49
50
  @inject(ContributionProvider) @named(SaveErrorChecker)
50
51
  protected readonly errorCheckers: ContributionProvider<SaveErrorChecker>;
51
52
 
53
+ @inject(WindowFocusService)
54
+ protected readonly windowFocusService: WindowFocusService;
55
+
52
56
  protected saveThrottles = new Map<Widget, AutoSaveThrottle>();
53
57
  protected saveMode: AutoSaveMode = 'off';
54
58
  protected saveDelay = 1000;
@@ -131,6 +135,35 @@ export class SaveableService implements FrontendApplicationContribution {
131
135
  this.saveThrottles.get(e)?.dispose();
132
136
  this.saveThrottles.delete(e);
133
137
  });
138
+ // Save all dirty editors when any application window loses focus
139
+ this.windowFocusService.onDidWindowChangeFocus(({ hasFocus }) => {
140
+ if (!hasFocus) {
141
+ this.saveOnWindowBlur();
142
+ }
143
+ });
144
+ }
145
+
146
+ /**
147
+ * Save all dirty saveables when the application window loses focus.
148
+ * Triggered for both `onFocusChange` and `onWindowChange` auto-save modes,
149
+ * matching VSCode's behavior where a window focus loss is a superset of
150
+ * editor focus loss.
151
+ */
152
+ protected saveOnWindowBlur(): void {
153
+ if (this.saveMode !== 'onWindowChange' && this.saveMode !== 'onFocusChange') {
154
+ return;
155
+ }
156
+ if (!this.shell) {
157
+ return;
158
+ }
159
+ for (const widget of this.shell.widgets) {
160
+ const saveable = Saveable.get(widget);
161
+ if (saveable && this.shouldAutoSave(widget, saveable)) {
162
+ saveable.save({
163
+ saveReason: SaveReason.FocusChange
164
+ });
165
+ }
166
+ }
134
167
  }
135
168
 
136
169
  protected updateAutoSaveMode(mode: AutoSaveMode): void {
@@ -169,39 +202,13 @@ export class SaveableService implements FrontendApplicationContribution {
169
202
  saveReason: SaveReason.AfterDelay
170
203
  });
171
204
  }
172
- },
173
- this.addBlurListener(widget, saveable)
205
+ }
174
206
  );
175
207
  this.saveThrottles.set(widget, saveThrottle);
176
208
  this.applySaveableWidget(widget, saveable);
177
209
  return saveThrottle;
178
210
  }
179
211
 
180
- protected addBlurListener(widget: Widget, saveable: Saveable): Disposable {
181
- const document = widget.node.ownerDocument;
182
- const listener = (() => {
183
- if (this.saveMode === 'onWindowChange' && !this.windowHasFocus(document) && this.shouldAutoSave(widget, saveable)) {
184
- saveable.save({
185
- saveReason: SaveReason.FocusChange
186
- });
187
- }
188
- }).bind(this);
189
- document.addEventListener('blur', listener);
190
- return Disposable.create(() => {
191
- document.removeEventListener('blur', listener);
192
- });
193
- }
194
-
195
- protected windowHasFocus(document: Document): boolean {
196
- if (document.visibilityState === 'hidden') {
197
- return false;
198
- } else if (document.hasFocus()) {
199
- return true;
200
- }
201
- // TODO: Add support for iframes
202
- return false;
203
- }
204
-
205
212
  protected shouldAutoSave(widget: Widget, saveable: Saveable): boolean {
206
213
  const uri = NavigatableWidget.getUri(widget);
207
214
  if (uri?.scheme === UNTITLED_SCHEME) {
@@ -16,6 +16,7 @@
16
16
 
17
17
  import { inject, injectable, postConstruct } from 'inversify';
18
18
  import * as React from 'react';
19
+ import { buttonKeyboardProps, isActivationKey } from '../../keyboard/keyboard-utils';
19
20
  import { ContextKeyService } from '../../context-key-service';
20
21
  import { CommandRegistry, Disposable, DisposableCollection, nls } from '../../../common';
21
22
  import { Anchor, ContextMenuAccess, ContextMenuRenderer } from '../../context-menu-renderer';
@@ -150,7 +151,10 @@ export class TabBarToolbar extends ReactWidget {
150
151
 
151
152
  protected renderMore(): React.ReactNode {
152
153
  return !!this.more.size && <div key='__more__' className={TabBarToolbar.Styles.TAB_BAR_TOOLBAR_ITEM + ' enabled'}>
153
- <div id='__more__' className={codicon('ellipsis', true)} onClick={this.showMoreContextMenu}
154
+ <div id='__more__' className={codicon('ellipsis', true)}
155
+ {...buttonKeyboardProps(nls.localizeByDefault('More Actions...'))}
156
+ onClick={this.showMoreContextMenu}
157
+ onKeyDown={this.handleMoreKeyDown}
154
158
  title={nls.localizeByDefault('More Actions...')} />
155
159
  </div>;
156
160
  }
@@ -162,6 +166,15 @@ export class TabBarToolbar extends ReactWidget {
162
166
  this.renderMoreContextMenu(anchor);
163
167
  };
164
168
 
169
+ protected handleMoreKeyDown = (event: React.KeyboardEvent) => {
170
+ if (isActivationKey(event)) {
171
+ event.preventDefault();
172
+ event.stopPropagation();
173
+ const { left, bottom } = (event.currentTarget as HTMLElement).getBoundingClientRect();
174
+ this.renderMoreContextMenu({ x: left, y: bottom });
175
+ }
176
+ };
177
+
165
178
  renderMoreContextMenu(anchor: Anchor): ContextMenuAccess {
166
179
  const toDisposeOnHide = new DisposableCollection();
167
180
  this.addClass('menu-open');
@@ -23,6 +23,7 @@ import { KeybindingRegistry } from '../../keybinding';
23
23
  import { ACTION_ITEM } from '../../widgets';
24
24
  import { TabBarToolbar } from './tab-bar-toolbar';
25
25
  import * as React from 'react';
26
+ import { buttonKeyboardProps, isActivationKey } from '../../keyboard/keyboard-utils';
26
27
  import { ActionMenuNode, GroupImpl, MenuNode } from '../../../common/menu';
27
28
 
28
29
  export interface TabBarToolbarItem {
@@ -195,16 +196,24 @@ export class RenderedToolbarItemImpl extends AbstractToolbarItemImpl<RenderedToo
195
196
  };
196
197
 
197
198
  protected executeCommand(e: React.MouseEvent<HTMLElement>, widget: Widget): void {
199
+ this.doExecuteCommand(e, widget);
200
+ };
201
+
202
+ protected doExecuteCommand(e: React.SyntheticEvent<HTMLElement>, widget: Widget): void {
198
203
  e.preventDefault();
199
204
  e.stopPropagation();
200
-
201
205
  if (!this.isEnabled(widget)) {
202
206
  return;
203
207
  }
204
-
205
208
  if (this.action.command) {
206
209
  this.commandRegistry.executeCommand(this.action.command, widget);
207
210
  }
211
+ }
212
+
213
+ protected onKeyDownEvent = (e: React.KeyboardEvent<HTMLElement>, widget: Widget) => {
214
+ if (isActivationKey(e)) {
215
+ this.doExecuteCommand(e, widget);
216
+ }
208
217
  };
209
218
 
210
219
  protected renderItem(widget: Widget): React.ReactNode {
@@ -249,7 +258,9 @@ export class RenderedToolbarItemImpl extends AbstractToolbarItemImpl<RenderedToo
249
258
  onMouseUp={this.onMouseUpEvent}
250
259
  onMouseOut={this.onMouseUpEvent} >
251
260
  <div id={this.action.id} className={classNames.join(' ')}
261
+ {...buttonKeyboardProps(tooltip)}
252
262
  onClick={e => this.executeCommand(e, widget)}
263
+ onKeyDown={e => this.onKeyDownEvent(e, widget)}
253
264
  title={tooltip} > {innerText}
254
265
  </div>
255
266
  </div>;
@@ -101,11 +101,13 @@
101
101
  transition: opacity 0.15s;
102
102
  }
103
103
 
104
- .theia-Card:hover .theia-Card-footer-time {
104
+ .theia-Card:hover .theia-Card-footer-time,
105
+ .theia-Card:focus-within .theia-Card-footer-time {
105
106
  opacity: 0;
106
107
  }
107
108
 
108
- .theia-Card:hover .theia-Card-footer-actions {
109
+ .theia-Card:hover .theia-Card-footer-actions,
110
+ .theia-Card:focus-within .theia-Card-footer-actions {
109
111
  opacity: 1;
110
112
  pointer-events: auto;
111
113
  }
@@ -30,6 +30,8 @@
30
30
  padding: var(--theia-ui-padding);
31
31
  max-width: var(--theia-hover-max-width);
32
32
  user-select: text;
33
+ --vscode-scmGraph-historyItemHoverAdditionsForeground: var(--theia-scmGraph-historyItemHoverAdditionsForeground);
34
+ --vscode-scmGraph-historyItemHoverDeletionsForeground: var(--theia-scmGraph-historyItemHoverDeletionsForeground);
33
35
  }
34
36
 
35
37
  /* overwrite potentially different default user agent styles */
@@ -60,6 +62,11 @@
60
62
  background-color: var(--theia-editorHoverWidget-statusBarBackground);
61
63
  }
62
64
 
65
+ .theia-hover .codicon {
66
+ vertical-align: middle;
67
+ margin-bottom: 2px;
68
+ }
69
+
63
70
  .theia-hover code {
64
71
  background-color: var(--theia-textCodeBlock-background);
65
72
  font-family: var(--theia-code-font-family);
@@ -24,6 +24,7 @@ import { SecondaryWindowService } from './secondary-window-service';
24
24
  import { DefaultSecondaryWindowService } from './default-secondary-window-service';
25
25
  import { bindRootContributionProvider } from '../../common';
26
26
  import { WindowTitleContribution } from './window-title-service';
27
+ import { WindowFocusService } from './window-focus-service';
27
28
 
28
29
  export default new ContainerModule(bind => {
29
30
  bind(DefaultWindowService).toSelf().inSingletonScope();
@@ -31,5 +32,6 @@ export default new ContainerModule(bind => {
31
32
  bind(FrontendApplicationContribution).toService(DefaultWindowService);
32
33
  bind(ClipboardService).to(BrowserClipboardService).inSingletonScope();
33
34
  bind(SecondaryWindowService).to(DefaultSecondaryWindowService).inSingletonScope();
35
+ bind(WindowFocusService).toSelf().inSingletonScope();
34
36
  bindRootContributionProvider(bind, WindowTitleContribution);
35
37
  });
@@ -22,6 +22,7 @@ import { Saveable } from '../saveable';
22
22
  import { Emitter, environment, Event, PreferenceService } from '../../common';
23
23
  import { SaveableService } from '../saveable-service';
24
24
  import { getAllWidgetsFromSecondaryWindow, getDefaultRestoreArea } from '../secondary-window-handler';
25
+ import { WindowFocusService } from './window-focus-service';
25
26
 
26
27
  @injectable()
27
28
  export class DefaultSecondaryWindowService implements SecondaryWindowService {
@@ -53,6 +54,9 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
53
54
  @inject(SaveableService)
54
55
  protected readonly saveResourceService: SaveableService;
55
56
 
57
+ @inject(WindowFocusService)
58
+ protected readonly windowFocusService: WindowFocusService;
59
+
56
60
  @postConstruct()
57
61
  init(): void {
58
62
  // Set up messaging with secondary windows
@@ -106,6 +110,7 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
106
110
  this.secondaryWindows.push(newWindow);
107
111
  this.onWindowOpenedEmitter.fire(newWindow);
108
112
  newWindow.addEventListener('DOMContentLoaded', () => {
113
+ const focusRegistration = this.windowFocusService.registerWindow(newWindow);
109
114
  newWindow.addEventListener('beforeunload', evt => {
110
115
  const widgets = getAllWidgetsFromSecondaryWindow(newWindow) ?? [widget];
111
116
  for (const w of widgets) {
@@ -120,6 +125,7 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
120
125
  }, { capture: true });
121
126
 
122
127
  newWindow.addEventListener('unload', () => {
128
+ focusRegistration.dispose();
123
129
  const extIndex = this.secondaryWindows.indexOf(newWindow);
124
130
  if (extIndex > -1) {
125
131
  this.onWindowClosedEmitter.fire(newWindow);
@@ -0,0 +1,187 @@
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
+ // based on https://github.com/microsoft/vscode/blob/ea6aac971b851ff8675f9ea04f8c0dfc36034a89/src/vs/workbench/services/host/browser/browserHostService.ts
18
+ // and https://github.com/microsoft/vscode/blob/ea6aac971b851ff8675f9ea04f8c0dfc36034a89/src/vs/base/browser/dom.ts#L1319 (FocusTracker)
19
+ /*---------------------------------------------------------------------------------------------
20
+ * Copyright (c) Microsoft Corporation. All rights reserved.
21
+ * Licensed under the MIT License. See License.txt in the project root for license information.
22
+ *--------------------------------------------------------------------------------------------*/
23
+
24
+ import { injectable, postConstruct } from 'inversify';
25
+ import { Disposable, DisposableCollection, Emitter, Event } from '../../common';
26
+
27
+ export interface WindowFocusEvent {
28
+ win: Window;
29
+ hasFocus: boolean;
30
+ }
31
+
32
+ /**
33
+ * Tracks focus state for each registered application window independently.
34
+ *
35
+ * The main window is registered automatically. Secondary windows should be
36
+ * registered via {@link registerWindow} — typically by the service responsible
37
+ * for creating them.
38
+ *
39
+ * Uses two complementary signals per window for robust detection:
40
+ * - `window` `focus`/`blur` events (OS-level window focus changes)
41
+ * - `document` `visibilitychange` events (browser tab switches)
42
+ *
43
+ * Blur events are debounced per window with `setTimeout(0)` so that focus
44
+ * moving between elements within the same window does not produce a false
45
+ * blur: the subsequent `focus` event cancels the pending blur before it fires.
46
+ *
47
+ * Each per-window event is latched — it only fires when that window's focus
48
+ * state actually changes.
49
+ */
50
+ @injectable()
51
+ export class WindowFocusService implements Disposable {
52
+
53
+ protected readonly onDidWindowChangeFocusEmitter = new Emitter<WindowFocusEvent>();
54
+
55
+ /**
56
+ * Fires when an individual window's focus state changes.
57
+ * The event payload identifies which window changed and whether it gained or lost focus.
58
+ *
59
+ * A window losing focus to another application window will fire separately
60
+ * for each window involved: one event with `hasFocus: false` for the window
61
+ * that lost focus, and one with `hasFocus: true` for the window that gained it.
62
+ */
63
+ readonly onDidWindowChangeFocus: Event<WindowFocusEvent> = this.onDidWindowChangeFocusEmitter.event;
64
+
65
+ protected readonly toDispose = new DisposableCollection(this.onDidWindowChangeFocusEmitter);
66
+
67
+ /** Per-window tracking state. */
68
+ protected readonly windowStates = new Map<Window, WindowTrackingState>();
69
+
70
+ @postConstruct()
71
+ protected init(): void {
72
+ this.registerWindow(window);
73
+ }
74
+
75
+ /**
76
+ * Register a window for focus tracking. The returned {@link Disposable}
77
+ * removes the window from tracking when disposed.
78
+ *
79
+ * The main window is registered automatically. Call this for secondary
80
+ * windows when they are created.
81
+ */
82
+ registerWindow(win: Window): Disposable {
83
+ if (this.windowStates.has(win)) {
84
+ return Disposable.NULL;
85
+ }
86
+
87
+ const state: WindowTrackingState = {
88
+ lastFocusState: this.windowHasFocus(win),
89
+ pendingBlurTimeout: undefined,
90
+ };
91
+ this.windowStates.set(win, state);
92
+
93
+ const onFocus = () => this.handleFocus(win, state);
94
+ const onBlur = () => this.scheduleBlur(win, state);
95
+ const onVisibilityChange = () => this.updateWindowFocusState(win, state);
96
+
97
+ win.addEventListener('focus', onFocus);
98
+ win.addEventListener('blur', onBlur);
99
+ win.document.addEventListener('visibilitychange', onVisibilityChange);
100
+
101
+ const cleanup = Disposable.create(() => {
102
+ this.cancelPendingBlur(state);
103
+ this.windowStates.delete(win);
104
+ win.removeEventListener('focus', onFocus);
105
+ win.removeEventListener('blur', onBlur);
106
+ try {
107
+ win.document.removeEventListener('visibilitychange', onVisibilityChange);
108
+ } catch {
109
+ // The window may already be closed
110
+ }
111
+ });
112
+
113
+ this.toDispose.push(cleanup);
114
+ return cleanup;
115
+ }
116
+
117
+ /**
118
+ * Whether any registered window currently has focus.
119
+ */
120
+ get hasFocus(): boolean {
121
+ for (const win of this.windowStates.keys()) {
122
+ if (this.windowHasFocus(win)) {
123
+ return true;
124
+ }
125
+ }
126
+ return false;
127
+ }
128
+
129
+ protected windowHasFocus(win: Window): boolean {
130
+ try {
131
+ return win.document.hasFocus();
132
+ } catch {
133
+ // The window may have been closed
134
+ return false;
135
+ }
136
+ }
137
+
138
+ protected handleFocus(win: Window, state: WindowTrackingState): void {
139
+ // Cancel this window's pending blur — focus arrived before the timeout,
140
+ // meaning focus just moved between elements within this window.
141
+ this.cancelPendingBlur(state);
142
+ this.updateWindowFocusState(win, state);
143
+ }
144
+
145
+ /**
146
+ * Schedule a deferred blur check for this specific window.
147
+ * If no `focus` event arrives on this same window before the timeout fires,
148
+ * we treat it as a real focus loss for that window.
149
+ */
150
+ protected scheduleBlur(win: Window, state: WindowTrackingState): void {
151
+ this.cancelPendingBlur(state);
152
+ state.pendingBlurTimeout = setTimeout(() => {
153
+ state.pendingBlurTimeout = undefined;
154
+ this.updateWindowFocusState(win, state);
155
+ }, 0);
156
+ }
157
+
158
+ protected cancelPendingBlur(state: WindowTrackingState): void {
159
+ if (state.pendingBlurTimeout !== undefined) {
160
+ clearTimeout(state.pendingBlurTimeout);
161
+ state.pendingBlurTimeout = undefined;
162
+ }
163
+ }
164
+
165
+ /**
166
+ * Re-evaluate a single window's focus and fire if it changed (latching).
167
+ */
168
+ protected updateWindowFocusState(win: Window, state: WindowTrackingState): void {
169
+ const focused = this.windowHasFocus(win);
170
+ if (focused !== state.lastFocusState) {
171
+ state.lastFocusState = focused;
172
+ this.onDidWindowChangeFocusEmitter.fire({ win, hasFocus: focused });
173
+ }
174
+ }
175
+
176
+ dispose(): void {
177
+ for (const state of this.windowStates.values()) {
178
+ this.cancelPendingBlur(state);
179
+ }
180
+ this.toDispose.dispose();
181
+ }
182
+ }
183
+
184
+ interface WindowTrackingState {
185
+ lastFocusState: boolean;
186
+ pendingBlurTimeout: ReturnType<typeof setTimeout> | undefined;
187
+ }
@@ -29,4 +29,84 @@ describe('Event Objects', () => {
29
29
  expect(counter).eq(1);
30
30
  });
31
31
 
32
+ describe('Emitter errorHandling option', () => {
33
+
34
+ it('should log errors by default', () => {
35
+ const emitter = new Emitter<void>();
36
+ const errors: unknown[] = [];
37
+ const originalError = console.error;
38
+ console.error = (e: unknown) => errors.push(e);
39
+
40
+ try {
41
+ emitter.event(() => { throw new Error('test error'); });
42
+ emitter.fire(undefined);
43
+
44
+ expect(errors).to.have.lengthOf(1);
45
+ expect((errors[0] as Error).message).to.equal('test error');
46
+ } finally {
47
+ console.error = originalError;
48
+ }
49
+ });
50
+
51
+ it('should propagate a single error when errorHandling is propagate', () => {
52
+ const emitter = new Emitter<void>({ errorHandling: 'propagate' });
53
+
54
+ emitter.event(() => { throw new Error('boom'); });
55
+
56
+ expect(() => emitter.fire(undefined)).to.throw('boom');
57
+ });
58
+
59
+ it('should call all listeners before propagating the error', () => {
60
+ const emitter = new Emitter<void>({ errorHandling: 'propagate' });
61
+ let secondCalled = false;
62
+
63
+ emitter.event(() => { throw new Error('first fails'); });
64
+ emitter.event(() => { secondCalled = true; });
65
+
66
+ expect(() => emitter.fire(undefined)).to.throw('first fails');
67
+ expect(secondCalled).to.be.true;
68
+ });
69
+
70
+ it('should throw AggregateError when multiple listeners fail with propagate', () => {
71
+ const emitter = new Emitter<void>({ errorHandling: 'propagate' });
72
+
73
+ emitter.event(() => { throw new Error('error 1'); });
74
+ emitter.event(() => { throw new Error('error 2'); });
75
+
76
+ try {
77
+ emitter.fire(undefined);
78
+ expect.fail('Expected an error to be thrown');
79
+ } catch (err) {
80
+ expect(err).to.be.instanceOf(AggregateError);
81
+ const aggregate = err as AggregateError;
82
+ expect(aggregate.errors).to.have.lengthOf(2);
83
+ expect(aggregate.errors[0].message).to.equal('error 1');
84
+ expect(aggregate.errors[1].message).to.equal('error 2');
85
+ }
86
+ });
87
+
88
+ it('should invoke custom error handler for each error', () => {
89
+ const errors: unknown[] = [];
90
+ const emitter = new Emitter<void>({ errorHandling: e => errors.push(e) });
91
+
92
+ emitter.event(() => { throw new Error('handled 1'); });
93
+ emitter.event(() => { throw new Error('handled 2'); });
94
+ emitter.fire(undefined);
95
+
96
+ expect(errors).to.have.lengthOf(2);
97
+ expect((errors[0] as Error).message).to.equal('handled 1');
98
+ expect((errors[1] as Error).message).to.equal('handled 2');
99
+ });
100
+
101
+ it('should not throw when no listeners fail with propagate', () => {
102
+ const emitter = new Emitter<void>({ errorHandling: 'propagate' });
103
+ let called = false;
104
+
105
+ emitter.event(() => { called = true; });
106
+ emitter.fire(undefined);
107
+
108
+ expect(called).to.be.true;
109
+ });
110
+ });
111
+
32
112
  });