sorbet-result 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.standard.yml +1 -1
  4. data/.tool-versions +1 -1
  5. data/CHANGELOG.md +11 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +52 -57
  8. data/README.md +3 -3
  9. data/lib/typed/result.rb +32 -2
  10. data/sorbet/rbi/gems/ast@2.4.2.rbi +1 -0
  11. data/sorbet/rbi/gems/{erubi@1.12.0.rbi → erubi@1.13.0.rbi} +20 -15
  12. data/sorbet/rbi/gems/io-console@0.7.2.rbi +1 -0
  13. data/sorbet/rbi/gems/{json@2.7.1.rbi → json@2.7.5.rbi} +148 -72
  14. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +1 -0
  15. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +1 -0
  16. data/sorbet/rbi/gems/{minitest@5.22.2.rbi → minitest@5.25.1.rbi} +252 -241
  17. data/sorbet/rbi/gems/netrc@0.11.0.rbi +1 -0
  18. data/sorbet/rbi/gems/{parallel@1.24.0.rbi → parallel@1.26.3.rbi} +32 -21
  19. data/sorbet/rbi/gems/{parser@3.3.0.5.rbi → parser@3.3.5.1.rbi} +233 -186
  20. data/sorbet/rbi/gems/prism@1.2.0.rbi +39085 -0
  21. data/sorbet/rbi/gems/psych@5.1.2.rbi +1 -0
  22. data/sorbet/rbi/gems/{racc@1.7.3.rbi → racc@1.8.1.rbi} +38 -33
  23. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +1 -0
  24. data/sorbet/rbi/gems/{rake@13.1.0.rbi → rake@13.2.1.rbi} +56 -55
  25. data/sorbet/rbi/gems/rbi@0.2.1.rbi +4535 -0
  26. data/sorbet/rbi/gems/{regexp_parser@2.9.0.rbi → regexp_parser@2.9.2.rbi} +3 -2
  27. data/sorbet/rbi/gems/{reline@0.4.2.rbi → reline@0.5.10.rbi} +1 -0
  28. data/sorbet/rbi/gems/{rubocop-ast@1.30.0.rbi → rubocop-ast@1.33.1.rbi} +1143 -671
  29. data/sorbet/rbi/gems/{rubocop-performance@1.20.2.rbi → rubocop-performance@1.22.1.rbi} +1 -0
  30. data/sorbet/rbi/gems/{rubocop-sorbet@0.7.7.rbi → rubocop-sorbet@0.7.8.rbi} +1 -0
  31. data/sorbet/rbi/gems/{rubocop@1.60.2.rbi → rubocop@1.66.1.rbi} +3312 -2415
  32. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1 -0
  33. data/sorbet/rbi/gems/{spoom@1.2.4.rbi → spoom@1.5.0.rbi} +2009 -854
  34. data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +1 -0
  35. data/sorbet/rbi/gems/{standard-performance@1.3.1.rbi → standard-performance@1.5.0.rbi} +1 -0
  36. data/sorbet/rbi/gems/standard-sorbet@0.0.2.rbi +1 -0
  37. data/sorbet/rbi/gems/{standard@1.34.0.rbi → standard@1.41.1.rbi} +171 -95
  38. data/sorbet/rbi/gems/{stringio@3.1.0.rbi → stringio@3.1.1.rbi} +1 -0
  39. data/sorbet/rbi/gems/{tapioca@0.12.0.rbi → tapioca@0.16.3.rbi} +357 -257
  40. data/sorbet/rbi/gems/{thor@1.3.0.rbi → thor@1.3.2.rbi} +114 -81
  41. data/sorbet/rbi/gems/{unicode-display_width@2.5.0.rbi → unicode-display_width@2.6.0.rbi} +1 -0
  42. data/sorbet/rbi/gems/{yard-sorbet@0.8.1.rbi → yard-sorbet@0.9.0.rbi} +36 -29
  43. data/sorbet/rbi/gems/{yard@0.9.34.rbi → yard@0.9.37.rbi} +430 -270
  44. metadata +28 -45
  45. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +0 -951
  46. data/sorbet/rbi/gems/prism@0.24.0.rbi +0 -31040
  47. data/sorbet/rbi/gems/rbi@0.1.9.rbi +0 -3006
  48. data/sorbet/rbi/gems/rexml@3.2.6.rbi +0 -4781
  49. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +0 -23133
