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

Fix Go's variables #88

Merged
merged 1 commit into from
Oct 13, 2021
Merged

Conversation

keithrussell42
Copy link
Contributor

The Go syntax causes some schemes to colour all variables of any kind
with the "variable" colour. This can also be seen with the
built-in "Sixteen" colour scheme (and, indeed, with the original Base16
it came from). Without the change in this commit there is no instance
of a variable with foreground which contrasts with, say, Python where
most variables appear with the foreground colour. In the case of
Solarized light it's a "sea of blue".

An example in Python shows the expected behaviour.

if not os.path.exists(repo_name):
    return False
for fname in ["refs", "HEAD", "objects", "hooks"]:

"os", "path", "repo_name" and "fname" are all set to the default
foreground.

This Go code, however does not.

fileHeader := make([]byte, exifHeaderSize)
if _, err := data.Read(fileHeader); err != nil {

"fileHeader", "exifHeaderSize", "err" (both instances) and "data" all
display as the variable colour (blue, in the case of Solarized light
theme).

I'm not expecting the syntax file to change any time soon (changing the
way the syntax definition works could have drastic downstream effects).
Working around it in the scheme seems like the right approach. I
believe JavaScript has a similar variable workaround.

The Go syntax causes some schemes to colour _all_ variables of any kind
with the "variable" colour. This can also be seen with the
built-in "Sixteen" colour scheme (and, indeed, with the original Base16
it came from). Without the change in this commit there is no instance
of a variable with foreground which contrasts with, say, Python where
most variables appear with the foreground colour. In the case of
Solarized light it's a "sea of blue".

An example in Python shows the expected behaviour.

    if not os.path.exists(repo_name):
        return False
    for fname in ["refs", "HEAD", "objects", "hooks"]:

"os", "path", "repo_name" and "fname" are all set to the default
 foreground.

This Go code, however does not.

  	fileHeader := make([]byte, exifHeaderSize)
	if _, err := data.Read(fileHeader); err != nil {

"fileHeader", "exifHeaderSize", "err" (both instances) and "data" all
display as the variable colour (blue, in the case of Solarized light
theme).

I'm not expecting the syntax file to change any time soon (changing the
way the syntax definition works could have drastic downstream effects).
Working around it in the scheme seems like the right approach. I
believe JavaScript has a similar variable workaround.
@braver
Copy link
Owner

braver commented Oct 13, 2021

I believe JavaScript has a similar variable workaround.

Yes, I don't think the syntax it at fault really, it's just that in Solarized all variables are blue. Except in most cases they are switched back to the foreground color. PHP is generally a sea of blue as well. There is no real reason for all of this, it's just the output several inconsistent systems coming together: there is no solid spec for Solarized so it itself is inconsistent (although I did try to improve it there), the syntaxes used to be wildly inconsistent too.

This looks like a good improvement though, I have nothing against it. Let's ship it!

And thanks for the donation by the way, it is very much appreciated ❤️

@braver braver merged commit 24d8ee8 into braver:master Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants