Skip to content

Commit 2847471

Browse files
committed
Don't initialize with VsWindowLogger if the showWindowMessages is false
1 parent 89db3d6 commit 2847471

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,19 @@
2222
"onLanguage:markdown"
2323
],
2424
"main": "./out/src/extension/extension",
25-
"contributes": {},
25+
"contributes": {
26+
"configuration": {
27+
"type": "object",
28+
"title": "Markdown Table Prettifier Configuration",
29+
"properties": {
30+
"markdownTablePrettify.showWindowMessages": {
31+
"type": "boolean",
32+
"default": true,
33+
"description": "Whether or not show window messages."
34+
}
35+
}
36+
}
37+
},
2638
"capabilities": {
2739
"documentFormattingProvider": "true"
2840
},

src/extension/prettyfierFactory.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ export function getDocumentRangePrettyfier(strict: boolean = false) {
3131
)
3232
),
3333
new TableStringWriter(),
34-
[new VsWindowLogger(), new ConsoleLogger()]
34+
[
35+
...(canShowWindowMessages() ? [ new VsWindowLogger() ] : []),
36+
new ConsoleLogger()
37+
]
3538
);
3639
}
3740

@@ -40,4 +43,12 @@ export function getDocumentPrettyfier(strict: boolean = true): vscode.DocumentFo
4043
new TableFinder(new TableValidator(new SelectionInterpreter(strict))),
4144
getDocumentRangePrettyfier(strict)
4245
);
46+
}
47+
48+
function canShowWindowMessages(): boolean {
49+
return getConfigurationValue<boolean>("showWindowMessages", true);
50+
}
51+
52+
function getConfigurationValue<T>(key: string, defaultValue: T): T {
53+
return vscode.workspace.getConfiguration("markdownTablePrettify").get(key, defaultValue);
4354
}

0 commit comments

Comments
 (0)