Skip to content

Commit ef16f01

Browse files
committed
Revert "update settings.json as default formatter as yaml"
This reverts commit 84d4516. Fixes #1157 Adjusting the user settings automatically was annoying to some users. The main bug fix, which consisted of setting the document selector to include Docker Compose and GitHub Action files, will not be reverted.
1 parent 2e69ade commit ef16f01

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

src/extension.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*--------------------------------------------------------------------------------------------*/
77
'use strict';
88

9-
import { workspace, ExtensionContext, extensions, window, commands, Uri, ConfigurationTarget } from 'vscode';
9+
import { workspace, ExtensionContext, extensions, window, commands, Uri } from 'vscode';
1010
import {
1111
CommonLanguageClient,
1212
LanguageClientOptions,
@@ -161,7 +161,7 @@ export function startClient(
161161
findConflicts();
162162
client
163163
.onReady()
164-
.then(async () => {
164+
.then(() => {
165165
// Send a notification to the server with any YAML schema associations in all extensions
166166
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations());
167167

@@ -218,8 +218,6 @@ export function startClient(
218218
});
219219

220220
initializeRecommendation(context);
221-
222-
await setDefaultFormatter(['dockercompose', 'github-actions-workflow']);
223221
})
224222
.catch((err) => {
225223
sendStartupTelemetryEvent(runtime.telemetry, false, err);
@@ -228,23 +226,6 @@ export function startClient(
228226
return schemaExtensionAPI;
229227
}
230228

231-
/**
232-
* set redhat.vscode-yaml as default formatter
233-
* @param extensions [dockercompose, github-actions-workflow]
234-
*/
235-
async function setDefaultFormatter(extensions: string[]): Promise<void> {
236-
const config = workspace.getConfiguration();
237-
extensions.forEach(async (extension) => {
238-
const extensionConf = config.get<Record<string, string>>(`[${extension}]`) || {};
239-
if (extensionConf) {
240-
if (extensionConf['editor.defaultFormatter'] === undefined) {
241-
extensionConf['editor.defaultFormatter'] = 'redhat.vscode-yaml';
242-
await config.update(`[${extension}]`, extensionConf, ConfigurationTarget.Global);
243-
}
244-
}
245-
});
246-
}
247-
248229
/**
249230
* Finds extensions that conflict with VSCode-YAML.
250231
* If one or more conflicts are found then show an uninstall notification

0 commit comments

Comments
 (0)