-
Notifications
You must be signed in to change notification settings - Fork 750
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
Command like "Balance Parens" from sc.app #602
Comments
I'd like to see this too! Graham
|
+1. This would be great! |
Bumping with a question for Jakob: If I wanted to implement this, where would I begin? I just had to hunt by hand for the closing brace of a long if-branch. Why isn't the IDE searching for that brace for me? (Compare emacs: cursor before the opening brace, then ctrl-alt-F.) Tired of it -- I want to implement it myself. We really need this feature. |
Hi James, I'm glad you want to contribute :) You'll need to add some key handling in ScCodeEditor::keyPressEvent() at: If you need to search for existing brackets in the document, take a look at how TokenIterator class is used, for example in ScCodeEditor::matchBrackets() in the same file. Also take at look at its header file, because it has useful comments about its methods: Cheers |
Hmm, couple more thoughts: The action will need to be connected to the signal multiplexer just as the SelectRegion action, which will distribute the action trigger to whatever editor is currently active. Then you add the corresponding "slot" method to ScCodeEditor where you implement the functionality. Moreover there are already GotoPreviousBlock and GotoNextBlock actions which will jump to next/previous outer bracket. Maybe it would make sense to rather just add SelectToNextBlock and SelectToPreviousBlock which would do the same, only it would select everything between old cursor position and new position after the jump. |
Done. |
Perhaps this should be a new issue, but... It seems that the functionality is currently selecting a Region not the Enclosed Block. The shortcut assigned to Select Enclosed Block appears to select the Region, while the shortcut for Select Region, doesn't do anything. SC IDE 3.6.6 |
Works as expected here (in 3.7alpha): |
I raised this suggestion in #444, but it got lost. It would be very useful to be able to select not only "regions" delimited by () but also to expand the selection to include everything in the next outer layer of brackets. I used this feature a lot in sc.app, and in emacs, I could get close to the same functionality using C-M-f and C-M-b. There is nothing in the ide that does anything like this, and sometimes, I really wish it were easier.
The text was updated successfully, but these errors were encountered: