Skip to content

Commit 259a8ab

Browse files
committed
#6679 telemetry logging
1 parent 04c58d9 commit 259a8ab

File tree

5 files changed

+52
-22
lines changed

5 files changed

+52
-22
lines changed

src/vs/base/parts/tree/browser/treeDefaults.ts

+14-12
Original file line numberDiff line numberDiff line change
@@ -432,19 +432,21 @@ export class DefaultAccessibilityProvider implements _.IAccessibilityProvider {
432432

433433
export class CollapseAllAction extends Action {
434434

435-
constructor(viewer: _.ITree, enabled: boolean) {
436-
super('workbench.action.collapse', nls.localize('collapse', "Collapse All"), 'monaco-tree-action collapse-all', enabled, (context: any) => {
437-
if (viewer.getHighlight()) {
438-
return TPromise.as(null); // Global action disabled if user is in edit mode from another action
439-
}
435+
constructor(private viewer: _.ITree, enabled: boolean) {
436+
super('workbench.action.collapse', nls.localize('collapse', "Collapse All"), 'monaco-tree-action collapse-all', enabled);
437+
}
440438

441-
viewer.collapseAll();
442-
viewer.clearSelection();
443-
viewer.clearFocus();
444-
viewer.DOMFocus();
445-
viewer.focusFirst();
439+
public run(context?: any): TPromise<any> {
440+
if (this.viewer.getHighlight()) {
441+
return TPromise.as(null); // Global action disabled if user is in edit mode from another action
442+
}
446443

447-
return TPromise.as(null);
448-
});
444+
this.viewer.collapseAll();
445+
this.viewer.clearSelection();
446+
this.viewer.clearFocus();
447+
this.viewer.DOMFocus();
448+
this.viewer.focusFirst();
449+
450+
return TPromise.as(null);
449451
}
450452
}

src/vs/workbench/browser/panel.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export abstract class TogglePanelAction extends Action {
7373
id: string,
7474
label: string,
7575
panelId: string,
76-
private panelService: IPanelService,
76+
protected panelService: IPanelService,
7777
private editorService: IWorkbenchEditorService
7878
) {
7979
super(id, name);
@@ -100,7 +100,7 @@ export abstract class TogglePanelAction extends Action {
100100
return panel && panel.getId() === this.panelId;
101101
}
102102

103-
private isPanelFocussed(): boolean {
103+
protected isPanelFocussed(): boolean {
104104
let activePanel = this.panelService.getActivePanel();
105105
let activeElement = document.activeElement;
106106

src/vs/workbench/parts/markers/browser/markersPanel.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ import Constants from 'vs/workbench/parts/markers/common/constants';
2727
import { IProblemsConfiguration, MarkersModel, Marker, Resource } from 'vs/workbench/parts/markers/common/markersModel';
2828
import {Controller} from 'vs/workbench/parts/markers/browser/markersTreeController';
2929
import Tree = require('vs/base/parts/tree/browser/tree');
30-
import {CollapseAllAction} from 'vs/base/parts/tree/browser/treeDefaults';
3130
import TreeImpl = require('vs/base/parts/tree/browser/treeImpl');
3231
import * as Viewer from 'vs/workbench/parts/markers/browser/markersTreeViewer';
3332
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
3433
import { ActionProvider } from 'vs/workbench/parts/markers/browser/markersActionProvider';
35-
import { FilterAction, FilterInputBoxActionItem } from 'vs/workbench/parts/markers/browser/markersPanelActions';
34+
import { CollapseAllAction, FilterAction, FilterInputBoxActionItem } from 'vs/workbench/parts/markers/browser/markersPanelActions';
3635
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
3736

3837
export class MarkersPanel extends Panel {
@@ -90,8 +89,6 @@ export class MarkersPanel extends Panel {
9089

9190
this.render();
9291

93-
// this.telemetryService.publicLog('problems.used');
94-
9592
return TPromise.as(null);
9693
}
9794

src/vs/workbench/parts/markers/browser/markersPanelActions.ts

+31-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { Delayer } from 'vs/base/common/async';
77
import * as DOM from 'vs/base/browser/dom';
88
import * as lifecycle from 'vs/base/common/lifecycle';
9+
import { TPromise } from 'vs/base/common/winjs.base';
910
import { IAction, Action } from 'vs/base/common/actions';
1011
import { BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
1112
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
@@ -20,7 +21,9 @@ import { MarkersPanel } from 'vs/workbench/parts/markers/browser/markersPanel';
2021
import { IPartService } from 'vs/workbench/services/part/common/partService';
2122
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
2223
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
23-
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
24+
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
25+
import { CollapseAllAction as TreeCollapseAction } from 'vs/base/parts/tree/browser/treeDefaults';
26+
import Tree = require('vs/base/parts/tree/browser/tree');
2427

2528
export class ToggleProblemsPanelAction extends TogglePanelAction {
2629

@@ -34,6 +37,28 @@ export class ToggleProblemsPanelAction extends TogglePanelAction {
3437
) {
3538
super(id, label, Constants.MARKERS_PANEL_ID, panelService, editorService);
3639
}
40+
41+
public run(): TPromise<any> {
42+
let promise= super.run();
43+
if (this.isPanelFocussed()) {
44+
this.telemetryService.publicLog('problems.used');
45+
}
46+
return promise;
47+
}
48+
}
49+
50+
export class CollapseAllAction extends TreeCollapseAction {
51+
52+
constructor(viewer: Tree.ITree, enabled: boolean,
53+
@ITelemetryService private telemetryService: ITelemetryService) {
54+
super(viewer, enabled);
55+
}
56+
57+
public run(context?: any): TPromise<any> {
58+
this.telemetryService.publicLog('problems.collapseAll.used');
59+
return super.run(context);
60+
}
61+
3762
}
3863

3964
export class FilterAction extends Action {
@@ -75,8 +100,11 @@ export class FilterInputBoxActionItem extends BaseActionItem {
75100
}
76101

77102
private reportFilteringUsed(): void {
78-
// Report only filtering is used, do not use the input from the user
79-
// this.telemetryService.publicLog('problems.filtered');
103+
let data= {};
104+
data['errors']= this.markersPanel.markersModel.filterOptions.filterErrors;
105+
data['warnings']= this.markersPanel.markersModel.filterOptions.filterWarnings;
106+
data['infos']= this.markersPanel.markersModel.filterOptions.filterInfos;
107+
this.telemetryService.publicLog('problems.filter', data);
80108
}
81109

82110
public dispose(): void {

src/vs/workbench/parts/markers/browser/markersTreeController.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ import treedefaults = require('vs/base/parts/tree/browser/treeDefaults');
1212
import { MarkersModel, Marker } from 'vs/workbench/parts/markers/common/markersModel';
1313
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
1414
import { IMarker } from 'vs/platform/markers/common/markers';
15+
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
1516

1617
export class Controller extends treedefaults.DefaultController {
1718

18-
constructor(@IWorkbenchEditorService private editorService: IWorkbenchEditorService) {
19+
constructor(@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
20+
@ITelemetryService private telemetryService: ITelemetryService) {
1921
super();
2022
}
2123

@@ -46,6 +48,7 @@ export class Controller extends treedefaults.DefaultController {
4648

4749
private openFileAtElement(element: any, preserveFocus: boolean, sideByside: boolean) {
4850
if (element instanceof Marker) {
51+
this.telemetryService.publicLog('problems.marker.opened', {source: element.source});
4952
let marker = <IMarker>element.marker;
5053
this.editorService.openEditor({
5154
resource: marker.resource,

0 commit comments

Comments
 (0)