File tree Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 11## 8.0.8
2+ - Added ` Event.idePluginEvent ` for events reported by IDE plugins.
23- More data for ` Event.analysisStatistics ` for events from Dart Analysis Server.
34
45## 8.0.7
Original file line number Diff line number Diff line change @@ -69,6 +69,20 @@ enum DashEvent {
6969 toolOwner: DashTool .devtools,
7070 ),
7171
72+ // Events for IDE plugins
73+
74+ intellijPluginEvent (
75+ label: 'intellij_event' ,
76+ description: 'Information for Intellij Plugin events' ,
77+ toolOwner: DashTool .intellijPlugins,
78+ ),
79+
80+ vsCodePluginEvent (
81+ label: 'vscode_event' ,
82+ description: 'Information for VSCode Plugin events' ,
83+ toolOwner: DashTool .vscodePlugins,
84+ ),
85+
7286 // Events for the Flutter CLI
7387
7488 appleUsageEvent (
@@ -251,3 +265,13 @@ enum DevicePlatform {
251265 final String label;
252266 const DevicePlatform (this .label);
253267}
268+
269+ /// Supported IDEs.
270+ enum IDE {
271+ intellij (DashEvent .intellijPluginEvent),
272+ vscode (DashEvent .vsCodePluginEvent),
273+ ;
274+
275+ final DashEvent event;
276+ const IDE (this .event);
277+ }
Original file line number Diff line number Diff line change @@ -794,6 +794,22 @@ final class Event {
794794 },
795795 );
796796
797+ /// Event that is sent from an IDE plugin.
798+ ///
799+ /// [name] - the name of the event.
800+ ///
801+ /// [ide] - the reporting [IDE] .
802+ ///
803+ /// [additionalData] - any additional data.
804+ Event .idePluginEvent ({
805+ required String name,
806+ required IDE ide,
807+ CustomMetrics ? additionalData,
808+ }) : this ._(eventName: ide.event, eventData: {
809+ 'name' : name,
810+ if (additionalData != null ) ...additionalData.toMap (),
811+ });
812+
797813 /// Event that is emitted periodically to report the number of times each lint
798814 /// has been enabled.
799815 ///
Original file line number Diff line number Diff line change @@ -216,6 +216,29 @@ void main() {
216216 expect (constructedEvent.eventData.length, 1 );
217217 });
218218
219+ test ('Event.idePluginEvent constructed' , () {
220+ Event generateEvent () => Event .idePluginEvent (
221+ name: 'ide.command' ,
222+ ide: IDE .intellij,
223+ additionalData: _TestMetrics (
224+ stringField: 'test' ,
225+ intField: 100 ,
226+ boolField: false ,
227+ ),
228+ );
229+
230+ final constructedEvent = generateEvent ();
231+
232+ expect (generateEvent, returnsNormally);
233+ expect (constructedEvent.eventName, DashEvent .intellijPluginEvent);
234+
235+ expect (constructedEvent.eventData['stringField' ], 'test' );
236+ expect (constructedEvent.eventData['intField' ], 100 );
237+ expect (constructedEvent.eventData['boolField' ], false );
238+ expect (constructedEvent.eventData.containsKey ('nullableField' ), false );
239+ expect (constructedEvent.eventData.length, 4 );
240+ });
241+
219242 test ('Event.lintUsageCount constructed' , () {
220243 Event generateEvent () => Event .lintUsageCount (
221244 count: 5 ,
You can’t perform that action at this time.
0 commit comments