Skip to content

fix(figspec): fix generated completions for azd extension install#8887

Open
JeffreyCA with Copilot wants to merge 3 commits into
mainfrom
copilot/azd-update-figspec-generation
Open

fix(figspec): fix generated completions for azd extension install#8887
JeffreyCA with Copilot wants to merge 3 commits into
mainfrom
copilot/azd-update-figspec-generation

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Related to #8416 and microsoft/vscode#321221

Summary

This PR updates azd's Fig spec generator to preserve VS Code's corrected completions for azd extension install.

Issue

The generator still emitted the legacy template: 'filepaths' fallback, while the VS Code spec now combines extension ID suggestions with .zip file paths. Regenerating the spec could therefore overwrite the fix from microsoft/vscode#321221.

Changes

  • Adds support for rendering multiple generators on a single argument.
  • Generates both extension ID suggestions and .zip-only file path suggestions for azd extension install.
  • Emits the VS Code filepaths helper import and removes the obsolete argument template field.
  • Documents combined generators and refreshes the generated spec snapshot.

Behavior at a glance

Scenario Before After
azd extension install <arg> Extension IDs plus unrestricted legacy file path completion Extension IDs plus .zip file path completion

Testing

Updated unit coverage for multi-generator rendering and extension install customization, along with the generated Fig spec snapshot.

- Add FigGenFilepathsZip constant and filepathsHelperImport for VS Code's
  filepaths({ extensions: ['zip'] }) helper
- Add Generators []string to Arg struct (takes precedence over Generator);
  remove unused Template string field
- Update typescript_renderer to emit the filepaths import preamble and
  render Generators as an array when multiple entries are present
- Switch azd extension install customization to use
  Generators: [listExtensions, filepaths({extensions:['zip']})]
- Update tests and snapshot accordingly
- Update docs/fig-spec.md: add listConfigKeys table row and filepaths
  helper subsection

Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Copilot AI changed the title [WIP] Update azd figspec generation for new extension argument feat(figspec): use filepaths zip helper + Generators array for azd extension install Jun 30, 2026
Copilot AI requested a review from JeffreyCA June 30, 2026 18:29
@microsoft-github-policy-service microsoft-github-policy-service Bot added the no-recent-activity identity issues with no activity label Jul 7, 2026
@JeffreyCA JeffreyCA requested a review from Copilot July 13, 2026 23:05

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.

Pull request overview

Updates azd’s Fig spec generation (used for VS Code terminal IntelliSense) so azd extension install completions can combine extension-ID suggestions with .zip-scoped file path suggestions using VS Code’s filepaths helper API.

Changes:

  • Extends the Fig spec arg model to support multi-generator args via a new Arg.Generators []string field (taking precedence over Arg.Generator) and removes the unused Template field.
  • Updates the TypeScript renderer to emit generators: [...] when multiple generators are present and to add a filepaths helper import to the generated spec output.
  • Adds a FigGenFilepathsZip constant and updates azd extension install customization, docs, and the Fig spec snapshot accordingly.
Show a summary per file
File Description
cli/azd/internal/figspec/typescript_renderer.go Renders multi-generator args and injects a filepaths import into generated TypeScript.
cli/azd/internal/figspec/typescript_renderer_test.go Updates renderer tests for multi-generator output and import presence.
cli/azd/internal/figspec/types.go Adds Arg.Generators []string and removes the dead Template field.
cli/azd/internal/figspec/fig_generators.go Adds FigGenFilepathsZip and the filepaths import constant.
cli/azd/internal/figspec/customizations.go Uses the new multi-generator form for azd extension install.
cli/azd/internal/figspec/customizations_test.go Updates customization assertions for multi-generator args.
cli/azd/docs/fig-spec.md Documents the new multi-generator usage and filepaths import behavior; adds missing generator doc row.
cli/azd/cmd/testdata/TestFigSpec.ts Snapshot updated to include the new import preamble and generator array form.

Review details

Comments suppressed due to low confidence (1)

cli/azd/internal/figspec/typescript_renderer.go:59

  • azd-code-reviewer: ToTypeScript currently injects filepathsHelperImport unconditionally. That hard-codes the generated spec to VS Code’s repo layout even when the spec doesn’t use filepaths(...) (e.g., TestToTypeScript_Empty), and can also become a TS compile/lint failure if filepaths usage is removed later (unused/missing-module import). Consider emitting this import only when the rendered spec actually contains a filepaths( generator (or when FigGenFilepathsZip is present in any arg).
	data := map[string]string{
		"Name":        s.Name,
		"Description": s.Description,
		"Import":      filepathsHelperImport,
		"Generators":  figGeneratorDefinitionsTS,
		"Subcommands": renderSubcommands(s.Subcommands, 2),
		"Options":     renderOptions(s.Options, 2, false),
	}
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread cli/azd/internal/figspec/types.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the no-recent-activity identity issues with no activity label Jul 13, 2026
@JeffreyCA

Copy link
Copy Markdown
Contributor

/azp run azure-dev - cli

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@JeffreyCA JeffreyCA marked this pull request as ready for review July 13, 2026 23:14
@JeffreyCA JeffreyCA requested a review from vhvb1989 as a code owner July 13, 2026 23:14
Copilot AI review requested due to automatic review settings July 13, 2026 23:14
@JeffreyCA JeffreyCA changed the title feat(figspec): use filepaths zip helper + Generators array for azd extension install fix(figspec): fix generated completions for azd extension install Jul 13, 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.

Review details

  • Files reviewed: 8/8 changed files
  • Comments generated: 0 new
  • Review effort level: Medium

@github-actions github-actions Bot added the area/extensions Extensions (general) label Jul 13, 2026

@jongio jongio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One optional note below on the generated filepaths import. Otherwise this looks correct: the old Template field is fully removed with no remaining references, and the multi-generator rendering, updated tests, and regenerated Fig spec snapshot all pass locally.

data := map[string]string{
"Name": s.Name,
"Description": s.Description,
"Import": filepathsHelperImport,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This injects the filepaths import into every generated spec, whether or not any arg actually uses filepaths. It's fine today because azd extension install always needs it, but if that usage ever goes away the generated spec keeps an unused import, which trips no-unused-vars in the VS Code repo where the spec lives. Consider gating the import on whether the rendered output actually references filepaths so the preamble stays in sync with real usage.

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

Labels

area/extensions Extensions (general)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants