1 module served.lsp.protoext; 2 3 import served.lsp.protocol; 4 5 import painlessjson; 6 import std.json; 7 8 struct AddImportParams 9 { 10 /// Text document to look in 11 TextDocumentIdentifier textDocument; 12 /// The name of the import to add 13 string name; 14 /// Location of cursor as standard offset 15 int location; 16 /// if `false`, the import will get added to the innermost block 17 bool insertOutermost = true; 18 } 19 20 struct SortImportsParams 21 { 22 /// Text document to look in 23 TextDocumentIdentifier textDocument; 24 /// Location of cursor as standard offset 25 int location; 26 } 27 28 struct ImplementMethodsParams 29 { 30 /// Text document to look in 31 TextDocumentIdentifier textDocument; 32 /// Location of cursor as standard offset 33 int location; 34 } 35 36 struct UpdateSettingParams 37 { 38 /// The configuration section to update in (e.g. "d" or "dfmt") 39 string section; 40 /// The value to set the configuration value to 41 JSONValue value; 42 /// `true` if this is a configuration change across all instances and not just the active one 43 bool global; 44 } 45 46 /// Represents a dependency of a dub project 47 struct DubDependency 48 { 49 /// The name of this package 50 string name; 51 /// The installed version of this dependency or null if it isn't downloaded/installed yet 52 @SerializedName("version") 53 string version_; 54 /// Path to the directory in which the package resides or null if it's not stored in the local file system. 55 string path; 56 /** Description as given in dub package file */ 57 string description; 58 /// Homepage as given in dub package file 59 string homepage; 60 /// Authors as given in dub package file 61 const(string)[] authors; 62 /// Copyright as given in dub package file 63 string copyright; 64 /// License as given in dub package file 65 string license; 66 /// List of the names of subPackages as defined in the package 67 const(string)[] subPackages; 68 /// `true` if this dependency has other dependencies 69 bool hasDependencies; 70 /// `true` if no package name was given and thus this dependency is a root dependency of the active project. 71 bool root; 72 } 73 74 /// Parameters for a dub recipe conversion call 75 struct DubConvertRequest 76 { 77 /// Text document to look in 78 TextDocumentIdentifier textDocument; 79 /// The format to convert the dub recipe to. (json, sdl) 80 string newFormat; 81 } 82 83 /// 84 struct InstallRequest 85 { 86 /// Name of the dub dependency 87 string name; 88 /// Version to install in the dub recipe file 89 @SerializedName("version") 90 string version_; 91 } 92 93 /// 94 struct UpdateRequest 95 { 96 /// Name of the dub dependency 97 string name; 98 /// Version to install in the dub recipe file 99 @SerializedName("version") 100 string version_; 101 } 102 103 /// 104 struct UninstallRequest 105 { 106 /// Name of the dub dependency 107 string name; 108 } 109 110 struct Task 111 { 112 enum Group : string 113 { 114 clean = "clean", 115 build = "build", 116 rebuild = "rebuild", 117 test = "test" 118 } 119 120 /// the default JSON task 121 JSONValue definition; 122 /// global | workspace | uri of workspace folder 123 @SerializedName("scope") 124 string scope_; 125 /// command to execute 126 string[] exec; 127 /// name of the task 128 string name; 129 /// true if this is a background task without shown console 130 bool isBackground; 131 /// Task source extension name 132 string source; 133 /// clean | build | rebuild | test 134 Group group; 135 /// problem matchers to use 136 string[] problemMatchers; 137 } 138 139 struct DocumentSymbolParamsEx 140 { 141 // LSP field 142 TextDocumentIdentifier textDocument; 143 bool verbose; 144 145 this(DocumentSymbolParams params) 146 { 147 textDocument = params.textDocument; 148 } 149 150 this(TextDocumentIdentifier textDocument, bool verbose) 151 { 152 this.textDocument = textDocument; 153 this.verbose = verbose; 154 } 155 } 156 157 /// special serve-d internal symbol kinds 158 enum SymbolKindEx 159 { 160 none = 0, 161 /// set for unittests 162 test, 163 /// `debug = X` specification 164 debugSpec, 165 /// `version = X` specification 166 versionSpec, 167 /// `static this()` 168 staticCtor, 169 /// `shared static this()` 170 sharedStaticCtor, 171 /// `static ~this()` 172 staticDtor, 173 /// `shared static ~this()` 174 sharedStaticDtor, 175 /// `this(this)` in structs & classes 176 postblit 177 } 178 179 struct SymbolInformationEx 180 { 181 string name; 182 SymbolKind kind; 183 Location location; 184 string containerName; 185 @SerializedName("deprecated") bool deprecated_; 186 TextRange range; 187 TextRange selectionRange; 188 SymbolKindEx extendedType; 189 string detail; 190 191 SymbolInformation downcast() 192 { 193 SymbolInformation ret; 194 static foreach (member; __traits(allMembers, SymbolInformationEx)) 195 static if (__traits(hasMember, SymbolInformation, member)) 196 __traits(getMember, ret, member) = __traits(getMember, this, member); 197 return ret; 198 } 199 } 200 201 struct AddDependencySnippetParams 202 { 203 string[] requiredDependencies; 204 SerializablePlainSnippet snippet; 205 } 206 207 struct SerializablePlainSnippet 208 { 209 /// Grammar scopes in which to complete this snippet. Maps to workspaced.com.snippets:SnippetLevel 210 int[] levels; 211 /// Shortcut to type for this snippet 212 string shortcut; 213 /// Label for this snippet. 214 string title; 215 /// Text with interactive snippet locations to insert assuming global indentation. 216 string snippet; 217 /// Markdown documentation for this snippet 218 string documentation; 219 /// Plain text to insert assuming global level indentation. Optional if snippet is a simple string only using plain variables and snippet locations. 220 string plain; 221 /// true if this snippet shouldn't be formatted before inserting. 222 bool unformatted; 223 } 224 225 /// Parameters to pass when updating dub imports 226 struct UpdateImportsParams 227 { 228 /// set this to false to not emit progress updates for the UI 229 bool reportProgress = true; 230 } 231 232 /// An ini section of the dscanner.ini which is written in form [name] 233 struct DScannerIniSection 234 { 235 /// A textual human readable description of the section 236 string description; 237 /// The name of the section as written in the ini 238 string name; 239 /// Features which are children of this section 240 DScannerIniFeature[] features; 241 } 242 243 /// A single feature in a dscanner.ini which can be turned on/off 244 struct DScannerIniFeature 245 { 246 /// A textual human readable description of the value 247 string description; 248 /// The name of the value 249 string name; 250 /// disabled | enabled | skip-unittest 251 string enabled; 252 } 253 254 struct UnittestProject 255 { 256 /// Workspace uri which may or may not map to an actual workspace folder 257 /// but rather to some folder inside one. 258 DocumentUri workspaceUri; 259 260 /// Package name if available 261 string name; 262 263 /// List of modules, sorted by moduleName 264 UnittestModule[] modules; 265 266 /// `true` if the project still needs to be opened to be loaded. 267 bool needsLoad; 268 } 269 270 struct UnittestModule 271 { 272 string moduleName; 273 DocumentUri uri; 274 UnittestInfo[] tests; 275 } 276 277 struct UnittestInfo 278 { 279 string id, name; 280 string containerName; 281 TextRange range; 282 } 283 284 struct RescanTestsParams 285 { 286 string uri = null; 287 }