From d3547134e7552eff9b650cfb00f0e5d83d042004 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Mon, 17 Feb 2025 15:22:24 -0800 Subject: [PATCH] get ready to add searchReplaceService --- .../contrib/void/browser/editCodeService.ts | 4 +- .../void/browser/searchReplaceService.ts | 37 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/vs/workbench/contrib/void/browser/searchReplaceService.ts diff --git a/src/vs/workbench/contrib/void/browser/editCodeService.ts b/src/vs/workbench/contrib/void/browser/editCodeService.ts index 8468a241..989086a6 100644 --- a/src/vs/workbench/contrib/void/browser/editCodeService.ts +++ b/src/vs/workbench/contrib/void/browser/editCodeService.ts @@ -1192,7 +1192,7 @@ class EditCodeService extends Disposable implements IEditCodeService { const userMessageContent = searchReplace_userMessage({ originalCode: fileContents, applyStr: applyStr }) const messages: LLMChatMessage[] = [ { role: 'system', content: searchReplace_systemMessage }, - { role: 'user', content: userMessageContent } + { role: 'user', content: userMessageContent }, ] let streamRequestIdRef: { current: string | null } = { current: null } @@ -1232,8 +1232,10 @@ class EditCodeService extends Disposable implements IEditCodeService { } + // any time there's an error, add assistant's message, then user message saying the problem and to retry // TODO!!! turn this into a service and provide it + // this generates >>>>>>> ORIGINAL <<<<<<< REPLACE blocks and and simultaneously applies it streamRequestIdRef.current = this._llmMessageService.sendLLMMessage({ messagesType: 'chatMessages', useProviderFor: 'Apply', diff --git a/src/vs/workbench/contrib/void/browser/searchReplaceService.ts b/src/vs/workbench/contrib/void/browser/searchReplaceService.ts new file mode 100644 index 00000000..9bf958c4 --- /dev/null +++ b/src/vs/workbench/contrib/void/browser/searchReplaceService.ts @@ -0,0 +1,37 @@ +/*-------------------------------------------------------------------------------------- + * Copyright 2025 Glass Devtools, Inc. All rights reserved. + * Licensed under the Apache License, Version 2.0. See LICENSE.txt for more information. + *--------------------------------------------------------------------------------------*/ + +import { Emitter, Event } from '../../../../base/common/event.js'; +import { Disposable } from '../../../../base/common/lifecycle.js'; +import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js'; +import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js'; +import { ILLMMessageService } from '../common/llmMessageService.js'; + + + +export interface ISearchReplaceService { + readonly _serviceBrand: undefined; +} + +export const ISearchReplaceService = createDecorator('SearchReplaceService'); +class SearchReplaceService extends Disposable implements ISearchReplaceService { + _serviceBrand: undefined; + + static readonly ID = 'SearchReplaceService'; + + private readonly _onDidChangeState = new Emitter(); + readonly onDidChangeState: Event = this._onDidChangeState.event; + + constructor( + @ILLMMessageService private readonly llmMessageService: ILLMMessageService, + ) { + super() + // this.llmMessageService.sendLLMMessage({}) + + } + +} + +registerSingleton(ISearchReplaceService, SearchReplaceService, InstantiationType.Eager);