@codingame/monaco-vscode-telemetry-service-override 36.2.7 → 37.0.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 (44) hide show
  1. package/index.js +1 -1
  2. package/package.json +2 -2
  3. package/vscode/src/vs/base/common/editArcTracker.d.ts +29 -0
  4. package/vscode/src/vs/base/common/editArcTracker.js +291 -0
  5. package/vscode/src/vs/platform/agentHost/common/diffComputeService.d.ts +19 -0
  6. package/vscode/src/vs/platform/agentHost/common/fileEditAttribution.d.ts +107 -0
  7. package/vscode/src/vs/platform/agentHost/common/fileEditAttribution.js +59 -0
  8. package/vscode/src/vs/platform/agentHost/common/fileEditAttribution.service.d.ts +12 -0
  9. package/vscode/src/vs/platform/telemetry/browser/errorTelemetry.js +5 -5
  10. package/vscode/src/vs/platform/telemetry/common/1dsAppender.d.ts +2 -0
  11. package/vscode/src/vs/platform/telemetry/common/1dsAppender.js +12 -10
  12. package/vscode/src/vs/platform/telemetry/common/editArcTelemetry.d.ts +141 -0
  13. package/vscode/src/vs/platform/telemetry/common/editArcTelemetry.js +5 -0
  14. package/vscode/src/vs/platform/telemetry/common/editTelemetry.d.ts +49 -0
  15. package/vscode/src/vs/platform/telemetry/common/editTelemetry.js +10 -0
  16. package/vscode/src/vs/platform/telemetry/common/telemetryLogAppender.d.ts +5 -2
  17. package/vscode/src/vs/platform/telemetry/common/telemetryLogAppender.js +4 -3
  18. package/vscode/src/vs/platform/telemetry/common/telemetryService.d.ts +14 -4
  19. package/vscode/src/vs/platform/telemetry/common/telemetryService.js +50 -34
  20. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/editStats/aiStatsChart.js +1 -1
  21. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/editStats/aiStatsStatusBar.js +8 -8
  22. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/editTelemetry.contribution.js +12 -7
  23. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/editTelemetryContribution.js +2 -1
  24. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/helpers/documentWithAnnotatedEdits.d.ts +7 -1
  25. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/helpers/documentWithAnnotatedEdits.js +15 -2
  26. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/settingIds.d.ts +1 -1
  27. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/settingIds.js +1 -2
  28. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/agentHostEditMarkerService.d.ts +83 -0
  29. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/agentHostEditMarkerService.js +690 -0
  30. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/arcTelemetryReporter.d.ts +2 -2
  31. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/arcTelemetrySender.d.ts +3 -3
  32. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/arcTelemetrySender.js +3 -0
  33. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/editSourceTrackingFeature.js +11 -4
  34. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/editSourceTrackingImpl.d.ts +15 -4
  35. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/editSourceTrackingImpl.js +185 -83
  36. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/editTracker.d.ts +21 -5
  37. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/editTracker.js +128 -12
  38. package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/scmAdapter.d.ts +7 -2
  39. package/vscode/src/vs/workbench/contrib/editTelemetry/common/arcTracker.d.ts +3 -11
  40. package/vscode/src/vs/workbench/contrib/editTelemetry/common/arcTracker.js +17 -47
  41. package/vscode/src/vs/workbench/contrib/telemetry/browser/telemetry.contribution.js +13 -2
  42. package/vscode/src/vs/workbench/services/telemetry/browser/telemetryService.d.ts +1 -1
  43. package/vscode/src/vs/workbench/services/dataChannel/browser/dataChannelService.d.ts +0 -10
  44. package/vscode/src/vs/workbench/services/dataChannel/browser/dataChannelService.js +0 -30
@@ -1,25 +1,55 @@
1
1
 
2
- import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
2
+ import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
3
3
  import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
4
4
  import { AnnotatedStringEdit } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/edits/stringEdit';
5
+ import { EditKeySourceData, EditSourceBase } from '../helpers/documentWithAnnotatedEdits.js';
5
6
  import { observableSignal } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignal';
