Skip to content

Commit e526a87

Browse files
committed
Fix settings; refactor the way settings are loaded
* Fixes spadgos#313 * Fixes spadgos#334 * Fixes spadgos#338 * Fixes spadgos#408 * Fixes spadgos#400 * Fixes spadgos#360 * Fixes spadgos#397
1 parent ec22003 commit e526a87

File tree

6 files changed

+166
-137
lines changed

6 files changed

+166
-137
lines changed

Default.sublime-keymap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n${TM_CURRENT_LINE/^\\s*((?:#|\\/\\/[\\/!]?)\\s*).*/$1/}"},
8080
"context": [
8181
{ "key": "setting.auto_indent", "operator": "equal", "operand": true, "match_all": true },
82-
{ "key": "setting.jsdocs_extend_double_slash", "operator": "equal", "operand": true, "match_all": true },
82+
{ "key": "setting.docblockr.extend_double_slash", "operator": "equal", "operand": true, "match_all": true },
8383
{ "key": "selector", "operator": "equal", "operand": "comment.line", "match_all": true },
8484
{ "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true },
8585
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\/\\/[\\/!]?|#)", "match_all": true }
@@ -89,7 +89,7 @@
8989
{ "keys": ["keypad_enter"], "command": "insert_snippet", "args": {"contents": "\n${TM_CURRENT_LINE/^\\s*((?:#|\\/\\/[\\/!]?)\\s*).*$/$1/}"},
9090
"context": [
9191
{ "key": "setting.auto_indent", "operator": "equal", "operand": true, "match_all": true },
92-
{ "key": "setting.jsdocs_extend_double_slash", "operator": "equal", "operand": true, "match_all": true },
92+
{ "key": "setting.docblockr.extend_double_slash", "operator": "equal", "operand": true, "match_all": true },
9393
{ "key": "selector", "operator": "equal", "operand": "comment.line", "match_all": true },
9494
{ "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true },
9595
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\/\\/[\\/!]?", "match_all": true }
@@ -150,7 +150,7 @@
150150
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
151151
{ "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true },
152152
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\/\\*{2}$", "match_all": true },
153-
{ "key": "setting.jsdocs_quick_open_inline", "operator": "equal", "operand": true, "match_all": true}
153+
{ "key": "setting.docblockr.quick_open_inline", "operator": "equal", "operand": true, "match_all": true}
154154
]
155155
},
156156
// Open an inline docblock (/** */)
@@ -191,7 +191,7 @@
191191
// indent to align with the previous line
192192
{ "keys": ["tab"], "command": "jsdocs_indent",
193193
"context": [
194-
{ "key": "setting.jsdocs_deep_indent", "operator": "equal", "operand": true, "match_all": true },
194+
{ "key": "setting.docblockr.deep_indent", "operator": "equal", "operand": true, "match_all": true },
195195
{ "key": "setting.auto_indent", "operator": "equal", "operand": true, "match_all": true },
196196
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
197197
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*\\*\\s*$", "match_all": true },
@@ -201,14 +201,14 @@
201201
// decorate a double-slash comment
202202
{ "keys": ["ctrl+enter"], "command": "jsdocs_decorate",
203203
"context": [
204-
{ "key": "setting.jsdocs_decorate", "operator": "equal", "operand": true, "match_all": true },
204+
{ "key": "setting.docblockr.decorate", "operator": "equal", "operand": true, "match_all": true },
205205
{ "key": "selector", "operator": "equal", "operand": "comment.line.double-slash", "match_all": true }
206206
]
207207
},
208208
// decorate a double-slash comment
209209
{ "keys": ["ctrl+keypad_enter"], "command": "jsdocs_decorate",
210210
"context": [
211-
{ "key": "setting.jsdocs_decorate", "operator": "equal", "operand": true, "match_all": true },
211+
{ "key": "setting.docblockr.decorate", "operator": "equal", "operand": true, "match_all": true },
212212
{ "key": "selector", "operator": "equal", "operand": "comment.line.double-slash", "match_all": true }
213213
]
214214
},

Base File.sublime-settings renamed to Preferences.sublime-settings

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// If true, when in a docblock, pressing tab after a @tag line (like @param, @return)
33
// will indent to the description. This is useful if you are writing a long description
44
// and want that block of text to stay aligned.
5-
"jsdocs_deep_indent": true,
5+
"docblockr.deep_indent": true,
66

77
// If true, then pressing enter while in a double-slash comment (like this one)
88
// will automatically add two slashes to the next line as well
9-
"jsdocs_extend_double_slash": true,
9+
"docblockr.extend_double_slash": true,
1010

1111
// the number of spaces to add after the leading *
12-
"jsdocs_indentation_spaces": 1,
12+
"docblockr.indentation_spaces": 1,
1313

1414
// The number of spaces to add after the leading * in lines under the first line of each
1515
// paragraph. This is only used together with automatic line wrapping. For example, a value
@@ -24,7 +24,7 @@
2424
// * massa, sit amet adipiscing dolor.
2525
// * @return {[Type]}
2626
// */
27-
"jsdocs_indentation_spaces_same_para": 1,
27+
"docblockr.indentation_spaces_same_para": 1,
2828

2929
// whether the words following the @tags should align.
3030
// Possible values are 'no', 'shallow', 'deep'
@@ -39,34 +39,34 @@
3939
// @param {MyCustomClass} myVariable desc1
4040
// @return {String} foo desc2
4141
// @property {Number} blahblah desc3
42-
"jsdocs_align_tags": "deep",
42+
"docblockr.align_tags": "deep",
4343

4444
// Any additional boilerplate tags which should be added to each block. Should be an array of strings.
4545
// Note that this only applies when a docblock is opened directly preceding a function.
4646
// Tab points can be added by using snippet syntax, eg: ${1:default text}
47-
"jsdocs_extra_tags": [],
47+
"docblockr.extra_tags": [],
4848

4949
// If extra tags are defined, by default they go between the description and the param/return tags. If this is set to
5050
// true, the extra tags are placed at the very end.
51-
"jsdocs_extra_tags_go_after": false,
51+
"docblockr.extra_tags_go_after": false,
5252

5353
// A map to determine the value of variables, should hungarian notation (or similar) be in use
54-
"jsdocs_notation_map": [],
54+
"docblockr.notation_map": [],
5555

5656
// Since there seems to be no agreed standard for "@return" or "@returns", use this setting to rename it as you wish.
57-
"jsdocs_return_tag": "@return",
57+
"docblockr.return_tag": "@return",
5858

5959
// Add a '[function_name description]' for the function block
60-
"jsdocs_function_description": true,
60+
"docblockr.function_description": true,
6161

6262
// Add a '[description]' placeholder for the return tag?
63-
"jsdocs_return_description": true,
63+
"docblockr.return_description": true,
6464

6565
// Add a '[description]' placeholder for the param tag?
66-
"jsdocs_param_description": true,
66+
"docblockr.param_description": true,
6767

6868
// Add a name of parameter in param tag?
69-
"jsdocs_param_name": true,
69+
"docblockr.param_name": true,
7070

7171
// Whether there should be blank lines added between the description line, and between tags of different types.
7272
// Possible values are true, false, or "after_description".
@@ -91,11 +91,11 @@
9191
// * @param {Number} bar
9292
// * @return {[Type]}
9393
// */
94-
"jsdocs_spacer_between_sections": false,
94+
"docblockr.spacer_between_sections": false,
9595

9696
// Whether each section should be indented to the same level, or indent each one individually.
9797
// (When true, the @param section will lose the extra space immediately after each '@param').
98-
"jsdocs_per_section_indent": false,
98+
"docblockr.per_section_indent": false,
9999

100100
// Minimum spaces between cols (default is 1). For example, a value
101101
// of 2 might look like this:
@@ -108,32 +108,32 @@
108108
// *
109109
// * @return {[Type]} description
110110
// */
111-
"jsdocs_min_spaces_between_columns": 1,
111+
"docblockr.min_spaces_between_columns": 1,
112112

113113
// indicates whether the @method tag should be added automatically
114-
"jsdocs_autoadd_method_tag": false,
114+
"docblockr.autoadd_method_tag": false,
115115

116116
// If set to true, DocBlockr won't parse any code, providing no default templates. All other functions work as normal.
117-
"jsdocs_simple_mode": false,
117+
"docblockr.simple_mode": false,
118118

119119
// If set to true, primitives such as "Number" and "String" will be documented as "number" and "string".
120-
"jsdocs_lower_case_primitives": false,
120+
"docblockr.lower_case_primitives": false,
121121

122122
// If set to true, primitives such as "boolean" and "integer" will be shortened to "bool" and "int".
123-
"jsdocs_short_primitives": false,
123+
"docblockr.short_primitives": false,
124124

125125
// This property affects the default tag added to `var` declarations in Javascript/Coffeescript. If `false`, the
126126
// default is used ("var"), otherwise it can be set to any String, eg: "property"
127-
"jsdocs_override_js_var": false,
127+
"docblockr.override_js_var": false,
128128

129129
// If set to true, an extra line break is added after the end of a docblock to separate it from the code.
130-
"jsdocs_newline_after_block": false,
130+
"docblockr.newline_after_block": false,
131131

132132
// If set to true, Ctrl+Enter while in a single line comment will 'decorate' the comment.
133-
"jsdocs_decorate": true,
133+
"docblockr.decorate": true,
134134

135135
// If set to true, typing /**<space> will open an inline docblock
136-
"jsdocs_quick_open_inline": true,
136+
"docblockr.quick_open_inline": true,
137137

138-
"jsdocs_development_mode": false
138+
"docblockr.development_mode": false
139139
}

README.md

Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,7 @@ the pull request back to that branch.
2424

2525
## Changelog
2626

27-
- **v2.14.1**, *17 Aug 2015*
28-
- Fix deindentation bug with reparsing doc blocks
29-
- **v2.14.0**, *15 Jun 2015*
30-
- Adds `jsdocs_function_description` option (thanks to [Gerard Roche](https://github.com/gerardroche))
31-
- Better handling of parser errors (thanks to Gerard Roche)
32-
- **v2.13.3**, *4 Jun 2015*
33-
- PHP array shorthand is identified correctly (thanks to [Gerard Roche](https://github.com/gerardroche))
34-
- Decorating comments when using tabs for indentation works better (thanks to [Jack Cherng](https://github.com/jfcherng))
35-
- **v2.13.2**, *30 Mar 2015*
36-
- Updated PHPDoc autocompletions to align with the new spec (thanks to [Gerard Roche](https://github.com/gerardroche))
37-
- Properly handle the case when commas appear inside a type name in Java
38-
- Added link to README in the preferences menu
39-
- **v2.13.1**, *29 Mar 2015*
40-
- Adds support for Apex language (thanks @michacom)
41-
- Fixes identifying multidimensional arrays in C/C++
42-
- Fixes reformatting and reparsing docblocks in Java
43-
- Adds options to disable:
44-
- opening an inline docblock with space (`jsdocs_quick_open_inline`)
45-
- inline comment decoration (`jsdocs_decorate`)
46-
47-
Older history can be found in [the history file][history].
27+
See [the history file][history].
4828

4929
## Usage
5030

@@ -100,7 +80,7 @@ DocBlockr will also try to determine the type of the variable from its name. Var
10080

10181
```js
10282
{
103-
"jsdocs_notation_map": [
83+
"docblockr.notation_map": [
10484
{
10585
"prefix": "b", /* a prefix, matches only if followed by an underscore or A-Z */
10686
"type": "bool" /* translates to "Boolean" in javascript, "bool" in PHP */
@@ -152,7 +132,7 @@ If you write a double-slash comment and then press `Ctrl+Enter`, DocBlockr will
152132
// Foo bar baz //
153133
/////////////////
154134

155-
This can be disabled by changing the `jsdocs_decorate` setting to `false`.
135+
This can be disabled by changing the `docblockr.decorate` setting to `false`.
156136

157137
### Reparsing a DocBlock
158138

@@ -182,21 +162,19 @@ Finally, typing `@` inside a docblock will show a completion list for all tags s
182162

183163
You can access the configuration settings by selecting `Preferences -> Package Settings -> DocBlockr`.
184164

185-
*The `jsdocs_*` prefix is a legacy from days gone by...*
165+
- `docblockr.indentation_spaces` *(Number)* The number of spaces to indent after the leading asterisk.
186166

187-
- `jsdocs_indentation_spaces` *(Number)* The number of spaces to indent after the leading asterisk.
188-
189-
// jsdocs_indentation_spaces = 1
167+
// docblockr.indentation_spaces = 1
190168
/**
191169
* foo
192170
*/
193171

194-
// jsdocs_indentation_spaces = 5
172+
// docblockr.indentation_spaces = 5
195173
/**
196174
* foo
197175
*/
198176

199-
- `jsdocs_align_tags` *(String)* Whether the words following the tags should align. Possible values are `'no'`, `'shallow'` and `'deep'`
177+
- `docblockr.align_tags` *(String)* Whether the words following the tags should align. Possible values are `'no'`, `'shallow'` and `'deep'`
200178

201179
> For backwards compatibility, `false` is equivalent to `'no'`, `true` is equivalent to `'shallow'`
202180
@@ -213,9 +191,9 @@ You can access the configuration settings by selecting `Preferences -> Package S
213191
@property {Number} blahblah desc3
214192

215193

216-
- `jsdocs_extra_tags` *(Array.String)* An array of strings, each representing extra boilerplate comments to add to *functions*. These can also include arbitrary text (not just tags).
194+
- `docblockr.extra_tags` *(Array.String)* An array of strings, each representing extra boilerplate comments to add to *functions*. These can also include arbitrary text (not just tags).
217195

218-
// jsdocs_extra_tags = ['This is a cool function', '@author nickf', '@version ${1:[version]}']
196+
// docblockr.extra_tags = ['This is a cool function', '@author nickf', '@version ${1:[version]}']
219197
/**<<enter>>
220198
function foo (x) {}
221199

@@ -231,7 +209,7 @@ You can access the configuration settings by selecting `Preferences -> Package S
231209

232210
Basic variable substitution is supported here for the variables `date` and `datetime`, wrapped in double curly brackets.
233211

234-
// jsdocs_extra_tags = ['@date {{date}}', '@anotherdate {{datetime}}']
212+
// docblockr.extra_tags = ['@date {{date}}', '@anotherdate {{datetime}}']
235213
/**<<enter>>
236214
function foo() {}
237215

@@ -242,37 +220,37 @@ You can access the configuration settings by selecting `Preferences -> Package S
242220
* @return {[type]}
243221
*/
244222

245-
- `jsdocs_extra_tags_go_after` *(Boolean)* If true, the extra tags are placed at the end of the block (after param/return). Default: `false`
223+
- `docblockr.extra_tags_go_after` *(Boolean)* If true, the extra tags are placed at the end of the block (after param/return). Default: `false`
246224

247-
- `jsdocs_extend_double_slash` *(Boolean)* Whether double-slash comments should be extended. An example of this feature is described above. Default: `true`
225+
- `docblockr.extend_double_slash` *(Boolean)* Whether double-slash comments should be extended. An example of this feature is described above. Default: `true`
248226

249-
- `jsdocs_deep_indent` *(Boolean)* Whether pressing tab at the start of a line in docblock should indent to match the previous line's description field. An example of this feature is described above. Default: `true`
227+
- `docblockr.deep_indent` *(Boolean)* Whether pressing tab at the start of a line in docblock should indent to match the previous line's description field. An example of this feature is described above. Default: `true`
250228

251-
- `jsdocs_notation_map` *(Array)* An array of notation objects. Each notation object must define either a `prefix` OR a `regex` property, and a `type` property.
229+
- `docblockr.notation_map` *(Array)* An array of notation objects. Each notation object must define either a `prefix` OR a `regex` property, and a `type` property.
252230

253-
- `jsdocs_return_tag` *(String)* The text which should be used for a `@return` tag. By default, `@return` is used, however this can be changed to `@returns` if you use that style.
231+
- `docblockr.return_tag` *(String)* The text which should be used for a `@return` tag. By default, `@return` is used, however this can be changed to `@returns` if you use that style.
254232

255-
- `jsdocs_spacer_between_sections` *(Boolean|String)* If true, then extra blank lines are inserted between the sections of the docblock. If set to `"after_description"` then a spacer will only be added between the description and the first tag. Default: `false`.
233+
- `docblockr.spacer_between_sections` *(Boolean|String)* If true, then extra blank lines are inserted between the sections of the docblock. If set to `"after_description"` then a spacer will only be added between the description and the first tag. Default: `false`.
256234

257-
- `jsdocs_indentation_spaces_same_para` *(Number)* Described above in the *Reformatting paragraphs* section. Default: `1`
235+
- `docblockr.indentation_spaces_same_para` *(Number)* Described above in the *Reformatting paragraphs* section. Default: `1`
258236

259-
- `jsdocs_autoadd_method_tag` *(Boolean)* Add a `@method` tag to docblocks of functions. Default: `false`
237+
- `docblockr.autoadd_method_tag` *(Boolean)* Add a `@method` tag to docblocks of functions. Default: `false`
260238

261-
- `jsdocs_simple_mode` *(Boolean)* If true, DocBlockr won't add a template when creating a doc block before a function or variable. Useful if you don't want to write Javadoc-style, but still want your editor to help when writing block comments. Default: `false`
239+
- `docblockr.simple_mode` *(Boolean)* If true, DocBlockr won't add a template when creating a doc block before a function or variable. Useful if you don't want to write Javadoc-style, but still want your editor to help when writing block comments. Default: `false`
262240

263-
- `jsdocs_lower_case_primitives` *(Boolean)* If true, primitive data types are added in lower case, eg "number" instead of "Number". Default: `false`
241+
- `docblockr.lower_case_primitives` *(Boolean)* If true, primitive data types are added in lower case, eg "number" instead of "Number". Default: `false`
264242

265-
- `jsdocs_short_primitives` *(Boolean)* If true, the primitives `Boolean` and `Integer` are shortened to `Bool` and `Int`. Default: `false`
243+
- `docblockr.short_primitives` *(Boolean)* If true, the primitives `Boolean` and `Integer` are shortened to `Bool` and `Int`. Default: `false`
266244

267-
- `jsdocs_newline_after_block` *(Boolean)* If true, an extra line break is added after the end of a docblock to separate it from the code. Default `false`
245+
- `docblockr.newline_after_block` *(Boolean)* If true, an extra line break is added after the end of a docblock to separate it from the code. Default `false`
268246

269-
- `jsdocs_param_name` *(Boolean)* If true, the name of a function parameter is added to the template. If false, it is omitted. Default: `true`
247+
- `docblockr.param_name` *(Boolean)* If true, the name of a function parameter is added to the template. If false, it is omitted. Default: `true`
270248

271-
- `jsdocs_decorate` *(Boolean)* If false, disable decoration of single line comments with <kbd>Ctrl+Enter</kbd>. Default: `true`
249+
- `docblockr.decorate` *(Boolean)* If false, disable decoration of single line comments with <kbd>Ctrl+Enter</kbd>. Default: `true`
272250

273-
- `jsdocs_quick_open_inline` *(Boolean)* If true, an inline docblock will be opened when pressing <kbd>Space</kbd> after an opener (`/**`). When set to `false`, these can be opened by pressing <kbd>Shift+Enter</kbd>. Default: `true`
251+
- `docblockr.quick_open_inline` *(Boolean)* If true, an inline docblock will be opened when pressing <kbd>Space</kbd> after an opener (`/**`). When set to `false`, these can be opened by pressing <kbd>Shift+Enter</kbd>. Default: `true`
274252

275-
- `jsdocs_function_description` *(Boolean)* If true, a 'description' line will be added for functions. Default: `true`
253+
- `docblockr.function_description` *(Boolean)* If true, a 'description' line will be added for functions. Default: `true`
276254

277255
## Contributors
278256

0 commit comments

Comments
 (0)