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

[Feature request] Highlight matching parentheses #135

Open
euhmeuh opened this issue Feb 20, 2019 · 3 comments
Open

[Feature request] Highlight matching parentheses #135

euhmeuh opened this issue Feb 20, 2019 · 3 comments
Labels

Comments

@euhmeuh
Copy link
Contributor

euhmeuh commented Feb 20, 2019

Specification

When the cursor is on (, ), [, ], { or }, highlight the corresponding closing or opening character (if found).

Notes

It's the only feature missing for this editor to be perfect ;)

There's a lot of algorithms lying around on the Internets, so I guess there's plenty of ways to implement this. I wonder what would be the easiest considering Amp's architecture. Looking at other open source projects for examples might be a good idea.

I'm open to any advice, tips, and directions on how to implement this, if no one has the time to do it. I'm pretty busy myself, that's why I didn't directly submitted a PR, but with some starting points, I could try something.

@jmacdonald
Copy link
Owner

Hi @euhmeuh!

Can you explain a little bit about what problem that feature is solving? Are you dealing with heavily nested parentheses, like this:

nested(functions(are(painful())))

or are you trying to select a series of lines like this:

function() {
  nested_function() {
    really_nested_function() {
      // Lots of content
      // here that makes
      // it difficult to see
      // which nesting level
      // you're targeting.
    }
  }
}

I don't run into the first case very often, but I do run into the second, and I have other ideas for how to solve that. 🙂

@euhmeuh
Copy link
Contributor Author

euhmeuh commented Feb 26, 2019

Well I work with Lisp languages 😛 so I'd say the first case:

(define (harvest crops)
  (cond
    [(wheat? crops) (make-bread water (make-flour crops))]
    [(hop? crops) (make-beer crops)]
    [else (store crops)]))

It's basically the only feature I feel is mandatory for working with Lisp languages: you can just move your cursor from one paren to the other and immediately see the scope of what you're working on.
It's useful when working with Racket, Scheme, Common Lisp, Arc, Clojure... to cite a few.

@jmacdonald
Copy link
Owner

Makes sense! This should sit in the normal mode presenter. That said, those are under a bit of a rewrite for 0.6.0. Once that lands, I can add this to the pipe for a minor release in that series. 🙂

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

No branches or pull requests

2 participants