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

Add a face for other fields #735

Open
fniessen opened this issue Sep 26, 2016 · 5 comments
Open

Add a face for other fields #735

fniessen opened this issue Sep 26, 2016 · 5 comments

Comments

@fniessen
Copy link

Would it be possible to add a face (yas-other-fields-highlight-face or such) and to highlight all non-selected fields?

The idea would be that:

  1. $1 gets highlighted with yas-field-highlight-face, while $2 and $3 get highlighted with yas-other-fields-highlight-face; then
  2. $2 gets highlighted with yas-field-highlight-face, while $1 and $3 get highlighted with yas-other-fields-highlight-face; then
  3. $3 gets highlighted with yas-field-highlight-face, while $1 and $2 get highlighted with yas-other-fields-highlight-face.

That would make the variable elements in the template stand out a lot more.

Thanks a lot!

@npostavs
Copy link
Collaborator

Sounds doable. I'm thinking to do it in a slightly simpler way: give all of $1, $2, $3 yas-field-face (this would probably use the :box attribute by default), and the current field will additionally get yas-field-highlight-face (as it does now).

@joaotavora
Copy link
Owner

@npostavs, how would you do it? with an overlay? Those would have to be cleaned up, remember. Anything else might clash with the syntax highlighting, be it font-lock or simple text properties.

Yasnippet has once worked like this (before 0.6 though, I think), but I found it was distracting and clashed with the natural syntax highlighting. This way was much simpler, and also imitated TextMate better.

@npostavs
Copy link
Collaborator

Uh, I had thought fields already have overlays on them, but if not, this might indeed involve more complexity than I'd want to add for such a feature.

Yasnippet has once worked like this (before 0.6 though, I think), but I found it was distracting and clashed with the natural syntax highlighting. This way was much simpler, and also imitated TextMate better.

Eclipse uses :box style "highlighting" of fields, I think it looks reasonable.

@fniessen
Copy link
Author

Thanks for improving this. I'll love it!

@joaotavora
Copy link
Owner

joaotavora commented Sep 27, 2016

@fniessen, if it were up to me (but it isn't anymore) I wouldn't get my hopes up. Adding this feature needlessly bloats yasnippet's sensitive engine.

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

3 participants