* WIP host bridge * Run formatter * remove tmp impl & rename host grpc client * gitignore more files * better layout * host handler to make other hosts easier to add * remove adapter pattern * get host responses correctly * fix streaming mode for host bridge * first wip subscription host bridge demo for watching mcp server config * format, comment * add cancellation for host grpc stream * remove unneeded functions from host-grpc-handler * add a method for canceling request rather than using the registry * another todo * use StringRequest for uri.proto * debounce new file watcher * remove test setup * remove some todos and logs * remove registry use todo * Revert "remove registry use todo" This reverts commit 84078d3469b9cd7875f63c7fc7f66a29fac99654. * fix capitalization of uri.proto * a better pattern for a callback based bridge without using the requestRegistry directly --------- Co-authored-by: Andrei Edell <andrei@nugbase.com> Co-authored-by: Sarah Fortune <sarah.fortune@gmail.com> Co-authored-by: Andrei Eternal <eternal@cline.bot>
29 lines
867 B
TypeScript
29 lines
867 B
TypeScript
import * as vscode from "vscode"
|
|
import { JoinPathRequest, Uri } from "../../../src/shared/proto/host/uri"
|
|
|
|
/**
|
|
* Joins a URI with additional path segments
|
|
* @param request The request containing the base URI and path segments
|
|
* @returns A new URI with the path segments joined
|
|
*/
|
|
export async function joinPath(request: JoinPathRequest): Promise<Uri> {
|
|
// Convert proto Uri to vscode.Uri
|
|
if (!request.base) {
|
|
throw new Error("Base URI is required")
|
|
}
|
|
const baseUri = vscode.Uri.parse(`${request.base.scheme}://${request.base.authority}${request.base.path}`)
|
|
|
|
// Join paths
|
|
const result = vscode.Uri.joinPath(baseUri, ...request.pathSegments)
|
|
|
|
// Convert back to proto Uri
|
|
return Uri.create({
|
|
scheme: result.scheme,
|
|
authority: result.authority,
|
|
path: result.path,
|
|
query: result.query,
|
|
fragment: result.fragment,
|
|
fsPath: result.fsPath,
|
|
})
|
|
}
|