@@ -28,6 +28,11 @@ public struct DocumentFormattingRequest: TextDocumentRequest, Hashable {
28
28
29
29
/// Options to customize the formatting.
30
30
public var options : FormattingOptions
31
+
32
+ public init ( textDocument: TextDocumentIdentifier , options: FormattingOptions ) {
33
+ self . textDocument = textDocument
34
+ self . options = options
35
+ }
31
36
}
32
37
33
38
/// Request to format a specified range within a document.
@@ -54,6 +59,12 @@ public struct DocumentRangeFormattingRequest: TextDocumentRequest, Hashable {
54
59
55
60
/// Options to customize the formatting.
56
61
public var options : FormattingOptions
62
+
63
+ public init ( textDocument: TextDocumentIdentifier , range: Range < Position > , options: FormattingOptions ) {
64
+ self . textDocument = textDocument
65
+ self . range = range
66
+ self . options = options
67
+ }
57
68
}
58
69
59
70
/// Request to format part of a document during typing.
@@ -87,6 +98,13 @@ public struct DocumentOnTypeFormattingRequest: TextDocumentRequest, Hashable {
87
98
88
99
/// Options to customize the formatting.
89
100
public var options : FormattingOptions
101
+
102
+ public init ( textDocument: TextDocumentIdentifier , position: Position , ch: String , options: FormattingOptions ) {
103
+ self . textDocument = textDocument
104
+ self . position = position
105
+ self . ch = ch
106
+ self . options = options
107
+ }
90
108
}
91
109
92
110
/// Options to customize how document formatting requests are performed.
@@ -106,4 +124,12 @@ public struct FormattingOptions: Codable, Hashable {
106
124
107
125
/// Trim all newlines after the final newline at the end of the file.
108
126
public var trimFinalNewlines : Bool ?
127
+
128
+ public init ( tabSize: Int , insertSpaces: Bool , trimTrailingWhitespace: Bool ? = nil , insertFinalNewline: Bool ? = nil , trimFinalNewlines: Bool ? = nil ) {
129
+ self . tabSize = tabSize
130
+ self . insertSpaces = insertSpaces
131
+ self . trimTrailingWhitespace = trimTrailingWhitespace
132
+ self . insertFinalNewline = insertFinalNewline
133
+ self . trimFinalNewlines = trimFinalNewlines
134
+ }
109
135
}
0 commit comments