mirror of
https://github.com/cline/cline.git
synced 2026-09-21 05:10:09 +08:00
Adds the `textDocuments` RPC method to the VS Code host bridge. This method allows the client to retrieve a list of currently open text documents in the VS Code workspace, along with their paths, active status, and view column information. The changes include: - Adding `textDocuments` RPC method to `WorkspaceService` in `proto/host/workspace.proto`. - Creating `src/hosts/vscode/hostbridge/workspace/textDocuments.ts` to implement the `textDocuments` method, which retrieves the list of open documents from `vscode.workspace.textDocuments` and their associated metadata. - Updating `DiffViewProvider.ts` to use the new `textDocuments` RPC method to check if a file is already open and dirty before getting its contents. This ensures that the latest version of the file is used.
40 lines
1.3 KiB
Protocol Buffer
40 lines
1.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package host;
|
|
option java_package = "bot.cline.host.proto";
|
|
option java_multiple_files = true;
|
|
import "host/window.proto";
|
|
|
|
// Provides methods for working with workspaces/projects.
|
|
service WorkspaceService {
|
|
// Returns a list of the top level directories of the workspace.
|
|
rpc getWorkspacePaths(GetWorkspacePathsRequest) returns (GetWorkspacePathsResponse);
|
|
rpc textDocuments(TextDocumentsRequest) returns (TextDocumentsResponse);
|
|
}
|
|
|
|
message GetWorkspacePathsRequest {
|
|
// The unique ID for the workspace/project.
|
|
// This is currently optional in vscode. It is required in other environments where cline is running at
|
|
// the application level, and the user can open multiple projects.
|
|
optional string id = 1;
|
|
}
|
|
|
|
message GetWorkspacePathsResponse {
|
|
// The unique ID for the workspace/project.
|
|
optional string id = 1;
|
|
repeated string paths = 2;
|
|
}
|
|
|
|
message TextDocumentsRequest {
|
|
// The unique ID for the workspace/project.
|
|
// This is currently optional in vscode. It is required in other environments where cline is running at
|
|
// the application level, and the user can open multiple projects.
|
|
optional string id = 1;
|
|
}
|
|
|
|
message TextDocumentsResponse {
|
|
// The unique ID for the workspace/project.
|
|
optional string id = 1;
|
|
// The list of text documents in the workspace.
|
|
repeated TextEditorInfo editors = 2;
|
|
} |