Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';

import { workspace, ExtensionContext, extensions, window, commands, Uri, ConfigurationTarget } from 'vscode';
import { workspace, ExtensionContext, extensions, window, commands, Uri } from 'vscode';
import {
CommonLanguageClient,
LanguageClientOptions,
Expand Down Expand Up @@ -161,7 +161,7 @@ export function startClient(
findConflicts();
client
.onReady()
.then(async () => {
.then(() => {
// Send a notification to the server with any YAML schema associations in all extensions
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations());

Expand Down Expand Up @@ -218,8 +218,6 @@ export function startClient(
});

initializeRecommendation(context);

await setDefaultFormatter(['dockercompose', 'github-actions-workflow']);
})
.catch((err) => {
sendStartupTelemetryEvent(runtime.telemetry, false, err);
Expand All @@ -228,23 +226,6 @@ export function startClient(
return schemaExtensionAPI;
}

/**
* set redhat.vscode-yaml as default formatter
* @param extensions [dockercompose, github-actions-workflow]
*/
async function setDefaultFormatter(extensions: string[]): Promise<void> {
const config = workspace.getConfiguration();
extensions.forEach(async (extension) => {
const extensionConf = config.get<Record<string, string>>(`[${extension}]`) || {};
if (extensionConf) {
if (extensionConf['editor.defaultFormatter'] === undefined) {
extensionConf['editor.defaultFormatter'] = 'redhat.vscode-yaml';
await config.update(`[${extension}]`, extensionConf, ConfigurationTarget.Global);
}
}
});
}

/**
* Finds extensions that conflict with VSCode-YAML.
* If one or more conflicts are found then show an uninstall notification
Expand Down
Loading