Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

ProjectManager.createNewItem() doesn't work with rename on Linux #8175

Closed
bodhiBit opened this issue Jun 19, 2014 · 5 comments
Closed

ProjectManager.createNewItem() doesn't work with rename on Linux #8175

bodhiBit opened this issue Jun 19, 2014 · 5 comments

Comments

@bodhiBit
Copy link
Contributor

When calling ProjectManager.createNewItem() with skipRename set to false in an extension and running it on the Linux version of Brackets (sprint 40), the renaming is skipped anyway.. The item just gets created as if skipRename was set to true..

I can use ProjectManager.renameItemInline() in the promise of createNewItem(), but since renameItemInline() doesn't return a promise, I can't chain any action to it for when the user is done renaming..

Also renameItemInline() doesn't seem to work either when used alone.. It only works together with createNewItem()..

I've created a small test extension to demonstrate the issue..

@peterflynn
Copy link
Member

@bodhiBit If you right-click in the project tree and choose New File, does the inline naming/renaming UI work properly in that case? If so, it might be helpful to compare your extension's code to the way in which DocumentCommandHandlers._handleNewItemInProject() invokes ProjectManager.createNewItem()...

Similarly for ProjectManager.renameItemInline(), you can see an example of it being used alone in DocumentCommandHandlers.handleFileRename(). Does this differ from the way you're invoking it?

@bodhiBit
Copy link
Contributor Author

The built-in "New File" and "Rename" works fine.. I suspect it has something to do with the fact that I'm invoking the commands from the menu, which is implemented differently in Linux..

I've added delayed versions (wrapped in setTimeout) of the commands in my test extension.. The delayed commands works perfectly (except for the delay of course)..

Perhaps the menu somehow cancels the renaming when it's closing after a command has been selected..?

@dangoor
Copy link
Contributor

dangoor commented Jul 7, 2014

Reviewed low priority in the Project Panel area.

@pthiess pthiess mentioned this issue Aug 17, 2014
30 tasks
@dangoor
Copy link
Contributor

dangoor commented Sep 16, 2014

@bodhiBit I believe this is fixed in the ProjectManager branch (pull request #9015) and will be fixed when #8788 is complete. If it's not, it's a bug that should be easy to correct but I'm pretty sure that the new implementation of createNewItem is properly handling skipRename flag. (renameItemInline also returns a promise now).

@dangoor dangoor added this to the Release 0.44 milestone Oct 1, 2014
@dangoor
Copy link
Contributor

dangoor commented Oct 1, 2014

This is fixed on master and in release 0.44

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants