Skip to content

fix: show save dialog when creating new files (issue 6309) #6745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

su0as
Copy link

@su0as su0as commented Jul 22, 2025

Description

This PR fixes issue #6309 where the "Create File" command always created files in the workspace root instead of allowing users to choose the location.

Related Issue

Fixes #6309 - Files created in workspace root instead of chosen directory

Changes

  • Added showSaveDialog?: boolean property to ApplyToFilePayload interface for backward compatibility
  • Updated VS Code extension message handler to show a native save dialog when showSaveDialog flag is set
  • Modified frontend to set showSaveDialog: true when creating new files (when fileExists is false)

Testing

Manual Testing Performed

  • ✅ Creating new files shows the save dialog
  • ✅ Dialog suggests correct filename from relative path (e.g., utils/helper.js suggests helper.js)
  • ✅ User can choose any location to save the file
  • ✅ Existing files still apply changes without dialog
  • ✅ User can cancel file creation
  • ✅ Nested directories work correctly (e.g., src/components/Button.tsx)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • My code follows the style guidelines of this project (Prettier formatted)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • The fix is focused on the specific issue without unrelated changes
  • New and existing unit tests pass locally with my changes
  • I have added tests that prove my fix is effective (can be added in follow-up PR)

Summary by cubic

Fixed an issue where creating a new file always placed it in the workspace root by showing a save dialog so users can choose the file location.

  • Bug Fixes
    • Added a save dialog when creating new files, allowing users to pick the directory and filename.
    • Existing files are updated without showing the dialog.

@su0as su0as requested a review from a team as a code owner July 22, 2025 07:06
@su0as su0as requested review from tingwai and removed request for a team July 22, 2025 07:06
Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@su0as
Copy link
Author

su0as commented Jul 22, 2025

recheck

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Change location where Create File writes to.
1 participant