Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Contextual types. Types are scoped where types are expected. There's no whitelist of "known" types. * Better understands the language and its syntax. Better at handling whitespace and comments inside complex forms. Better at handling other nuances. Unlikely to be confused by unusual code style. * Vars and consts in the root scope are added to the symbol index and searchable by ⌘R, ⌘⇪R, and `goto_definition`. * Supports parenthesized `type (...)` groups, not just `const (...)` and `var (...)`. * The first argument to `new` and `make` is scoped as a type. * Methods declared inside an `interface` are added to the symbol index, reflecting the fact that they actually exist as functions. * Supports embedded structs. * Supports inherited interfaces. * Supports imaginary number literals. * Variable declarations are scoped differently from other variable occurrences. * `iota` is scoped only in constant initialization expressions. * Symbols in ⌘R are annotated with their origin: `var`, `const`, `type` or `func`. * Auto-pairing of backticks. * Much more comprehensive tests. * All keywords and predeclared identifiers are added to auto-completions by default. * Better snippets that don't mess with auto-completion. * Slightly better indentation rules that more closely match `gofmt`. Current shortcomings (?): * Fewer meta scopes: needs feedback. * No support for block labels: needs feedback.
- Loading branch information
Showing
32 changed files
with
3,564 additions
and
1,043 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[ | ||
// Auto-pair backquotes. Partially copied from the default Sublime keymap, | ||
// with some modifications. | ||
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context": | ||
[ | ||
{ "key": "selector", "operator": "equal", "operand": "source.go", }, | ||
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, | ||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "(?:^|\\s)$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\\s|$)", "match_all": true }, | ||
] | ||
}, | ||
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}`"}, "context": | ||
[ | ||
{ "key": "selector", "operator": "equal", "operand": "source.go", }, | ||
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, | ||
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }, | ||
] | ||
}, | ||
{ "keys": ["`"], "command": "move", "args": {"by": "characters", "forward": true}, "context": | ||
[ | ||
{ "key": "selector", "operator": "equal", "operand": "source.go", }, | ||
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, | ||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }, | ||
] | ||
}, | ||
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": | ||
[ | ||
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, | ||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }, | ||
] | ||
}, | ||
|
||
{ "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context": | ||
[ | ||
{ "key": "setting.auto_indent", "operator": "equal", "operand": true }, | ||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, | ||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true } | ||
] | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"scope": "source.go", | ||
|
||
"completions": [ | ||
// https://golang.org/ref/spec#Keywords | ||
"break", | ||
"default", | ||
"func", | ||
"interface", | ||
"select", | ||
"case", | ||
"defer", | ||
"go", | ||
"map", | ||
"struct", | ||
"chan", | ||
"else", | ||
"goto", | ||
"package", | ||
"switch", | ||
"const", | ||
"fallthrough", | ||
"if", | ||
"range", | ||
"type", | ||
"continue", | ||
"for", | ||
"import", | ||
"return", | ||
"var", | ||
|
||
// https://golang.org/ref/spec#Predeclared_identifiers | ||
"bool", | ||
"byte", | ||
"complex64", | ||
"complex128", | ||
"error", | ||
"float32", | ||
"float64", | ||
"int", | ||
"int8", | ||
"int16", | ||
"int32", | ||
"int64", | ||
"rune", | ||
"string", | ||
"uint", | ||
"uint8", | ||
"uint16", | ||
"uint32", | ||
"uint64", | ||
"uintptr", | ||
"true", | ||
"false", | ||
"iota", | ||
"nil", | ||
"append", | ||
"cap", | ||
"close", | ||
"complex", | ||
"copy", | ||
"delete", | ||
"imag", | ||
"len", | ||
"make", | ||
"new", | ||
"panic", | ||
"real", | ||
"recover", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
// Prefer tabs because gofmt enforces tabs. | ||
"translate_tabs_to_spaces": false, | ||
// Trigger autocompletion on dot access. | ||
"auto_complete_triggers": [ | ||
{ | ||
"characters": ".", | ||
"selector": "source.go", | ||
}, | ||
], | ||
} |
Oops, something went wrong.