atom / language-go

Go language package for Atom
Other
106 stars 65 forks source link

Implement naming conventions in Go grammar #182

Open chbk opened 4 years ago

chbk commented 4 years ago

Description of the Change

This is a rewrite of the Tree-sitter grammar to implement naming conventions for syntax scopes.

Benefits

Possible Drawbacks

Some new scopes to be added to themes. The changes aim to facilitate theme development, filling the template is enough to ensure coherent highlighting across languages, instead of painfully creating styling rules for every language separately.

Applicable Issues

Related Pull Requests

chbk commented 4 years ago

Preview of the changes with Atom's default syntax themes:

Without naming conventions
(current Tree-sitter grammar)
With naming conventions in
theme and Tree-sitter grammar
Solarized Dark
solarized-dark-go-0
Solarized Dark
solarized-dark-go-1
One Dark
one-dark-go-0
One Dark
one-dark-go-1
Base16 Tomorrow Dark
base16-dark-go-0
Base16 Tomorrow Dark
base16-dark-go-1
Atom Dark
atom-dark-go-0
Atom Dark
atom-dark-go-1
Solarized Light
solarized-light-go-0
Solarized Light
solarized-light-go-1
One Light
one-light-go-0
One Light
one-light-go-1
Base16 Tomorrow Light
base16-light-go-0
Base16 Tomorrow Light
base16-light-go-1
Atom Light
atom-light-go-0
Atom Light
atom-light-go-1

Code snippet:


package main

import (
  "bosco"
  mule "molly"
)

// Management will be pleased

const pet string = "steeve"

func dig(b *Bag, i int) int {
  b.bismor += i
  return molly.come.here()
}

type Bag struct {
  gold, nitra, bismor int
}

func yell(say func(string)) {
  say("For Karl")
  say("Rock & Stone")
}

func main() {

  var inventory Bag
  var iron, will = true, true
  var core interface{} = 1.4
  var matrix = &core
  const leaf_lover = iota * 2

  beers := map[string]int{
    "Dark Morkite": 5,
    "Malt Rockbearer": 4,
  }

  laser := make(chan string)
  go func() {
    laser <- "jadiz"
  }()
  look_here := <-laser

  flares := []int{2, 3, 4}
  for i, f := range flares {
    if f >= 4 {
      say("Out of flares")
    } else {
      say("Lighting up")
    }
  }
}