Skip to content

Commit

Permalink
fix: restore refactor commits
Browse files Browse the repository at this point in the history
so that main package doesn't depend on xterm
  • Loading branch information
Loïc Mangeonjean committed Nov 18, 2024
1 parent 584777e commit 646f835
Show file tree
Hide file tree
Showing 3 changed files with 403 additions and 1 deletion.
142 changes: 142 additions & 0 deletions vscode-paches/0055-fix-extract-constants-into-separate-module.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= <[email protected]>
Date: Tue, 22 Oct 2024 13:04:46 +0200
Subject: [PATCH] fix: extract constants into separate module

so that only the constant is pulled from the root instead of the whole module graph
---
src/vs/workbench/api/browser/mainThreadChatAgents2.ts | 5 +++--
.../contrib/chat/browser/actions/chatActions.ts | 5 ++---
.../contrib/chat/browser/actions/chatConstants.ts | 10 ++++++++++
.../chat/browser/actions/chatQuickInputActions.ts | 3 ++-
.../chat/browser/contrib/chatDynamicVariables.ts | 3 ++-
.../browser/contrib/chatDynamicVariablesConstant.ts | 6 ++++++
.../contrib/quickaccess/browser/commandsQuickAccess.ts | 3 +--
7 files changed, 26 insertions(+), 9 deletions(-)
create mode 100644 src/vs/workbench/contrib/chat/browser/actions/chatConstants.ts
create mode 100644 src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariablesConstant.ts

diff --git a/src/vs/workbench/api/browser/mainThreadChatAgents2.ts b/src/vs/workbench/api/browser/mainThreadChatAgents2.ts
index 5de097d706d..b8fe352d99f 100644
--- a/src/vs/workbench/api/browser/mainThreadChatAgents2.ts
+++ b/src/vs/workbench/api/browser/mainThreadChatAgents2.ts
@@ -23,7 +23,7 @@ import { IInstantiationService } from '../../../platform/instantiation/common/in
import { ILogService } from '../../../platform/log/common/log.js';
import { IChatWidgetService } from '../../contrib/chat/browser/chat.js';
import { ChatInputPart } from '../../contrib/chat/browser/chatInputPart.js';
-import { AddDynamicVariableAction, IAddDynamicVariableContext } from '../../contrib/chat/browser/contrib/chatDynamicVariables.js';
+import { IAddDynamicVariableContext } from '../../contrib/chat/browser/contrib/chatDynamicVariables.js';
import { ChatAgentLocation, IChatAgentHistoryEntry, IChatAgentImplementation, IChatAgentRequest, IChatAgentService } from '../../contrib/chat/common/chatAgents.js';
import { ChatRequestAgentPart } from '../../contrib/chat/common/chatParserTypes.js';
import { ChatRequestParser } from '../../contrib/chat/common/chatRequestParser.js';
@@ -32,6 +32,7 @@ import { IExtHostContext, extHostNamedCustomer } from '../../services/extensions
import { IExtensionService } from '../../services/extensions/common/extensions.js';
import { Dto } from '../../services/extensions/common/proxyIdentifier.js';
import { ExtHostChatAgentsShape2, ExtHostContext, IChatParticipantMetadata, IChatProgressDto, IDynamicChatAgentProps, IExtensionChatAgentMetadata, MainContext, MainThreadChatAgentsShape2 } from '../common/extHost.protocol.js';
+import { addDynamicVariableActionId } from '../../contrib/chat/browser/contrib/chatDynamicVariablesConstant.js';

interface AgentData {
dispose: () => void;
@@ -313,7 +314,7 @@ export class MainThreadChatAgents2 extends Disposable implements MainThreadChatA
kind: CompletionItemKind.Text,
detail: v.detail,
documentation: v.documentation,
- command: { id: AddDynamicVariableAction.ID, title: '', arguments: [{ id: v.id, widget, range: rangeAfterInsert, variableData: revive(v.value) as any, command: v.command } satisfies IAddDynamicVariableContext] }
+ command: { id: addDynamicVariableActionId, title: '', arguments: [{ id: v.id, widget, range: rangeAfterInsert, variableData: revive(v.value) as any, command: v.command } satisfies IAddDynamicVariableContext] }
} satisfies CompletionItem;
});

diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
index 3b308d96078..0705038398a 100644
--- a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
+++ b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
@@ -49,9 +49,8 @@ import { URI } from '../../../../../base/common/uri.js';
import { IHostService } from '../../../../services/host/browser/host.js';
import { isCancellationError } from '../../../../../base/common/errors.js';
import { ITelemetryService } from '../../../../../platform/telemetry/common/telemetry.js';
-
-export const CHAT_CATEGORY = localize2('chat.category', 'Chat');
-export const CHAT_OPEN_ACTION_ID = 'workbench.action.chat.open';
+import { CHAT_CATEGORY, CHAT_OPEN_ACTION_ID } from './chatConstants.js';
+export { CHAT_CATEGORY, CHAT_OPEN_ACTION_ID } from './chatConstants.js';

export interface IChatViewOpenOptions {
/**
diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatConstants.ts b/src/vs/workbench/contrib/chat/browser/actions/chatConstants.ts
new file mode 100644
index 00000000000..6ce67486a58
--- /dev/null
+++ b/src/vs/workbench/contrib/chat/browser/actions/chatConstants.ts
@@ -0,0 +1,10 @@
+/*---------------------------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+import { localize2 } from '../../../../../nls.js';
+
+export const CHAT_CATEGORY = localize2('chat.category', 'Chat');
+export const CHAT_OPEN_ACTION_ID = 'workbench.action.chat.open';
+export const ASK_QUICK_QUESTION_ACTION_ID = 'workbench.action.quickchat.toggle';
+
diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.ts
index 43b7bf8b6fa..91987dc1493 100644
--- a/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.ts
+++ b/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.ts
@@ -15,8 +15,9 @@ import { CHAT_CATEGORY } from './chatActions.js';
import { IQuickChatOpenOptions, IQuickChatService } from '../chat.js';
import { CONTEXT_CHAT_ENABLED } from '../../common/chatContextKeys.js';
import { InlineChatController } from '../../../inlineChat/browser/inlineChatController.js';
+import { ASK_QUICK_QUESTION_ACTION_ID } from './chatConstants.js';
+export { ASK_QUICK_QUESTION_ACTION_ID } from './chatConstants.js';

-export const ASK_QUICK_QUESTION_ACTION_ID = 'workbench.action.quickchat.toggle';
export function registerQuickChatActions() {
registerAction2(QuickChatGlobalAction);
registerAction2(AskQuickChatAction);
diff --git a/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts b/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts
index 29977605ad3..1377fcea1f0 100644
--- a/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts
+++ b/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts
@@ -23,6 +23,7 @@ import { IQuickInputService } from '../../../../../platform/quickinput/common/qu
import { IChatWidget } from '../chat.js';
import { ChatWidget, IChatWidgetContrib } from '../chatWidget.js';
import { IChatRequestVariableValue, IChatVariablesService, IDynamicVariable } from '../../common/chatVariables.js';
+import { addDynamicVariableActionId } from './chatDynamicVariablesConstant.js';

export const dynamicVariableDecorationType = 'chat-dynamic-variable';

@@ -232,7 +233,7 @@ function isAddDynamicVariableContext(context: any): context is IAddDynamicVariab
}

export class AddDynamicVariableAction extends Action2 {
- static readonly ID = 'workbench.action.chat.addDynamicVariable';
+ static readonly ID = addDynamicVariableActionId;

constructor() {
super({
diff --git a/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariablesConstant.ts b/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariablesConstant.ts
new file mode 100644
index 00000000000..df0794493a8
--- /dev/null
+++ b/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariablesConstant.ts
@@ -0,0 +1,6 @@
+/*---------------------------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+export const addDynamicVariableActionId = 'workbench.action.chat.addDynamicVariable';
diff --git a/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts b/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts
index 3ab1684b9ac..a91549c6daf 100644
--- a/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts
+++ b/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts
@@ -30,8 +30,7 @@ import { IQuickInputService, IQuickPickSeparator } from '../../../../platform/qu
import { IStorageService } from '../../../../platform/storage/common/storage.js';
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
import { IWorkbenchQuickAccessConfiguration } from '../../../browser/quickaccess.js';
-import { CHAT_OPEN_ACTION_ID } from '../../chat/browser/actions/chatActions.js';
-import { ASK_QUICK_QUESTION_ACTION_ID } from '../../chat/browser/actions/chatQuickInputActions.js';
+import { CHAT_OPEN_ACTION_ID, ASK_QUICK_QUESTION_ACTION_ID } from '../../chat/browser/actions/chatConstants.js';
import { ChatAgentLocation, IChatAgentService } from '../../chat/common/chatAgents.js';
import { CommandInformationResult, IAiRelatedInformationService, RelatedInformationType } from '../../../services/aiRelatedInformation/common/aiRelatedInformation.js';
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
Loading

0 comments on commit 646f835

Please sign in to comment.