Skip to content

Add file parameter type for workspace file selection in templates#12

Merged
jeremytenjo merged 4 commits intomainfrom
copilot/add-template-file-selection
Nov 9, 2025
Merged

Add file parameter type for workspace file selection in templates#12
jeremytenjo merged 4 commits intomainfrom
copilot/add-template-file-selection

Conversation

Copy link
Contributor

Copilot AI commented Nov 9, 2025

Templates can now prompt users to select files from the workspace via a native file picker dialog.

Changes

  • Type system (ParamsPropsSchema.ts): Added 'file' as a valid param type
  • File selection (generateCode/index.ts): Implemented using vscode.window.showOpenDialog, stores selected file path in params object
  • Documentation (README.md): Documented params feature including all types (input, dropdown, file)
  • Example (superCodeGen.schema.ts): Added "Component with Config" template demonstrating file selection

Usage

const template: SuperCodeGeneratorTemplateSchema = {
  type: 'Component with Config',
  params: [
    {
      name: 'configFile',
      type: 'file',
      description: 'Select a configuration file'
    }
  ],
  files: [{
    path: ({ name }) => `${name}.tsx`,
    template: ({ params }) => `
      // Config from: ${params.configFile}
      export default function Component() { /* ... */ }
    `
  }]
}

Selected file path is available in template/path functions via params.configFile.

Original prompt

add a template option to select a file from the workspace


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 9, 2025
Copilot AI and others added 3 commits November 9, 2025 21:28
Co-authored-by: jeremytenjo <25231946+jeremytenjo@users.noreply.github.com>
Co-authored-by: jeremytenjo <25231946+jeremytenjo@users.noreply.github.com>
Co-authored-by: jeremytenjo <25231946+jeremytenjo@users.noreply.github.com>
Copilot AI changed the title [WIP] Add template option to select a file from workspace Add file parameter type for workspace file selection in templates Nov 9, 2025
Copilot AI requested a review from jeremytenjo November 9, 2025 21:34
@jeremytenjo jeremytenjo marked this pull request as ready for review November 9, 2025 21:49
@jeremytenjo jeremytenjo merged commit 397207f into main Nov 9, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants