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

bracket auto-paring #513

Closed
ifranco opened this issue Sep 19, 2012 · 11 comments
Closed

bracket auto-paring #513

ifranco opened this issue Sep 19, 2012 · 11 comments

Comments

@ifranco
Copy link

ifranco commented Sep 19, 2012

Several code editors (vim, emacs, texmate) have a feature called bracket auto-pairing.
This is well described on Textmate's feature page:

"When writing structured text (like markup or source code) there are characters which go together in pairs. For example in a programming language you rarely type an opening brace ({) without also needing the closing brace (}).

To help you keep these characters balanced, TextMate will insert the appropriate closing character after the caret when you type the opening one. If you type the closing character TextMate is smart enough to overwrite the auto-inserted one. If you type an opening character and then delete it using backward delete (⌫) then the auto-inserted character will also be deleted. If you only want to delete the auto-inserted character, use forward delete instead (⌦).

It is also possible to wrap a selection in an open/close character by selecting text and typing the opening character. For example if you type foo, select it and type ( then TextMate will make it (foo) placing the caret after the ending parentheses."

(from: http://manual.macromates.com/en/working_with_text)

@timblechmann
Copy link
Contributor

rewording. please use labels instead of [] in the subject.

feature itself is widely implemented, but it is great to see a detailed specification.

@ifranco
Copy link
Author

ifranco commented Sep 20, 2012

Hi Tim,
Shure, I just can't seem to find how to add labels to issues.
Maybe because I'm not a collaborator?

Best,
Ivan

On Sep 20, 2012, at 4:00 AM, Tim Blechmann notifications@github.com wrote:

rewording. please use labels instead of [] in the subject.

feature itself is widely implemented, but it is read to see a detailed specification.


Reply to this email directly or view it on GitHub.

@gusano
Copy link
Member

gusano commented Oct 6, 2012

For the record, I'm adding details specified in #582 (closed as duplicate).
It would be nice to

  • make this behavior enabled by user preference
  • add auto-indentation of closed bracket when one types ENTER:
    • I type: var func = { + ENTER

    • I get:

      var func = {
          // cursor is here
      }
      

@telephon
Copy link
Member

telephon commented Oct 7, 2012

On 20.09.2012, at 16:27, ifranco notifications@github.com wrote:

Hi Tim,
Shure, I just can't seem to find how to add labels to issues.
Maybe because I'm not a collaborator?

it may be the browser. Here it also doesn't work on FireFox.

@gusano
Copy link
Member

gusano commented Oct 20, 2012

Thinking about it, auto-pairing and intelligent-insertion on selected text should also work for " and '.

@sensestage
Copy link
Contributor

On Saturday 20 October 2012 13:51:08 Yvan Volochine wrote:

Thinking about it, auto-pairing and intelligent-insertion on selected text
should also work for " and '.

maybe a separate issue, but it would at least be nice to see the opening
bracket light up when you type the closing one, so you can actually see
whether they match up as you expect them to, as you type.
This is a feature I really miss in the IDE, as I'm so used to it in Emacs.

sincerely,
Marije

@jamshark70
Copy link
Contributor

Marije: It already does that. There's a preference for bracket matching color in the Fonts and Colors panel.

@sensestage
Copy link
Contributor

On Saturday 20 October 2012 16:04:15 jamshark70 wrote:

Marije: It already does that. There's a preference for bracket matching
color in the Fonts and Colors panel.

I didn't see it happen in the default preference set...
I see text blinking up red, when there is a mismatch, but no assurance when
I'm doing it right...

sincerely,
Marije

@jleben
Copy link
Member

jleben commented Oct 22, 2012

On Mon, Oct 22, 2012 at 9:04 AM, sensestage notifications@github.comwrote:

On Saturday 20 October 2012 16:04:15 jamshark70 wrote:

Marije: It already does that. There's a preference for bracket matching
color in the Fonts and Colors panel.

I didn't see it happen in the default preference set...

Maybe you had on old config file. At some point, changing of settings
format resulted in bracket-match highlighting preference cleared, so you
ought to re-set it again. Does it work for you if you set it manually, or
if you completely remove the config file, and restart IDE, to make a clean
start?

@sensestage
Copy link
Contributor

Hiho,

On Monday 22 October 2012 09:15:15 Jakob Leben wrote:

On Mon, Oct 22, 2012 at 9:04 AM, sensestage notifications@github.comwrote:

On Saturday 20 October 2012 16:04:15 jamshark70 wrote:

Marije: It already does that. There's a preference for bracket matching
color in the Fonts and Colors panel.

I didn't see it happen in the default preference set...

Maybe you had on old config file. At some point, changing of settings
format resulted in bracket-match highlighting preference cleared, so you
ought to re-set it again. Does it work for you if you set it manually, or
if you completely remove the config file, and restart IDE, to make a clean
start?

ok, that (setting the preference in the menu) seems to fix it partly.

What I notice is that as I type, the bracket I type lights up in the color I
define, but not the matching one before (which I would like to see).
If I go back to it with the cursor, both light up. There is also a slightly
different behaviour coming from one side or the other with the cursor.

sincerely,
Marije

gusano added a commit to gusano/supercollider that referenced this issue Mar 27, 2013
 - hitting ENTER when between curly brackets adds a newline between
brackets and put the cursor in between with correct indention
 - re supercollider#513

Signed-off-by: Yvan Volochine <yvan.volochine@gmail.com>
@jleben
Copy link
Member

jleben commented Apr 1, 2013

This has been implemented. The conditions under which symmetric characters are automatically inserted may be improved, but I believe the current implementation is sufficient to closet this request.

@jleben jleben closed this as completed Apr 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants