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

Draft MVP/design-validation PR.

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

This is intended to validate the general TypeSpec core/LSP direction for editor-only dynamic suggestions, such as AI-generated rename options through the existing VS Code custom/chatCompletion bridge. It is not intended to be treated as the final production-hardened design until reviewed by TypeSpec/LSP owners.

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

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>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Jul 29, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Hi @@haiyuazhang. Your PR has had no update for 14 days and it is marked as a stale PR. If it is not updated within 14 additional days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.

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 stale Mark a PR that hasn't been recently updated and will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant