Skip to content

Add dynamic codefix expansion support#11191

Draft
haiyuazhang wants to merge 6 commits into
microsoft:mainfrom
haiyuazhang:haiyzhan/resolve-codefixes-api-draft
Draft

Add dynamic codefix expansion support#11191
haiyuazhang wants to merge 6 commits into
microsoft:mainfrom
haiyuazhang:haiyzhan/resolve-codefixes-api-draft

Conversation

@haiyuazhang

@haiyuazhang haiyuazhang commented Jul 7, 2026

Copy link
Copy Markdown
Member

Adds an optional resolveCodefixes hook to CodeFix so one diagnostic fix can expand into multiple quick-fix entries when code actions are requested.

This supports editor-only dynamic suggestions, such as AI-generated rename options through the existing VS Code custom/chatCompletion bridge.

Includes a server test for expanding dynamic fixes and resolving the selected generated fix.

Local note: focused test could not be run locally because dependency install failed on a private package feed auth error; CI should validate.

Haiyuan Zhang and others added 3 commits July 8, 2026 03:04
Extends the CodeFix interface with an optional resolveCodefixes() method
that allows a single codefix to expand into multiple labeled options at
Ctrl+. time. This enables AI-powered codefixes where the labels are
determined asynchronously (e.g., via vscode.lm through the existing
custom/chatCompletion LSP bridge).

Changes:
- types.ts: Add resolveCodefixes to CodeFix interface
- serverlib.ts: Modify getCodeActions to resolve and cache dynamic codefixes
  - Promise-based cache prevents duplicate AI calls from concurrent requests
  - Separate resolvedCodefixMap for resolveCodeAction lookup
  - Both caches cleared on recompilation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify resolveCodefixes expands one diagnostic fix into multiple code actions and resolves the selected dynamic fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the compiler:core Issues for @typespec/compiler label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - feature ✏️

Add dynamic codefix expansion support for language-server code actions.

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

pkg-pr-new Bot commented Jul 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/compiler@11191

commit: ed8c1eb

@azure-sdk-automation

azure-sdk-automation Bot commented Jul 7, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Haiyuan Zhang and others added 2 commits July 8, 2026 04:08
Ignore the standard suppress-warning quick fix and assert only dynamically resolved suggestions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant