-
Notifications
You must be signed in to change notification settings - Fork 588
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
[Go] syntax rework #1662
[Go] syntax rework #1662
Changes from all commits
984f814
31abd0d
6e733ba
adffe48
2938d85
8d63f72
e1007b3
caa2fd4
ed3c3bd
50997bd
980645e
9fa51d2
982dcbc
0392749
eb519b4
06e203c
23993dc
2825db4
a06dd39
a820b27
a182359
7f44c59
8614e81
7bb6f90
8c7bf1b
5dbd19d
c40f286
c19aaec
02634d3
a7f273d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[ | ||
// 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": "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": "`$", "match_all": true }, | ||
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }, | ||
] | ||
}, | ||
|
||
// Insert an indented line when pressing Enter between parentheses. | ||
{ "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context": | ||
[ | ||
{ "key": "selector", "operator": "equal", "operand": "source.go", }, | ||
{ "key": "setting.auto_indent", "operator": "equal", "operand": true }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also doesn't have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, added the missing selector. |
||
{ "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 }, | ||
] | ||
}, | ||
] |
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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest adding a description for these completions, i.e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm the docs don't mention any descriptions. Apparently, some completions in the standard packages use tab-separated triggers: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Played with generating Really the problem is that even one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meh, sounds like sublimehq/sublime_text#1061 is striking again. I thought tab triggers wouldn't affect it. Or maybe it is actually a different issue, but that would be surprising. |
||
"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", | ||
], | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
// Prefer tabs because gofmt enforces tabs. | ||
"translate_tabs_to_spaces": false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is certainly debatable, but I don't have insight on whether people write Go without gofmt. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't have a
selector
context specifier.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, added the missing selector.