Skip to content

Commit e61dd48

Browse files
authored
fix: "formatterExample" in telemetry is regarded as measure (#664)
* convert formatterExample to string * use string enum
1 parent e80b730 commit e61dd48

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/formatter-settings/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ export class JavaFormatterSettingsEditorProvider implements vscode.CustomTextEdi
9797
}
9898
break;
9999
case "onWillChangeExampleKind":
100-
sendInfo("", { formatterExample: e.exampleKind });
101-
this.exampleKind = e.exampleKind;
102-
this.format();
100+
if (this.exampleKind !== e.exampleKind) {
101+
sendInfo("", { formatterExample: e.exampleKind });
102+
this.exampleKind = e.exampleKind;
103+
this.format();
104+
}
103105
break;
104106
case "onWillChangeSetting":
105107
const settingValue: string | undefined = FormatterConverter.webView2ProfileConvert(e.id, e.value.toString());

src/formatter-settings/types.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ export enum Category {
3232
}
3333

3434
export enum ExampleKind {
35-
INDENTATION_EXAMPLE,
36-
BLANKLINE_EXAMPLE,
37-
COMMENT_EXAMPLE,
38-
INSERTLINE_EXAMPLE,
39-
BRACED_CODE_TYPE_EXAMPLE,
40-
BRACED_CODE_RECORD_EXAMPLE,
41-
BRACED_CODE_ENUM_EXAMPLE,
42-
ANNOTATION_AND_ANONYMOUS_EXAMPLE,
43-
WHITESPACE_EXAMPLE,
44-
WRAPPING_EXAMPLE,
35+
INDENTATION_EXAMPLE = "Indentation",
36+
BLANKLINE_EXAMPLE = "Blank line",
37+
COMMENT_EXAMPLE = "Comment",
38+
INSERTLINE_EXAMPLE = "Insert Line",
39+
BRACED_CODE_TYPE_EXAMPLE = "Braced type",
40+
BRACED_CODE_RECORD_EXAMPLE = "Braced record",
41+
BRACED_CODE_ENUM_EXAMPLE = "Braced enum",
42+
ANNOTATION_AND_ANONYMOUS_EXAMPLE = "Annotation and anonymous",
43+
WHITESPACE_EXAMPLE = "Whitespace",
44+
WRAPPING_EXAMPLE = "Wrapping",
4545
}
4646

4747
// two extra properties from xmldom package, see https://www.npmjs.com/package/xmldom

0 commit comments

Comments
 (0)