liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.5k stars 256 forks source link

Feature Request: Selective Auto-Delete for Remote Files on Local Deletion #1031

Open miztizm opened 1 month ago

miztizm commented 1 month ago

Summary: I am requesting an enhancement to the SFTP/FTP extension that would allow for the auto-deletion of a single remote file when its corresponding local file is deleted from Visual Studio Code. This feature should operate independently of full directory synchronization, functioning similarly to the "Upload on Save" feature but for deletions.

Current Behavior: Currently, the extension supports syncing changes between local and remote directories, including deletions. However, this is part of a broader sync functionality that mirrors the entire directory structure.

Requested Behavior: I would like the extension to support a more granular approach where individual file deletions in the VS Code editor can trigger the deletion of the corresponding file on the remote server without needing to sync the entire directory. This behavior should be similar to the "Upload on Save" feature, where saving a file locally automatically updates the file on the remote server.

Use Case: This feature would be particularly useful for developers who work in environments where changes are frequently made and tested incrementally. Being able to delete a file locally and have that change immediately reflected on the server without manually syncing the entire directory would streamline workflows significantly.

Implementation Suggestion: A possible implementation could involve adding a configuration option such as autoDeleteOnLocalDelete in the sftp.json configuration file. When set to true, this would enable the behavior. Here is a possible configuration snippet:

{
    "name": "Server",
    "host": "example.com",
    "protocol": "sftp",
    "port": 22,
    "username": "username",
    "password": "password",
    "remotePath": "/path/to/remote",
    "uploadOnSave": true,
    "autoDeleteOnLocalDelete": true
}

Additional Notes:

Ensuring that this feature includes safeguards or confirmations before deletion could help prevent accidental data loss. Optionally, this feature could be extended to include other actions triggered by local events, enhancing the flexibility of the extension. I believe this feature would enhance the utility of the SFTP/FTP extension by making it more adaptable to a variety of development workflows and environments.