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

scala/scalaz ligatures #447

Closed
wants to merge 8 commits into from
Closed

scala/scalaz ligatures #447

wants to merge 8 commits into from

Conversation

merlinorg
Copy link

@merlinorg merlinorg commented Jun 24, 2017

Adds ligatures for various scala/scalaz/... symbols including type constraints, applicative builder, tagged types, disjunctions, their friends and distant relatives. Disjunction and conjunction (\/, /\) are treated specially so they only substitute before space, period or leftbracket where they look like types and less like common regexes. Does not include rebuilt font distribution, I'm not that skilled.

@merlinorg
Copy link
Author

Touches on issues #292, #191.

@j-f1
Copy link
Contributor

j-f1 commented Jun 25, 2017

Got a screenshot of the ligatures?

@merlinorg
Copy link
Author

scalaligs

@dhouck
Copy link

dhouck commented Jun 26, 2017

What are those with ligatures disabled? I can guess at some of them, but not all (presumably they’d be clearer if I knew Scala).

EDIT:

I believe they are:

<: >: <% <:< _*
<\/- <\/ -\/ \/ \/- \/> -\/>
\|/ \&/ /\ @@ |@| |+|
-<| <|- -|> |>-

The one I’m least sure on is the one I labeled as |@|. If it’s instead |a|, I think it is a bad idea to have it, since I can imagine that appearing in other contexts where it’s not clear what it’s supposed to be (the same as the =< problem). I’m also wary of the disjunction ligatures, for the reason expressed in #191.

@j-f1
Copy link
Contributor

j-f1 commented Jun 26, 2017

My guess:

<: >: <% <:< _*
<\/- <\/ -\/ \/ \/- \/> -\/>
\|/ \&/ /\ @@ |@| |+|
-<| <|- -|> |>-

@merlinorg
Copy link
Author

The very circled at is indeed |@| which is the applicative builder. The disjunction ligature only kicks in before ., [ or , as...

val a = \/.fromTryCatchNonFatal
type T = \/[A, B]
type t = A \/ B

These seem not hugely common regex cases.

@tonsky
Copy link
Owner

tonsky commented Jun 26, 2017

@merlinorg thanks for taking the effort to make it a pull request. I really like your thinking, but I want Fira Code to stay true to its principles. Those are: ligatures should improve the reading experience, they should not increase confusion and be immediately obvious, they should not break the indentation (e.g. 3-char ligature should take up 3 character spaces without creating too much extra whitespace), and they should work for all languages. I also prefer them to be aestethically pleasing and contribute enough to justify their existence. I also tend not to add very rare combinations as there might be more people hurt by those than there will be people helped by those.

I like the vertical adjustments in <: >: <:< but if we’re doing those I think we should do :<, :> and >:> as well?

I’m not sure about <% seems like very minor adjustment.

_* feels too much of a stretch

\/ and /\ would cause too much conflicts in escape sequences

<\/- <\/ \/> -\/> seems too strange. How often are they used? Same about -\/ \/-. Also worried about escape sequences

\|/ \&/ would not play nicely as 3-width ligatures

@@ I like the idea but would prefer to redraw it myself

|@| |+| are impossible to decypher. I thought that circled + stands for (+). They also have width problems—should be 3-char wide, but that would create too much whitespace around it that isn’t even there.

-<| <|- -|> |>- are great and would be nice addition to |> <|

If you don’t mind I will take the ideas from this PR but will add only stuff I see fit & probably redrawn on my own. Thanks for the contribution!

@doowruc
Copy link

doowruc commented Jun 27, 2017

<% is used heavily in ASP.Net so if it is implemented then %> will also need to be done to match it.

@dhouck
Copy link

dhouck commented Jun 27, 2017

I like <% and %>. I don’t know how often they’re used so I don’t know if they’d be worth it, though.

@doowruc
Copy link

doowruc commented Jun 27, 2017

In ASP.Net (and classic ASP) they are actually used less and less now I think, mostly on legacy sites.

ASP.Net MVC is (AFAIK) used much more widely now and that uses a different rendering engine (Razor) which use @ tags for server-side markup.

Some info on <% and %> is available here

@merlinorg
Copy link
Author

... anent <: and friends, I just included the main ones from scala/scalaz (although I since added :<:) but the missing mirrors would not hurt. If made more opinionated, <% and %> are defensible although their usage in scala and ASP/JSP are presumably waning. The various friends of \/ are only useful/used alongside the disjunction ligature itself; with the more restrictive lookup rules I placed on it I find it to not kick in needlessly but ymmv. All the ligatures suffer from looking out of place in surprising places and so the choice of which to include is obviously personal, I'm happy to close this PR and just use the forked font for my own purposes. Fwiw the ligatures I ended up adding were the following..

         ??? ${ _* *_*
     -<<- <~< <~~> >~> ->>-
   <% <:< :<: <: >: :>: >:> %>
  <\/- <\/ -\/ \/ \/- \/> -\/>
     \|/ \&/ /\ @@ |@| |+|
        -<| <|- -|> |>-

scalaligs

@merlinorg merlinorg closed this Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants