[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Thoughts on syntax consistency across languages #29

Closed
pkazmier opened this issue Jun 10, 2018 · 7 comments
Closed

Thoughts on syntax consistency across languages #29

pkazmier opened this issue Jun 10, 2018 · 7 comments

Comments

@pkazmier
Copy link
Contributor

I'm curious to your thoughts about consistency across languages in terms of common syntactic elements. For example, function definitions vim are not highlighted, but they are orange in ruby and go. Yet, internal vim function names are highlighted orange, but in go they are blue. This inconsistency would be easy to fix, but I'm curious if you are opposed to receiving PRs to improve this consistency or whether you don't agree in principle. Thanks!

@cocopon
Copy link
Owner
cocopon commented Jun 14, 2018

I think that consistency is important too.

About Vim function, it's my mistake 😅

Vim function is linked to Statement (it's blue in Iceberg) group by default: vimFuncKey -> vimCommand -> Statement
So it is displayed in blue color. I'll fix it later!

Sending PR or creating issue about inconsistency is welcome :)

@pkazmier
Copy link
Contributor Author

I submitted #32 to fix.

@pkazmier
Copy link
Contributor Author
pkazmier commented Jul 1, 2018

As I've been trying to normalize the syntax highlighting across several languages, I'm torn on whether or not function invocations should be highlighted. What do you think? To give a concrete example, here is a screenshot of Go code normalized using your guidelines (as I have interpreted them):

screen shot 2018-07-01 at 12 39 02 pm

And here is an alternate version where I experimented with highlighting function invocations and changing variable definitions to green to make them easy to spot:

screen shot 2018-07-01 at 12 39 39 pm

Function invocation highlighting is beneficial when you have a series of function calls within function calls such as:

rand.Seed(time.Now().Unix()) 

From a legibility point of view, it makes it much easier to read code. The only problem is if I use cyan for this function invocation, then there is too much cyan, which require tweaking maybe the color of variable definitions to green perhaps as shown in the alternate version above.

I would be very appreciative of your opinion on the matter as it would impact the PR I've submitted.

@cocopon
Copy link
Owner
cocopon commented Jul 23, 2018

As a first step, I re-organized whole highlighting rules in b688907.
Because your changes and mine affect too wide range, I can't merge them...really sorry 😢

@cocopon
Copy link
Owner
cocopon commented Aug 14, 2018

After much thought, I carefully resolved conflicts and merged your changes (#32) to the latest files. In the process, I modified some definitions in terms of consistency:

  • jsDestructuringBlock should be highlighted as Normal (same as other variables)

  • jsFuncArgs, jsVariableDef should be highlighted as Normal (same as other languages)

  • jsTemplateExpression should be highlighted as Normal (because it should be highlighted as same as normal expressions)

    // Example: `foo` should be highlighted as `Normal`
    `${foo['bar']}`

Feel free to reopen the issue if there are any problems.

@cocopon cocopon closed this as completed Aug 14, 2018
@cocopon
Copy link
Owner
cocopon commented Aug 14, 2018

Ah I forgot to reply your suggestion, sorry...

From a legibility point of view, it makes it much easier to read code. The only problem is if I use cyan for this function invocation, then there is too much cyan, which require tweaking maybe the color of variable definitions to green perhaps as shown in the alternate version above.

As I said in this comment, at the moment, I think that current highlightings have enough readability so using less colors is better. But I am hesitating about which one is really good.

@cocopon cocopon reopened this Aug 14, 2018
@cocopon
Copy link
Owner
cocopon commented Oct 13, 2018

Feel free to reopen the issue or create new one if you find new inconsistencies.

@cocopon cocopon closed this as completed Oct 13, 2018
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

No branches or pull requests

2 participants