Skip to content
Merged
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
1 change: 1 addition & 0 deletions com.microsoft.copilot.eclipse.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Require-Bundle: org.eclipse.lsp4e;bundle-version="0.18.1",
org.eclipse.wildwebdeveloper.embedder.node;bundle-version="1.0.3";resolution:=optional,
org.eclipse.core.net;bundle-version="1.5.200",
org.eclipse.core.resources;bundle-version="3.20.0",
org.eclipse.core.filesystem;bundle-version="1.10.200",
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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
import com.microsoft.copilot.eclipse.core.lsp.protocol.ConversationContextParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.CurrentEditorContext;
import com.microsoft.copilot.eclipse.core.lsp.protocol.DidChangeFeatureFlagsParams;
import com.microsoft.copilot.eclipse.core.lsp.protocol.FindFilesParams;
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;
Expand Down Expand Up @@ -345,6 +349,22 @@ public CompletableFuture<ReadDirectoryResult> readDirectory(String uri) {
return CompletableFuture.supplyAsync(() -> FileUtils.readDirectoryEntries(uri));
}

/**
* Searches for files matching a glob pattern under the given base URI.
*/
@JsonRequest("workspace/findFiles")
public CompletableFuture<FindFilesResult> findFiles(FindFilesParams params) {
return CompletableFuture.supplyAsync(() -> FileUtils.findFiles(params));
}

/**
* Searches for text (or a regex) in files under the given base URI.
*/
@JsonRequest("workspace/findTextInFiles")
public CompletableFuture<FindTextInFilesResult> findTextInFiles(FindTextInFilesParams params) {
return CompletableFuture.supplyAsync(() -> FileUtils.findTextInFiles(params));
}
Comment thread
ethanyhou marked this conversation as resolved.

/**
* Handles the progress notification for chat replies.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

package com.microsoft.copilot.eclipse.core.lsp.protocol;

/**
* Parameters for the {@code workspace/findFiles} request. Used by the language server to ask the client to search for
* files matching a glob pattern under a given base URI (e.g. a semanticfs workspace folder).
*
* @param baseUri the base URI to search under (e.g. a semanticfs workspace folder)
* @param pattern the glob pattern to match file paths against
* @param maxResults the maximum number of results to return (optional)
*/
public record FindFilesParams(String baseUri, String pattern, int maxResults) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

package com.microsoft.copilot.eclipse.core.lsp.protocol;

import java.util.List;

/**
* Result of the {@code workspace/findFiles} request, containing URIs of files matching the glob pattern.
*
* @param uris the list of file URIs matching the glob pattern
*/
public record FindFilesResult(List<String> uris) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

package com.microsoft.copilot.eclipse.core.lsp.protocol;

/**
* Parameters for the {@code workspace/findTextInFiles} request. Used by the language server to ask the client to search
* for text (or a regex) in files under a given base URI.
*
* @param baseUri the base URI to search under (e.g. a semanticfs workspace folder)
* @param query the text or regex pattern to search for in files
* @param isRegexp whether the query is a regular expression
* @param includePattern an optional glob pattern to filter which files to search
* @param maxResults the maximum number of results to return (optional)
*/
public record FindTextInFilesParams(String baseUri, String query, Boolean isRegexp, String includePattern,
int maxResults) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

package com.microsoft.copilot.eclipse.core.lsp.protocol;

import java.util.List;

/**
* Result of the {@code workspace/findTextInFiles} request, containing the list of matches.
*
* @param matches the list of text search matches
*/
public record FindTextInFilesResult(List<TextSearchMatch> matches) {

/**
* A single text search match. Field names mirror the CLS protocol.
*
* @param uri the URI of the file containing the match
* @param lineNumber the 1-based line number of the match within the file
* @param lineText the full text of the line containing the match
*/
public record TextSearchMatch(String uri, int lineNumber, String lineText) {
}

}
Loading
Loading