6
7
  import { runOnChange } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils/runOnChange';
7
8
 
9
+ const EXTERNAL_OBSERVATION_KEY_PREFIX = "external-observation:";
8
10
  class DocumentEditSourceTracker extends Disposable {
9
- constructor(_doc, data) {
11
+ constructor(
12
+ _doc,
13
+ data,
14
+ _externalEditCorrelation,
15
+ _externalEditCorrelationPolicy = "suppress"
16
+ ) {
10
17
  super();
11
18
  this._doc = _doc;
12
19
  this.data = data;
20
+ this._externalEditCorrelation = _externalEditCorrelation;
21
+ this._externalEditCorrelationPolicy = _externalEditCorrelationPolicy;
13
22
  this._edits = AnnotatedStringEdit.empty;
14
23
  this._pendingExternalEdits = AnnotatedStringEdit.empty;
15
24
  this._update = observableSignal(this);
25
+ this._documentStore = this._register(( new DisposableStore()));
16
26
  this._representativePerKey = ( new Map());
17
27
  this._sumAddedCharactersPerKey = ( new Map());
18
- this._register(runOnChange(this._doc.value, (_val, _prevVal, edits) => {
19
- const eComposed = AnnotatedStringEdit.compose(( edits.map(e => e.edit)));
28
+ this._externalObservationIds = ( new Set());
29
+ this._ignoredInitialExternalObservationIds = ( new Set());
30
+ this._suppressedExternalObservationIds = ( new Set());
31
+ this._invalidatedExternalObservationIds = ( new Set());
32
+ this._reattributedExternalObservations = ( new Map());
33
+ this._documentStore.add(runOnChange(this._doc.value, (_val, _prevVal, edits) => {
34
+ let eComposed = AnnotatedStringEdit.compose(( edits.map(e => e.edit)));
20
35
  if (eComposed.replacements.every(e => e.data.source.category === "external")) {
21
- if (this._edits.isEmpty())
36
+ if (this._edits.isEmpty() && !this._externalEditCorrelation)
22
37
  ; else {
38
+ if (this._externalEditCorrelation) {
39
+ const observationId = this._externalEditCorrelation.register(_prevVal.value, _val.value);
40
+ this._externalObservationIds.add(observationId);
41
+ if (this._edits.isEmpty()) {
42
+ this._ignoredInitialExternalObservationIds.add(observationId);
43
+ }
44
+ const resolution = this._externalEditCorrelation.getResolution?.(observationId);
45
+ if (resolution) {
46
+ this._resolveExternalObservation(resolution);
47
+ } else if (this._externalEditCorrelationPolicy === "suppress" && this._externalEditCorrelation.isSuppressed(observationId)) {
48
+ this._suppressedExternalObservationIds.add(observationId);
49
+ }
50
+ const key = `${EXTERNAL_OBSERVATION_KEY_PREFIX}${observationId}`;
51
+ eComposed = eComposed.mapData(replacement => ( new EditKeySourceData(key, replacement.data.source, replacement.data.representative)));
52
+ }
23
53
  this._pendingExternalEdits = this._pendingExternalEdits.compose(eComposed);
24
54
  }
25
55
  } else {
@@ -31,6 +61,40 @@ class DocumentEditSourceTracker extends Disposable {
31
61
  }
32
62
  this._update.trigger(undefined);
33
63
  }));
64
+ if (this._externalEditCorrelation) {
65
+ if (this._externalEditCorrelation.onDidResolve) {
66
+ this._register(
67
+ this._externalEditCorrelation.onDidResolve(resolution => this._resolveExternalObservation(resolution))
68
+ );
69
+ } else {
70
+ this._register(this._externalEditCorrelation.onDidSuppress(observationId => {
71
+ if (( this._externalObservationIds.has(observationId)) && this._externalEditCorrelationPolicy === "suppress") {
72
+ this._suppressedExternalObservationIds.add(observationId);
73
+ this._update.trigger(undefined);
74
+ }
75
+ }));
76
+ }
77
+ this._register(this._externalEditCorrelation.onDidInvalidate(observationId => {
78
+ if (( this._externalObservationIds.has(observationId))) {
79
+ this._suppressedExternalObservationIds.delete(observationId);
80
+ this._reattributedExternalObservations.delete(observationId);
81
+ this._invalidatedExternalObservationIds.add(observationId);
82
+ this._update.trigger(undefined);
83
+ }
84
+ }));
85
+ }
86
+ }
87
+ releaseExternalEditCorrelations() {
88
+ for (const observationId of this._externalObservationIds) {
89
+ this._externalEditCorrelation?.release(observationId);
90
+ }
91
+ this._externalObservationIds.clear();
92
+ }
93
+ stopTracking() {
94
+ this._documentStore.clear();
95
+ }
96
+ async waitForExternalEditCorrelations(timeoutMs) {
97
+ await this._externalEditCorrelation?.waitForResolution?.(Array.from(this._externalObservationIds), timeoutMs);
34
98
  }
35
99
  _applyEdit(e) {
36
100
  for (const r of e.replacements) {
@@ -47,27 +111,76 @@ class DocumentEditSourceTracker extends Disposable {
47
111
  async waitForQueue() {
48
112
  await this._doc.waitForQueue();
49
113
  }
50
- getTotalInsertedCharactersCount(key) {
114
+ getTotalInsertedCharactersCount(key, includeSuppressed = false) {
115
+ if (!this._shouldIncludeKey(key, includeSuppressed)) {
116
+ return 0;
117
+ }
51
118
  const val = this._sumAddedCharactersPerKey.get(key);
52
119
  return val ?? 0;
53
120
  }
54
- getAllKeys() {
55
- return Array.from(( this._sumAddedCharactersPerKey.keys()));
121
+ getAllKeys(includeSuppressed = false) {
122
+ return Array.from(( this._sumAddedCharactersPerKey.keys())).filter(key => this._shouldIncludeKey(key, includeSuppressed));
56
123
  }
57
124
  getRepresentative(key) {
125
+ const observationId = getExternalObservationId(key);
126
+ if (observationId) {
127
+ return this._reattributedExternalObservations.get(observationId) ?? this._representativePerKey.get(key);
128
+ }
58
129
  return this._representativePerKey.get(key);
59
130
  }
60
- getTrackedRanges(reader) {
131
+ applyPendingExternalEdits() {
132
+ if (this._pendingExternalEdits.isEmpty()) {
133
+ return;
134
+ }
135
+ this._applyEdit(this._pendingExternalEdits);
136
+ this._pendingExternalEdits = AnnotatedStringEdit.empty;
137
+ this._update.trigger(undefined);
138
+ }
139
+ getTrackedRanges(reader, includeSuppressed = false) {
61
140
  this._update.read(reader);
62
141
  const ranges = this._edits.getNewRanges();
63
142
  return ( ranges.map((r, idx) => {
64
143
  const e = this._edits.replacements[idx];
65
- const te = ( new TrackedEdit(e.replaceRange, r, e.data.key, e.data.source, e.data.representative));
144
+ const representative = this.getRepresentative(e.data.key) ?? e.data.representative;
145
+ const source = representative === e.data.representative ? e.data.source : EditSourceBase.create(representative);
146
+ const te = ( new TrackedEdit(e.replaceRange, r, e.data.key, source, representative));
66
147
  return te;
67
- }));
148
+ })).filter(edit => this._shouldIncludeKey(edit.sourceKey, includeSuppressed));
68
149
  }
69
150
  isEmpty() {
70
- return this._edits.isEmpty();
151
+ return this.getAllKeys().length === 0;
152
+ }
153
+ _shouldIncludeKey(key, includeSuppressed) {
154
+ const observationId = getExternalObservationId(key);
155
+ if (!observationId) {
156
+ return true;
157
+ }
158
+ if (( this._reattributedExternalObservations.has(observationId))) {
159
+ return true;
160
+ }
161
+ if (( this._invalidatedExternalObservationIds.has(observationId))) {
162
+ return true;
163
+ }
164
+ const isSuppressed = ( this._suppressedExternalObservationIds.has(observationId));
165
+ if (( this._ignoredInitialExternalObservationIds.has(observationId))) {
166
+ if (this._externalEditCorrelationPolicy === "reattribute") {
167
+ return true;
168
+ }
169
+ return includeSuppressed && isSuppressed;
170
+ }
171
+ return includeSuppressed || !isSuppressed;
172
+ }
173
+ _resolveExternalObservation(resolution) {
174
+ if (!( this._externalObservationIds.has(resolution.id))) {
175
+ return;
176
+ }
177
+ this._invalidatedExternalObservationIds.delete(resolution.id);
178
+ if (this._externalEditCorrelationPolicy === "suppress") {
179
+ this._suppressedExternalObservationIds.add(resolution.id);
180
+ } else if (resolution.source) {
181
+ this._reattributedExternalObservations.set(resolution.id, resolution.source);
182
+ }
183
+ this._update.trigger(undefined);
71
184
  }
72
185
  _getDebugVisualization() {
73
186
  const ranges = this.getTrackedRanges();
@@ -86,6 +199,9 @@ class DocumentEditSourceTracker extends Disposable {
86
199
  };
87
200
  }
88
201
  }
202
+ function getExternalObservationId(key) {
203
+ return key.startsWith(EXTERNAL_OBSERVATION_KEY_PREFIX) ? key.substring(EXTERNAL_OBSERVATION_KEY_PREFIX.length) : undefined;
204
+ }
89
205
  class TrackedEdit {
90
206
  constructor(originalRange, range, sourceKey, source, sourceRepresentative) {
91
207
  this.originalRange = originalRange;
@@ -7,9 +7,14 @@ export declare class ScmAdapter {
7
7
  private readonly _repos;
8
8
  private readonly _reposChangedSignal;
9
9
  constructor(_scmService: ISCMService);
10
- getRepo(uri: URI, reader: IReader | undefined): ScmRepoAdapter | undefined;
10
+ getRepo(uri: URI, reader: IReader | undefined): IScmRepoAdapter | undefined;
11
11
  }
12
- export declare class ScmRepoAdapter {
12
+ export interface IScmRepoAdapter {
13
+ readonly headBranchNameObs: IObservable<string | undefined>;
14
+ readonly headCommitHashObs: IObservable<string | undefined>;
15
+ isIgnored(uri: URI): Promise<boolean>;
16
+ }
17
+ export declare class ScmRepoAdapter implements IScmRepoAdapter {
13
18
  private readonly _repo;
14
19
  readonly headBranchNameObs: IObservable<string | undefined>;
15
20
  readonly headCommitHashObs: IObservable<string | undefined>;
@@ -1,29 +1,21 @@
1
- import { BaseStringEdit, IEditData } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/edits/stringEdit";
1
+ import { BaseStringEdit } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/edits/stringEdit";
2
2
  import { AbstractText } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/text/abstractText";
3
3
  /**
4
4
  * The ARC (accepted and retained characters) counts how many characters inserted by the initial suggestion (trackedEdit)
5
5
  * stay unmodified after a certain amount of time after acceptance.
6
6
  */
7
7
  export declare class ArcTracker {
8
- private readonly _valueBeforeTrackedEdit;
9
- private _updatedTrackedEdit;
10
- private _trackedEdit;
11
- constructor(_valueBeforeTrackedEdit: AbstractText, trackedEdit: BaseStringEdit);
8
+ private readonly _tracker;
9
+ constructor(valueBeforeTrackedEdit: AbstractText, trackedEdit: BaseStringEdit);
12
10
  getOriginalCharacterCount(): number;
13
11
  /**
14
12
  * edit must apply to _updatedTrackedEdit.apply(_valueBeforeTrackedEdit)
15
13
  */
16
14
  handleEdits(edit: BaseStringEdit): void;
17
15
  getAcceptedRestrainedCharactersCount(): number;
18
- getDebugState(): unknown;
19
16
  getLineCountInfo(): {
20
17
  deletedLineCounts: number;
21
18
  insertedLineCounts: number;
22
19
  };
23
20
  getValues(): unknown;
24
21
  }
25
- export declare class IsTrackedEditData implements IEditData<IsTrackedEditData> {
26
- readonly isTrackedEdit: boolean;
27
- constructor(isTrackedEdit: boolean);
28
- join(data: IsTrackedEditData): IsTrackedEditData | undefined;
29
- }
@@ -1,64 +1,34 @@
1
1
 
2
- import { sumBy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
3
- import { LineEdit } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/edits/lineEdit';
2
+ import { EditArcTracker } from '../../../../base/common/editArcTracker.js';
4
3
 
5
4
  class ArcTracker {
6
- constructor(_valueBeforeTrackedEdit, trackedEdit) {
7
- this._valueBeforeTrackedEdit = _valueBeforeTrackedEdit;
8
- this._trackedEdit = trackedEdit.removeCommonSuffixPrefix(_valueBeforeTrackedEdit.getValue());
9
- this._updatedTrackedEdit = this._trackedEdit.mapData(() => ( new IsTrackedEditData(true)));
5
+ constructor(valueBeforeTrackedEdit, trackedEdit) {
6
+ this._tracker = ( new EditArcTracker(valueBeforeTrackedEdit.getValue(), toArcTextEdit(trackedEdit)));
10
7
  }
11
8
  getOriginalCharacterCount() {
12
- return sumBy(this._trackedEdit.replacements, e => e.getNewLength());
9
+ return this._tracker.getOriginalCharacterCount();
13
10
  }
14
11
  handleEdits(edit) {
15
- const e = edit.mapData(_d => ( new IsTrackedEditData(false)));
16
- const composedEdit = this._updatedTrackedEdit.compose(e);
17
- this._updatedTrackedEdit = composedEdit;
12
+ this._tracker.handleEdits(toArcTextEdit(edit));
18
13
  }
19
14
  getAcceptedRestrainedCharactersCount() {
20
- const s = sumBy(
21
- this._updatedTrackedEdit.replacements,
22
- e => e.data.isTrackedEdit ? e.getNewLength() : 0
23
- );
24
- return s;
25
- }
26
- getDebugState() {
27
- return {
28
- edits: ( this._updatedTrackedEdit.replacements.map(e => ({
29
- range: ( e.replaceRange.toString()),
30
- newText: e.newText,
31
- isTrackedEdit: e.data.isTrackedEdit
32
- })))
33
- };
15
+ return this._tracker.getAcceptedRestrainedCharactersCount();
34
16
  }
35
17
  getLineCountInfo() {
36
- const e = this._updatedTrackedEdit.toStringEdit(r => r.data.isTrackedEdit);
37
- const le = LineEdit.fromStringEdit(e, this._valueBeforeTrackedEdit);
38
- const deletedLineCount = sumBy(le.replacements, r => r.lineRange.length);
39
- const insertedLineCount = sumBy(le.getNewLineRanges(), r => r.length);
40
- return {
41
- deletedLineCounts: deletedLineCount,
42
- insertedLineCounts: insertedLineCount
43
- };
18
+ return this._tracker.getLineCountInfo();
44
19
  }
45
20
  getValues() {
46
- return {
47
- arc: this.getAcceptedRestrainedCharactersCount(),
48
- ...this.getLineCountInfo()
49
- };
21
+ return this._tracker.getValues();
50
22
  }
51
23
  }
52
- class IsTrackedEditData {
53
- constructor(isTrackedEdit) {
54
- this.isTrackedEdit = isTrackedEdit;
55
- }
56
- join(data) {
57
- if (this.isTrackedEdit !== data.isTrackedEdit) {
58
- return undefined;
59
- }
60
- return this;
61
- }
24
+ function toArcTextEdit(edit) {
25
+ return {
26
+ replacements: ( edit.replacements.map(replacement => ({
27
+ start: replacement.replaceRange.start,
28
+ endExclusive: replacement.replaceRange.endExclusive,
29
+ text: replacement.newText
30
+ })))
31
+ };
62
32
  }
63
33
 
64
- export { ArcTracker, IsTrackedEditData };
34
+ export { ArcTracker };
@@ -176,7 +176,7 @@ let TelemetryContribution = class TelemetryContribution extends Disposable {
176
176
  constructor() {
177
177
  super({
178
178
  id: "workbench.action.showTelemetry",
179
- title: ( localize2(14739, "Show Telemetry")),
179
+ title: ( localize2(16498, "Show Telemetry")),
180
180
  category: Categories.Developer,
181
181
  f1: true
182
182
  });
@@ -270,6 +270,18 @@ let ConfigurationTelemetryContribution = class ConfigurationTelemetryContributio
270
270
  source
271
271
  });
272
272
  return;
273
+ case LayoutSettings.MODERN_UI:
274
+ this.telemetryService.publicLog2("workbench.experimental.modernUI", {
275
+ settingValue: this.getValueToReport(key, target),
276
+ source
277
+ });
278
+ return;
279
+ case LayoutSettings.MODERN_UI_DENSITY:
280
+ this.telemetryService.publicLog2("window.density.layout", {
281
+ settingValue: this.getValueToReport(key, target),
282
+ source
283
+ });
284
+ return;
273
285
  case AutoUpdateConfigurationKey:
274
286
  this.telemetryService.publicLog2("extensions.autoUpdate", {
275
287
  settingValue: this.getValueToReport(key, target),
@@ -335,7 +347,6 @@ let ConfigurationTelemetryContribution = class ConfigurationTelemetryContributio
335
347
  });
336
348
  return;
337
349
  case TerminalContribSettingId.AgentSandboxEnabled:
338
- case TerminalContribSettingId.DeprecatedAgentSandboxEnabled:
339
350
  this.telemetryService.publicLog2("chat.agent.sandbox", {
340
351
  settingValue: this.getValueToReport(key, target),
341
352
  source
@@ -28,7 +28,7 @@ export declare class TelemetryService extends Disposable implements ITelemetrySe
28
28
  */
29
29
  private initializeService;
30
30
  setExperimentProperty(name: string, value: string): void;
31
- setCommonProperty(name: string, value: string | boolean): void;
31
+ setCommonProperty(name: string, value: string | boolean | undefined): void;
32
32
  get telemetryLevel(): TelemetryLevel;
33
33
  publicLog(eventName: string, data?: ITelemetryData): void;
34
34
  publicLog2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>): void;
@@ -1,10 +0,0 @@
1
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { CoreDataChannel, IDataChannelEvent } from "@codingame/monaco-vscode-api/vscode/vs/platform/dataChannel/common/dataChannel";
3
- import { IDataChannelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dataChannel/common/dataChannel.service";
4
- export declare class DataChannelService extends Disposable implements IDataChannelService {
5
- readonly _serviceBrand: undefined;
6
- private readonly _onDidSendData;
7
- readonly onDidSendData: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<IDataChannelEvent<unknown>>;
8
- constructor();
9
- getDataChannel<T>(channelId: string): CoreDataChannel<T>;
10
- }
@@ -1,30 +0,0 @@
1
-
2
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
3
- import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
- import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
5
- import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
6
-
7
- class DataChannelService extends Disposable {
8
- constructor() {
9
- super();
10
- this._onDidSendData = this._register(( new Emitter()));
11
- this.onDidSendData = this._onDidSendData.event;
12
- }
13
- getDataChannel(channelId) {
14
- return ( new CoreDataChannelImpl(channelId, this._onDidSendData));
15
- }
16
- }
17
- class CoreDataChannelImpl {
18
- constructor(channelId, _onDidSendData) {
19
- this.channelId = channelId;
20
- this._onDidSendData = _onDidSendData;
21
- }
22
- sendData(data) {
23
- this._onDidSendData.fire({
24
- channelId: this.channelId,
25
- data
26
- });
27
- }
28
- }
29
-
30
- export { DataChannelService };