Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/conversation/vscode-node/welcomeMessageProvider.ts
13399 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
7
import * as vscode from 'vscode';
8
import { ICopilotTokenStore } from '../../../platform/authentication/common/copilotTokenStore';
9
import { ConfigKey, IConfigurationService } from '../../../platform/configuration/common/configurationService';
10
import { ServicesAccessor } from '../../../util/vs/platform/instantiation/common/instantiation';
11
12
13
export function getAdditionalWelcomeMessage(accessor: ServicesAccessor): vscode.MarkdownString | undefined {
14
const configurationService = accessor.get(IConfigurationService);
15
const copilotTokenStore = accessor.get(ICopilotTokenStore);
16
const isInternalOrTeam = !!copilotTokenStore.copilotToken?.isInternal || !!copilotTokenStore.copilotToken?.isVscodeTeamMember;
17
// For internal/team users, default to showing the hint unless the user has explicitly disabled it
18
const showHint = isInternalOrTeam && !configurationService.isConfigured(ConfigKey.TeamInternal.InternalWelcomeHintEnabled)
19
? true
20
: configurationService.getConfig(ConfigKey.TeamInternal.InternalWelcomeHintEnabled);
21
if (showHint) {
22
const openSettingsCommand = 'workbench.action.openSettings';
23
const messageString = new vscode.MarkdownString(vscode.l10n.t({
24
message: 'If handling customer data, [disable telemetry]({0}).',
25
args: [`command:${openSettingsCommand}?${encodeURIComponent('["telemetry.telemetryLevel"]')}`],
26
// To make sure the translators don't break the link
27
comment: [`{Locked=']({'}`]
28
}));
29
messageString.isTrusted = { enabledCommands: [openSettingsCommand] };
30
return messageString;
31
}
32
return undefined;
33
}
34
35