@@ -1,951 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `prettier_print` gem.
5
- # Please instead update this file by running `bin/tapioca gem prettier_print`.
6
-
7
- # This class implements a pretty printing algorithm. It finds line breaks and
8
- # nice indentations for grouped structure.
9
- #
10
- # By default, the class assumes that primitive elements are strings and each
11
- # byte in the strings is a single column in width. But it can be used for other
12
- # situations by giving suitable arguments for some methods:
13
- #
14
- # * newline object and space generation block for PrettierPrint.new
15
- # * optional width argument for PrettierPrint#text
16
- # * PrettierPrint#breakable
17
- #
18
- # There are several candidate uses:
19
- # * text formatting using proportional fonts
20
- # * multibyte characters which has columns different to number of bytes
21
- # * non-string formatting
22
- #
23
- # == Usage
24
- #
25
- # To use this module, you will need to generate a tree of print nodes that
26
- # represent indentation and newline behavior before it gets sent to the printer.
27
- # Each node has different semantics, depending on the desired output.
28
- #
29
- # The most basic node is a Text node. This represents plain text content that
30
- # cannot be broken up even if it doesn't fit on one line. You would create one
31
- # of those with the text method, as in:
32
- #
33
- # PrettierPrint.format { |q| q.text('my content') }
34
- #
35
- # No matter what the desired output width is, the output for the snippet above
36
- # will always be the same.
37
- #
38
- # If you want to allow the printer to break up the content on the space
39
- # character when there isn't enough width for the full string on the same line,
40
- # you can use the Breakable and Group nodes. For example:
41
- #
42
- # PrettierPrint.format do |q|
43
- # q.group do
44
- # q.text("my")
45
- # q.breakable
46
- # q.text("content")
47
- # end
48
- # end
49
- #
50
- # Now, if everything fits on one line (depending on the maximum width specified)
51
- # then it will be the same output as the first example. If, however, there is
52
- # not enough room on the line, then you will get two lines of output, one for
53
- # the first string and one for the second.
54
- #
55
- # There are other nodes for the print tree as well, described in the
56
- # documentation below. They control alignment, indentation, conditional
57
- # formatting, and more.
58
- #
59
- # == References
60
- # Christian Lindig, Strictly Pretty, March 2000
61
- # https://lindig.github.io/papers/strictly-pretty-2000.pdf
62
- #
63
- # Philip Wadler, A prettier printer, March 1998
64
- # https://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf
65
- #
66
- # source://prettier_print//lib/prettier_print.rb#62
67
- class PrettierPrint
68
- # Creates a buffer for pretty printing.
69
- #
70
- # +output+ is an output target. If it is not specified, '' is assumed. It
71
- # should have a << method which accepts the first argument +obj+ of
72
- # PrettierPrint#text, the first argument +separator+ of PrettierPrint#breakable,
73
- # the first argument +newline+ of PrettierPrint.new, and the result of a given
74
- # block for PrettierPrint.new.
75
- #
76
- # +maxwidth+ specifies maximum line length. If it is not specified, 80 is
77
- # assumed. However actual outputs may overflow +maxwidth+ if long
78
- # non-breakable texts are provided.
79
- #
80
- # +newline+ is used for line breaks. "\n" is used if it is not specified.
81
- #
82
- # The block is used to generate spaces. ->(n) { ' ' * n } is used if it is not
83
- # given.
84
- #
85
- # @return [PrettierPrint] a new instance of PrettierPrint
86
- #
87
- # source://prettier_print//lib/prettier_print.rb#441
88
- def initialize(output = T.unsafe(nil), maxwidth = T.unsafe(nil), newline = T.unsafe(nil), &genspace); end
89
-
90
- # This inserts a BreakParent node into the print tree which forces the
91
- # surrounding and all parent group nodes to break.
92
- #
93
- # source://prettier_print//lib/prettier_print.rb#814
94
- def break_parent; end
95
-
96
- # This says "you can break a line here if necessary", and a +width+\-column
97
- # text +separator+ is inserted if a line is not broken at the point.
98
- #
99
- # If +separator+ is not specified, ' ' is used.
100
- #
101
- # If +width+ is not specified, +separator.length+ is used. You will have to
102
- # specify this when +separator+ is a multibyte character, for example.
103
- #
104
- # By default, if the surrounding group is broken and a newline is inserted,
105
- # the printer will indent the subsequent line up to the current level of
106
- # indentation. You can disable this behavior with the +indent+ argument if
107
- # that's not desired (rare).
108
- #
109
- # By default, when you insert a Breakable into the print tree, it only breaks
110
- # the surrounding group when the group's contents cannot fit onto the
111
- # remaining space of the current line. You can force it to break the
112
- # surrounding group instead if you always want the newline with the +force+
113
- # argument.
114
- #
115
- # There are a few circumstances where you'll want to force the newline into
116
- # the output but no insert a break parent (because you don't want to
117
- # necessarily force the groups to break unless they need to). In this case you
118
- # can pass `force: :skip_break_parent` to this method and it will not insert
119
- # a break parent.`
120
- #
121
- # source://prettier_print//lib/prettier_print.rb#802
122
- def breakable(separator = T.unsafe(nil), width = T.unsafe(nil), indent: T.unsafe(nil), force: T.unsafe(nil)); end
123
-
124
- # Another very common breakable call you receive while formatting is an
125
- # empty string in flat mode and a newline in break mode. Similar to
126
- # breakable_space, this is here for avoid unnecessary calculation.
127
- #
128
- # source://prettier_print//lib/prettier_print.rb#646
129
- def breakable_empty; end
130
-
131
- # The final of the very common breakable calls you receive while formatting
132
- # is the normal breakable space but with the addition of the break_parent.
133
- #
134
- # source://prettier_print//lib/prettier_print.rb#652
135
- def breakable_force; end
136
-
137
- # This is the same shortcut as breakable_force, except that it doesn't indent
138
- # the next line. This is necessary if you're trying to preserve some custom
139
- # formatting like a multi-line string.
140
- #
141
- # source://prettier_print//lib/prettier_print.rb#660
142
- def breakable_return; end
143
-
144
- # The vast majority of breakable calls you receive while formatting are a
145
- # space in flat mode and a newline in break mode. Since this is so common,
146
- # we have a method here to skip past unnecessary calculation.
147
- #
148
- # source://prettier_print//lib/prettier_print.rb#639
149
- def breakable_space; end
150
-
151
- # This is an output buffer that wraps the output object and provides
152
- # additional functionality depending on its type.
153
- #
154
- # This defaults to Buffer::StringBuffer.new("".dup)
155
- #
156
- # source://prettier_print//lib/prettier_print.rb#400
157
- def buffer; end
158
-
159
- # A convenience method which is same as follows:
160
- #
161
- # text(",")
162
- # breakable
163
- #
164
- # source://prettier_print//lib/prettier_print.rb#669
165
- def comma_breakable; end
166
-
167
- # Returns the group most recently added to the stack.
168
- #
169
- # Contrived example:
170
- # out = ""
171
- # => ""
172
- # q = PrettierPrint.new(out)
173
- # => #<PrettierPrint:0x0>
174
- # q.group {
175
- # q.text q.current_group.inspect
176
- # q.text q.newline
177
- # q.group(q.current_group.depth + 1) {
178
- # q.text q.current_group.inspect
179
- # q.text q.newline
180
- # q.group(q.current_group.depth + 1) {
181
- # q.text q.current_group.inspect
182
- # q.text q.newline
183
- # q.group(q.current_group.depth + 1) {
184
- # q.text q.current_group.inspect
185
- # q.text q.newline
186
- # }
187
- # }
188
- # }
189
- # }
190
- # => 284
191
- # puts out
192
- # #<PrettierPrint::Group:0x0 @depth=1>
193
- # #<PrettierPrint::Group:0x0 @depth=2>
194
- # #<PrettierPrint::Group:0x0 @depth=3>
195
- # #<PrettierPrint::Group:0x0 @depth=4>
196
- #
197
- # source://prettier_print//lib/prettier_print.rb#484
198
- def current_group; end
199
-
200
- # This is similar to #breakable except the decision to break or not is
201
- # determined individually.
202
- #
203
- # Two #fill_breakable under a group may cause 4 results:
204
- # (break,break), (break,non-break), (non-break,break), (non-break,non-break).
205
- # This is different to #breakable because two #breakable under a group
206
- # may cause 2 results: (break,break), (non-break,non-break).
207
- #
208
- # The text +separator+ is inserted if a line is not broken at this point.
209
- #
210
- # If +separator+ is not specified, ' ' is used.
211
- #
212
- # If +width+ is not specified, +separator.length+ is used. You will have to
213
- # specify this when +separator+ is a multibyte character, for example.
214
- #
215
- # source://prettier_print//lib/prettier_print.rb#688
216
- def fill_breakable(separator = T.unsafe(nil), width = T.unsafe(nil)); end
217
-
218
- # Flushes all of the generated print tree onto the output buffer, then clears
219
- # the generated tree from memory.
220
- #
221
- # source://prettier_print//lib/prettier_print.rb#490
222
- def flush(base_indentation = T.unsafe(nil)); end
223
-
224
- # An object that responds to call that takes one argument, of an Integer, and
225
- # returns the corresponding number of spaces.
226
- #
227
- # By default this is: ->(n) { ' ' * n }
228
- #
229
- # source://prettier_print//lib/prettier_print.rb#416
230
- def genspace; end
231
-
232
- # Groups line break hints added in the block. The line break hints are all to
233
- # be used or not.
234
- #
235
- # If +indent+ is specified, the method call is regarded as nested by
236
- # nest(indent) { ... }.
237
- #
238
- # If +open_object+ is specified, <tt>text(open_object, open_width)</tt> is
239
- # called before grouping. If +close_object+ is specified,
240
- # <tt>text(close_object, close_width)</tt> is called after grouping.
241
- #
242
- # source://prettier_print//lib/prettier_print.rb#845
243
- def group(indent = T.unsafe(nil), open_object = T.unsafe(nil), close_object = T.unsafe(nil), open_width = T.unsafe(nil), close_width = T.unsafe(nil)); end
244
-
245
- # The stack of groups that are being printed.
246
- #
247
- # source://prettier_print//lib/prettier_print.rb#419
248
- def groups; end
249
-
250
- # Inserts an IfBreak node with the contents of the block being added to its
251
- # list of nodes that should be printed if the surrounding node breaks. If it
252
- # doesn't, then you can specify the contents to be printed with the #if_flat
253
- # method used on the return object from this method. For example,
254
- #
255
- # q.if_break { q.text('do') }.if_flat { q.text('{') }
256
- #
257
- # In the example above, if the surrounding group is broken it will print 'do'
258
- # and if it is not it will print '{'.
259
- #
260
- # source://prettier_print//lib/prettier_print.rb#917
261
- def if_break; end
262
-
263
- # This is similar to if_break in that it also inserts an IfBreak node into the
264
- # print tree, however it's starting from the flat contents, and cannot be used
265
- # to build the break contents.
266
- #
267
- # source://prettier_print//lib/prettier_print.rb#936
268
- def if_flat; end
269
-
270
- # Very similar to the #nest method, this indents the nested content by one
271
- # level by inserting an Indent node into the print tree. The contents of the
272
- # node are determined by the block.
273
- #
274
- # source://prettier_print//lib/prettier_print.rb#956
275
- def indent; end
276
-
277
- # This method calculates the position of the text relative to the current
278
- # indentation level when the doc has been printed. It's useful for
279
- # determining how to align text to doc nodes that are already built into the
280
- # tree.
281
- #
282
- # source://prettier_print//lib/prettier_print.rb#696
283
- def last_position(node); end
284
-
285
- # Inserts a LineSuffix node into the print tree. The contents of the node are
286
- # determined by the block.
287
- #
288
- # source://prettier_print//lib/prettier_print.rb#967
289
- def line_suffix(priority: T.unsafe(nil)); end
290
-
291
- # The maximum width of a line, before it is separated in to a newline
292
- #
293
- # This defaults to 80, and should be an Integer
294
- #
295
- # source://prettier_print//lib/prettier_print.rb#405
296
- def maxwidth; end
297
-
298
- # Increases left margin after newline with +indent+ for line breaks added in
299
- # the block.
300
- #
301
- # source://prettier_print//lib/prettier_print.rb#977
302
- def nest(indent); end
303
-
304
- # The value that is appended to +output+ to add a new line.
305
- #
306
- # This defaults to "\n", and should be String
307
- #
308
- # source://prettier_print//lib/prettier_print.rb#410
309
- def newline; end
310
-
311
- # The output object. It represents the final destination of the contents of
312
- # the print tree. It should respond to <<.
313
- #
314
- # This defaults to "".dup
315
- #
316
- # source://prettier_print//lib/prettier_print.rb#394
317
- def output; end
318
-
319
- # This method will remove any breakables from the list of contents so that
320
- # no newlines are present in the output. If a newline is being forced into
321
- # the output, the replace value will be used.
322
- #
323
- # source://prettier_print//lib/prettier_print.rb#721
324
- def remove_breaks(node, replace = T.unsafe(nil)); end
325
-
326
- # Adds a separated list.
327
- # The list is separated by comma with breakable space, by default.
328
- #
329
- # #seplist iterates the +list+ using +iter_method+.
330
- # It yields each object to the block given for #seplist.
331
- # The procedure +separator_proc+ is called between each yields.
332
- #
333
- # If the iteration is zero times, +separator_proc+ is not called at all.
334
- #
335
- # If +separator_proc+ is nil or not given,
336
- # +lambda { comma_breakable }+ is used.
337
- # If +iter_method+ is not given, :each is used.
338
- #
339
- # For example, following 3 code fragments has similar effect.
340
- #
341
- # q.seplist([1,2,3]) {|v| xxx v }
342
- #
343
- # q.seplist([1,2,3], lambda { q.comma_breakable }, :each) {|v| xxx v }
344
- #
345
- # xxx 1
346
- # q.comma_breakable
347
- # xxx 2
348
- # q.comma_breakable
349
- # xxx 3
350
- #
351
- # source://prettier_print//lib/prettier_print.rb#760
352
- def seplist(list, sep = T.unsafe(nil), iter_method = T.unsafe(nil)); end
353
-
354
- # The current array of contents that calls to methods that generate print tree
355
- # nodes will append to.
356
- #
357
- # source://prettier_print//lib/prettier_print.rb#423
358
- def target; end
359
-
360
- # This adds +object+ as a text of +width+ columns in width.
361
- #
362
- # If +width+ is not specified, object.length is used.
363
- #
364
- # source://prettier_print//lib/prettier_print.rb#989
365
- def text(object = T.unsafe(nil), width = T.unsafe(nil)); end
366
-
367
- # This inserts a Trim node into the print tree which, when printed, will clear
368
- # all whitespace at the end of the output buffer. This is useful for the rare
369
- # case where you need to delete printed indentation and force the next node
370
- # to start at the beginning of the line.
371
- #
372
- # source://prettier_print//lib/prettier_print.rb#828
373
- def trim; end
374
-
375
- # A convenience method used by a lot of the print tree node builders that
376
- # temporarily changes the target that the builders will append to.
377
- #
378
- # source://prettier_print//lib/prettier_print.rb#1007
379
- def with_target(target); end
380
-
381
- private
382
-
383
- # This method returns a boolean as to whether or not the remaining commands
384
- # fit onto the remaining space on the current line. If we finish printing
385
- # all of the commands or if we hit a newline, then we return true. Otherwise
386
- # if we continue printing past the remaining space, we return false.
387
- #
388
- # @return [Boolean]
389
- #
390
- # source://prettier_print//lib/prettier_print.rb#1019
391
- def fits?(next_commands, rest_commands, remaining); end
392
-
393
- # source://prettier_print//lib/prettier_print.rb#1091
394
- def remove_breaks_with(doc, replace); end
395
-
396
- # Resets the group stack and target array so that this pretty printer object
397
- # can continue to be used before calling flush again if desired.
398
- #
399
- # source://prettier_print//lib/prettier_print.rb#1085
400
- def reset; end
401
-
402
- class << self
403
- # This is a convenience method which is same as follows:
404
- #
405
- # begin
406
- # q = PrettierPrint.new(output, maxwidth, newline, &genspace)
407
- # ...
408
- # q.flush
409
- # output
410
- # end
411
- #
412
- # @yield [q]
413
- #
414
- # source://prettier_print//lib/prettier_print.rb#377
415
- def format(output = T.unsafe(nil), maxwidth = T.unsafe(nil), newline = T.unsafe(nil), genspace = T.unsafe(nil), indentation = T.unsafe(nil)); end
416
-
417
- # This is similar to PrettierPrint::format but the result has no breaks.
418
- #
419
- # +maxwidth+, +newline+ and +genspace+ are ignored.
420
- #
421
- # The invocation of +breakable+ in the block doesn't break a line and is
422
- # treated as just an invocation of +text+.
423
- #
424
- # @yield [q]
425
- #
426
- # source://prettier_print//lib/prettier_print/single_line.rb#156
427
- def singleline_format(output = T.unsafe(nil), _maxwidth = T.unsafe(nil), _newline = T.unsafe(nil), _genspace = T.unsafe(nil)); end
428
- end
429
- end
430
-
431
- # A node in the print tree that represents aligning nested nodes to a certain
432
- # prefix width or string.
433
- #
434
- # source://prettier_print//lib/prettier_print.rb#65
435
- class PrettierPrint::Align
436
- # @return [Align] a new instance of Align
437
- #
438
- # source://prettier_print//lib/prettier_print.rb#68
439
- def initialize(indent:, contents: T.unsafe(nil)); end
440
-
441
- # Returns the value of attribute contents.
442
- #
443
- # source://prettier_print//lib/prettier_print.rb#66
444
- def contents; end
445
-
446
- # Returns the value of attribute indent.
447
- #
448
- # source://prettier_print//lib/prettier_print.rb#66
449
- def indent; end
450
-
451
- # source://prettier_print//lib/prettier_print.rb#73
452
- def pretty_print(q); end
453
- end
454
-
455
- # source://prettier_print//lib/prettier_print.rb#126
456
- PrettierPrint::BREAKABLE_EMPTY = T.let(T.unsafe(nil), PrettierPrint::Breakable)
457
-
458
- # source://prettier_print//lib/prettier_print.rb#127
459
- PrettierPrint::BREAKABLE_FORCE = T.let(T.unsafe(nil), PrettierPrint::Breakable)
460
-
461
- # source://prettier_print//lib/prettier_print.rb#128
462
- PrettierPrint::BREAKABLE_RETURN = T.let(T.unsafe(nil), PrettierPrint::Breakable)
463
-
464
- # Below here are the most common combination of options that are created when
465
- # creating new breakables. They are here to cut down on some allocations.
466
- #
467
- # source://prettier_print//lib/prettier_print.rb#125
468
- PrettierPrint::BREAKABLE_SPACE = T.let(T.unsafe(nil), PrettierPrint::Breakable)
469
-
470
- # Since there's really no difference in these instances, just using the same
471
- # one saves on some allocations.
472
- #
473
- # source://prettier_print//lib/prettier_print.rb#141
474
- PrettierPrint::BREAK_PARENT = T.let(T.unsafe(nil), PrettierPrint::BreakParent)
475
-
476
- # A node in the print tree that forces the surrounding group to print out in
477
- # the "break" mode as opposed to the "flat" mode. Useful for when you need to
478
- # force a newline into a group.
479
- #
480
- # source://prettier_print//lib/prettier_print.rb#133
481
- class PrettierPrint::BreakParent
482
- # source://prettier_print//lib/prettier_print.rb#134
483
- def pretty_print(q); end
484
- end
485
-
486
- # A node in the print tree that represents a place in the buffer that the
487
- # content can be broken onto multiple lines.
488
- #
489
- # source://prettier_print//lib/prettier_print.rb#82
490
- class PrettierPrint::Breakable
491
- # @return [Breakable] a new instance of Breakable
492
- #
493
- # source://prettier_print//lib/prettier_print.rb#85
494
- def initialize(separator = T.unsafe(nil), width = T.unsafe(nil), force: T.unsafe(nil), indent: T.unsafe(nil)); end
495
-
496
- # @return [Boolean]
497
- #
498
- # source://prettier_print//lib/prettier_print.rb#97
499
- def force?; end
500
-
501
- # @return [Boolean]
502
- #
503
- # source://prettier_print//lib/prettier_print.rb#101
504
- def indent?; end
505
-
506
- # source://prettier_print//lib/prettier_print.rb#105
507
- def pretty_print(q); end
508
-
509
- # Returns the value of attribute separator.
510
- #
511
- # source://prettier_print//lib/prettier_print.rb#83
512
- def separator; end
513
-
514
- # Returns the value of attribute width.
515
- #
516
- # source://prettier_print//lib/prettier_print.rb#83
517
- def width; end
518
- end
519
-
520
- # When building up the contents in the output buffer, it's convenient to be
521
- # able to trim trailing whitespace before newlines. If the output object is a
522
- # string or array or strings, then we can do this with some gsub calls. If
523
- # not, then this effectively just wraps the output object and forwards on
524
- # calls to <<.
525
- #
526
- # source://prettier_print//lib/prettier_print.rb#277
527
- module PrettierPrint::Buffer
528
- class << self
529
- # This is a switch for building the correct output buffer wrapper class for
530
- # the given output object.
531
- #
532
- # source://prettier_print//lib/prettier_print.rb#336
533
- def for(output); end
534
- end
535
- end
536
-
537
- # This is an output buffer that wraps an array output object. It provides a
538
- # trim! method that trims off trailing whitespace from the last element in
539
- # the array if it's an unfrozen string using the same method as the
540
- # StringBuffer.
541
- #
542
- # source://prettier_print//lib/prettier_print.rb#303
543
- class PrettierPrint::Buffer::ArrayBuffer
544
- # @return [ArrayBuffer] a new instance of ArrayBuffer
545
- #
546
- # source://prettier_print//lib/prettier_print.rb#306
547
- def initialize(output = T.unsafe(nil)); end
548
-
549
- # source://prettier_print//lib/prettier_print.rb#310
550
- def <<(object); end
551
-
552
- # Returns the value of attribute output.
553
- #
554
- # source://prettier_print//lib/prettier_print.rb#304
555
- def output; end
556
-
557
- # source://prettier_print//lib/prettier_print.rb#314
558
- def trim!; end
559
- end
560
-
561
- # This is an output buffer that wraps a string output object. It provides a
562
- # trim! method that trims off trailing whitespace from the string using
563
- # gsub!.
564
- #
565
- # source://prettier_print//lib/prettier_print.rb#281
566
- class PrettierPrint::Buffer::StringBuffer
567
- # @return [StringBuffer] a new instance of StringBuffer
568
- #
569
- # source://prettier_print//lib/prettier_print.rb#284
570
- def initialize(output = T.unsafe(nil)); end
571
-
572
- # source://prettier_print//lib/prettier_print.rb#288
573
- def <<(object); end
574
-
575
- # Returns the value of attribute output.
576
- #
577
- # source://prettier_print//lib/prettier_print.rb#282
578
- def output; end
579
-
580
- # source://prettier_print//lib/prettier_print.rb#292
581
- def trim!; end
582
- end
583
-
584
- # When generating spaces after a newline for indentation, by default we
585
- # generate one space per character needed for indentation. You can change this
586
- # behavior (for instance to use tabs) by passing a different genspace
587
- # procedure.
588
- #
589
- # source://prettier_print//lib/prettier_print.rb#350
590
- PrettierPrint::DEFAULT_GENSPACE = T.let(T.unsafe(nil), Proc)
591
-
592
- # The default indentation for printing is zero, assuming that the code starts
593
- # at the top level. That can be changed if desired to start from a different
594
- # indentation level.
595
- #
596
- # source://prettier_print//lib/prettier_print.rb#366
597
- PrettierPrint::DEFAULT_INDENTATION = T.let(T.unsafe(nil), Integer)
598
-
599
- # When printing, you can optionally specify the value that should be used
600
- # whenever a group needs to be broken onto multiple lines. In this case the
601
- # default is \n.
602
- #
603
- # source://prettier_print//lib/prettier_print.rb#344
604
- PrettierPrint::DEFAULT_NEWLINE = T.let(T.unsafe(nil), String)
605
-
606
- # A node in the print tree that represents a group of items which the printer
607
- # should try to fit onto one line. This is the basic command to tell the
608
- # printer when to break. Groups are usually nested, and the printer will try
609
- # to fit everything on one line, but if it doesn't fit it will break the
610
- # outermost group first and try again. It will continue breaking groups until
611
- # everything fits (or there are no more groups to break).
612
- #
613
- # source://prettier_print//lib/prettier_print.rb#149
614
- class PrettierPrint::Group
615
- # @return [Group] a new instance of Group
616
- #
617
- # source://prettier_print//lib/prettier_print.rb#152
618
- def initialize(depth, contents: T.unsafe(nil)); end
619
-
620
- # source://prettier_print//lib/prettier_print.rb#158
621
- def break; end
622
-
623
- # @return [Boolean]
624
- #
625
- # source://prettier_print//lib/prettier_print.rb#162
626
- def break?; end
627
-
628
- # Returns the value of attribute contents.
629
- #
630
- # source://prettier_print//lib/prettier_print.rb#150
631
- def contents; end
632
-
633
- # Returns the value of attribute depth.
634
- #
635
- # source://prettier_print//lib/prettier_print.rb#150
636
- def depth; end
637
-
638
- # source://prettier_print//lib/prettier_print.rb#166
639
- def pretty_print(q); end
640
- end
641
-
642
- # A node in the print tree that represents printing one thing if the
643
- # surrounding group node is broken and another thing if the surrounding group
644
- # node is flat.
645
- #
646
- # source://prettier_print//lib/prettier_print.rb#176
647
- class PrettierPrint::IfBreak
648
- # @return [IfBreak] a new instance of IfBreak
649
- #
650
- # source://prettier_print//lib/prettier_print.rb#179
651
- def initialize(break_contents: T.unsafe(nil), flat_contents: T.unsafe(nil)); end
652
-
653
- # Returns the value of attribute break_contents.
654
- #
655
- # source://prettier_print//lib/prettier_print.rb#177
656
- def break_contents; end
657
-
658
- # Returns the value of attribute flat_contents.
659
- #
660
- # source://prettier_print//lib/prettier_print.rb#177
661
- def flat_contents; end
662
-
663
- # source://prettier_print//lib/prettier_print.rb#184
664
- def pretty_print(q); end
665
- end
666
-
667
- # A small DSL-like object used for specifying the alternative contents to be
668
- # printed if the surrounding group doesn't break for an IfBreak node.
669
- #
670
- # source://prettier_print//lib/prettier_print.rb#874
671
- class PrettierPrint::IfBreakBuilder
672
- # @return [IfBreakBuilder] a new instance of IfBreakBuilder
673
- #
674
- # source://prettier_print//lib/prettier_print.rb#877
675
- def initialize(q, flat_contents); end
676
-
677
- # Returns the value of attribute flat_contents.
678
- #
679
- # source://prettier_print//lib/prettier_print.rb#875
680
- def flat_contents; end
681
-
682
- # source://prettier_print//lib/prettier_print.rb#882
683
- def if_flat; end
684
-
685
- # Returns the value of attribute q.
686
- #
687
- # source://prettier_print//lib/prettier_print.rb#875
688
- def q; end
689
- end
690
-
691
- # When we already know that groups are broken, we don't actually need to track
692
- # the flat versions of the contents. So this builder version is effectively a
693
- # no-op, but we need it to maintain the same API. The only thing this can
694
- # impact is that if there's a forced break in the flat contents, then we need
695
- # to propagate that break up the whole tree.
696
- #
697
- # source://prettier_print//lib/prettier_print.rb#892
698
- class PrettierPrint::IfFlatIgnore
699
- # @return [IfFlatIgnore] a new instance of IfFlatIgnore
700
- #
701
- # source://prettier_print//lib/prettier_print.rb#895
702
- def initialize(q); end
703
-
704
- # source://prettier_print//lib/prettier_print.rb#899
705
- def if_flat; end
706
-
707
- # Returns the value of attribute q.
708
- #
709
- # source://prettier_print//lib/prettier_print.rb#893
710
- def q; end
711
- end
712
-
713
- # A node in the print tree that is a variant of the Align node that indents
714
- # its contents by one level.
715
- #
716
- # source://prettier_print//lib/prettier_print.rb#200
717
- class PrettierPrint::Indent
718
- # @return [Indent] a new instance of Indent
719
- #
720
- # source://prettier_print//lib/prettier_print.rb#203
721
- def initialize(contents: T.unsafe(nil)); end
722
-
723
- # Returns the value of attribute contents.
724
- #
725
- # source://prettier_print//lib/prettier_print.rb#201
726
- def contents; end
727
-
728
- # source://prettier_print//lib/prettier_print.rb#207
729
- def pretty_print(q); end
730
- end
731
-
732
- # A node in the print tree that has its own special buffer for implementing
733
- # content that should flush before any newline.
734
- #
735
- # Useful for implementating trailing content, as it's not always practical to
736
- # constantly check where the line ends to avoid accidentally printing some
737
- # content after a line suffix node.
738
- #
739
- # source://prettier_print//lib/prettier_print.rb#220
740
- class PrettierPrint::LineSuffix
741
- # @return [LineSuffix] a new instance of LineSuffix
742
- #
743
- # source://prettier_print//lib/prettier_print.rb#225
744
- def initialize(priority: T.unsafe(nil), contents: T.unsafe(nil)); end
745
-
746
- # Returns the value of attribute contents.
747
- #
748
- # source://prettier_print//lib/prettier_print.rb#223
749
- def contents; end
750
-
751
- # source://prettier_print//lib/prettier_print.rb#230
752
- def pretty_print(q); end
753
-
754
- # Returns the value of attribute priority.
755
- #
756
- # source://prettier_print//lib/prettier_print.rb#223
757
- def priority; end
758
- end
759
-
760
- # source://prettier_print//lib/prettier_print.rb#221
761
- PrettierPrint::LineSuffix::DEFAULT_PRIORITY = T.let(T.unsafe(nil), Integer)
762
-
763
- # There are two modes in printing, break and flat. When we're in break mode,
764
- # any lines will use their newline, any if-breaks will use their break
765
- # contents, etc.
766
- #
767
- # source://prettier_print//lib/prettier_print.rb#356
768
- PrettierPrint::MODE_BREAK = T.let(T.unsafe(nil), Integer)
769
-
770
- # This is another print mode much like MODE_BREAK. When we're in flat mode, we
771
- # attempt to print everything on one line until we either hit a broken group,
772
- # a forced line, or the maximum width.
773
- #
774
- # source://prettier_print//lib/prettier_print.rb#361
775
- PrettierPrint::MODE_FLAT = T.let(T.unsafe(nil), Integer)
776
-
777
- # PrettierPrint::SingleLine is used by PrettierPrint.singleline_format
778
- #
779
- # It is passed to be similar to a PrettierPrint object itself, by responding to
780
- # all of the same print tree node builder methods, as well as the #flush
781
- # method.
782
- #
783
- # The significant difference here is that there are no line breaks in the
784
- # output. If an IfBreak node is used, only the flat contents are printed.
785
- # LineSuffix nodes are printed at the end of the buffer when #flush is called.
786
- #
787
- # source://prettier_print//lib/prettier_print/single_line.rb#13
788
- class PrettierPrint::SingleLine
789
- # Create a PrettierPrint::SingleLine object
790
- #
791
- # Arguments:
792
- # * +output+ - String (or similar) to store rendered text. Needs to respond
793
- # to '<<'.
794
- # * +maxwidth+ - Argument position expected to be here for compatibility.
795
- # This argument is a noop.
796
- # * +newline+ - Argument position expected to be here for compatibility.
797
- # This argument is a noop.
798
- #
799
- # @return [SingleLine] a new instance of SingleLine
800
- #
801
- # source://prettier_print//lib/prettier_print/single_line.rb#34
802
- def initialize(output, _maxwidth = T.unsafe(nil), _newline = T.unsafe(nil)); end
803
-
804
- # Here for compatibility, does nothing.
805
- #
806
- # source://prettier_print//lib/prettier_print/single_line.rb#64
807
- def break_parent; end
808
-
809
- # Appends +separator+ to the text to be output. By default +separator+ is
810
- # ' '
811
- #
812
- # The +width+, +indent+, and +force+ arguments are here for compatibility.
813
- # They are all noop arguments.
814
- #
815
- # source://prettier_print//lib/prettier_print/single_line.rb#54
816
- def breakable(separator = T.unsafe(nil), _width = T.unsafe(nil), indent: T.unsafe(nil), force: T.unsafe(nil)); end
817
-
818
- # Appends +separator+ to the output buffer. +width+ is a noop here for
819
- # compatibility.
820
- #
821
- # source://prettier_print//lib/prettier_print/single_line.rb#69
822
- def fill_breakable(separator = T.unsafe(nil), _width = T.unsafe(nil)); end
823
-
824
- # Flushes the line suffixes onto the output buffer.
825
- #
826
- # source://prettier_print//lib/prettier_print/single_line.rb#41
827
- def flush; end
828
-
829
- # Opens a block for grouping objects to be pretty printed.
830
- #
831
- # Arguments:
832
- # * +indent+ - noop argument. Present for compatibility.
833
- # * +open_obj+ - text appended before the &block. Default is ''
834
- # * +close_obj+ - text appended after the &block. Default is ''
835
- # * +open_width+ - noop argument. Present for compatibility.
836
- # * +close_width+ - noop argument. Present for compatibility.
837
- #
838
- # source://prettier_print//lib/prettier_print/single_line.rb#90
839
- def group(_indent = T.unsafe(nil), open_object = T.unsafe(nil), close_object = T.unsafe(nil), _open_width = T.unsafe(nil), _close_width = T.unsafe(nil)); end
840
-
841
- # Effectively unnecessary, but here for compatibility.
842
- #
843
- # source://prettier_print//lib/prettier_print/single_line.rb#113
844
- def if_break; end
845
-
846
- # Also effectively unnecessary, but here for compatibility.
847
- #
848
- # source://prettier_print//lib/prettier_print/single_line.rb#118
849
- def if_flat; end
850
-
851
- # A noop that immediately yields.
852
- #
853
- # source://prettier_print//lib/prettier_print/single_line.rb#122
854
- def indent; end
855
-
856
- # Changes the target output buffer to the line suffix output buffer which
857
- # will get flushed at the end of printing.
858
- #
859
- # source://prettier_print//lib/prettier_print/single_line.rb#128
860
- def line_suffix; end
861
-
862
- # A buffer output that wraps any calls to line_suffix that will be flushed
863
- # at the end of printing.
864
- #
865
- # source://prettier_print//lib/prettier_print/single_line.rb#23
866
- def line_suffixes; end
867
-
868
- # Takes +indent+ arg, but does nothing with it.
869
- #
870
- # Yields to a block.
871
- #
872
- # source://prettier_print//lib/prettier_print/single_line.rb#137
873
- def nest(_indent); end
874
-
875
- # The output object. It stores rendered text and should respond to <<.
876
- #
877
- # source://prettier_print//lib/prettier_print/single_line.rb#15
878
- def output; end
879
-
880
- # The current array of contents that the print tree builder methods should
881
- # append to.
882
- #
883
- # source://prettier_print//lib/prettier_print/single_line.rb#19
884
- def target; end
885
-
886
- # Add +object+ to the text to be output.
887
- #
888
- # +width+ argument is here for compatibility. It is a noop argument.
889
- #
890
- # source://prettier_print//lib/prettier_print/single_line.rb#144
891
- def text(object = T.unsafe(nil), _width = T.unsafe(nil)); end
892
-
893
- # Immediately trims the output buffer.
894
- #
895
- # source://prettier_print//lib/prettier_print/single_line.rb#74
896
- def trim; end
897
- end
898
-
899
- # A class that wraps the ability to call #if_flat. The contents of the
900
- # #if_flat block are executed immediately, so effectively this class and the
901
- # #if_break method that triggers it are unnecessary, but they're here to
902
- # maintain compatibility.
903
- #
904
- # source://prettier_print//lib/prettier_print/single_line.rb#106
905
- class PrettierPrint::SingleLine::IfBreakBuilder
906
- # source://prettier_print//lib/prettier_print/single_line.rb#107
907
- def if_flat; end
908
- end
909
-
910
- # Since all of the instances here are the same, we can reuse the same one to
911
- # cut down on allocations.
912
- #
913
- # source://prettier_print//lib/prettier_print.rb#270
914
- PrettierPrint::TRIM = T.let(T.unsafe(nil), PrettierPrint::Trim)
915
-
916
- # A node in the print tree that represents plain content that cannot be broken
917
- # up (by default this assumes strings, but it can really be anything).
918
- #
919
- # source://prettier_print//lib/prettier_print.rb#239
920
- class PrettierPrint::Text
921
- # @return [Text] a new instance of Text
922
- #
923
- # source://prettier_print//lib/prettier_print.rb#242
924
- def initialize; end
925
-
926
- # source://prettier_print//lib/prettier_print.rb#247
927
- def add(object: T.unsafe(nil), width: T.unsafe(nil)); end
928
-
929
- # Returns the value of attribute objects.
930
- #
931
- # source://prettier_print//lib/prettier_print.rb#240
932
- def objects; end
933
-
934
- # source://prettier_print//lib/prettier_print.rb#252
935
- def pretty_print(q); end
936
-
937
- # Returns the value of attribute width.
938
- #
939
- # source://prettier_print//lib/prettier_print.rb#240
940
- def width; end
941
- end
942
-
943
- # A node in the print tree that represents trimming all of the indentation of
944
- # the current line, in the rare case that you need to ignore the indentation
945
- # that you've already created. This node should be placed after a Breakable.
946
- #
947
- # source://prettier_print//lib/prettier_print.rb#262
948
- class PrettierPrint::Trim
949
- # source://prettier_print//lib/prettier_print.rb#263
950
- def pretty_print(q); end
951
- end