Skip to content


Subversion checkout URL

You can clone with
Download ZIP


F2 should rename the current file #6431

thany opened this Issue · 9 comments

5 participants


When pressing F2 inside of the code editor, I would expect it to rename the file you're working on. Not the file that happens to be selected in the files pane.

Can this be changed?


It is possible to rename the current file that is also in the current project, but not for a file that is not inside the current project. The reason is that rename feature requires to set up an editable input field on top of the selected file in the project tree.


@thany Isn't "the file you're working on" the same thing as "the file that's selected in the files pane"?

To clarify what you mean, it'd be helpful if you could describe the issue this way:
What steps you follow to cause the issue
What happens when you do those steps
What you expected to happen instead (what you think it should do differently)


Hm, now that I look into it a little bit better, I was mistaken. I meant to say "the directory that's selected in the left pane".

So, when editing a file, you can select a directory in the left pane without anything changing in the code editor. When carrying on editing, the directory remains selected. When then pressing F2, you start renaming the directory... Not what you'd expect after having resumed editing the file.

@redmunds redmunds was assigned

@redmunds -- if we decided to fix this let's discuss what the desired behavior shall be.


As @RaymondLim pointed out, you can edit a file outside of the current project tree, and it's not possible to rename a file in that case. Another case where you cannot edit file currently being edited is when you use File > New and file has not yet been saved to disk.

If this suggestion was implemented, then how would user be able to rename a folder? Close all files first? That's equally confusing and undiscoverable.

The main problem is that there's currently no way to put focus in the project tree -- you can select items in the tree, but focus always goes back to the editor (except when renaming via inline edit control). If user could clearly know when the focus is in the file tree versus the editor, then I think this suggestion makes sense. Another benefit would be the ability to navigate file tree using keyboard! But I think this is a significant change and until this change gets made, I suggest we keep it like it is for now.

@thany Does this make sense?


Another thing that would make this less confusing would be to make folders not selectable in the tree. Then they could still be renamed via right-click, but you wouldn't get these situations where the tree selection disagrees with the 'current document' / open editor. Several other tools behave this way.

Unfortunately, I don't think jsTree supports this so it would require some work to make Brackets behave that way. (#4690 would track further discussion along those lines)


@redmunds It does makes sense, partly. From a technical standpoint, I understand you "want" to put focus to an element to hit F2 on. But I take some example from Lightroom. I'm not sure if you've ever used it, but in Lightroom you can't rename a folder unless you right-click on it. Otoh, Lightroom "displays" a folder which Brackets can't.

Now, a code editor is of course much more keyboard-oriented than a photo editor. But still, I don't think, personally, that it's that much of a problem that renaming a folder would become impossible by keyboard. If F2 renames the thing that's I'm looking at in the main pane, then that makes sense to me. You can't make the editor "display" a whole folder (perhaps as thumbnails), so not being able te rename that by keybaord, consequently, would make sense to me as well.

Doing a right-click and select Rename, to rename a folder, as a requirement to rename a folder, doesn't seem all that bad to be personally. After all, how often would you rename a folder anyway?

@peterflynn Sort-of agree with you there. But incontrary to your argument, I would hint towards making a folder selectable and make it display something sensible in the main pane. At least it wouldn't require doing weird things to jsTree.


Move to backlog. We may want to handle this with the overall focus story.


Closing since it's no longer possible to select folders in the sidebar, making this selection discrepancy impossible to encounter.

@peterflynn peterflynn closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.