Skip to content
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

Creating a new file with clipboard contents #1995

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Syrux64
Copy link

@Syrux64 Syrux64 commented Feb 23, 2025

Description

This WIP PR does the following:

  • A new file can be created with the contents on the clipboard using menu action.
  • PTAL and LMK if I can proceed to implement this with shortcut key.

Related Issue

Screenshot

REC-2025022334437.PM.mp4

Potential Bugs to fix

  • New file not being opened in new tab.

@Syrux64 Syrux64 changed the title WIP PR for Creating a file with copied contents Creating a new file with clipboard contents Feb 23, 2025
@austincondiff
Copy link
Collaborator

@Syrux64 looks great so far. Yeah go ahead and implement the keyboard shortcut for this. When the navigator is in focus and cmd V is pressed, it should create the file inside the selected folder. If a file is selected, the newly created file should be a sibling to the selected file both having the same parent folder.

@Syrux64
Copy link
Author

Syrux64 commented Feb 24, 2025

@austincondiff Sure! Thanks for the heads up.

@thecoolwinter
Copy link
Collaborator

This looks good so far! If you want to merge this before finishing the key command that would be fine.

My one suggestion is you can remove your new file method and just add a new contents parameter to the addFile method, with a default value of nil. That should make it so we don't have multiple addFile-type methods which could get messy.

    func addFile(
        fileName: String,
        toFile file: CEWorkspaceFile,
        useExtension: String? = nil,
        contents: Data? = nil // Shouldn't break any existing calls, reduces duplicate code.
    ) throws -> CEWorkspaceFile {

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.

3 participants