@theia/core 1.78.0-next.19 → 1.78.0-next.28

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 (78) hide show
  1. package/lib/browser/catalog.json +52 -0
  2. package/lib/browser/common-frontend-contribution.js +4 -4
  3. package/lib/browser/common-frontend-contribution.js.map +1 -1
  4. package/lib/browser/saveable.d.ts +1 -1
  5. package/lib/browser/saveable.d.ts.map +1 -1
  6. package/lib/browser/saveable.js +18 -0
  7. package/lib/browser/saveable.js.map +1 -1
  8. package/lib/browser/shell/application-shell.d.ts.map +1 -1
  9. package/lib/browser/shell/application-shell.js +13 -1
  10. package/lib/browser/shell/application-shell.js.map +1 -1
  11. package/lib/browser/shell/tab-bars.d.ts +71 -1
  12. package/lib/browser/shell/tab-bars.d.ts.map +1 -1
  13. package/lib/browser/shell/tab-bars.js +243 -8
  14. package/lib/browser/shell/tab-bars.js.map +1 -1
  15. package/lib/browser/shell/tab-bars.spec.js +382 -2
  16. package/lib/browser/shell/tab-bars.spec.js.map +1 -1
  17. package/lib/browser/widgets/widget.d.ts.map +1 -1
  18. package/lib/browser/widgets/widget.js +34 -1
  19. package/lib/browser/widgets/widget.js.map +1 -1
  20. package/lib/common/char-code.d.ts +7 -3
  21. package/lib/common/char-code.d.ts.map +1 -1
  22. package/lib/common/char-code.js +408 -1
  23. package/lib/common/char-code.js.map +1 -1
  24. package/lib/common/core-preferences.d.ts +1 -0
  25. package/lib/common/core-preferences.d.ts.map +1 -1
  26. package/lib/common/core-preferences.js +10 -0
  27. package/lib/common/core-preferences.js.map +1 -1
  28. package/lib/common/glob.js +2 -1
  29. package/lib/common/glob.js.map +1 -1
  30. package/lib/common/message-rpc/rpc-message-encoder.d.ts +1 -1
  31. package/lib/common/message-rpc/rpc-message-encoder.d.ts.map +1 -1
  32. package/lib/common/message-rpc/rpc-message-encoder.js +13 -5
  33. package/lib/common/message-rpc/rpc-message-encoder.js.map +1 -1
  34. package/lib/common/message-rpc/rpc-protocol.js +6 -6
  35. package/lib/common/message-rpc/rpc-protocol.js.map +1 -1
  36. package/lib/common/messaging/socket-write-buffer.d.ts +8 -2
  37. package/lib/common/messaging/socket-write-buffer.d.ts.map +1 -1
  38. package/lib/common/messaging/socket-write-buffer.js +18 -12
  39. package/lib/common/messaging/socket-write-buffer.js.map +1 -1
  40. package/lib/common/messaging/socket-write-buffer.spec.d.ts +2 -0
  41. package/lib/common/messaging/socket-write-buffer.spec.d.ts.map +1 -0
  42. package/lib/common/messaging/socket-write-buffer.spec.js +72 -0
  43. package/lib/common/messaging/socket-write-buffer.spec.js.map +1 -0
  44. package/lib/common/observable/autorun.d.ts +1 -1
  45. package/lib/common/observable/autorun.d.ts.map +1 -1
  46. package/lib/common/observable/autorun.js +27 -12
  47. package/lib/common/observable/autorun.js.map +1 -1
  48. package/lib/common/observable/derived-observable.d.ts +1 -1
  49. package/lib/common/observable/derived-observable.d.ts.map +1 -1
  50. package/lib/common/observable/derived-observable.js +36 -17
  51. package/lib/common/observable/derived-observable.js.map +1 -1
  52. package/lib/common/paths.js +12 -11
  53. package/lib/common/paths.js.map +1 -1
  54. package/lib/common/shell-quoting.d.ts +1 -1
  55. package/lib/common/shell-quoting.d.ts.map +1 -1
  56. package/lib/common/shell-quoting.js +34 -0
  57. package/lib/common/shell-quoting.js.map +1 -1
  58. package/lib/common/shell-quoting.spec.js +10 -10
  59. package/lib/common/shell-quoting.spec.js.map +1 -1
  60. package/lib/common/strings.js +4 -2
  61. package/lib/common/strings.js.map +1 -1
  62. package/lib/common/ternary-search-tree.js +2 -1
  63. package/lib/common/ternary-search-tree.js.map +1 -1
  64. package/package.json +4 -4
  65. package/src/browser/saveable.ts +1 -1
  66. package/src/browser/shell/application-shell.ts +14 -1
  67. package/src/browser/shell/tab-bars.spec.ts +431 -2
  68. package/src/browser/shell/tab-bars.ts +261 -9
  69. package/src/browser/style/tabs.css +58 -3
  70. package/src/browser/widgets/widget.ts +36 -1
  71. package/src/common/char-code.ts +7 -3
  72. package/src/common/core-preferences.ts +11 -0
  73. package/src/common/message-rpc/rpc-message-encoder.ts +1 -1
  74. package/src/common/messaging/socket-write-buffer.spec.ts +90 -0
  75. package/src/common/messaging/socket-write-buffer.ts +18 -14
  76. package/src/common/observable/autorun.ts +1 -1
  77. package/src/common/observable/derived-observable.ts +1 -1
  78. package/src/common/shell-quoting.ts +1 -1
@@ -21,38 +21,42 @@ import { WebSocket } from './web-socket-channel.js';
21
21
  export class SocketWriteBuffer {
22
22
  private static readonly DEFAULT_DISCONNECTED_BUFFER_SIZE = 100 * 1024;
23
23
 
24
- protected disconnectedBuffer: Uint8Array | undefined;
25
- protected bufferWritePosition = 0;
24
+ protected bufferedMessages: Uint8Array[] = [];
25
+ protected bufferedBytes = 0;
26
26
 
27
27
  protected get maxBufferSize(): number {
28
28
  return SocketWriteBuffer.DEFAULT_DISCONNECTED_BUFFER_SIZE;
29
29
  }
30
30
 
31
+ /**
32
+ * Stores a copy of `data`, so the caller can reuse its buffer before the next flush.
33
+ */
31
34
  buffer(data: Uint8Array): void {
32
35
  this.ensureWriteBuffer(data.byteLength);
33
- this.disconnectedBuffer?.set(data, this.bufferWritePosition);
34
- this.bufferWritePosition += data.byteLength;
36
+ // Not `data.slice()`: on a Node `Buffer` that returns a view of the same memory.
37
+ this.bufferedMessages.push(new Uint8Array(data));
38
+ this.bufferedBytes += data.byteLength;
35
39
  }
36
40
 
37
41
  protected ensureWriteBuffer(byteLength: number): void {
38
- if (!this.disconnectedBuffer) {
39
- this.disconnectedBuffer = new Uint8Array(this.maxBufferSize);
40
- this.bufferWritePosition = 0;
41
- }
42
-
43
- if (this.bufferWritePosition + byteLength > this.disconnectedBuffer.byteLength) {
42
+ if (this.bufferedBytes + byteLength > this.maxBufferSize) {
44
43
  throw new Error(`Max disconnected buffer size exceeded by adding ${byteLength} bytes`);
45
44
  }
46
45
  }
47
46
 
47
+ /**
48
+ * Sends each buffered message on its own: the receiving side reads one message per socket message.
49
+ */
48
50
  flush(socket: WebSocket): void {
49
- if (this.disconnectedBuffer) {
50
- socket.send(this.disconnectedBuffer.slice(0, this.bufferWritePosition));
51
- this.disconnectedBuffer = undefined;
51
+ const messages = this.bufferedMessages;
52
+ this.drain();
53
+ for (const message of messages) {
54
+ socket.send(message);
52
55
  }
53
56
  }
54
57
 
55
58
  drain(): void {
56
- this.disconnectedBuffer = undefined;
59
+ this.bufferedMessages = [];
60
+ this.bufferedBytes = 0;
57
61
  }
58
62
  }
@@ -227,7 +227,7 @@ export namespace Autorun {
227
227
  willHandleChange?: <T, TChange>(context: Observable.ChangeContext<T, TChange>, changeSummary: TChangeSummary | undefined) => boolean;
228
228
  }
229
229
 
230
- export const enum State {
230
+ export enum State {
231
231
  /**
232
232
  * Dependencies might have changed. Need to check if at least one dependency has actually changed.
233
233
  */
@@ -297,7 +297,7 @@ export namespace DerivedObservable {
297
297
  willHandleChange?: <U, UChange>(context: Observable.ChangeContext<U, UChange>, changeSummary: TChangeSummary | undefined) => boolean;
298
298
  }
299
299
 
300
- export const enum State {
300
+ export enum State {
301
301
  /**
302
302
  * Initial state. No cached value.
303
303
  */
@@ -27,7 +27,7 @@
27
27
  * Defines how an argument should be quoted if it contains
28
28
  * spaces or unsupported characters.
29
29
  */
30
- export const enum ShellQuoting {
30
+ export enum ShellQuoting {
31
31
 
32
32
  /**
33
33
  * Character escaping should be used. This for example