Skip to content

Commit

Permalink
[Go] Fix highligting of import and initializer statements
Browse files Browse the repository at this point in the history
  • Loading branch information
wbond committed Feb 1, 2016
1 parent 87362df commit 380a68e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Go/Go.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ contexts:
- include: no_param_anonymous_function_begin
- include: multi_param_anonymous_function_begin
- include: single_param_anonymous_function_begin
- include: basic_things
- include: exported_variables
- match: '^[[:blank:]]*(import)\b\s+'
- match: '^\s*(import)\b\s+'
captures:
1: keyword.control.import.go
push:
Expand All @@ -32,6 +30,8 @@ contexts:
captures:
0: punctuation.definition.string.end.go
pop: true
- include: basic_things
- include: exported_variables
- include: block
- include: root_parens
- include: function_calls
Expand Down Expand Up @@ -126,7 +126,7 @@ contexts:
2: support.function.any-method.go
3: punctuation.definition.parameters.go
initializers:
- match: '^[[:blank:]]*(var)\s+(?:[[:alpha:]_][[:alnum:]_]*)(?:,\s+[[:alpha:]_][[:alnum:]_]*)*'
- match: '^\s*(var)\s+(?:[[:alpha:]_][[:alnum:]_]*)(?:,\s+[[:alpha:]_][[:alnum:]_]*)*'
comment: This matches the 'var x int = 0' style of variable declaration.
scope: meta.initialization.explicit.go
captures:
Expand Down
12 changes: 12 additions & 0 deletions Go/syntax_test_go.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
// SYNTAX TEST "Packages/Go/Go.sublime-syntax"
package examples

import (
// ^ meta.preprocessor.go.import
"fmt"
)

(
// var commented int = 0
// ^ comment.line
var valid int = 0
// <- meta.initialization.explicit
)

const (
graveAccentString = `highlights %s and %[1]s`
// ^ constant.other.placeholder
Expand Down

0 comments on commit 380a68e

Please sign in to comment.