forked from microsoft/copilot-for-eclipse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCopilotPreferenceInitializer.java
More file actions
71 lines (63 loc) · 2.93 KB
/
Copy pathCopilotPreferenceInitializer.java
File metadata and controls
71 lines (63 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package com.microsoft.copilot.eclipse.ui.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.preference.IPreferenceStore;
import com.microsoft.copilot.eclipse.core.Constants;
import com.microsoft.copilot.eclipse.core.chat.CustomInstructionsChatLoadScope;
import com.microsoft.copilot.eclipse.ui.CopilotUi;
/**
* A class to initialize the default preferences for the plugin.
*/
public class CopilotPreferenceInitializer extends AbstractPreferenceInitializer {
public static final String DEFAULT_MCP_REGISTRY_BASE_URL = "https://api.mcp.github.com";
@Override
public void initializeDefaultPreferences() {
IPreferenceStore pref = CopilotUi.getPlugin().getPreferenceStore();
pref.setDefault(Constants.AUTO_SHOW_COMPLETION, true);
pref.setDefault(Constants.ENABLE_NEXT_EDIT_SUGGESTION, false);
pref.setDefault(Constants.ENABLE_STRICT_SSL, true);
pref.setDefault(Constants.PROXY_KERBEROS_SP, "");
pref.setDefault(Constants.GITHUB_ENTERPRISE, "");
pref.setDefault(Constants.WORKSPACE_CONTEXT_ENABLED, false);
pref.setDefault(Constants.SUB_AGENT_ENABLED, true);
pref.setDefault(Constants.AGENT_MAX_REQUESTS, 25);
pref.setDefault(Constants.ENABLE_SKILLS, true);
pref.setDefault(Constants.CUSTOM_INSTRUCTIONS_WORKSPACE_ENABLED, false);
pref.setDefault(Constants.CUSTOM_INSTRUCTIONS_WORKSPACE, "");
pref.setDefault(Constants.CUSTOM_INSTRUCTIONS_CHAT_LOAD_SCOPE,
CustomInstructionsChatLoadScope.DEFAULT_VALUE.getValue());
pref.setDefault(Constants.AUTO_BREAKPOINT_RESPONSE, false);
pref.setDefault(Constants.MCP, """
{
"servers": {
// example 1: local mcp server
// "local-mcp-server": {
// "type": "stdio",
// "command": "my-command",
// "args": [],
// "env": { "<KEY>": "<VALUE>" }
// }
// example 2: remote mcp server
// "remote-mcp-server": {
// "url": "<URL>",
// "requestInit": {
// "headers": {
// "Authorization": "Bearer <TOKEN>"
// }
// }
// }
}
}
""");
pref.setDefault(Constants.MCP_TOOLS_STATUS, "{}");
IEclipsePreferences configPrefs = ConfigurationScope.INSTANCE
.getNode(CopilotUi.getPlugin().getBundle().getSymbolicName());
boolean autoShowWhatsNew = configPrefs.getBoolean(Constants.AUTO_SHOW_WHAT_IS_NEW, true);
pref.setDefault(Constants.AUTO_SHOW_WHAT_IS_NEW, autoShowWhatsNew);
String mcpRegistryUrl = configPrefs.get(Constants.MCP_REGISTRY_URL, DEFAULT_MCP_REGISTRY_BASE_URL);
pref.setDefault(Constants.MCP_REGISTRY_URL, mcpRegistryUrl);
}
}