Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ connection to the language server. A capability is an *offer of support*, not a
A gate that exposes in-development features to a subset of users. It is distinct
from the sub-agent policy: after this change, the availability of sub-agents no
longer depends on the client preview feature.

### Workspace folder
A project root associated with a chat so project-scoped prompts, skills, agents,
and instructions can be discovered. A workspace folder does not imply that the
project's files are semantically indexed.

### Workspace instructions
Custom instructions associated with workspace folders and loaded into chat.
They are distinct from semantic search over project files.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
package com.microsoft.copilot.eclipse.core.lsp;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;

import java.io.IOException;

import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.junit.jupiter.api.Test;

import com.microsoft.copilot.eclipse.core.lsp.protocol.InitializationOptions;

class LsStreamConnectionProviderTests {

private static final String LEGACY_WORKSPACE_CONTEXT_PREFERENCE = "workspaceContextEnabled";
private static final String UI_PREFERENCE_NODE = "com.microsoft.copilot.eclipse.ui";

@Test
void testInitializationOptions() {
LsStreamConnectionProvider provider = new LsStreamConnectionProvider();
Expand All @@ -23,6 +29,27 @@ void testInitializationOptions() {
assertEquals(LsStreamConnectionProvider.EDITOR_PLUGIN_NAME, options.getEditorPluginInfo().getName());
}

@Test
void testInitializationIgnoresLegacyWorkspaceContextPreference() {
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(UI_PREFERENCE_NODE);
String previousValue = preferences.get(LEGACY_WORKSPACE_CONTEXT_PREFERENCE, null);
preferences.putBoolean(LEGACY_WORKSPACE_CONTEXT_PREFERENCE, true);

try {
LsStreamConnectionProvider provider = new LsStreamConnectionProvider();

InitializationOptions options = (InitializationOptions) provider.getInitializationOptions(null);

assertFalse(options.getCopilotCapabilities().isWatchedFiles());
} finally {
if (previousValue == null) {
preferences.remove(LEGACY_WORKSPACE_CONTEXT_PREFERENCE);
} else {
preferences.put(LEGACY_WORKSPACE_CONTEXT_PREFERENCE, previousValue);
}
}
}

@Test
void testStartLanguageServer() throws IOException {
LsStreamConnectionProvider provider = new LsStreamConnectionProvider();
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion com.microsoft.copilot.eclipse.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Require-Bundle: org.eclipse.lsp4e;bundle-version="0.18.1",
org.eclipse.core.runtime;bundle-version="[3.30.0,4.0.0)",
org.apache.httpcomponents.client5.httpclient5;bundle-version="5.2.1",
org.apache.httpcomponents.core5.httpcore5;bundle-version="5.2.3",
org.eclipse.jgit;bundle-version="6.8.0",
org.osgi.service.event;bundle-version="1.4.1",
org.eclipse.e4.core.services;bundle-version="2.4.200",
org.eclipse.e4.core.contexts;bundle-version="1.12.400"
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ private Constants() {
public static final String ENABLE_STRICT_SSL = "enableStrictSsl";
public static final String PROXY_KERBEROS_SP = "proxyKerberosSp";
public static final String GITHUB_ENTERPRISE = "githubEnterprise";
public static final String WORKSPACE_CONTEXT_ENABLED = "workspaceContextEnabled";
public static final String AGENT_MAX_REQUESTS = "agentMaxRequests";
public static final String ENABLE_SKILLS = "enableSkills";
public static final String TRANSCRIPT_SUBDIR = ".copilot/eclipse";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

package com.microsoft.copilot.eclipse.core;

import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;

/**
* Class to manage feature flags for the Copilot plugin. This class allows enabling or disabling features.
*/
Expand Down Expand Up @@ -108,23 +105,6 @@ public void setClientPreviewFeatureEnabled(boolean clientPreviewFeatureEnabled)
this.clientPreviewFeatureEnabled = clientPreviewFeatureEnabled;
}

/**
* Checks if the workspace context is enabled.
*
* @return true if the workspace context is enabled, false otherwise.
*/
public static boolean isWorkspaceContextEnabled() {
// Directly access the instance scope of Eclipse preferences, which are preferences that are specific to the
// current workspace. So the code won't need to involve any component from the UI plugin.
// The file name for the preferences is "com.microsoft.copilot.eclipse.ui.prefs"
IEclipsePreferences uiPrefs = InstanceScope.INSTANCE.getNode("com.microsoft.copilot.eclipse.ui");
if (uiPrefs != null) {
return uiPrefs.getBoolean(Constants.WORKSPACE_CONTEXT_ENABLED, false);
}

return false;
}

/**
* Checks if the custom agent is enabled.
* Custom agent is enabled only if the organization policy allows it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.eclipse.lsp4j.ProgressParams;
import org.eclipse.lsp4j.ShowDocumentParams;
import org.eclipse.lsp4j.ShowDocumentResult;
import org.eclipse.lsp4j.WorkspaceFolder;
import org.eclipse.lsp4j.jsonrpc.messages.ResponseError;
import org.eclipse.lsp4j.jsonrpc.messages.ResponseErrorCode;
import org.eclipse.lsp4j.jsonrpc.services.JsonNotification;
Expand Down Expand Up @@ -54,8 +53,6 @@
import com.microsoft.copilot.eclipse.core.lsp.protocol.FindFilesResult;
import com.microsoft.copilot.eclipse.core.lsp.protocol.FindTextInFilesParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.FindTextInFilesResult;
import com.microsoft.copilot.eclipse.core.lsp.protocol.GetWatchedFilesRequest;
import com.microsoft.copilot.eclipse.core.lsp.protocol.GetWatchedFilesResponse;
import com.microsoft.copilot.eclipse.core.lsp.protocol.InvokeClientToolConfirmationParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.InvokeClientToolParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.LanguageModelToolResult;
Expand All @@ -80,8 +77,6 @@ public class CopilotLanguageClient extends LanguageClientImpl {
private static final String HTTP = "http"; //$NON-NLS-1$
private static final String COPILOT_FILE_ENCODING_SECTION = "copilot.file.encoding"; //$NON-NLS-1$

private WatchedFileManager watchedFileManager;

private IEventBroker eventBroker;

private static final String SIGNUP_URL = "https://github.com/github-copilot/signup";
Expand Down Expand Up @@ -186,20 +181,6 @@ public CompletableFuture<Object[]> confirmClientTool(InvokeClientToolConfirmatio
});
}

// TODO: Should remove workspace-root folder as the projects are not directly under it in Eclipse, and can cause
// confusion in CLS.
@Override
public CompletableFuture<List<WorkspaceFolder>> workspaceFolders() {
// Ideally, we should return each IProject as a workspace folder, but given that when
// creating a new conversation or new conversation turn, the uri of the workspace folder
// is required to use the @project (or @workspace) agent. There is no easy way to guess which
// IProject should be used. So we are returning the workspace root as a single workspace folder.
final WorkspaceFolder folder = new WorkspaceFolder();
folder.setUri(PlatformUtils.getWorkspaceRootUri());
folder.setName("workspace-root"); // $NON-NLS-1$
return CompletableFuture.completedFuture(List.of(folder));
}

@Override
public CompletableFuture<List<Object>> configuration(ConfigurationParams params) {
return CompletableFuture.supplyAsync(() -> {
Expand All @@ -223,17 +204,6 @@ public CompletableFuture<List<Object>> configuration(ConfigurationParams params)
});
}

/**
* Get the conversation context for the given request.
*/
@JsonRequest("copilot/watchedFiles")
public CompletableFuture<GetWatchedFilesResponse> getWatchedFiles(GetWatchedFilesRequest params) {
if (watchedFileManager == null) {
watchedFileManager = new WatchedFileManager();
}
return watchedFileManager.getWatchedFilesWithProgress(params);
}

/**
* Notify when mcp server/tool change.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.microsoft.copilot.eclipse.core.lsp.protocol.CheckStatusParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.CompletionParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.CompletionResult;
import com.microsoft.copilot.eclipse.core.lsp.protocol.ConversationAgent;
import com.microsoft.copilot.eclipse.core.lsp.protocol.ConversationCodeCopyParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.ConversationCreateParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.ConversationDestroyParams;
Expand Down Expand Up @@ -223,12 +222,6 @@ public interface CopilotLanguageServer extends LanguageServer {
@JsonRequest("copilot/models")
CompletableFuture<CopilotModel[]> listModels(NullParams param);

/**
* Get the conversation agents.
*/
@JsonRequest("conversation/agents")
CompletableFuture<ConversationAgent[]> listAgents(NullParams params);

/**
* Notify the code acceptance.
*/
Expand Down
Loading
Loading