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

[CLOSED] Add "New Folder" and "Rename" features #1675

Open
core-ai-bot opened this issue Aug 29, 2021 · 12 comments
Open

[CLOSED] Add "New Folder" and "Rename" features #1675

core-ai-bot opened this issue Aug 29, 2021 · 12 comments

Comments

@core-ai-bot
Copy link
Member

Issue by gruehle
Wednesday Sep 26, 2012 at 14:55 GMT
Originally opened as adobe/brackets#1719


This pull request adds two new features: New Folder, and Rename file/folder.

IMPORTANT: This pull request requires adobe/brackets-shell#120

USAGE

The New Folder command is added to the File menu and the project context menu. When selected, a new folder is created at the same level as the current selection in the project tree. If nothing in the project tree is selected (for example, if a file in the working set is selected), the folder is created at the root of the project folder.

The Rename command is added to the project context menu. It will rename the selected file or folder. Note that the Rename command will only work on project tree items. You cannot rename a file in the working set.

API NOTES

DocumentManager dispatches a new fileNameChange event whenever the name of a file or folder has changed.

DirectoryEntry.getDirectory() is now implemented. This will return a reference to an existing directory or create a new directory if needed.

UNIT TESTS

Unit tests are added for rename(), but not directory creation. We need an API to remove a directory before we can add unit tests that create a directory.


gruehle included the following code: https://github.com/adobe/brackets/pull/1719/commits

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Wednesday Sep 26, 2012 at 19:50 GMT


Oh, one other comment actually -- the inline editor UI shows the filename in two places, so it needs to listen for the notification to. (Or maybe its TextRanges do, and then the inline editor UI listens to something they dispatch in turn).

The Find in Files panel could be another one, but I think since we don't keep it up to date in other cases (e.g. the text content changing causing line numbers to shift) we could safely ignore it for now.

@core-ai-bot
Copy link
Member Author

Comment by gruehle
Friday Sep 28, 2012 at 01:36 GMT


For the inline editor, we actually get lucky. Only the filename is shown. If the file is renamed, it is selected before it is renamed, so the inline editor is closed. If a folder containing the file is renamed, no UI needs to change and the functionality works since the underlying document path is changed.

Find in Files has been fixed.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Monday Oct 01, 2012 at 22:49 GMT


On Windows, when you use New Folder, the initial folder named "Untitled" is not sorted correctly. It's listed with the files (at the bottom) and not with the folders (at the top). Even after changing the name, it's still sorted with the files.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Tuesday Oct 02, 2012 at 00:18 GMT


Initial review complete

@core-ai-bot
Copy link
Member Author

Comment by gruehle
Tuesday Oct 02, 2012 at 05:56 GMT


Thanks for reviewing! All comments have been addressed and changes pushed.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Tuesday Oct 02, 2012 at 19:24 GMT


I notice another bug that the "New File" recognizes when a file named Untitled.js already exists, and then generates a unique name (e.g. Untitled-1.js), but "New Folder" does not generate a unique name.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Wednesday Oct 03, 2012 at 00:50 GMT


UTR BUG: I keep hitting the case where "New File" and "New Folder" stop working, but I can't nail down a reproducible recipe. Anyway, something to be on the lookout for.

@core-ai-bot
Copy link
Member Author

Comment by gruehle
Wednesday Oct 03, 2012 at 04:58 GMT


I fixed the "New Folder" untitled naming problem. I haven't seen cases where "New File" or "New Folder" break. Are you seeing this on Mac or PC?

@core-ai-bot
Copy link
Member Author

Comment by njx
Wednesday Oct 03, 2012 at 09:26 GMT


I've seen the failing "New File" in master, so it's not related to Glenn's changes. There seems to be some case where it throws an exception when trying to scroll the new file into view in the project panel. I'll try to find repro steps and file a bug.

@core-ai-bot
Copy link
Member Author

Comment by gruehle
Wednesday Oct 03, 2012 at 17:09 GMT


The selection is now done after sorting. Hopefully this resolves the last issue.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Wednesday Oct 03, 2012 at 17:19 GMT


Yes, this fixes the selection issue. This pull request is now ready to merge as soon as the necessary brackets-shell pull request gets merged.

@core-ai-bot
Copy link
Member Author

Comment by jasonsanjose
Wednesday Oct 03, 2012 at 18:26 GMT


Merging

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

No branches or pull requests

1 participant