fdorg / flashdevelop

FlashDevelop is a free and open source code editor.
MIT License
817 stars 219 forks source link

Add keyboard shortcuts for "new class"/"new interface"/etc. dialogs (now accessible through Project panel) #1268

Open gene-pavlovsky opened 8 years ago

gene-pavlovsky commented 8 years ago

I frequently find a need to create a new class, interface etc., the dialogs in the project panel are really useful for that, but would be convenient if I could do it with keyboard shortcuts. By default package may be populated with the package of currently open file.

wise0704 commented 8 years ago

Would you want it to be added to the global shortcuts, or fixed shortcuts? image For example, Cut, Copy, Paste, Delete and Rename are fixed shortcuts, and they don't show in the ShortcutDialog.

Fixed shortcuts mean easier implementations for developers, and less clutter of shortcut keys for users, but obviously, fixed. Global shortcuts mean configurable, but can add more conflicts to the existing shortcuts (like, there are already 12 options that includes the word "New").

If you want fixed, we should discuss the shortcut values. If you want global, I can still do it. But meanwhile check out #1245 - if this gets merged you can group them all with the same prefix; something like Ctrl+Shift+A, C/E/F/I/N.

gene-pavlovsky commented 8 years ago

I'd like to be able to open the "Add New Something" dialog without having to open the project panel, or in fact using mouse at all. Can it be accomplished with fixed shortcuts? In fact, I love your #1245 PR, that would be the most awesome solution in my opinion. Alternatively, I would be happy enough if a shortcut would open that Add > context menu (without having to go to the project panel), offering to add in the current document's folder.. but is that intuitive and good usability?

wise0704 commented 8 years ago

Fixed shortcuts require the parent control of the context menu to have focus, so wouldn't work. I'm not sure if it's possible to add a new item without selecting a folder... Also, I don't think it's possible to open a sub item in a context menu, as that is a ToolStripDropDownItem, which is not a Control. There could be a way to work around it such as adding them to a temporary instance of a context menu, but I think that will over-complicate things. And I don't think the current structure of the context menu should be changed either.

Thinking how a folder needs to be selected to add an item, now I don't think global shortcuts are appropriate for those either. It's a contextual shortcut, and since currently there is no support for contextual shortcuts (I might work on it later tho, after the advanced shortcuts is merged), the only option is to have the shortcuts in the context menu as fixed.

If you want a feature that allows you to add items to folders without using the ProjectManager nor the mouse, I think it's better to have that as a plugin, rather than built-in. A plugin like in VSCode which allows you to select a destination folder and item type only using the keyboard to type.

gene-pavlovsky commented 8 years ago

I completely understand your point about having to select the destination folder does complicate thing. What I'm using now is, with Alt-Shift-P set as Project panel shortcut, and those AutoHotKey shortcuts

#if WinActive("ahk_exe FlashDevelop.exe")
; New class
^!n::Send !+p{Left}{AppsKey}a
; New interface
^!i::Send !+p{Left}{AppsKey}a{Down 3}{Enter}

Of course in Haxe mode the items on that menu are different so these shortcuts don't work as expected. So it's not flexible - hence this feature request. I'm not sure about plugin is best or not, it's up to you, the developers. As a user I'd like simplest usability and no configuration: using current file's folder is a sensible default, and the dialog itself allows to change the package (and thus the folder).