Remove unused code (#332219)

* Remove unused code

Delete unreachable helpers, stale notebook styles, and obsolete compatibility aliases across workbench and Copilot code. (Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update chat input type comment

Remove the stale reference to deleted compatibility aliases. (Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
roblourens
2026-08-24 02:42:32 +00:00
committed by GitHub
co-authored by Copilot
parent ee6d34f364
commit d0686fe12d
22 changed files with 31 additions and 507 deletions
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import { BasePromptElementProps, PromptElement, PromptMetadata, PromptPiece, PromptSizing } from '@vscode/prompt-tsx';
import type * as vscode from 'vscode';
import { IPromptPathRepresentationService } from '../../../../../platform/prompts/common/promptPathRepresentationService';
import { IWorkspaceService } from '../../../../../platform/workspace/common/workspaceService';
import { WorkingDirectory } from '../../../../../platform/workspace/common/workingDirectory';
import { createFencedCodeBlock } from '../../../../../util/common/markdown';
@@ -165,35 +164,3 @@ export class AgentMultirootWorkspaceStructure extends MultirootWorkspaceStructur
</>;
}
}
type DirectoryStructureProps = BasePromptElementProps & {
maxSize: number;
directory: URI;
};
export class DirectoryStructure extends PromptElement<DirectoryStructureProps, IFileTreeData> {
constructor(
props: DirectoryStructureProps,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IPromptPathRepresentationService private readonly _promptPathRepresentationService: IPromptPathRepresentationService,
) {
super(props);
}
override async prepare(sizing: PromptSizing, progress: vscode.Progress<vscode.ChatResponseProgressPart> | undefined, token?: vscode.CancellationToken): Promise<IFileTreeData> {
return this._instantiationService.invokeFunction(accessor => workspaceVisualFileTree(accessor, this.props.directory, { maxLength: this.props.maxSize }, token ?? CancellationToken.None));
}
override render(state: IFileTreeData, sizing: PromptSizing): PromptPiece<any, any> | undefined {
if (!state) {
return;
}
return <>
The folder `{this._promptPathRepresentationService.getFilePath(this.props.directory)}` has the following structure:<br />
<br />
{createFencedCodeBlock('', state.tree)}
</>;
}
}
@@ -108,8 +108,6 @@ export enum ContributedToolName {
Codebase = 'copilot_searchCodebase',
SearchWorkspaceSymbols = 'copilot_searchWorkspaceSymbols',
VSCodeAPI = 'copilot_getVSCodeAPI',
/** @deprecated moving to core soon */
RunTests = 'copilot_runTests1',
FindFiles = 'copilot_findFiles',
FindTextInFiles = 'copilot_findTextInFiles',
ReadFile = 'copilot_readFile',
@@ -134,7 +132,6 @@ export enum ContributedToolName {
FindTestFiles = 'copilot_findTestFiles',
GithubSemanticRepoSearch = 'copilot_githubRepo',
GithubTextSearch = 'copilot_githubTextSearch',
CreateAndRunTask = 'copilot_createAndRunTask',
CreateDirectory = 'copilot_createDirectory',
RunVscodeCmd = 'copilot_runVscodeCommand',
EditFilesPlaceholder = 'copilot_editFiles',
@@ -925,27 +925,6 @@ export async function load_files(
return orig;
}
export function apply_commit(
commit: Commit,
writeFn: (p: string, c: string) => void,
removeFn: (p: string) => void,
): void {
for (const [p, change] of Object.entries(commit.changes)) {
if (change.type === ActionType.DELETE) {
removeFn(p);
} else if (change.type === ActionType.ADD) {
writeFn(p, change.newContent ?? '');
} else if (change.type === ActionType.UPDATE) {
if (change.movePath) {
writeFn(change.movePath, change.newContent ?? '');
removeFn(p);
} else {
writeFn(p, change.newContent ?? '');
}
}
}
}
export async function processPatch(
text: string,
openFn: (p: string) => Promise<AbstractDocumentWithLanguageId | TextDocument>,
@@ -385,18 +385,6 @@ Return ONLY the corrected string in the specified JSON format with the key 'corr
}
}
const CORRECT_STRING_ESCAPING_SCHEMA: ObjectJsonSchema = {
type: 'object',
properties: {
corrected_string_escaping: {
type: 'string',
description:
'The string with corrected escaping, ensuring it is valid, specially considering potential over-escaping issues from previous LLM generations.',
},
},
required: ['corrected_string_escaping'],
};
async function getJsonResponse(endpoint: IChatEndpoint, prompt: string, schema: ObjectJsonSchema, example: object, token: CancellationToken) {
prompt += `\n\nYour response must follow the JSON format:
@@ -437,45 +425,6 @@ For example: ${JSON.stringify(example)}
return JSONC.parse(result.value.slice(idx)) || undefined;
}
export async function correctStringEscaping(
potentiallyProblematicString: string,
endpoint: IChatEndpoint,
token: CancellationToken,
): Promise<string> {
const prompt = `
Context: An LLM has just generated potentially_problematic_string and the text might have been improperly escaped (e.g. too many backslashes for newlines like \\n instead of \n, or unnecessarily quotes like \\"Hello\\" instead of "Hello").
potentially_problematic_string (this text MIGHT have bad escaping, or might be entirely correct):
\`\`\`
${potentiallyProblematicString}
\`\`\`
Task: Analyze the potentially_problematic_string. If it's syntactically invalid due to incorrect escaping (e.g., "\n", "\t", "\\", "\\'", "\\""), correct the invalid syntax. The goal is to ensure the text will be a valid and correctly interpreted.
For example, if potentially_problematic_string is "bar\\nbaz", the corrected_newString_escaping should be "bar\nbaz".
If potentially_problematic_string is console.log(\\"Hello World\\"), it should be console.log("Hello World").
Return ONLY the corrected string in the specified JSON format with the key 'corrected_string_escaping'. If no escaping correction is needed, return the original potentially_problematic_string.
`.trim();
try {
const result = await getJsonResponse(endpoint, prompt, CORRECT_STRING_ESCAPING_SCHEMA, { corrected_string_escaping: '<corrected string here>' }, token);
if (
result &&
typeof result.corrected_string_escaping === 'string' &&
result.corrected_string_escaping.length > 0
) {
return result.corrected_string_escaping;
} else {
return potentiallyProblematicString;
}
} catch (error) {
return potentiallyProblematicString;
}
}
function trimPairIfPossible(
target: string,
trimIfTargetTrims: string,
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { PromptElement, PromptPiece } from '@vscode/prompt-tsx';
import { realpath } from 'fs/promises';
import * as path from 'path';
import type * as vscode from 'vscode';
@@ -26,11 +25,9 @@ import { extUriBiasedIgnorePathCase, isEqual, normalizePath } from '../../../uti
import { isString } from '../../../util/vs/base/common/types';
import { URI } from '../../../util/vs/base/common/uri';
import { IInstantiationService, ServicesAccessor } from '../../../util/vs/platform/instantiation/common/instantiation';
import { LanguageModelPromptTsxPart, LanguageModelToolResult } from '../../../vscodeTypes';
import { isCustomizationsIndex, isPromptFile } from '../../prompt/common/chatVariablesCollection';
import { IBuildPromptContext } from '../../prompt/common/intents';
import { IChatDiskSessionResources } from '../../prompts/common/chatDiskSessionResources';
import { renderPromptElementJSON } from '../../prompts/node/base/promptRenderer';
export function checkCancellation(token: CancellationToken): void {
if (token.isCancellationRequested) {
@@ -38,18 +35,6 @@ export function checkCancellation(token: CancellationToken): void {
}
}
export async function toolTSX(insta: IInstantiationService, options: vscode.LanguageModelToolInvocationOptions<unknown>, piece: PromptPiece, token: CancellationToken): Promise<vscode.LanguageModelToolResult> {
return new LanguageModelToolResult([
new LanguageModelPromptTsxPart(
await renderPromptElementJSON(insta, class extends PromptElement {
render() {
return piece;
}
}, {}, options.tokenizationOptions, token)
)
]);
}
export interface InputGlobResult {
/** The resolved glob patterns to pass to the search API. */
readonly patterns: vscode.GlobPattern[];
-12
View File
@@ -149,18 +149,6 @@ export async function asPromise<T>(event: vscode.Event<T>, timeout = vscode.env.
});
}
export function testRepeat(n: number, description: string, callback: (this: any) => any): void {
for (let i = 0; i < n; i++) {
test(`${description} (iteration ${i})`, callback);
}
}
export function suiteRepeat(n: number, description: string, callback: (this: any) => any): void {
for (let i = 0; i < n; i++) {
suite(`${description} (iteration ${i})`, callback);
}
}
export async function poll<T>(
fn: () => Thenable<T>,
acceptFn: (result: T) => boolean,
@@ -1,53 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"source": [
"## Header"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 2,
"source": [
"print('hello 1')\n",
"print('hello 2')"
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"hello 1\n",
"hello 2\n"
]
}
],
"metadata": {}
}
],
"metadata": {
"interpreter": {
"hash": "815c6b7592bf74925ca002a1774bcf064bae9d6a27e7933fd9109275fb484258"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3.9.5 64-bit ('myvenv': venv)"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
@@ -1,29 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IContextMenuProvider } from '../../../base/browser/contextmenu.js';
import { IActionProvider } from '../../../base/browser/ui/dropdown/dropdown.js';
import { DropdownMenuActionViewItem, IDropdownMenuActionViewItemOptions } from '../../../base/browser/ui/dropdown/dropdownActionViewItem.js';
import { IAction } from '../../../base/common/actions.js';
import { IContextKeyService } from '../../contextkey/common/contextkey.js';
import { IKeybindingService } from '../../keybinding/common/keybinding.js';
export class DropdownMenuActionViewItemWithKeybinding extends DropdownMenuActionViewItem {
constructor(
action: IAction,
menuActionsOrProvider: readonly IAction[] | IActionProvider,
contextMenuProvider: IContextMenuProvider,
options: IDropdownMenuActionViewItemOptions = Object.create(null),
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
) {
super(action, menuActionsOrProvider, contextMenuProvider, options);
}
protected override getTooltip() {
const tooltip = this.action.tooltip ?? this.action.label;
return this.keybindingService.appendKeybinding(tooltip, this.action.id, this.contextKeyService);
}
}
@@ -57,10 +57,6 @@ export {
PendingMessageKind,
PolicyState,
ResponsePartKind,
ChatInputAnswerState as SessionInputAnswerState,
ChatInputAnswerValueKind as SessionInputAnswerValueKind,
ChatInputQuestionKind as SessionInputQuestionKind,
ChatInputResponseKind as SessionInputResponseKind,
ChatInteractivity,
ChatOriginKind,
SessionLifecycle,
@@ -74,8 +70,7 @@ export {
type MessageResourceAttachment, type MessageEmbeddedResourceAttachment, type MessageAnnotationsAttachment, type MessageChatAttachment, type ModelSelection, type PendingMessage, type PluginCustomization, type ProjectInfo, type PromptCustomization, type ReasoningResponsePart,
type ResponsePart,
type RootState, type RuleCustomization, type SessionActiveClient,
type SessionConfigState, type ChatInputAnswer as SessionInputAnswer,
type ChatInputOption as SessionInputOption, type ChatInputQuestion as SessionInputQuestion, type ChatInputRequest as SessionInputRequest, type SessionModelInfo,
type SessionConfigState, type SessionModelInfo,
type SessionState,
type SessionSummary, type SkillCustomization, type Snapshot, type StringOrMarkdown, type TerminalState, type TextRange,
type ToolAnnotations,
@@ -453,7 +448,7 @@ export {
// Canonical chat-input type names (the protocol renamed the former
// `SessionInput*` types to `ChatInput*` when input requests moved onto the
// chat channel). Re-exported here so consumers can import them from the glue
// layer alongside the legacy `SessionInput*` aliases above.
// layer.
export {
ChatInputAnswerState,
ChatInputAnswerValueKind,
@@ -26,9 +26,9 @@ import { withEphemeralSessionMeta } from '../../common/meta/agentEphemeralSessio
import { ISessionDataService } from '../../common/sessionDataService.js';
import { SessionConfigKey } from '../../common/sessionConfigKeys.js';
import type { RootConfigChangedAction } from '../../common/state/protocol/actions.js';
import { ChangesSummary, ChatOriginKind, CustomizationEnablementKind, CustomizationType, McpAuthRequiredReason, McpServerStatus, SessionInputRequestKind } from '../../common/state/protocol/state.js';
import { ChangesSummary, ChatInputAnswerState, ChatInputAnswerValueKind, ChatInputQuestionKind, ChatInputResponseKind, ChatOriginKind, CustomizationEnablementKind, CustomizationType, McpAuthRequiredReason, McpServerStatus, SessionInputRequestKind } from '../../common/state/protocol/state.js';
import { ActionType, ActionEnvelope, AuthRequiredReason, type ChatAction, type INotification, type SessionAction } from '../../common/state/sessionActions.js';
import { buildSubagentChatUri, buildChatUri, buildDefaultChatUri, ChatInputAnswerState, ChatInputAnswerValueKind, ChatInputQuestionKind, ChatInteractivity, CustomizationLoadStatus, MessageAttachmentKind, MessageKind, PendingMessageKind, ResponsePartKind, ROOT_STATE_URI, SessionInputResponseKind, SessionLifecycle, SessionStatus, ToolCallConfirmationReason, ToolCallContributorKind, ToolCallStatus, ToolResultContentType, TurnState, customizationId, type ChatInputRequest, type ClientPluginCustomization, type Customization, type PluginCustomization, type Turn } from '../../common/state/sessionState.js';
import { buildSubagentChatUri, buildChatUri, buildDefaultChatUri, ChatInteractivity, CustomizationLoadStatus, MessageAttachmentKind, MessageKind, PendingMessageKind, ResponsePartKind, ROOT_STATE_URI, SessionLifecycle, SessionStatus, ToolCallConfirmationReason, ToolCallContributorKind, ToolCallStatus, ToolResultContentType, TurnState, customizationId, type ChatInputRequest, type ClientPluginCustomization, type Customization, type PluginCustomization, type Turn } from '../../common/state/sessionState.js';
import { IProductService } from '../../../product/common/productService.js';
import { ITelemetryService, TelemetryLevel } from '../../../telemetry/common/telemetry.js';
import { NullTelemetryService } from '../../../telemetry/common/telemetryUtils.js';
@@ -6140,7 +6140,7 @@ suite('AgentSideEffects', () => {
stateManager.dispatchServerAction(defaultChatUri, {
type: ActionType.ChatInputCompleted,
requestId: 'req-1',
response: SessionInputResponseKind.Accept,
response: ChatInputResponseKind.Accept,
});
assert.deepStrictEqual(sessionInputNeeded(), []);
@@ -6169,7 +6169,7 @@ suite('AgentSideEffects', () => {
stateManager.dispatchClientAction(defaultChatUri, {
type: ActionType.ChatInputCompleted,
requestId: 'req-1',
response: SessionInputResponseKind.Accept,
response: ChatInputResponseKind.Accept,
}, { clientId: 'test', clientSeq: 3 });
const event = telemetryService.events.find(event => event.eventName === 'askQuestionsToolInvoked');
@@ -6222,7 +6222,7 @@ suite('AgentSideEffects', () => {
stateManager.dispatchServerAction(defaultChatUri, {
type: ActionType.ChatInputCompleted,
requestId: request.id,
response: SessionInputResponseKind.Accept,
response: ChatInputResponseKind.Accept,
});
const events = telemetryService.events.filter(event => event.eventName === 'askQuestionsToolInvoked');
-1
View File
@@ -109,7 +109,6 @@ export const SelectedEditorsInGroupFileOrUntitledResourceContextKey = new RawCon
// Editor Part Context Keys
export const EditorPartMultipleEditorGroupsContext = new RawContextKey<boolean>('editorPartMultipleEditorGroups', false, localize('editorPartMultipleEditorGroups', "Whether there are multiple editor groups opened in an editor part"));
export const EditorPartSingleEditorGroupsContext = EditorPartMultipleEditorGroupsContext.toNegated();
export const EditorPartMaximizedEditorGroupContext = new RawContextKey<boolean>('editorPartMaximizedEditorGroup', false, localize('editorPartEditorGroupMaximized', "Editor Part has a maximized group"));
export const EditorPartModalContext = new RawContextKey<boolean>('editorPartModal', false, localize('editorPartModal', "Whether focus is in a modal editor part"));
@@ -1,10 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IMarkdownString } from '../../../../../../../base/common/htmlContent.js';
export class AutoApproveMessageWidget {
constructor(public readonly message: IMarkdownString) { }
}
@@ -13,7 +13,7 @@ import { ThemeIcon } from '../../../../../base/common/themables.js';
import { URI } from '../../../../../base/common/uri.js';
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
import { IChatRequestVariableEntry } from '../attachments/chatVariableEntries.js';
import { ChatAgentVoteDirection, ChatRequestQueueKind, IChatCodeCitation, IChatContentReference, IChatDisabledClaudeHooksPart, IChatFollowup, IChatMcpAuthenticationRequired, IChatMcpServersStarting, IChatMcpServersStartingSlow, IChatPlanReview, IChatProgressMessage, IChatQuestionCarousel, IChatResponseErrorDetails, IChatTask, IChatUsage, IChatUsedContext } from '../chatService/chatService.js';
import { ChatAgentVoteDirection, ChatRequestQueueKind, IChatCodeCitation, IChatContentReference, IChatDisabledClaudeHooksPart, IChatFollowup, IChatMcpAuthenticationRequired, IChatMcpServersStarting, IChatMcpServersStartingSlow, IChatPlanReview, IChatProgressMessage, IChatQuestionCarousel, IChatResponseErrorDetails, IChatUsage, IChatUsedContext } from '../chatService/chatService.js';
import { getFullyQualifiedId, IChatAgentCommand, IChatAgentData, IChatAgentNameService, IChatAgentResult } from '../participants/chatAgents.js';
import { IParsedChatRequest } from '../requestParser/chatParserTypes.js';
import { IChatModel, IChatProgressRenderableResponseContent, IChatRequestDisablement, IChatRequestModel, IChatResponseModel, IChatTextEditGroup, IResponse } from './chatModel.js';
@@ -132,43 +132,6 @@ export interface IChatRequestViewModel {
readonly origin?: IChatRequestModel['origin'];
}
export interface IChatResponseMarkdownRenderData {
renderedWordCount: number;
lastRenderTime: number;
isFullyRendered: boolean;
originalMarkdown: IMarkdownString;
}
export interface IChatResponseMarkdownRenderData2 {
renderedWordCount: number;
lastRenderTime: number;
isFullyRendered: boolean;
originalMarkdown: IMarkdownString;
}
export interface IChatProgressMessageRenderData {
progressMessage: IChatProgressMessage;
/**
* Indicates whether this is part of a group of progress messages that are at the end of the response.
* (Not whether this particular item is the very last one in the response).
* Need to re-render and add to partsToRender when this changes.
*/
isAtEndOfResponse: boolean;
/**
* Whether this progress message the very last item in the response.
* Need to re-render to update spinner vs check when this changes.
*/
isLast: boolean;
}
export interface IChatTaskRenderData {
task: IChatTask;
isSettled: boolean;
progressLength: number;
}
export interface IChatResponseRenderData {
renderedParts: IChatRendererContent[];
@@ -442,7 +405,7 @@ export class ChatViewModel extends Disposable implements IChatViewModel {
}
}
export class ChatRequestViewModel implements IChatRequestViewModel {
class ChatRequestViewModel implements IChatRequestViewModel {
get id() {
return this._model.id;
}
@@ -5,7 +5,7 @@
import assert from 'assert';
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../../base/test/common/utils.js';
import { ChatInputQuestionKind, SessionInputAnswerState, SessionInputAnswerValueKind } from '../../../../../../platform/agentHost/common/state/sessionState.js';
import { ChatInputAnswerState, ChatInputAnswerValueKind, ChatInputQuestionKind } from '../../../../../../platform/agentHost/common/state/protocol/state.js';
import { convertCarouselAnswers } from '../../../browser/agentSessions/agentHost/agentHostSessionHandler.js';
suite('convertCarouselAnswers', () => {
@@ -16,8 +16,8 @@ suite('convertCarouselAnswers', () => {
const result = convertCarouselAnswers({ 'q1': 'hello' });
assert.deepStrictEqual(result, {
'q1': {
state: SessionInputAnswerState.Submitted,
value: { kind: SessionInputAnswerValueKind.Text, value: 'hello' }
state: ChatInputAnswerState.Submitted,
value: { kind: ChatInputAnswerValueKind.Text, value: 'hello' }
}
});
});
@@ -26,8 +26,8 @@ suite('convertCarouselAnswers', () => {
const result = convertCarouselAnswers({ 'q1': { selectedValue: 'opt-1' } });
assert.deepStrictEqual(result, {
'q1': {
state: SessionInputAnswerState.Submitted,
value: { kind: SessionInputAnswerValueKind.Selected, value: 'opt-1', freeformValues: undefined }
state: ChatInputAnswerState.Submitted,
value: { kind: ChatInputAnswerValueKind.Selected, value: 'opt-1', freeformValues: undefined }
}
});
});
@@ -36,8 +36,8 @@ suite('convertCarouselAnswers', () => {
const result = convertCarouselAnswers({ 'q1': { selectedValue: 'opt-1', freeformValue: 'custom' } });
assert.deepStrictEqual(result, {
'q1': {
state: SessionInputAnswerState.Submitted,
value: { kind: SessionInputAnswerValueKind.Selected, value: 'opt-1', freeformValues: ['custom'] }
state: ChatInputAnswerState.Submitted,
value: { kind: ChatInputAnswerValueKind.Selected, value: 'opt-1', freeformValues: ['custom'] }
}
});
});
@@ -50,8 +50,8 @@ suite('convertCarouselAnswers', () => {
}]);
assert.deepStrictEqual(result, {
'q1': {
state: SessionInputAnswerState.Submitted,
value: { kind: SessionInputAnswerValueKind.Boolean, value: false }
state: ChatInputAnswerState.Submitted,
value: { kind: ChatInputAnswerValueKind.Boolean, value: false }
}
});
});
@@ -60,8 +60,8 @@ suite('convertCarouselAnswers', () => {
const result = convertCarouselAnswers({ 'q1': { selectedValues: ['a', 'b'] } });
assert.deepStrictEqual(result, {
'q1': {
state: SessionInputAnswerState.Submitted,
value: { kind: SessionInputAnswerValueKind.SelectedMany, value: ['a', 'b'], freeformValues: undefined }
state: ChatInputAnswerState.Submitted,
value: { kind: ChatInputAnswerValueKind.SelectedMany, value: ['a', 'b'], freeformValues: undefined }
}
});
});
@@ -70,8 +70,8 @@ suite('convertCarouselAnswers', () => {
const result = convertCarouselAnswers({ 'q1': { selectedValues: ['a'], freeformValue: 'extra' } });
assert.deepStrictEqual(result, {
'q1': {
state: SessionInputAnswerState.Submitted,
value: { kind: SessionInputAnswerValueKind.SelectedMany, value: ['a'], freeformValues: ['extra'] }
state: ChatInputAnswerState.Submitted,
value: { kind: ChatInputAnswerValueKind.SelectedMany, value: ['a'], freeformValues: ['extra'] }
}
});
});
@@ -80,8 +80,8 @@ suite('convertCarouselAnswers', () => {
const result = convertCarouselAnswers({ 'q1': { freeformValue: 'something' } });
assert.deepStrictEqual(result, {
'q1': {
state: SessionInputAnswerState.Submitted,
value: { kind: SessionInputAnswerValueKind.Text, value: 'something' }
state: ChatInputAnswerState.Submitted,
value: { kind: ChatInputAnswerValueKind.Text, value: 'something' }
}
});
});
@@ -93,9 +93,9 @@ suite('convertCarouselAnswers', () => {
'q3': { selectedValues: ['a'] },
});
assert.strictEqual(Object.keys(result).length, 3);
assert.strictEqual(result['q1'].state, SessionInputAnswerState.Submitted);
assert.strictEqual(result['q2'].state, SessionInputAnswerState.Submitted);
assert.strictEqual(result['q3'].state, SessionInputAnswerState.Submitted);
assert.strictEqual(result['q1'].state, ChatInputAnswerState.Submitted);
assert.strictEqual(result['q2'].state, ChatInputAnswerState.Submitted);
assert.strictEqual(result['q3'].state, ChatInputAnswerState.Submitted);
});
test('skips empty object answers', () => {
@@ -85,41 +85,3 @@ function isSetProfileArgs(args: unknown): args is ISetProfileArgs {
setProfileArgs.profile === NotebookProfileType.default ||
setProfileArgs.profile === NotebookProfileType.jupyter;
}
// export class NotebookProfileContribution extends Disposable {
// static readonly ID = 'workbench.contrib.notebookProfile';
// constructor(@IConfigurationService configService: IConfigurationService, @IWorkbenchAssignmentService private readonly experimentService: IWorkbenchAssignmentService) {
// super();
// if (this.experimentService) {
// this.experimentService.getTreatment<NotebookProfileType.default | NotebookProfileType.jupyter | NotebookProfileType.colab>('notebookprofile').then(treatment => {
// if (treatment === undefined) {
// return;
// } else {
// // check if settings are already modified
// const focusIndicator = configService.getValue(NotebookSetting.focusIndicator);
// const insertToolbarPosition = configService.getValue(NotebookSetting.insertToolbarLocation);
// const globalToolbar = configService.getValue(NotebookSetting.globalToolbar);
// // const cellToolbarLocation = configService.getValue(NotebookSetting.cellToolbarLocation);
// const compactView = configService.getValue(NotebookSetting.compactView);
// const showCellStatusBar = configService.getValue(NotebookSetting.showCellStatusBar);
// const consolidatedRunButton = configService.getValue(NotebookSetting.consolidatedRunButton);
// if (focusIndicator === 'border'
// && insertToolbarPosition === 'both'
// && globalToolbar === false
// // && cellToolbarLocation === undefined
// && compactView === true
// && showCellStatusBar === 'visible'
// && consolidatedRunButton === true
// ) {
// applyProfile(configService, profiles[treatment] ?? profiles[NotebookProfileType.default]);
// }
// }
// });
// }
// }
// }
// registerWorkbenchContribution2(NotebookProfileContribution.ID, NotebookProfileContribution, WorkbenchPhase.BlockRestore);
@@ -74,12 +74,6 @@
width: 100%;
}
.monaco-workbench .notebookOverlay > .cell-list-container > .notebook-gutter > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row {
cursor: default;
overflow: visible !important;
width: 100%;
}
.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell {
display: flex;
position: relative;
@@ -308,10 +302,6 @@
box-shadow: inset var(--vscode-shadow-sm);
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-insertion-indicator-top {
top: -15px;
}
.monaco-workbench .notebookOverlay > .cell-list-container > .cell-list-insertion-indicator {
position: absolute;
height: 2px;
@@ -656,7 +646,6 @@
}
/** Cell status bar */
.monaco-workbench .notebookOverlay .cell-statusbar-container .cell-language-picker:hover,
.monaco-workbench .notebookOverlay .cell-statusbar-container .cell-status-item.cell-status-item-has-command:hover {
background-color: var(--vscode-notebook-cellStatusBarItemHoverBackground);
}
@@ -686,31 +675,6 @@
background-color: var(--vscode-toolbar-hoverBackground);
}
/** Cell insertion/deletion */
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-cell-modified .cell-focus-indicator {
background-color: var(--vscode-editorGutter-modifiedBackground) !important;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-cell-modified {
background-color: var(--vscode-editorGutter-modifiedBackground) !important;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-cell-added .cell-focus-indicator {
background-color: var(--vscode-diffEditor-insertedTextBackground) !important;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-cell-added {
background-color: var(--vscode-diffEditor-insertedTextBackground) !important;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-cell-deleted .cell-focus-indicator {
background-color: var(--vscode-diffEditor-removedTextBackground) !important;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-cell-deleted {
background-color: var(--vscode-diffEditor-removedTextBackground) !important;
}
.monaco-workbench .notebookOverlay .codicon-debug-continue {
color: var(--vscode-icon-foreground) !important;
}
@@ -1088,12 +1088,6 @@ configurationRegistry.registerConfiguration({
default: true,
tags: ['notebookLayout']
},
// [NotebookSetting.openOutputInPreviewEditor]: {
// description: nls.localize('notebook.output.openInPreviewEditor.description', "Controls whether or not the action to open a cell output in a preview editor is enabled. This action can be used via the cell output menu."),
// type: 'boolean',
// default: false,
// tags: ['preview']
// },
[NotebookSetting.showFoldingControls]: {
description: nls.localize('notebook.showFoldingControls.description', "Controls when the Markdown header folding arrow is shown."),
type: 'string',
@@ -13,13 +13,11 @@ import { Iterable } from '../../../../base/common/iterator.js';
import { IDisposable } from '../../../../base/common/lifecycle.js';
import { Mimes } from '../../../../base/common/mime.js';
import { Schemas } from '../../../../base/common/network.js';
import { basename } from '../../../../base/common/path.js';
import { isWindows } from '../../../../base/common/platform.js';
import { ISplice } from '../../../../base/common/sequence.js';
import { ThemeColor } from '../../../../base/common/themables.js';
import { URI, UriComponents } from '../../../../base/common/uri.js';
import { Range } from '../../../../editor/common/core/range.js';
import * as editorCommon from '../../../../editor/common/editorCommon.js';
import { Command, WorkspaceEditMetadata } from '../../../../editor/common/languages.js';
import { IReadonlyTextBuffer, ITextModel } from '../../../../editor/common/model.js';
import { IAccessibilityInformation } from '../../../../platform/accessibility/common/accessibility.js';
@@ -34,7 +32,7 @@ import { INotebookTextModelLike } from './notebookKernelService.js';
import { ICellRange } from './notebookRange.js';
import { RegisteredEditorPriority } from '../../../services/editor/common/editorResolverService.js';
import { generateMetadataUri, generate as generateUri, extractCellOutputDetails, parseMetadataUri, parse as parseUri } from '../../../services/notebook/common/notebookDocumentService.js';
import { IWorkingCopyBackupMeta, IWorkingCopySaveEvent } from '../../../services/workingCopy/common/workingCopy.js';
import { IWorkingCopySaveEvent } from '../../../services/workingCopy/common/workingCopy.js';
import { SnapshotContext } from '../../../services/workingCopy/common/fileWorkingCopy.js';
export const NOTEBOOK_EDITOR_ID = 'workbench.editor.notebook';
@@ -44,8 +42,6 @@ export const INTERACTIVE_WINDOW_EDITOR_ID = 'workbench.editor.interactive';
export const REPL_EDITOR_ID = 'workbench.editor.repl';
export const NOTEBOOK_OUTPUT_EDITOR_ID = 'workbench.editor.notebookOutputEditor';
export const EXECUTE_REPL_COMMAND_ID = 'replNotebook.input.execute';
export enum CellKind {
Markup = 1,
Code = 2
@@ -89,11 +85,6 @@ export const RENDERER_NOT_AVAILABLE = '_notAvailable';
export type ContributedNotebookRendererEntrypoint = string | { readonly extends: string; readonly path: string };
export enum NotebookRunState {
Running = 1,
Idle = 2
}
export type NotebookDocumentMetadata = Record<string, unknown>;
export enum NotebookCellExecutionState {
@@ -107,12 +98,6 @@ export enum NotebookExecutionState {
Executing = 3
}
export interface INotebookCellPreviousExecutionResult {
executionOrder?: number;
success?: boolean;
duration?: number;
}
export interface NotebookCellMetadata {
/**
* custom metadata
@@ -577,13 +562,6 @@ export interface IWorkspaceNotebookCellEdit {
cellEdit: ICellPartialMetadataEdit | IDocumentMetadataEdit | ICellReplaceEdit;
}
export interface IWorkspaceNotebookCellEditDto {
metadata?: WorkspaceEditMetadata;
resource: URI;
notebookVersionId: number | undefined;
cellEdit: ICellPartialMetadataEdit | IDocumentMetadataEdit | ICellReplaceEdit;
}
export interface NotebookData {
readonly cells: ICellDto2[];
readonly metadata: NotebookDocumentMetadata;
@@ -827,10 +805,6 @@ export function diff<T>(before: T[], after: T[], contains: (a: T) => boolean, eq
return result;
}
export interface ICellEditorViewState {
selections: editorCommon.ICursorState[];
}
export const NOTEBOOK_EDITOR_CURSOR_BOUNDARY = new RawContextKey<'none' | 'top' | 'bottom' | 'both'>('notebookEditorCursorAtBoundary', 'none');
export const NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY = new RawContextKey<'none' | 'start' | 'end' | 'both'>('notebookEditorCursorAtLineBoundary', 'none');
@@ -884,12 +858,6 @@ export interface INotebookDiffEditorModel extends IDisposable {
modified: { notebook: NotebookTextModel; resource: URI; viewType: string };
}
export interface NotebookDocumentBackupData extends IWorkingCopyBackupMeta {
readonly viewType: string;
readonly backupId?: string;
readonly mtime?: number;
}
export enum NotebookEditorPriority {
default = 'default',
option = 'option',
@@ -941,32 +909,6 @@ export function isDocumentExcludePattern(filenamePattern: string | glob.IRelativ
return false;
}
export function notebookDocumentFilterMatch(filter: INotebookDocumentFilter, viewType: string, resource: URI): boolean {
if (Array.isArray(filter.viewType) && filter.viewType.indexOf(viewType) >= 0) {
return true;
}
if (filter.viewType === viewType) {
return true;
}
if (filter.filenamePattern) {
const filenamePattern = isDocumentExcludePattern(filter.filenamePattern) ? filter.filenamePattern.include : (filter.filenamePattern as string | glob.IRelativePattern);
const excludeFilenamePattern = isDocumentExcludePattern(filter.filenamePattern) ? filter.filenamePattern.exclude : undefined;
if (glob.match(filenamePattern, basename(resource.fsPath), { ignoreCase: true })) {
if (excludeFilenamePattern) {
if (glob.match(excludeFilenamePattern, basename(resource.fsPath), { ignoreCase: true })) {
// should exclude
return false;
}
}
return true;
}
}
return false;
}
export interface INotebookCellStatusBarItemProvider {
viewType: string;
onDidChangeStatusBarItems?: Event<void>;
@@ -1015,7 +957,6 @@ export const NotebookSetting = {
stickyScrollMode: 'notebook.stickyScroll.mode',
undoRedoPerCell: 'notebook.undoRedoPerCell',
consolidatedOutputButton: 'notebook.consolidatedOutputButton',
openOutputInPreviewEditor: 'notebook.output.openInPreviewEditor.enabled',
showFoldingControls: 'notebook.showFoldingControls',
dragAndDropEnabled: 'notebook.dragAndDropEnabled',
cellEditorOptionsCustomizations: 'notebook.editorOptionsCustomizations',
@@ -1039,7 +980,6 @@ export const NotebookSetting = {
outputFontSize: 'notebook.output.fontSize',
outputFontFamily: 'notebook.output.fontFamily',
findFilters: 'notebook.find.filters',
logging: 'notebook.logging',
confirmDeleteRunningCell: 'notebook.confirmDeleteRunningCell',
remoteSaving: 'notebook.experimental.remoteSave',
gotoSymbolsAllSymbols: 'notebook.gotoSymbols.showAllSymbols',
@@ -56,7 +56,6 @@ export interface IAiSearchProvider extends IRemoteSearchProvider {
getLLMRankedResults(token: CancellationToken): Promise<ISearchResult | null>;
}
export const PREFERENCES_EDITOR_COMMAND_OPEN = 'workbench.preferences.action.openPreferencesEditor';
export const CONTEXT_PREFERENCES_SEARCH_FOCUS = new RawContextKey<boolean>('inPreferencesSearch', false);
export const SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS = 'settings.action.clearSearchResults';
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IStringDictionary } from '../../../../base/common/collections.js';
import { Event } from '../../../../base/common/event.js';
import { IMatch } from '../../../../base/common/filters.js';
import { IJSONSchema, IJSONSchemaMap } from '../../../../base/common/jsonSchema.js';
@@ -111,7 +110,6 @@ export interface IExtensionSetting extends ISetting {
export interface ISearchResult {
filterMatches: ISettingMatch[];
exactMatch: boolean;
metadata?: IFilterMetadata;
}
export interface ISearchResultGroup {
@@ -126,7 +124,6 @@ export interface IFilterResult {
filteredGroups: ISettingsGroup[];
allGroups: ISettingsGroup[];
matches: IRange[];
metadata?: IStringDictionary<IFilterMetadata>;
exactMatch?: boolean;
}
@@ -161,35 +158,6 @@ export interface ISettingMatch {
providerName?: string;
}
export interface IScoredResults {
[key: string]: IRemoteSetting;
}
export interface IRemoteSetting {
score: number;
key: string;
id: string;
defaultValue: string;
description: string;
packageId: string;
extensionName?: string;
extensionPublisher?: string;
}
export interface IFilterMetadata {
requestUrl: string;
requestBody: string;
timestamp: number;
duration: number;
scoredResults: IScoredResults;
/** The number of requests made, since requests are split by number of filters */
requestCount?: number;
/** The name of the server that actually served the request */
context: string;
}
export interface IPreferencesEditorModel<T> {
uri?: URI;
getPreference(key: string): T | undefined;
@@ -20,7 +20,7 @@ import { ConfigurationDefaultValueSource, ConfigurationScope, Extensions, IConfi
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { EditorModel } from '../../../common/editor/editorModel.js';
import { IFilterMetadata, IFilterResult, IGroupFilter, IKeybindingsEditorModel, ISearchResultGroup, ISetting, ISettingMatch, ISettingMatcher, ISettingsEditorModel, ISettingsGroup, SettingMatchType } from './preferences.js';
import { IFilterResult, IGroupFilter, IKeybindingsEditorModel, ISearchResultGroup, ISetting, ISettingMatch, ISettingMatcher, ISettingsEditorModel, ISettingsGroup, SettingMatchType } from './preferences.js';
import { FOLDER_SCOPES, WORKSPACE_SCOPES } from '../../configuration/common/configuration.js';
import { createValidator } from './preferencesValidation.js';
import { isString } from '../../../../base/common/types.js';
@@ -105,20 +105,6 @@ abstract class AbstractSettingsModel extends EditorModel {
return undefined;
}
protected collectMetadata(groups: ISearchResultGroup[]): IStringDictionary<IFilterMetadata> | null {
const metadata = Object.create(null);
let hasMetadata = false;
groups.forEach(g => {
if (g.result.metadata) {
metadata[g.id] = g.result.metadata;
hasMetadata = true;
}
});
return hasMetadata ? metadata : null;
}
protected get filterGroups(): ISettingsGroup[] {
return this.settingsGroups;
}
@@ -207,12 +193,10 @@ export class SettingsEditorModel extends AbstractSettingsModel implements ISetti
};
}
const metadata = this.collectMetadata(resultGroups);
return {
allGroups: this.settingsGroups,
filteredGroups: filteredGroup ? [filteredGroup] : [],
matches,
metadata: metadata ?? undefined
matches
};
}
}
@@ -867,13 +851,11 @@ export class DefaultSettingsEditorModel extends AbstractSettingsModel implements
const startLine = this.settingsGroups.at(-1)!.range.endLineNumber + 2;
const { settingsGroups: filteredGroups, matches } = this.writeResultGroups(nonEmptyResultGroups, startLine);
const metadata = this.collectMetadata(resultGroups);
return resultGroups.length ?
{
allGroups: this.settingsGroups,
filteredGroups,
matches,
metadata: metadata ?? undefined
matches
} :
undefined;
}
@@ -23,7 +23,6 @@ import { IWorkspaceContextService, IWorkspaceFolderData, toWorkspaceFolder, Work
import { IEditorGroupsService } from '../../editor/common/editorGroupsService.js';
import { IPathService } from '../../path/common/pathService.js';
import { ExcludeGlobPattern, getExcludes, IAITextQuery, ICommonQueryProps, IFileQuery, IFolderQuery, IPatternInfo, ISearchConfiguration, ITextQuery, ITextSearchPreviewOptions, pathIncludedInQuery, QueryType } from './search.js';
import { GlobPattern } from './searchExtTypes.js';
/**
* One folder to search and a glob expression that should be applied.
@@ -52,20 +51,6 @@ export function isISearchPatternBuilder<U extends UriComponents>(object: ISearch
return (typeof object === 'object' && 'uri' in object && 'pattern' in object);
}
export function globPatternToISearchPatternBuilder(globPattern: GlobPattern): ISearchPatternBuilder<URI> {
if (typeof globPattern === 'string') {
return {
pattern: globPattern
};
}
return {
pattern: globPattern.pattern,
uri: globPattern.baseUri
};
}
/**
* A set of search paths and a set of glob expressions that should be applied.
*/