-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sublime-package.json
514 lines (514 loc) · 22.2 KB
/
sublime-package.json
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
{
"contributions": {
"settings": [
//////////////
// settings //
//////////////
{
"file_patterns": ["/AutoSetSyntax.sublime-settings"],
"schema": {
"$id": "sublime://settings/AutoSetSyntax",
"type": "object",
"allOf": [
{
"$ref": "sublime://settings/AutoSetSyntax#/definitions/root_plugin_settings"
},
{
"$ref": "sublime://settings/AutoSetSyntax#/definitions/magika_settings"
}
],
"definitions": {
"root_plugin_settings": {
"properties": {
"debounce": {
"description": "The time (in secondes) to wait for the next event to be triggered.",
"type": "number",
"default": 0.3
},
"enable_log": {
"description": "Enables plugin log (in a dedicated panel).",
"type": "boolean",
"default": true
},
"exec_file_syntax": {
"markdownDescription": "The syntax used for a build (exec) output.\n\n---\n\nCan be one of following formats:\n\n- Syntax top scope: `\"scope:text.html.markdown\"`\n- Partial/full syntax file path: `\"Markdown/Markdown.\"`\n- The name of the syntax: `\"Markdown\"` (which is shown in the bottom-right corner of ST)\n- An empty string, which does nothing",
"type": "string",
"default": "Packages/AutoSetSyntax/syntaxes/ExecOutput.sublime-syntax"
},
"new_file_syntax": {
"markdownDescription": "The syntax used for a newly created file.\n\n---\n\nCan be one of following formats:\n\n- Syntax top scope: `\"scope:text.html.markdown\"`\n- Partial/full syntax file path: `\"Markdown/Markdown.\"`\n- The name of the syntax: `\"Markdown\"` (which is shown in the bottom-right corner of ST)\n- An empty string, which does nothing",
"type": "string",
"default": ""
},
"run_on_startup_views": {
"markdownDescription": "Run `auto_set_syntax` command on views which exist before the plugin is loaded?",
"type": "boolean",
"default": false
},
"trim_file_size": {
"description": "The max lookup size for the file. A negative number means no limit, which may have performance issue on large files.",
"type": "integer",
"default": 20000
},
"trim_first_line_length": {
"description": "The max lookup length for the first line. A negative number means no limit, which may have performance issue on a long first line.",
"type": "integer",
"default": 500
},
"trim_suffixes_auto": {
"markdownDescription": "Apart from `trim_suffixes`, also try to remove every sub-extensions when finding a syntax match.",
"type": "boolean",
"default": false
},
"default_syntax_rules": {
"description": "(Default Global) Rules which tell AutoSetSyntax how to behvae.",
"$ref": "sublime://settings/AutoSetSyntax#/definitions/syntax_rule_collection"
},
"project_syntax_rules": {
"description": "(Project Only) Rules which tell AutoSetSyntax how to behvae.",
"$ref": "sublime://settings/AutoSetSyntax#/definitions/syntax_rule_collection"
},
"user_syntax_rules": {
"description": "(User Global) Rules which tell AutoSetSyntax how to behvae.",
"$ref": "sublime://settings/AutoSetSyntax#/definitions/syntax_rule_collection"
},
"default_trim_suffixes": {
"description": "(Default Global) Suffixes that will be used to right trim the filename. Thus, the file may be then auto set syntax with a trimmed filename.",
"$ref": "sublime://settings/AutoSetSyntax#/definitions/trim_suffixes"
},
"project_trim_suffixes": {
"description": "(Project Only) Suffixes that will be used to right trim the filename. Thus, the file may be then auto set syntax with a trimmed filename.",
"$ref": "sublime://settings/AutoSetSyntax#/definitions/trim_suffixes"
},
"user_trim_suffixes": {
"description": "(User Global) Suffixes that will be used to right trim the filename. Thus, the file may be then auto set syntax with a trimmed filename.",
"$ref": "sublime://settings/AutoSetSyntax#/definitions/trim_suffixes"
}
}
},
"trim_suffixes": {
"type": "array",
"items": {
"$comment": "Suffixes to be trimmed.",
"type": "string"
},
"default": [
"-dev",
"-development",
"-dist",
"-optional",
"-prod",
"-production",
"-test",
".backup",
".bak",
".default",
".dist",
".example",
".inc",
".include",
".local",
".orig",
".sample",
".temp",
".test",
".tmp",
".tpl"
]
},
"syntax_rule_collection": {
"type": "array",
"items": {
"$ref": "sublime://settings/AutoSetSyntax#/definitions/syntax_rule"
}
},
"syntax_rule": {
"allOf": [
{
"properties": {
"comment": {
"description": "A comment to explain this rule.",
"type": "string",
"default": ""
},
"on_events": {
"description": "Limit this rule only to work with specific events.",
"type": "array",
"items": {
"$comment": "The targeted event names.",
"enum": [
"command",
"init",
"load",
"modify",
"new",
"reload",
"revert",
"save",
"untransientize"
]
}
},
"selector": {
"description": "Rules work only when the view's top scope matches this selector.",
"type": "string",
"default": "text.plain"
},
"syntaxes": {
"markdownDescription": "A list of syntaxes which will be tried to set the view one by one. For lazyness, if the list has only one item, you don't have to put it in a list.\n\n---\n\nCan be one of following formats:\n\n- Syntax top scope: `\"scope:text.html.markdown\"`\n- Partial/full syntax file path: `\"Markdown/Markdown.\"`\n- The name of the syntax: `\"Markdown\"` (which is shown in the bottom-right corner of ST)\n- An empty string, which does nothing",
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": ["syntaxes"]
},
{
"$ref": "sublime://settings/AutoSetSyntax#/definitions/match_rule"
}
]
},
"match_rule": {
"properties": {
"match": {
"markdownDescription": "The \"name\" of the `Match` class used for checking the amount of passing `rules`.",
"type": "string",
"enum": ["all", "any", "some", "ratio"],
"default": "any"
},
"args": {
"markdownDescription": "Positional arguments that used to initialize the `Match` object. For lazyness, if the list has only one item, you don't have to put it in a list.",
"default": []
},
"kwargs": {
"markdownDescription": "Keyword arguments that used to initialize the `Match` object.",
"type": "object",
"default": {}
},
"rules": {
"description": "Rules under test.",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "sublime://settings/AutoSetSyntax#/definitions/match_rule"
},
{
"$ref": "sublime://settings/AutoSetSyntax#/definitions/constraint_rule"
}
]
}
}
},
"required": ["rules"]
},
"constraint_rule": {
"properties": {
"constraint": {
"markdownDescription": "The \"name\" of the `Constraint` class used for testing the view.",
"type": "string",
"enum": [
"contains",
"contains_regex",
"first_line_contains",
"first_line_contains_regex",
"is_arch",
"is_extension",
"is_hidden_syntax",
"is_in_git_repo",
"is_in_hg_repo",
"is_in_python_django_project",
"is_in_ruby_on_rails_project",
"is_in_svn_repo",
"is_interpreter",
"is_line_count",
"is_magika_enabled",
"is_name",
"is_platform",
"is_platform_arch",
"is_size",
"is_syntax",
"name_contains",
"name_contains_regex",
"path_contains",
"path_contains_regex",
"relative_exists",
"selector_matches"
],
"markdownEnumDescriptions": [
"Test whether the file content contains any given strings. The `args` is a list of strings.",
"Test whether the file content contains any given regexes. The `args` is a list of regexes.",
"Test whether the first line of the file contains any given strings. The `args` is a list of strings.",
"Test whether the first line of the file contains any given regexes. The `args` is a list of regexes.",
"Test whether the system architecture is one of the given values. The `args` is a list of `x32`, `x64` and `arm64`.",
"Test whether the file name has any given extensions. The `args` is a list of extensions.",
"Test whether the current syntax is hidden.",
"Test whether the file is in a git repository.",
"Test whether the file is in a Mercurial repository.",
"Test whether the file is in a (Python) Django project.",
"Test whether the file is in a Ruby on Rails project.",
"Test whether the file is in a SVN repository.",
"Test whether the interpreter in the shebang of the file is any given ones. The `args` is a list of interpreters.",
"Test whether the file line count satisfies the given condition. The `args` is in the form of `[operator, size]` like `[\">=\", 30]`.",
"Test whether the `magika` detection is enabled.",
"Test whether the file name is any given strings. The `args` is a list of strings.",
"Test whether the system platform is one of the given values. The `args` is a list of `linux`, `osx` and `windows`.",
"Test whether the system `platform_arch` is one of the given values. The `args` is a list of `linux_x32`, `osx_arm64`, `windows_x64`, etc...",
"Test whether the file size satisfies the given condition. The `args` is in the form of `[operator, size]` like `[\">=\", 30]`.",
"Test whether the current syntax is in the given syntax list. The `args` is a list of syntaxes, which can be scope/name/path. See https://jfcherng-sublime.github.io/ST-AutoSetSyntax/configurations/#syntax-representations for more informations.",
"Test whether the file name contains any given strings. The `args` is a list of strings.",
"Test whether the file name contains any given regexes. The `args` is a list of regexes.",
"Test whether the file path contains any given strings. The `args` is a list of strings.",
"Test whether the file path contains any given regexes. The `args` is a list of regexes.",
"Test whether the any of file/directory exists relatively to the file. The `args` is a list of relative paths.",
"Test whether the any of selectors matches the base scope of the current syntax. The `args` is a list of selectors."
]
},
"args": {
"markdownDescription": "Positional arguments that used to initialize the `Constraint` object. For lazyness, if the list has only one item, you don't have to put it in a list.",
"default": []
},
"kwargs": {
"markdownDescription": "Keyword arguments that used to initialize the `Constraint` object.",
"type": "object",
"default": {}
},
"inverted": {
"description": "Invert the result of the match test. But sometimes, the output may always be truthy or falsy no matter it's inverted or not. For example, if you try to test the file size of a not-on-disk buffer, the output will always be false.",
"type": "boolean",
"default": false
}
},
"allOf": [
{
"if": {
"properties": {
"constraint": {
"pattern": "^.*_regex$"
}
}
},
"then": {
"properties": {
"kwargs": {
"type": "object",
"properties": {
"regex_flags": {
"description": "Flags/modifiers for the regular expression.",
"type": "array",
"items": {
"type": "string",
"enum": [
"A",
"ASCII",
"DEBUG",
"I",
"IGNORECASE",
"L",
"LOCALE",
"M",
"MULTILINE",
"S",
"DOTALL",
"X",
"VERBOSE",
"U",
"UNICODE"
]
},
"default": ["MULTILINE"]
}
},
"default": {}
}
}
}
},
{
"if": {
"properties": {
"constraint": {
"pattern": "^is_name|is_extension$"
}
}
},
"then": {
"properties": {
"kwargs": {
"type": "object",
"properties": {
"case_insensitive": {
"type": "boolean",
"default": false
}
},
"default": {},
"additionalItems": false
}
}
}
},
{
"if": {
"properties": {
"constraint": {
"pattern": "^is_size|is_line_count$"
}
}
},
"then": {
"properties": {
"args": {
"type": "array",
"items": [
{
"$comment": "The comparator.",
"enum": ["<", "<=", ">=", ">", "==", "!="]
},
{
"$comment": "The comparing number.",
"type": "integer"
}
],
"default": ["<", 20000],
"additionalItems": false
}
}
}
},
{
"if": {
"properties": {
"constraint": {
"pattern": "^contains(?:_regex)?$"
}
}
},
"then": {
"properties": {
"kwargs": {
"type": "object",
"properties": {
"threshold": {
"type": "integer",
"default": 1
}
},
"default": {},
"additionalItems": false
}
}
}
},
{
"if": {
"properties": {
"constraint": {
"pattern": "^relative_exists$"
}
}
},
"then": {
"properties": {
"kwargs": {
"type": "object",
"properties": {
"match": {
"type": "string",
"enum": ["any", "all"],
"enumDescriptions": [
"Match if `any` of the given paths exists.",
"Match if `all` of the given paths exists."
],
"default": "any"
}
},
"default": {},
"additionalItems": false
}
}
}
},
{
"if": {
"properties": {
"constraint": {
"pattern": "^is_interpreter$"
}
}
},
"then": {
"properties": {
"kwargs": {
"type": "object",
"properties": {
"loosy_version": {
"type": "boolean",
"markdownDescription": "Also match interpreters with version numbers. E.g., `php` will also match `php8`.",
"default": false
}
},
"default": {},
"additionalItems": false
}
}
}
}
],
"required": ["constraint"]
},
"magika_settings": {
"properties": {
"magika.enabled": {
"description": "Enables the magika feature.",
"type": "boolean",
"default": false
},
"magika.min_confidence": {
"description": "The minimum confidence to accept the magika detection result.",
"type": "number",
"default": 0.85
}
},
"patternProperties": {
"^magika\\.syntax_map\\..*$": {
"markdownDescription": "Syntaxes to be assigned for the Magika label.",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
}
}
}
}
},
//////////////////////
// project settings //
//////////////////////
{
"file_patterns": ["/*.sublime-project"],
"schema": {
"properties": {
"settings": {
"properties": {
"AutoSetSyntax": {
"$ref": "sublime://settings/AutoSetSyntax#/definitions/root_plugin_settings"
}
}
}
}
}
}
]
}
}