forked from DisposaBoy/GoSublime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoSublime.sublime-settings
259 lines (229 loc) · 10.8 KB
/
GoSublime.sublime-settings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
{
// The maximum amount of memory(MiB) that MarGo is allowed to use
"margo_oom": 1000,
// you may set specific environment variables here
// e.g "env": { "PATH": "$HOME/go/bin:$PATH" }
// in values, $PATH and ${PATH} are replaced with
// the corresponding environment(PATH) variable, if it exists.
"env": {},
// Your shell. e.g. on Linux and OS X, if your shell bash:
// you may set it to ["/bin/bash", "--login", "-c", "$CMD"]
// it's useful to pass the --login argument in order for it run your ~/.bashrc etc.
// otherwise environment variables may not be seen by Sublime Text and therefore GoSublime
//
// If set, commands are passed to it instead of the Python default which for *nix is usually
// /bin/sh which in most cases is not what you want
//
// the special entry "$CMD" is replaced by the actual command
"shell": [],
// whether or not pkg files should be automatically saved when necessary (e.g. when running 9o `replay` or `go test` commands)
"autosave": true,
// Whether or not gscomplete(gocode) is enabled
"gscomplete_enabled": true,
// Whether or not gsfmt is enabled
"fmt_enabled": true,
// whether or not to indent with tabs (alignment is always done using spaces)
"fmt_tab_indent": true,
// the assumed width of the tab character (or number of spaces to indent with)
"fmt_tab_width": 8,
// Whether or not gslint is enabled
"gslint_enabled": true,
// filter the kinds of lint checks that are done. supported kinds:
//
// gs.syntax - parser/syntax errors - it makes no sense to filter this as it will simply
// manifest itself in other checks (which will likely not be done if there are syntax errors)
// gs.flag.parse - check for possibly missing calls to flag.Parse()
// gs.types - do a typecheck using the go/types package(like the old gotype)
// disabled by default until it's ready(copied from tip)
"lint_filter": [
"gs.types"
],
// Whether or not comp lint is enabled (this might conflict with gslint)
"comp_lint_enabled": false,
// The list of commands that comp-lint will run (in the order specified)
// each entry contains a map of:
// cmd: a list containing the command and its args
// shell: whether or not use the $shell to run this command
// if you don't need $shell features then don't set this.
// global: whether or not commands like go install should affect the system globally
// by default the environment variable GOBIN is set to ($TEMPDIR/GoSublime/bin
// which in the installation of commands via comp-lint going there instead of into
// one of your GOPATHs.
// setting this to true, you can e.g automate the actual installation of your commands
// additionally, for `shell` and `global` if the value is not `true` then it's assumed to be false
"comp_lint_commands": [
{"cmd": ["go", "install"]}
],
// how long to wait after the last keystroke before the gslint_cmd command is run (in milliseconds)
"gslint_timeout": 100,
// Not Implemented
// Whether or not gslint is enabled
"lint_enabled": true,
// Not Implemented
// list of linters to run
// note: before the linters are run, the builtin gs.syntax linter is run
// * its purpose is to do a basic syntax check on the active file.
// * by design, it cannot be disabled
// * if there is a syntax error, no user-defined linters will be run
//
// each linter is an object of the form:
//
// {
// "ctx": "", // the context in which this linter runs, e.g. "live"
// // default: "live", builtin contexts:
// // live: the linters are being called while you're editing the file
// // save: the linters are being called after saving.
// // this can be used to e.g. rebuild or install the pkg
//
// "pat": "", // a regexp pattern that will define the following variables:
// // fn: the filename
// // line: the line number (starting from 1)
// // column: the column number (starting from 1)
// // (this can be considered optional because the error message is still useful without it)
// // message: the error message
// //
// // the default pat will be defined such that it matches `main.go:1:2 error` resulting in:
// // fn: main.go
// // line: 1
// // column: 2
// // message: error
// //
// // it will also allow `line` and `column` to be missing. this should be sufficient
// // for the output of the go tools (go vet, compilers, etc.)
//
// "env": "", // an object mapping keys to string values that will be added to the default env
// // you could, e.g. set {"GOBIN": "/tmp"} in order to avoid installing potentially
// // broken commands into your GOPATH*/bin
//
// "kind": "", // a string that identifies the linter, e.g. `go.vet'
// // this is useful to be able to identify what kind of error you're seeing,
// // but is otherwise optional
//
// "cmd": [], // the command to run, e.g. ["go", "vet"]
// }
//
// the minimal linter is thus: {"cmd": ["go", "vet"]}
//
// builtin linters:
// {"cmd": ["gs.flag.parse"]}: try to report calls to e.g. flag.Int(),flag.String()
// for which there is no call to flag.Parse()
//
// {"cmd": ["gs.types"]}: this is essentially `gotype`, it will do a full typecheck of the pkg
// similar to the compilers. it's faster than doing a full `go build`
// however, it can lead to false-positive errors, especially on cgo
// and other non-pure-go pkgs
"linters": [],
// whether or not to include snippets in the auto-completion list
"autocomplete_snippets": true,
// whether or not to include Test*, Benchmark* and Example* functions in the auto-completion list
"autocomplete_tests": false,
// whether or not builtin types and functions should be shown in the auto-completion list
"autocomplete_builtins": false,
// whether or not to show an expanded(closure) version of func types in the auto-completion list
// e.g. `type Fun func(i int)`
// will result in two entries `Fun` and `Fun {}`
// expanding to `Fun` and `func(i) {...}` respectively
"autocomplete_closures": false,
// you may set this to a regexp which will be used to filter entries in the auto-completion list
// e.g. "autocomplete_filter_name": "^autogenerated_" will prevent any type or function
// whose name begins with "autogenerated_" from appearing in the auto-completion list
"autocomplete_filter_name": "",
// whether or not autocomplete should suggest possible imports when autocomplete fails to
// find a match.
// note: this feature only comes into effect when autocomplete was triggered after a dot, e.g. `fmt.|`
"autocomplete_suggest_imports": false,
// whether or not to show function call tip in the status bar as you type
// the same can be achieved ctrl+dot,ctrl+space using an output panel
"autocomplete_live_hint": false,
// commands to run on (post) save - list of objects of the form {"cmd": "...", "args": {...}}
// Any TextCommand may be run. Supported GS commands include:
// gs_comp_lint - compile the pkg and report any errors
"on_save": [],
// as an alternative to Sublime Text's snippet system you may add snippets to GoSublime's
// code-completion by adding them to your user settings in the same format as bellow.
//
// "snippets": [
// {
// "match": {"global": true}, // these snippets will only be presented in the global scope
// "snippets": [
// {"text": "init", "title": "func init()", "value": "func init() {\n\t$1\n}"}
// ]
// },
// {
// "match": {"local": true}, // these snippets will only be present in a function scope
// "snippets": [
// {"text": "print", "title": "print(...)", "value": "print($1)"},
// {"text": "println", "title": "println(...)", "value": "println($1)"}
// ]
// }
// ]
//
// you maybe add field markers ($1, $2, etc) to the `value` string to dictate where the cursor is place
// once a completion is expanded and where it's placed once you press tab afterwards.
// duplicate markers e.g f("...", $1, $1) will result in multiple cursors, one for each duplication.
"snippets": [],
"default_snippets": [
{
"match": {"global": true, "pkgname": ""},
"snippets": [
{"text": "package ${default_pkgname}", "title": "", "value": "package ${default_pkgname}\n\n$1\n"}
]
},
{
"match": {"global": true, "pkgname": "^main$"},
"snippets": [
{"text": "func main", "title": "func main {...}", "value": "func main() {\n\t$0\n}\n"}
]
},
{
"match": {"global": true, "pkgname": "."},
"snippets": [
{"text": "import", "title": "import (...)", "value": "import (\n\t\"$1\"\n)"},
{"text": "func", "title": "func {...}", "value": "func ${1:name}($2)$3 {\n\t$0\n}"},
{"text": "var", "title": "var (...)", "value": "var (\n\t$1\n)"},
{"text": "const", "title": "const (...)", "value": "const (\n\t$1\n)"},
{"text": "init", "title": "func init()", "value": "func init() {\n\t$1\n}"},
{
"text": "func http handler",
"title": "func(rw, req)",
"value": "func ${1:name}(rw http.ResponseWriter, req *http.Request) {\n\t$0\n}"
}
]
},
{
"match": {"global": true, "pkgname": ".", "has_types": true},
"snippets": [
{
"text": "func (*${typename})",
"title": "func (...) {...}",
"value": "func (${1:${typename_abbr}} ${2:*}${typename}) ${3:name}($4)$5 {\n\t$0\n}"
}
]
},
{
"match": {"local": true},
"snippets": [
{"text": "func", "title": "func{...}()", "value": "func($1) {\n\t$0\n}($2)"},
{"text": "var", "title": "var [name] [type]", "value": "var ${1:name} ${2:type}"}
]
}
],
// if set, 9o will run in single-instance mode instead of per-pkg
// the name can be any string, so you can e.g. set it per-project and maintain project-specific
// command history
"9o_instance": "",
// if set 9o will use the specified color scheme.
// the path must relative to `Packages` e.g. `Packages/My/9o Specific.tmTheme`
// `""` essentially means no color_scheme (like the Sublime Text console)
// `"default"` leaves it as-is, i.e. matching the color_scheme that's being used for your other views
"9o_color_scheme": "default",
// what 9o command to run when (super or )ctrl+dot,ctrl+b us pressed
// e.g. ["go", "build"]
// the 9o command ^1 recalls the last command you ran manually
// see 9o help(ctrl+9 "help") for more details about what commands are supported
"build_command": ["^1"],
"auto_complete_triggers": [ {"selector": "source.go", "characters": "."} ],
// exclude files with the listed prefixes from the file browsing palette (ctrl+dot,ctrl+m)
"fn_exclude_prefixes": [".", "_"],
"extensions": ["go"]
}