Skip to content

Commit 0861575

Browse files
committed
Cleanup
1 parent 96ff3f5 commit 0861575

File tree

3 files changed

+10
-31
lines changed

3 files changed

+10
-31
lines changed

src/vs/workbench/contrib/chat/browser/chatEditor.ts

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ export class ChatEditor extends EditorPane {
128128

129129
// Need to set props individually on the memento
130130
this._viewState.inputValue = widgetViewState.inputValue;
131-
this._viewState.selectedLanguageModelId = widgetViewState.selectedLanguageModelId;
132131
this._memento.saveMemento();
133132
}
134133
}

src/vs/workbench/contrib/chat/browser/chatWidget.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ const $ = dom.$;
6060
export interface IChatViewState {
6161
inputValue?: string;
6262
inputState?: IChatInputState;
63-
selectedLanguageModelId?: string;
6463
}
6564

6665
export interface IChatWidgetStyles extends IChatInputStyles {
@@ -1261,8 +1260,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
12611260
getViewState(): IChatViewState {
12621261
return {
12631262
inputValue: this.getInput(),
1264-
inputState: this.inputPart.getViewState(),
1265-
selectedLanguageModelId: this.inputPart.currentLanguageModel,
1263+
inputState: this.inputPart.getViewState()
12661264
};
12671265
}
12681266

src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts

+9-27
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,22 @@ import { IContextKey, IContextKeyService } from '../../../../platform/contextkey
3333
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
3434
import { IInstantiationService, ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
3535
import { ILogService } from '../../../../platform/log/common/log.js';
36+
import { IEditorService, SIDE_GROUP } from '../../../services/editor/common/editorService.js';
37+
import { IViewsService } from '../../../services/views/common/viewsService.js';
3638
import { showChatView } from '../../chat/browser/chat.js';
37-
import { IChatViewState, IChatWidgetLocationOptions } from '../../chat/browser/chatWidget.js';
39+
import { IChatWidgetLocationOptions } from '../../chat/browser/chatWidget.js';
3840
import { ChatAgentLocation } from '../../chat/common/chatAgents.js';
41+
import { ChatContextKeys } from '../../chat/common/chatContextKeys.js';
3942
import { ChatModel, ChatRequestRemovalReason, IChatRequestModel, IChatTextEditGroup, IChatTextEditGroupState, IResponse } from '../../chat/common/chatModel.js';
4043
import { IChatService } from '../../chat/common/chatService.js';
41-
import { HunkInformation, Session, StashedSession } from './inlineChatSession.js';
42-
import { InlineChatError } from './inlineChatSessionServiceImpl.js';
43-
import { EditModeStrategy, HunkAction, IEditObserver, LiveStrategy, PreviewStrategy, ProgressingEditsOptions } from './inlineChatStrategies.js';
44-
import { CTX_INLINE_CHAT_EDITING, CTX_INLINE_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_RESPONSE_TYPE, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_VISIBLE, EditMode, INLINE_CHAT_ID, InlineChatConfigKeys, InlineChatResponseType } from '../common/inlineChat.js';
4544
import { INotebookEditorService } from '../../notebook/browser/services/notebookEditorService.js';
46-
import { IEditorService, SIDE_GROUP } from '../../../services/editor/common/editorService.js';
47-
import { IViewsService } from '../../../services/views/common/viewsService.js';
45+
import { CTX_INLINE_CHAT_EDITING, CTX_INLINE_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_RESPONSE_TYPE, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_VISIBLE, EditMode, INLINE_CHAT_ID, InlineChatConfigKeys, InlineChatResponseType } from '../common/inlineChat.js';
4846
import { IInlineChatSavingService } from './inlineChatSavingService.js';
47+
import { HunkInformation, Session, StashedSession } from './inlineChatSession.js';
4948
import { IInlineChatSessionService } from './inlineChatSessionService.js';
49+
import { InlineChatError } from './inlineChatSessionServiceImpl.js';
50+
import { EditModeStrategy, HunkAction, IEditObserver, LiveStrategy, PreviewStrategy, ProgressingEditsOptions } from './inlineChatStrategies.js';
5051
import { InlineChatZoneWidget } from './inlineChatZoneWidget.js';
51-
import { ChatContextKeys } from '../../chat/common/chatContextKeys.js';
52-
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
5352

5453
export const enum State {
5554
CREATE_SESSION = 'CREATE_SESSION',
@@ -104,8 +103,6 @@ export class InlineChatController implements IEditorContribution {
104103
return editor.getContribution<InlineChatController>(INLINE_CHAT_ID);
105104
}
106105

107-
private static readonly _storageKey = 'inlineChatController.state';
108-
109106
private _isDisposed: boolean = false;
110107
private readonly _store = new DisposableStore();
111108

@@ -147,7 +144,6 @@ export class InlineChatController implements IEditorContribution {
147144
@IContextKeyService contextKeyService: IContextKeyService,
148145
@IChatService private readonly _chatService: IChatService,
149146
@IEditorService private readonly _editorService: IEditorService,
150-
@IStorageService private readonly _storageService: IStorageService,
151147
@INotebookEditorService notebookEditorService: INotebookEditorService,
152148
) {
153149
this._ctxVisible = CTX_INLINE_CHAT_VISIBLE.bindTo(contextKeyService);
@@ -411,7 +407,7 @@ export class InlineChatController implements IEditorContribution {
411407
this._sessionStore.add(this._session.wholeRange.onDidChange(handleWholeRangeChange));
412408
handleWholeRangeChange();
413409

414-
this._ui.value.widget.setChatModel(this._session.chatModel, this._retrieveWidgetState());
410+
this._ui.value.widget.setChatModel(this._session.chatModel);
415411
this._updatePlaceholder();
416412

417413
const isModelEmpty = !this._session.chatModel.hasRequests;
@@ -893,11 +889,6 @@ export class InlineChatController implements IEditorContribution {
893889
this._ctxUserDidEdit.reset();
894890

895891
if (this._ui.rawValue) {
896-
// persist selected LM in memento
897-
const { selectedLanguageModelId } = this._ui.rawValue.widget.chatWidget.getViewState();
898-
const state = { selectedLanguageModelId };
899-
this._storageService.store(InlineChatController._storageKey, state, StorageScope.PROFILE, StorageTarget.USER);
900-
901892
this._ui.rawValue.hide();
902893
}
903894

@@ -907,15 +898,6 @@ export class InlineChatController implements IEditorContribution {
907898
}
908899
}
909900

910-
private _retrieveWidgetState(): IChatViewState | undefined {
911-
try {
912-
const state = JSON.parse(this._storageService.get(InlineChatController._storageKey, StorageScope.PROFILE) ?? '{}');
913-
return state;
914-
} catch {
915-
return undefined;
916-
}
917-
}
918-
919901
private _updateCtxResponseType(): void {
920902

921903
if (!this._session) {

0 commit comments

Comments
 (0)