Skip to content

copilot: remove unused code and orphaned dependencies - #348381

Draft
Dmitriy Vasyura (dmitrivMS) wants to merge 6 commits into
mainfrom
agents/remove-dead-code-copilot-extension
Draft

Dmitriy Vasyura (dmitrivMS) wants to merge 6 commits into
mainfrom
agents/remove-dead-code-copilot-extension

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator
  • Remove unused helpers, types, constants, internal methods, and legacy notebook-generation prompts from the built-in Copilot Chat extension.
  • Remove internal production code referenced only by its own tests, including obsolete prompt rendering, indentation-tree utilities, an OpenAI simulation adapter, and diff-generation code, together with exclusive tests and fixtures.
  • Delete obsolete tests and unused mocks and test helpers.
  • Recursively prune orphaned telemetry and file-stat plumbing, replay timing infrastructure, folding bookkeeping, caches, state, dependencies, and configuration entries.
  • Remove obsolete language-server context statistics and prompt telemetry metadata while retaining recording operation lookup with focused regression coverage.
  • Remove orphaned parser query registrations and semantic-chunking code, unused TypeScript-context APIs, and obsolete session/worktree helpers.

Remove unreferenced internal helpers, types, legacy notebook prompts, and obsolete tool-extension registration support. Follow recursive dependencies to remove orphaned members, caches, and bookkeeping while preserving active registrations and public APIs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 15, 2026 05:00
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added debt Code quality issues chat labels Nov 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the unused-code and dependency cleanup.

No open issues 🎉

What changed in this PR

This PR reduces maintenance overhead in the built-in Copilot extension by removing unused internal code and dependencies left behind by those removals. No user-facing behavior change is intended.

Changes:

  • Removes unused helpers, types, constants, and internal methods across platform services, prompts, completions, and chat sessions.
  • Removes legacy notebook-generation prompts, replay timing support, folding-parent bookkeeping, recent-document caching, and tool-extension registration.
  • Simplifies affected imports, constructors, and error handling while retaining query-registration side effects.

Paths below are relative to extensions/copilot/src/.

File Description
util/​common/​timeTravelScheduler.ts Removes unused scheduler and queue inspection methods.
util/​common/​markdown.ts Removes inline-code extraction helper.
util/​common/​diff.ts Removes unused sequence and change helpers.
platform/​workspaceRecorder/​common/​resolvedRecording/​resolvedRecording.ts Removes operation and document lookup helpers.
platform/​workspaceRecorder/​common/​resolvedRecording/​documentHistory.ts Removes operation-index bookkeeping and lookup.
platform/​workspaceChunkSearch/​node/​workspaceFileIndex.ts Removes fast content-version helper.
platform/​telemetry/​common/​telemetry.ts Removes redundant telemetry properties type.
platform/​parser/​node/​treeSitterQueries.ts Removes unused export while preserving query registration.
platform/​parser/​node/​parserService.ts Removes context type re-export.
platform/​parser/​node/​indentationStructure.ts Removes folding-parent computation and lookup machinery.
platform/​parser/​node/​chunkGroupTypes.ts Removes block-name tree interface.
platform/​notebook/​vscode/​notebookServiceImpl.ts Removes alternative-content scheme constant.
platform/​networking/​common/​openai.ts Removes chat-role enum and text extraction helper.
platform/​networking/​common/​fetch.ts Removes unused response-part types and guards.
platform/​networking/​common/​anthropic.ts Removes interleaved-thinking model helper.
platform/​languages/​common/​languageDiagnosticsService.ts Removes diagnostic severity helper.
platform/​inlineEdits/​common/​workspaceEditTracker/​workspaceDocumentEditTracker.ts Removes recent-document cache and associated helpers.
platform/​inlineEdits/​common/​statelessNextEditProvider.ts Removes edit callback type.
platform/​inlineEdits/​common/​inlineEditLogContext.ts Removes unused test-data interface.
platform/​inlineEdits/​common/​dataTypes/​textEditLengthHelper/​length.ts Removes unused length comparison and conversion helpers.
platform/​inlineEdits/​common/​dataTypes/​languageContext.ts Removes bulk diagnostic serialization helper.
platform/​github/​common/​githubService.ts Removes team identifier constant.
platform/​github/​common/​githubAPI.ts Removes unused response interfaces.
platform/​env/​common/​packagejson.ts Removes engine-version export.
platform/​embeddings/​common/​embeddingsIndex.ts Removes cache rebuilding method.
platform/​editSurvivalTracking/​common/​arcTracker.ts Removes debug helpers and retained edit field.
platform/​editing/​common/​offsetLineColumnConverter.ts Removes line-start lookup helper.
platform/​editing/​common/​abstractText.ts Removes offset-range conversion helper.
platform/​customInstructions/​common/​promptTypes.ts Removes prompt-file extension constant.
platform/​configuration/​common/​validator.ts Removes object-properties type alias.
platform/​authentication/​common/​copilotToken.ts Removes unused token and notification types.
extension/​xtab/​common/​lintErrors.ts Removes lint context interface.
extension/​typescriptContext/​vscode-node/​tsContextService.ts Removes runnable-result lookup method.
extension/​typescriptContext/​vscode-node/​ts7/​tsContextService.ts Removes handling for deleted budget exception.
extension/​typescriptContext/​vscode-node/​ts7/​contextProvider.ts Removes budget exception helpers and rejection tracking.
extension/​typescriptContext/​vscode-node/​ts7/​baseContextProviders.ts Removes node predicates and related imports.
extension/​typescriptContext/​serverPlugin/​src/​node/​create.ts Removes handling for deleted budget exception.
extension/​typescriptContext/​serverPlugin/​src/​common/​utils.ts Removes most-recently-used cache implementation.
extension/​typescriptContext/​serverPlugin/​src/​common/​typescripts.ts Removes symbol helpers and stale import-state bookkeeping.
extension/​typescriptContext/​serverPlugin/​src/​common/​sourceFileContextProvider.ts Removes scope-symbol type.
extension/​typescriptContext/​serverPlugin/​src/​common/​contextProvider.ts Simplifies import-state construction and budget support.
extension/​tools/​vscode-node/​toolsService.ts Removes tool-extension instantiation and overrides.
extension/​tools/​node/​applyPatch/​parser.ts Removes change assembly helper.
extension/​tools/​node/​applyPatch/​parseApplyPatch.ts Removes legacy parser while retaining patch constants.
extension/​tools/​common/​virtualTools/​virtualToolTypes.ts Removes summarizer error class.
extension/​tools/​common/​virtualTools/​virtualToolsConstants.ts Removes unused grouping constants.
extension/​tools/​common/​toolsRegistry.ts Removes tool-extension registration and storage.
extension/​renameSuggestions/​node/​renameSuggestionsProvider.ts Removes prefix detection helper.
extension/​prompts/​node/​panel/​newNotebook.tsx Removes legacy generation and improvement prompts.
extension/​prompts/​node/​panel/​currentEditor.tsx Removes inactive notebook-cell rendering path and dependency.
extension/​prompts/​node/​inline/​workingCopies.ts Removes unused edit projection and snapshot helpers.
extension/​prompts/​node/​inline/​summarizedDocument/​projectedText.ts Removes offset and edit projection helpers.
extension/​prompts/​node/​codeMapper/​codeMapperService.ts Removes resource-edit type alias.
extension/​prompts/​node/​agent/​promptRegistry.ts Removes prompt constructor alias.
extension/​prompts/​node/​agent/​backgroundTodoAgent/​backgroundTodoAgentProcessor.ts Removes unused policy input interface.
extension/​prompt/​node/​intents.ts Removes null intent implementation.
extension/​prompt/​node/​indentationGuesser.ts Removes indentation buffer interface.
extension/​prompt/​node/​feedbackReporter.ts Removes null reporter singleton.
extension/​prompt/​node/​editGeneration.ts Removes line-range type.
extension/​prompt/​node/​chatParticipantTelemetry.ts Removes telemetry lookup method.
extension/​prompt/​common/​conversation.ts Removes message accessor and conversation-state interface.
extension/​mcp/​vscode-node/​nuget.ts Removes unused server status and configuration types.
extension/​intents/​node/​searchIntent.ts Removes example prompt constant.
extension/​intents/​node/​newNotebookIntent.ts Removes legacy notebook cell-generation functions.
extension/​inlineEdits/​vscode-node/​utils/​virtualTextDocumentProvider.ts Removes unused document convenience methods.
extension/​inlineEdits/​vscode-node/​utils/​translations.ts Removes external text-edit conversion helper.
extension/​inlineEdits/​vscode-node/​features/​diagnosticsBasedCompletions/​diagnosticsCompletions.ts Removes diagnostic range and distance helpers.
extension/​inlineEdits/​common/​observableWorkspaceRecordingReplayer.ts Removes timed replay and simplifies synchronous stepping.
extension/​conversation/​vscode-node/​chatParticipants.ts Removes debug state and simplifies disposal return value.
extension/​context/​node/​resolvers/​selectionContextHelpers.ts Removes filepath marker predicate.
extension/​context/​node/​resolvers/​extensionApi.tsx Removes string-rendering helper.
extension/​configuration/​vscode-node/​configurationMigration.ts Removes unused configuration metadata declarations.
extension/​completions/​common/​config.ts Removes server-trimming helper.
extension/​completions-core/​vscode-node/​prompt/​src/​prompt.ts Removes prompt allocation aliases.
extension/​completions-core/​vscode-node/​prompt/​src/​indentation/​description.ts Removes indentation-tree encoding helper.
extension/​completions-core/​vscode-node/​lib/​src/​suggestions/​partialSuggestions.ts Removes copied partial-accept enum.
extension/​completions-core/​vscode-node/​lib/​src/​snippy/​telemetryHandlers.ts Removes no-op telemetry reporter.
extension/​completions-core/​vscode-node/​lib/​src/​prompt/​render/​utils.ts Removes node-cost callback type.
extension/​completions-core/​vscode-node/​lib/​src/​prompt/​render/​renderNode.ts Removes snapshot helper and empty-node constant.
extension/​completions-core/​vscode-node/​lib/​src/​prompt/​completionsPromptFactory/​componentsCompletionsPromptFactory.tsx Removes unused concrete prompt factory.
extension/​completions-core/​vscode-node/​lib/​src/​prompt/​asyncUtils.ts Removes event-to-promise helper.
extension/​completions-core/​vscode-node/​lib/​src/​openai/​fetch.ts Removes speculation request interface.
extension/​completions-core/​vscode-node/​lib/​src/​networkingTypes.ts Removes request-header alias.
extension/​completions-core/​vscode-node/​lib/​src/​networking.ts Removes legacy fetcher abstraction.
extension/​completions-core/​vscode-node/​lib/​src/​language/​languages.ts Removes language metadata type.
extension/​completions-core/​vscode-node/​lib/​src/​ghostText/​ghostText.ts Removes multiline override class.
extension/​completions-core/​vscode-node/​lib/​src/​config.ts Removes editor filter type and import.
extension/​completions-core/​vscode-node/​extension/​src/​panelShared/​baseSuggestionsPanel.ts Removes solution-reset method.
extension/​completions-core/​vscode-node/​extension/​src/​panelShared/​basePanelTypes.ts Removes webview configuration interface.
extension/​completions-core/​vscode-node/​extension/​src/​copilotPanel/​common.ts Removes navigation enum.
extension/​completions-core/​vscode-node/​extension/​src/​constants.ts Removes comparison-panel context constant.
extension/​chatSessions/​vscode/​chatSessionsUriHandler.ts Removes unused URI handler mapping.
extension/​chatSessions/​vscode-node/​pullArtifactResolver.ts Removes resolver options interface.
extension/​chatSessions/​copilotcli/​node/​userInputHelpers.ts Removes request alias and SDK import.
extension/​chatSessions/​copilotcli/​node/​copilotcliSessionService.ts Removes request alias and mutex inspection method.
extension/​chatSessions/​common/​chatSessionMetadataStore.ts Removes worktree session entry interface.
extension/​byok/​common/​byokProvider.ts Removes unused model registry, configuration, and key-update helpers.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The deletions leave unused telemetry state and pass-through parameters, along with obsolete file-stat methods and dependencies, that still need removal.

2 open issues

Review effort: Max

Remove unused internal helpers and production paths referenced only by their own tests. Delete obsolete rendering, indentation, adapter, and diff-generation code with its exclusive tests and fixtures, and prune orphaned state, types, and configuration entries.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The cleanup leaves unused prompt telemetry computation and orphaned telemetry declarations in place, while the discarded doc-comment query still registers at module load.

1 open issue
2 resolved since last review

Review effort: Max

Remove unused language-server context statistics and the orphaned prompt telemetry marker and result field. Retain recording operation lookup with focused regression coverage.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unpublished findings about lingering query registrations and orphaned APIs require human assessment of the cleanup’s completeness.

No open issues 🎉

1 resolved since last review

Review effort: Max

Prune unused parser/context paths, session APIs, and exclusive test helpers while retaining persisted metadata and compatibility-sensitive contracts.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The review is incomplete because one or more reviewers received a runtime budget-stop instruction.

No open issues 🎉

Review effort: Max

Escape every newline, tab, and backtick in inline-edit log entries. Add focused regression coverage for repeated whitespace and fenced backticks.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review identifies no active issues requiring changes to this unused-code cleanup.

No open issues 🎉

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chat debt Code quality issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants