1 module dls.protocol.interfaces.text_document; 2 3 public import dls.protocol.definitions; 4 import dls.protocol.interfaces.client : TextDocumentRegistrationOptions; 5 import dls.protocol.interfaces.general : TextDocumentSyncKind; 6 7 class DidOpenTextDocumentParams 8 { 9 TextDocumentItem textDocument = new TextDocumentItem(); 10 } 11 12 class DidChangeTextDocumentParams 13 { 14 VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier(); 15 TextDocumentContentChangeEvent[] contentChanges; 16 } 17 18 class TextDocumentContentChangeEvent 19 { 20 Nullable!Range range; 21 Nullable!size_t rangeLength; 22 string text; 23 } 24 25 class TextDocumentChangeRegistrationOptions : TextDocumentRegistrationOptions 26 { 27 TextDocumentSyncKind syncKind; 28 } 29 30 private class ParamsBase 31 { 32 TextDocumentIdentifier textDocument = new TextDocumentIdentifier(); 33 } 34 35 class WillSaveTextDocumentParams : ParamsBase 36 { 37 TextDocumentSaveReason reason; 38 } 39 40 enum TextDocumentSaveReason 41 { 42 manual = 1, 43 afterDelay = 2, 44 focusOut = 3 45 } 46 47 class DidSaveTextDocumentParams : ParamsBase 48 { 49 Nullable!string text; 50 } 51 52 class TextDocumentSaveRegistrationOptions : TextDocumentRegistrationOptions 53 { 54 Nullable!bool includeText; 55 } 56 57 alias DidCloseTextDocumentParams = ParamsBase; 58 59 class PublishDiagnosticsParams 60 { 61 DocumentUri uri; 62 Diagnostic[] diagnostics; 63 } 64 65 class CompletionParams : TextDocumentPositionParams 66 { 67 Nullable!CompletionContext context; 68 } 69 70 class CompletionContext 71 { 72 CompletionTriggerKind triggerKind; 73 Nullable!string triggerCharacter; 74 } 75 76 enum CompletionTriggerKind 77 { 78 invoked = 1, 79 triggerCharacter = 2, 80 triggerForIncompleteCompletions = 3 81 } 82 83 class CompletionList 84 { 85 bool isIncomplete; 86 CompletionItem[] items; 87 } 88 89 enum InsertTextFormat 90 { 91 plainText = 1, 92 snippet = 2 93 } 94 95 class CompletionItem 96 { 97 string label; 98 Nullable!CompletionItemKind kind; 99 Nullable!string detail; 100 Nullable!string documentation; 101 Nullable!string sortText; 102 Nullable!string filtrText; 103 Nullable!string insertText; 104 Nullable!InsertTextFormat insertTextFormat; 105 Nullable!TextEdit textEdit; 106 Nullable!(TextEdit[]) additionalTextEdits; 107 Nullable!(string[]) commitCharacters; 108 Nullable!Command command; 109 Nullable!JSONValue data; 110 } 111 112 enum CompletionItemKind 113 { 114 text = 1, 115 method = 2, 116 function_ = 3, 117 constructor = 4, 118 field = 5, 119 variable = 6, 120 class_ = 7, 121 interface_ = 8, 122 module_ = 9, 123 property = 10, 124 unit = 11, 125 value = 12, 126 enum_ = 13, 127 keyword = 14, 128 snippet = 15, 129 color = 16, 130 file = 17, 131 reference = 18, 132 folder = 19, 133 enumMember = 20, 134 constant = 21, 135 struct_ = 22, 136 event = 23, 137 operator = 24, 138 typeParameter = 25 139 } 140 141 class CompletionRegistrationOptions : TextDocumentRegistrationOptions 142 { 143 Nullable!(string[]) triggerCharacters; 144 Nullable!bool resolveProvider; 145 } 146 147 class Hover 148 { 149 JSONValue contents; 150 Nullable!Range range; 151 } 152 153 class SignatureHelp 154 { 155 SignatureInformation[] signatures; 156 Nullable!double activeSignature; 157 Nullable!double activeParameter; 158 } 159 160 private class InformationBase 161 { 162 string label; 163 Nullable!string documentation; 164 } 165 166 class SignatureInformation : InformationBase 167 { 168 Nullable!(ParameterInformation[]) parameters; 169 } 170 171 alias ParameterInformation = InformationBase; 172 173 class SignatureHelpRegistrationOptions : TextDocumentRegistrationOptions 174 { 175 Nullable!(string[]) triggerCharacters; 176 } 177 178 class ReferenceParams : TextDocumentPositionParams 179 { 180 ReferenceContext context = new ReferenceContext(); 181 } 182 183 class ReferenceContext 184 { 185 bool includeDeclaration; 186 } 187 188 class DocumentHighlight 189 { 190 Range range = new Range(); 191 Nullable!DocumentHighlightKind kind; 192 } 193 194 enum DocumentHighlightKind 195 { 196 text = 1, 197 read = 2, 198 write = 3 199 } 200 201 alias DocumentSymbolParams = ParamsBase; 202 203 class SymbolInformation 204 { 205 string name; 206 SymbolKind kind; 207 Location location = new Location(); 208 Nullable!string containerName; 209 } 210 211 enum SymbolKind 212 { 213 file = 1, 214 module_ = 2, 215 namespace = 3, 216 package_ = 4, 217 class_ = 5, 218 method = 6, 219 property = 7, 220 field = 8, 221 constructor = 9, 222 enum_ = 10, 223 interface_ = 11, 224 function_ = 12, 225 variable = 13, 226 constant = 14, 227 string_ = 15, 228 number = 16, 229 boolean = 17, 230 array = 18, 231 object = 19, 232 key = 20, 233 null_ = 21, 234 enumMember = 22, 235 struct_ = 23, 236 event = 24, 237 operator = 25, 238 typeParameter = 26 239 } 240 241 class CodeActionParams : ParamsBase 242 { 243 Range range = new Range(); 244 CodeActionContext context = new CodeActionContext(); 245 } 246 247 class CodeActionContext 248 { 249 Diagnostic[] diagnostics; 250 } 251 252 alias CodeLensParams = ParamsBase; 253 254 class CodeLens 255 { 256 Range range = new Range(); 257 Nullable!Command command; 258 Nullable!JSONValue data; 259 } 260 261 class CodeLensRegistrationOptions : TextDocumentRegistrationOptions 262 { 263 Nullable!bool resolveProvider; 264 } 265 266 alias DocumentLinkParams = ParamsBase; 267 268 class DocumentLink 269 { 270 Range range = new Range(); 271 Nullable!DocumentUri target; 272 } 273 274 class DocumentLinkRegistrationOptions : TextDocumentRegistrationOptions 275 { 276 Nullable!bool resolveProvider; 277 } 278 279 class DocumentColorParams 280 { 281 TextDocumentIdentifier textDocument; 282 } 283 284 class ColorInformation 285 { 286 Range range; 287 Color color; 288 } 289 290 class Color 291 { 292 float red; 293 float green; 294 float blue; 295 float alpha; 296 } 297 298 class ColorPresentationParams 299 { 300 TextDocumentIdentifier textDocument; 301 Color colorInfo; 302 Range range; 303 } 304 305 class ColorPresentation 306 { 307 string label; 308 Nullable!TextEdit textEdit; 309 Nullable!(TextEdit[]) additionalTextEdits; 310 } 311 312 class DocumentFormattingParams : ParamsBase 313 { 314 FormattingOptions options = new FormattingOptions(); 315 } 316 317 class FormattingOptions 318 { 319 size_t tabSize; 320 bool insertSpaces; 321 } 322 323 class DocumentRangeFormattingParams : DocumentFormattingParams 324 { 325 Range range = new Range(); 326 } 327 328 class DocumentOnTypeFormattingParams : DocumentFormattingParams 329 { 330 Position position = new Position(); 331 string ch; 332 } 333 334 class DocumentOnTypeFormattingRegistrationOptions : TextDocumentRegistrationOptions 335 { 336 string firstTriggerCharacter; 337 Nullable!(string[]) moreTriggerCharacter; 338 } 339 340 class RenameParams : ParamsBase 341 { 342 Position position = new Position(); 343 string newName; 344 }