├── .gitignore ├── analysis_options.yaml ├── .travis.yml ├── lib ├── lsp.dart └── src │ └── protocol │ └── language_server │ ├── interface.dart │ ├── wireformat.dart │ ├── messages.yaml │ ├── server.dart │ └── messages.dart ├── CHANGELOG.md ├── pubspec.yaml ├── appveyor.yml ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .packages 2 | pubspec.lock 3 | .dart_tool 4 | .pub 5 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:pedantic/analysis_options.yaml 2 | analyzer: 3 | strong-mode: 4 | implicit-casts: false 5 | linter: 6 | rules: 7 | - prefer_final_locals 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: dart 2 | branches: 3 | only: [master] 4 | dart: 5 | - stable 6 | cache: 7 | directories: 8 | - $HOME/.pub-cache 9 | dart_task: 10 | - test 11 | - dartfmt 12 | - dartanalyzer 13 | -------------------------------------------------------------------------------- /lib/lsp.dart: -------------------------------------------------------------------------------- 1 | export 'src/protocol/language_server/interface.dart' show LanguageServer; 2 | export 'src/protocol/language_server/messages.dart'; 3 | export 'src/protocol/language_server/server.dart' show StdIOLanguageServer; 4 | export 'src/protocol/language_server/wireformat.dart' show lspChannel; 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.1.1 2 | 3 | - Add `lspChannel` to wrap a stream and sink of bytes into a 4 | `StreamChannel` with the LSP header wireformat handled. This can be 5 | used to create a JSON RPC `Peer` directly rather than implementing the 6 | `LanguageServer` interface. Allows using a `Socket` as an alternative to 7 | `stdin` and `stdout`. 8 | 9 | # 0.1.0 10 | 11 | - Initial release. Forked from `dart_language_server`. 12 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: lsp 2 | version: 0.1.1 3 | description: Tools for writing a server following the Language Server Protocol. 4 | homepage: https://github.com/natebosch/dart_language_server 5 | 6 | environment: 7 | sdk: ">=2.7.0 <3.0.0" 8 | 9 | dependencies: 10 | async: ^2.0.0 11 | json_rpc_2: ^2.0.3 12 | stream_channel: ^2.0.0 13 | 14 | dev_dependencies: 15 | build_runner: ^1.0.0 16 | message_builder: ^0.1.6 17 | pedantic: ^1.9.0 18 | test: ^1.0.0 19 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | branches: 2 | only: 3 | - master 4 | 5 | version: '1.0.{build}' 6 | 7 | install: 8 | - ps: wget https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip 9 | - cmd: echo "Unzipping dart-sdk..." 10 | - cmd: 7z x dart-sdk.zip -o"C:\tools" -y > nul 11 | - set PATH=%PATH%;C:\tools\dart-sdk\bin 12 | - set PATH=%PATH%;%APPDATA%\Pub\Cache\bin 13 | - pub get && exit 0 14 | 15 | build: off 16 | 17 | test_script: 18 | - pub run test 19 | 20 | cache: 21 | - C:\Users\appveyor\AppData\Roaming\Pub\Cache 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Tools for writing a language server following the [Language Server 2 | Protocol][LSP]. 3 | 4 | [LSP]: https://github.com/Microsoft/language-server-protocol 5 | 6 | Any class implementing `LanguageServer` can be started as a server communicating 7 | over `stdin` and `stdout`. Includes types for all the messages that can be sent 8 | to and from the client. 9 | 10 | # Looking for a Dart language server? 11 | 12 | The Dart language server implemented in this package is deprecated. Instead, use 13 | the [analysis server][] from the Dart SDK with the `--lsp` flag. 14 | 15 | [analysis server]: https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2017 dart_language_server authors 2 | 3 | Redistribution and use in source and binary forms, with or without modification, 4 | are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors 14 | may be used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /lib/src/protocol/language_server/interface.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:json_rpc_2/json_rpc_2.dart'; 4 | 5 | import 'messages.dart'; 6 | 7 | abstract class LanguageServer { 8 | final _onDone = Completer(); 9 | Future get onDone => _onDone.future; 10 | 11 | Future shutdown() async {} 12 | void exit() { 13 | _onDone.complete(); 14 | } 15 | 16 | Future initialize(int clientPid, String rootUri, 17 | ClientCapabilities clientCapabilities, String trace) async => 18 | ServerCapabilities((b) => b); 19 | void initialized() {} 20 | void textDocumentDidOpen(TextDocumentItem document) {} 21 | void textDocumentDidChange(VersionedTextDocumentIdentifier documentId, 22 | List changes) {} 23 | void textDocumentDidClose(TextDocumentIdentifier documentId) {} 24 | Future textDocumentCompletion( 25 | TextDocumentIdentifier documentId, Position position) async => 26 | CompletionList((b) => b); 27 | Future textDocumentDefinition( 28 | TextDocumentIdentifier documentId, Position position) async => 29 | null; 30 | Future> textDocumentReferences( 31 | TextDocumentIdentifier documentId, 32 | Position position, 33 | ReferenceContext context) async => 34 | []; 35 | Future> textDocumentImplementation( 36 | TextDocumentIdentifier documentId, Position position) async => 37 | []; 38 | Future> textDocumentHighlight( 39 | TextDocumentIdentifier documentId, Position position) async => 40 | []; 41 | Future> textDocumentSymbols( 42 | TextDocumentIdentifier documentId) async => 43 | []; 44 | Future> workspaceSymbol(String query) async => []; 45 | Future textDocumentHover( 46 | TextDocumentIdentifier documentId, Position position) async => 47 | null; 48 | Future> textDocumentCodeAction( 49 | TextDocumentIdentifier documentId, 50 | Range range, 51 | CodeActionContext context) async => 52 | []; 53 | Future workspaceExecuteCommand( 54 | String command, List arguments) async {} 55 | Future textDocumentRename(TextDocumentIdentifier documentId, 56 | Position position, String newName) async => 57 | null; 58 | Stream get diagnostics => Stream.empty(); 59 | Stream get workspaceEdits => Stream.empty(); 60 | Stream get showMessages => Stream.empty(); 61 | Stream get logMessages => Stream.empty(); 62 | 63 | void setupExtraMethods(Peer peer) {} 64 | } 65 | -------------------------------------------------------------------------------- /lib/src/protocol/language_server/wireformat.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:stream_channel/stream_channel.dart'; 5 | import 'package:async/async.dart'; 6 | 7 | StreamChannel lspChannel( 8 | Stream> stream, StreamSink> sink) { 9 | final parser = _Parser(stream); 10 | final outSink = StreamSinkTransformer.fromHandlers( 11 | handleData: _serialize, 12 | handleDone: (sink) { 13 | sink.close(); 14 | parser.close(); 15 | }).bind(sink); 16 | return StreamChannel.withGuarantees(parser.stream, outSink); 17 | } 18 | 19 | void _serialize(String data, EventSink> sink) { 20 | final message = utf8.encode(data); 21 | final header = 'Content-Length: ${message.length}\r\n\r\n'; 22 | sink.add(ascii.encode(header)); 23 | for (var chunk in _chunks(message, 1024)) { 24 | sink.add(chunk); 25 | } 26 | } 27 | 28 | class _Parser { 29 | final _streamCtl = StreamController(); 30 | Stream get stream => _streamCtl.stream; 31 | 32 | final _buffer = []; 33 | bool _headerMode = true; 34 | int _contentLength = -1; 35 | 36 | StreamSubscription _subscription; 37 | 38 | _Parser(Stream> stream) { 39 | _subscription = 40 | stream.expand((bytes) => bytes).listen(_handleByte, onDone: () { 41 | _streamCtl.close(); 42 | }); 43 | } 44 | 45 | Future close() => _subscription.cancel(); 46 | 47 | void _handleByte(int byte) { 48 | _buffer.add(byte); 49 | if (_headerMode && _headerComplete) { 50 | _contentLength = _parseContentLength(); 51 | _buffer.clear(); 52 | _headerMode = false; 53 | } else if (!_headerMode && _messageComplete) { 54 | _streamCtl.add(utf8.decode(_buffer)); 55 | _buffer.clear(); 56 | _headerMode = true; 57 | } 58 | } 59 | 60 | /// Whether the entire message is in [_buffer]. 61 | bool get _messageComplete => _buffer.length >= _contentLength; 62 | 63 | /// Decodes [_buffer] into a String and looks for the 'Content-Length' header. 64 | int _parseContentLength() { 65 | final asString = ascii.decode(_buffer); 66 | final headers = asString.split('\r\n'); 67 | final lengthHeader = 68 | headers.firstWhere((h) => h.startsWith('Content-Length')); 69 | final length = lengthHeader.split(':').last.trim(); 70 | return int.parse(length); 71 | } 72 | 73 | /// Whether [_buffer] ends in '\r\n\r\n'. 74 | bool get _headerComplete { 75 | final l = _buffer.length; 76 | return l > 4 && 77 | _buffer[l - 1] == 10 && 78 | _buffer[l - 2] == 13 && 79 | _buffer[l - 3] == 10 && 80 | _buffer[l - 4] == 13; 81 | } 82 | } 83 | 84 | Iterable> _chunks(List data, int chunkSize) sync* { 85 | if (data.length <= chunkSize) { 86 | yield data; 87 | return; 88 | } 89 | var low = 0; 90 | while (low < data.length) { 91 | if (data.length > low + chunkSize) { 92 | yield data.sublist(low, low + chunkSize); 93 | } else { 94 | yield data.sublist(low); 95 | } 96 | low += chunkSize; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /lib/src/protocol/language_server/messages.yaml: -------------------------------------------------------------------------------- 1 | TextDocumentItem: 2 | uri: String 3 | text: String 4 | languageId: String 5 | version: int 6 | 7 | TextDocumentIdentifier: 8 | uri: String 9 | 10 | VersionedTextDocumentIdentifier: 11 | uri: String 12 | version: int 13 | 14 | TextDocumentContentChangeEvent: 15 | range: Range 16 | rangeLength: int 17 | text: String 18 | 19 | Range: 20 | start: Position 21 | end: Position 22 | 23 | Position: 24 | line: int 25 | character: int 26 | 27 | Diagnostics: 28 | uri: String 29 | diagnostics: 30 | listType: Diagnostic 31 | 32 | Diagnostic: 33 | range: Range 34 | severity: int 35 | code: dynamic 36 | source: String 37 | message: String 38 | 39 | CompletionList: 40 | isIncomplete: bool 41 | items: 42 | listType: CompletionItem 43 | 44 | CompletionItem: 45 | label: String 46 | kind: CompletionItemKind 47 | detail: String 48 | documentation: String 49 | sortText: String 50 | filterText: String 51 | insertText: String 52 | insertTextFormat: InsertTextFormat 53 | textEdit: TextEdit 54 | additionalTextEdits: 55 | listType: TextEdit 56 | command: Command 57 | data: dynamic 58 | 59 | CompletionItemKind: 60 | enumValues: 61 | text: 1 62 | method: 2 63 | function: 3 64 | constructor: 4 65 | field: 5 66 | variable: 6 67 | classKind: 7 68 | interface: 8 69 | module: 9 70 | property: 10 71 | unit: 11 72 | value: 12 73 | enumKind: 13 74 | keyword: 14 75 | snippet: 15 76 | color: 16 77 | file: 17 78 | reference: 18 79 | wireType: int 80 | 81 | InsertTextFormat: 82 | enumValues: 83 | plainText: 1 84 | snippet: 2 85 | wireType: int 86 | 87 | TextEdit: 88 | range: Range 89 | newText: String 90 | 91 | Command: 92 | title: String 93 | command: String 94 | arguments: 95 | listType: dynamic 96 | 97 | Location: 98 | uri: String 99 | range: Range 100 | 101 | DynamicRegistrationCapability: 102 | dynamicRegistration: bool 103 | 104 | WorkspaceClientCapabilities: 105 | applyEdit: bool 106 | didChangeConfiguration: DynamicRegistrationCapability 107 | didChangeWatchedFiles: DynamicRegistrationCapability 108 | symbol: DynamicRegistrationCapability 109 | executeCommand: DynamicRegistrationCapability 110 | 111 | SynchronizationCapabilities: 112 | dynamicRegistration: bool 113 | willSave: bool 114 | willSaveWaitUntil: bool 115 | didSave: bool 116 | 117 | CompletionItemCapabilities: 118 | snippetSupport: bool 119 | 120 | CompletionCapabilities: 121 | dynamicRegistration: bool 122 | completionItem: CompletionItemCapabilities 123 | 124 | HoverCapabilities: 125 | dynamicRegistration: bool 126 | contentFormat: 127 | listType: String 128 | 129 | CodeActionCapabilities: 130 | dynamicRegistration: bool 131 | codeActionLiteralSupport: CodeActionLiteralSupport 132 | 133 | CodeActionLiteralSupport: 134 | codeActionKind: CodeActionKinds 135 | 136 | CodeActionKinds: 137 | valueSet: 138 | listType: String # open ended enum 139 | 140 | TextDocumentClientCapabilities: 141 | codeAction: CodeActionCapabilities 142 | completion: CompletionCapabilities 143 | hover: HoverCapabilities 144 | synchronization: SynchronizationCapabilities 145 | codeLens: DynamicRegistrationCapability 146 | definition: DynamicRegistrationCapability 147 | documentHighlight: DynamicRegistrationCapability 148 | documentLink: DynamicRegistrationCapability 149 | documentSymbol: DynamicRegistrationCapability 150 | formatting: DynamicRegistrationCapability 151 | onTypeFormatting: DynamicRegistrationCapability 152 | references: DynamicRegistrationCapability 153 | rename: DynamicRegistrationCapability 154 | 155 | ClientCapabilities: 156 | workspace: WorkspaceClientCapabilities 157 | textDocument: TextDocumentClientCapabilities 158 | 159 | TextDocumentSyncKind: 160 | enumValues: 161 | none: 0 162 | full: 1 163 | incremental: 2 164 | wireType: int 165 | 166 | CompletionOptions: 167 | resolveProvider: bool 168 | triggerCharacters: 169 | listType: String 170 | 171 | SignatureHelpOptions: 172 | triggerCharacters: 173 | listType: String 174 | 175 | CodeLensOptions: 176 | resolveProvider: bool 177 | 178 | DocumentOnTypeFormattingOptions: 179 | firstTriggerCharacter: String 180 | moreTriggerCharacter: 181 | listType: String 182 | 183 | DocumentLinkOptions: 184 | resolveProvider: bool 185 | 186 | ExecuteCommandOptions: 187 | commands: 188 | listType: String 189 | 190 | SaveOptions: 191 | includeText: bool 192 | 193 | TextDocumentSyncOptions: 194 | openClose: bool 195 | change: TextDocumentSyncKind 196 | willSave: bool 197 | willSaveWaitUntil: bool 198 | save: SaveOptions 199 | 200 | ServerCapabilities: 201 | codeActionProvider: bool 202 | codeLensProvider: CodeLensOptions 203 | completionProvider: CompletionOptions 204 | definitionProvider: bool 205 | documentFormattingProvider: bool 206 | documentHighlightProvider: bool 207 | documentLinkProvider: DocumentLinkOptions 208 | documentOnTypeFormattingProvider: DocumentOnTypeFormattingOptions 209 | documentRangeFormattingProvider: bool 210 | documentSymbolProvider: bool 211 | executeCommandProvider: ExecuteCommandOptions 212 | hoverProvider: bool 213 | implementationProvider: bool 214 | referencesProvider: bool 215 | renameProvider: bool 216 | signatureHelpProvider: SignatureHelpOptions 217 | textDocumentSync: TextDocumentSyncOptions 218 | workspaceSymbolProvider: bool 219 | 220 | ReferenceContext: 221 | includeDeclaration: bool 222 | 223 | Hover: 224 | contents: String 225 | range: Range 226 | 227 | HoverMarkup: 228 | contents: MarkupContent 229 | range: Range 230 | 231 | CodeActionContext: 232 | diagnostics: 233 | listType: Diagnostic 234 | 235 | CodeAction: 236 | title: String 237 | kind: String 238 | diagnostics: 239 | listType: Diagnostic 240 | edit: WorkspaceEdit 241 | command: Command 242 | 243 | ApplyWorkspaceEditParams: 244 | label: String 245 | edit: WorkspaceEdit 246 | 247 | WorkspaceEdit: 248 | # Not using `documentChanges` since there is no reasonable way to support text 249 | # document version 250 | changes: 251 | mapType: 252 | listType: TextEdit 253 | 254 | DocumentHighlight: 255 | range: Range 256 | kind: DocumentHighlightKind 257 | 258 | DocumentHighlightKind: 259 | enumValues: 260 | text: 1 261 | read: 2 262 | write: 3 263 | wireType: int 264 | 265 | SymbolInformation: 266 | name: String 267 | kind: SymbolKind 268 | location: Location 269 | containerName: String 270 | 271 | SymbolKind: 272 | enumValues: 273 | file: 1 274 | module: 2 275 | namespace: 3 276 | package: 4 277 | classSymbol: 5 278 | method: 6 279 | property: 7 280 | field: 8 281 | constructor: 9 282 | enumSymbol: 10 283 | interface: 11 284 | function: 12 285 | variable: 13 286 | constant: 14 287 | string: 15 288 | number: 16 289 | boolean: 17 290 | array: 18 291 | object: 19 292 | key: 20 293 | nullSymbol: 21 294 | enumMember: 22 295 | struct: 23 296 | event: 24 297 | operator: 25 298 | typeParameter: 26 299 | wireType: int 300 | 301 | MarkupContentKind: 302 | enumValues: 303 | plaintext: 'plaintext' 304 | markdown: 'markdown' 305 | wireType: String 306 | 307 | MarkupContent: 308 | kind: MarkupContentKind 309 | value: String 310 | 311 | MessageType: 312 | enumValues: 313 | error: 1 314 | warning: 2 315 | info: 3 316 | log: 4 317 | wireType: int 318 | 319 | ShowMessageParams: 320 | type: MessageType 321 | message: String 322 | -------------------------------------------------------------------------------- /lib/src/protocol/language_server/server.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:json_rpc_2/json_rpc_2.dart'; 5 | 6 | import 'interface.dart'; 7 | import 'messages.dart'; 8 | import 'wireformat.dart'; 9 | 10 | /// A Language Server communicating over stdin and stdout. 11 | class StdIOLanguageServer { 12 | final LanguageServer _server; 13 | Future onDone; 14 | 15 | /// Wrap [_server] and register RPC methods using the LSP wire protocol. 16 | /// 17 | /// Methods are guarded against being called before the server is initialized. 18 | StdIOLanguageServer.start(this._server) { 19 | final peer = Peer(lspChannel(stdin, stdout)); 20 | 21 | _lifecycleMethods(peer); 22 | _fileHandlingMethods(peer); 23 | _notifications(peer); 24 | _completionMethods(peer); 25 | _referenceMethods(peer); 26 | _codeActionMethods(peer); 27 | 28 | _server.setupExtraMethods(peer); 29 | 30 | peer.listen(); 31 | 32 | onDone = _server.onDone.then((_) => peer.close()).then((_) => null); 33 | } 34 | 35 | bool _isInitialized = false; 36 | 37 | void _lifecycleMethods(Peer peer) { 38 | peer 39 | ..registerMethod('initialize', (params) async { 40 | final serverCapabilities = await _server.initialize( 41 | params['processId'].valueOr(0) as int, 42 | params['rootUri'].valueOr('') as String, 43 | ClientCapabilities.fromJson(params['capabilities'].value as Map), 44 | params['trace'].valueOr('off') as String); 45 | _isInitialized = true; 46 | return {'capabilities': serverCapabilities.toJson()}; 47 | }) 48 | ..registerMethod('initialized', (params) => _server.initialized()) 49 | ..registerMethod('shutdown', _server.shutdown) 50 | ..registerMethod('exit', _server.exit); 51 | } 52 | 53 | /// Register a request that will throw if throw if used before initialization. 54 | void _registerRequest(Peer peer, String methodName, Function callback) { 55 | peer.registerMethod(methodName, (params) { 56 | if (!_isInitialized) { 57 | throw RpcException(-32003, 'The server has not been initialized'); 58 | } 59 | return callback(params); 60 | }); 61 | } 62 | 63 | /// Notifications are ignored until after initialization. 64 | void _registerNotification(Peer peer, String methodName, Function callback) { 65 | peer.registerMethod(methodName, (params) { 66 | if (_isInitialized) return callback(params); 67 | }); 68 | } 69 | 70 | void _fileHandlingMethods(Peer peer) { 71 | _registerNotification(peer, 'textDocument/didOpen', (params) { 72 | _server.textDocumentDidOpen(_documentItem(params)); 73 | }); 74 | _registerNotification(peer, 'textDocument/didChange', (params) { 75 | _server.textDocumentDidChange( 76 | _versionedDocument(params), _contentChanges(params)); 77 | }); 78 | _registerNotification(peer, 'textDocument/didClose', (params) { 79 | _server.textDocumentDidClose(_document(params)); 80 | }); 81 | } 82 | 83 | void _notifications(Peer peer) { 84 | _server 85 | ..diagnostics.map((d) => d.toJson()).forEach((diagnostics) => 86 | peer.sendNotification('textDocument/publishDiagnostics', diagnostics)) 87 | ..workspaceEdits.map((e) => e.toJson()).forEach((edit) { 88 | // Ignore response? 89 | peer.sendRequest('workspace/applyEdit', edit); 90 | }) 91 | ..logMessages.map((e) => e.toJson()).forEach( 92 | (message) => peer.sendNotification('window/logMessage', message)) 93 | ..showMessages.map((e) => e.toJson()).forEach( 94 | (message) => peer.sendNotification('window/showMessage', message)); 95 | } 96 | 97 | void _completionMethods(Peer peer) { 98 | _registerRequest( 99 | peer, 100 | 'textDocument/completion', 101 | (params) => _server 102 | .textDocumentCompletion(_document(params), _position(params)) 103 | .then((r) => r.toJson())); 104 | } 105 | 106 | void _referenceMethods(Peer peer) { 107 | _registerRequest( 108 | peer, 109 | 'textDocument/definition', 110 | (params) => _server 111 | .textDocumentDefinition(_document(params), _position(params)) 112 | .then((r) => r?.toJson())); 113 | _registerRequest( 114 | peer, 115 | 'textDocument/hover', 116 | (params) => _server 117 | .textDocumentHover(_document(params), _position(params)) 118 | .then((r) => r?.toJson())); 119 | _registerRequest( 120 | peer, 121 | 'textDocument/references', 122 | (params) => _server 123 | .textDocumentReferences( 124 | _document(params), _position(params), _referenceContext(params)) 125 | .then((r) => r?.map((e) => e.toJson())?.toList())); 126 | _registerRequest( 127 | peer, 128 | 'textDocument/implementation', 129 | (params) => _server 130 | .textDocumentImplementation(_document(params), _position(params)) 131 | .then((r) => r?.map((e) => e.toJson())?.toList())); 132 | _registerRequest( 133 | peer, 134 | 'textDocument/documentHighlight', 135 | (params) => _server 136 | .textDocumentHighlight(_document(params), _position(params)) 137 | .then((r) => r?.map((e) => e.toJson())?.toList())); 138 | _registerRequest( 139 | peer, 140 | 'textDocument/documentSymbol', 141 | (params) => _server 142 | .textDocumentSymbols(_document(params)) 143 | .then((r) => r?.map((e) => e.toJson())?.toList())); 144 | _registerRequest( 145 | peer, 146 | 'workspace/symbol', 147 | (params) => _server 148 | .workspaceSymbol(_query(params)) 149 | .then((r) => r?.map((e) => e.toJson())?.toList())); 150 | } 151 | 152 | void _codeActionMethods(Peer peer) { 153 | _registerRequest( 154 | peer, 155 | 'textDocument/codeAction', 156 | (params) => _server 157 | .textDocumentCodeAction( 158 | _document(params), _range(params), _codeActionContext(params)) 159 | .then((r) => r?.map((e) => e.toJson())?.toList())); 160 | _registerRequest( 161 | peer, 162 | 'workspace/executeCommand', 163 | (params) => _server.workspaceExecuteCommand( 164 | params['command'].value as String, 165 | params['arguments']?.value as List)); 166 | _registerRequest( 167 | peer, 168 | 'textDocument/rename', 169 | (params) async => (await _server.textDocumentRename(_document(params), 170 | _position(params), params['newName'].value as String)) 171 | .toJson()); 172 | } 173 | } 174 | 175 | TextDocumentItem _documentItem(params) => 176 | TextDocumentItem.fromJson(params['textDocument'].value as Map); 177 | 178 | VersionedTextDocumentIdentifier _versionedDocument(params) => 179 | VersionedTextDocumentIdentifier.fromJson( 180 | params['textDocument'].value as Map); 181 | 182 | TextDocumentIdentifier _document(params) => 183 | TextDocumentIdentifier.fromJson(params['textDocument'].value as Map); 184 | 185 | Range _range(params) => Range.fromJson(params['range'].value as Map); 186 | 187 | Position _position(params) => 188 | Position.fromJson(params['position'].value as Map); 189 | 190 | CodeActionContext _codeActionContext(params) => 191 | CodeActionContext.fromJson(params['context'].value as Map); 192 | 193 | ReferenceContext _referenceContext(params) => 194 | ReferenceContext.fromJson(params['context'].value as Map); 195 | 196 | List _contentChanges(params) => 197 | (params['contentChanges'].value as Iterable) 198 | .map((change) => TextDocumentContentChangeEvent.fromJson(change as Map)) 199 | .toList(); 200 | 201 | String _query(params) => params['query'].value as String; 202 | -------------------------------------------------------------------------------- /lib/src/protocol/language_server/messages.dart: -------------------------------------------------------------------------------- 1 | class ApplyWorkspaceEditParams { 2 | ApplyWorkspaceEditParams._(this.edit, this.label); 3 | 4 | factory ApplyWorkspaceEditParams( 5 | void Function(ApplyWorkspaceEditParams$Builder) init) { 6 | final b = ApplyWorkspaceEditParams$Builder._(); 7 | init(b); 8 | return ApplyWorkspaceEditParams._(b.edit, b.label); 9 | } 10 | 11 | factory ApplyWorkspaceEditParams.fromJson(Map params) => 12 | ApplyWorkspaceEditParams._( 13 | params.containsKey('edit') && params['edit'] != null 14 | ? WorkspaceEdit.fromJson((params['edit'] as Map)) 15 | : null, 16 | params.containsKey('label') && params['label'] != null 17 | ? (params['label'] as String) 18 | : null); 19 | 20 | final WorkspaceEdit edit; 21 | 22 | final String label; 23 | 24 | Map toJson() => {'edit': edit?.toJson(), 'label': label}; 25 | @override 26 | int get hashCode { 27 | var hash = 711903695; 28 | hash = _hashCombine(hash, _deepHashCode(edit)); 29 | hash = _hashCombine(hash, _deepHashCode(label)); 30 | return _hashComplete(hash); 31 | } 32 | 33 | @override 34 | bool operator ==(Object other) => 35 | other is ApplyWorkspaceEditParams && 36 | edit == other.edit && 37 | label == other.label; 38 | } 39 | 40 | class ApplyWorkspaceEditParams$Builder { 41 | ApplyWorkspaceEditParams$Builder._(); 42 | 43 | WorkspaceEdit edit; 44 | 45 | String label; 46 | } 47 | 48 | class ClientCapabilities { 49 | ClientCapabilities._(this.textDocument, this.workspace); 50 | 51 | factory ClientCapabilities(void Function(ClientCapabilities$Builder) init) { 52 | final b = ClientCapabilities$Builder._(); 53 | init(b); 54 | return ClientCapabilities._(b.textDocument, b.workspace); 55 | } 56 | 57 | factory ClientCapabilities.fromJson(Map params) => ClientCapabilities._( 58 | params.containsKey('textDocument') && params['textDocument'] != null 59 | ? TextDocumentClientCapabilities.fromJson( 60 | (params['textDocument'] as Map)) 61 | : null, 62 | params.containsKey('workspace') && params['workspace'] != null 63 | ? WorkspaceClientCapabilities.fromJson((params['workspace'] as Map)) 64 | : null); 65 | 66 | final TextDocumentClientCapabilities textDocument; 67 | 68 | final WorkspaceClientCapabilities workspace; 69 | 70 | Map toJson() => { 71 | 'textDocument': textDocument?.toJson(), 72 | 'workspace': workspace?.toJson() 73 | }; 74 | @override 75 | int get hashCode { 76 | var hash = 410602613; 77 | hash = _hashCombine(hash, _deepHashCode(textDocument)); 78 | hash = _hashCombine(hash, _deepHashCode(workspace)); 79 | return _hashComplete(hash); 80 | } 81 | 82 | @override 83 | bool operator ==(Object other) => 84 | other is ClientCapabilities && 85 | textDocument == other.textDocument && 86 | workspace == other.workspace; 87 | } 88 | 89 | class ClientCapabilities$Builder { 90 | ClientCapabilities$Builder._(); 91 | 92 | TextDocumentClientCapabilities textDocument; 93 | 94 | WorkspaceClientCapabilities workspace; 95 | } 96 | 97 | class CodeAction { 98 | CodeAction._( 99 | this.command, this.diagnostics, this.edit, this.kind, this.title); 100 | 101 | factory CodeAction(void Function(CodeAction$Builder) init) { 102 | final b = CodeAction$Builder._(); 103 | init(b); 104 | return CodeAction._(b.command, b.diagnostics, b.edit, b.kind, b.title); 105 | } 106 | 107 | factory CodeAction.fromJson(Map params) => CodeAction._( 108 | params.containsKey('command') && params['command'] != null 109 | ? Command.fromJson((params['command'] as Map)) 110 | : null, 111 | params.containsKey('diagnostics') && params['diagnostics'] != null 112 | ? (params['diagnostics'] as List) 113 | .map((v) => Diagnostic.fromJson((v as Map))) 114 | .toList() 115 | : null, 116 | params.containsKey('edit') && params['edit'] != null 117 | ? WorkspaceEdit.fromJson((params['edit'] as Map)) 118 | : null, 119 | params.containsKey('kind') && params['kind'] != null 120 | ? (params['kind'] as String) 121 | : null, 122 | params.containsKey('title') && params['title'] != null 123 | ? (params['title'] as String) 124 | : null); 125 | 126 | final Command command; 127 | 128 | final List diagnostics; 129 | 130 | final WorkspaceEdit edit; 131 | 132 | final String kind; 133 | 134 | final String title; 135 | 136 | Map toJson() => { 137 | 'command': command?.toJson(), 138 | 'diagnostics': diagnostics?.map((v) => v?.toJson())?.toList(), 139 | 'edit': edit?.toJson(), 140 | 'kind': kind, 141 | 'title': title 142 | }; 143 | @override 144 | int get hashCode { 145 | var hash = 817881006; 146 | hash = _hashCombine(hash, _deepHashCode(command)); 147 | hash = _hashCombine(hash, _deepHashCode(diagnostics)); 148 | hash = _hashCombine(hash, _deepHashCode(edit)); 149 | hash = _hashCombine(hash, _deepHashCode(kind)); 150 | hash = _hashCombine(hash, _deepHashCode(title)); 151 | return _hashComplete(hash); 152 | } 153 | 154 | @override 155 | bool operator ==(Object other) => 156 | other is CodeAction && 157 | command == other.command && 158 | _deepEquals(diagnostics, other.diagnostics) && 159 | edit == other.edit && 160 | kind == other.kind && 161 | title == other.title; 162 | } 163 | 164 | class CodeAction$Builder { 165 | CodeAction$Builder._(); 166 | 167 | Command command; 168 | 169 | List diagnostics; 170 | 171 | WorkspaceEdit edit; 172 | 173 | String kind; 174 | 175 | String title; 176 | } 177 | 178 | class CodeActionCapabilities { 179 | CodeActionCapabilities._( 180 | this.codeActionLiteralSupport, this.dynamicRegistration); 181 | 182 | factory CodeActionCapabilities( 183 | void Function(CodeActionCapabilities$Builder) init) { 184 | final b = CodeActionCapabilities$Builder._(); 185 | init(b); 186 | return CodeActionCapabilities._( 187 | b.codeActionLiteralSupport, b.dynamicRegistration); 188 | } 189 | 190 | factory CodeActionCapabilities.fromJson(Map params) => 191 | CodeActionCapabilities._( 192 | params.containsKey('codeActionLiteralSupport') && 193 | params['codeActionLiteralSupport'] != null 194 | ? CodeActionLiteralSupport.fromJson( 195 | (params['codeActionLiteralSupport'] as Map)) 196 | : null, 197 | params.containsKey('dynamicRegistration') && 198 | params['dynamicRegistration'] != null 199 | ? (params['dynamicRegistration'] as bool) 200 | : null); 201 | 202 | final CodeActionLiteralSupport codeActionLiteralSupport; 203 | 204 | final bool dynamicRegistration; 205 | 206 | Map toJson() => { 207 | 'codeActionLiteralSupport': codeActionLiteralSupport?.toJson(), 208 | 'dynamicRegistration': dynamicRegistration 209 | }; 210 | @override 211 | int get hashCode { 212 | var hash = 857718763; 213 | hash = _hashCombine(hash, _deepHashCode(codeActionLiteralSupport)); 214 | hash = _hashCombine(hash, _deepHashCode(dynamicRegistration)); 215 | return _hashComplete(hash); 216 | } 217 | 218 | @override 219 | bool operator ==(Object other) => 220 | other is CodeActionCapabilities && 221 | codeActionLiteralSupport == other.codeActionLiteralSupport && 222 | dynamicRegistration == other.dynamicRegistration; 223 | } 224 | 225 | class CodeActionCapabilities$Builder { 226 | CodeActionCapabilities$Builder._(); 227 | 228 | CodeActionLiteralSupport codeActionLiteralSupport; 229 | 230 | bool dynamicRegistration; 231 | } 232 | 233 | class CodeActionContext { 234 | CodeActionContext._(this.diagnostics); 235 | 236 | factory CodeActionContext(void Function(CodeActionContext$Builder) init) { 237 | final b = CodeActionContext$Builder._(); 238 | init(b); 239 | return CodeActionContext._(b.diagnostics); 240 | } 241 | 242 | factory CodeActionContext.fromJson(Map params) => CodeActionContext._( 243 | params.containsKey('diagnostics') && params['diagnostics'] != null 244 | ? (params['diagnostics'] as List) 245 | .map((v) => Diagnostic.fromJson((v as Map))) 246 | .toList() 247 | : null); 248 | 249 | final List diagnostics; 250 | 251 | Map toJson() => 252 | {'diagnostics': diagnostics?.map((v) => v?.toJson())?.toList()}; 253 | @override 254 | int get hashCode { 255 | var hash = 698635161; 256 | hash = _hashCombine(hash, _deepHashCode(diagnostics)); 257 | return _hashComplete(hash); 258 | } 259 | 260 | @override 261 | bool operator ==(Object other) => 262 | other is CodeActionContext && _deepEquals(diagnostics, other.diagnostics); 263 | } 264 | 265 | class CodeActionContext$Builder { 266 | CodeActionContext$Builder._(); 267 | 268 | List diagnostics; 269 | } 270 | 271 | class CodeActionKinds { 272 | CodeActionKinds._(this.valueSet); 273 | 274 | factory CodeActionKinds(void Function(CodeActionKinds$Builder) init) { 275 | final b = CodeActionKinds$Builder._(); 276 | init(b); 277 | return CodeActionKinds._(b.valueSet); 278 | } 279 | 280 | factory CodeActionKinds.fromJson(Map params) => CodeActionKinds._( 281 | params.containsKey('valueSet') && params['valueSet'] != null 282 | ? (params['valueSet'] as List).cast() 283 | : null); 284 | 285 | final List valueSet; 286 | 287 | Map toJson() => {'valueSet': valueSet}; 288 | @override 289 | int get hashCode { 290 | var hash = 274472753; 291 | hash = _hashCombine(hash, _deepHashCode(valueSet)); 292 | return _hashComplete(hash); 293 | } 294 | 295 | @override 296 | bool operator ==(Object other) => 297 | other is CodeActionKinds && _deepEquals(valueSet, other.valueSet); 298 | } 299 | 300 | class CodeActionKinds$Builder { 301 | CodeActionKinds$Builder._(); 302 | 303 | List valueSet; 304 | } 305 | 306 | class CodeActionLiteralSupport { 307 | CodeActionLiteralSupport._(this.codeActionKind); 308 | 309 | factory CodeActionLiteralSupport( 310 | void Function(CodeActionLiteralSupport$Builder) init) { 311 | final b = CodeActionLiteralSupport$Builder._(); 312 | init(b); 313 | return CodeActionLiteralSupport._(b.codeActionKind); 314 | } 315 | 316 | factory CodeActionLiteralSupport.fromJson(Map params) => 317 | CodeActionLiteralSupport._(params.containsKey('codeActionKind') && 318 | params['codeActionKind'] != null 319 | ? CodeActionKinds.fromJson((params['codeActionKind'] as Map)) 320 | : null); 321 | 322 | final CodeActionKinds codeActionKind; 323 | 324 | Map toJson() => {'codeActionKind': codeActionKind?.toJson()}; 325 | @override 326 | int get hashCode { 327 | var hash = 9179648; 328 | hash = _hashCombine(hash, _deepHashCode(codeActionKind)); 329 | return _hashComplete(hash); 330 | } 331 | 332 | @override 333 | bool operator ==(Object other) => 334 | other is CodeActionLiteralSupport && 335 | codeActionKind == other.codeActionKind; 336 | } 337 | 338 | class CodeActionLiteralSupport$Builder { 339 | CodeActionLiteralSupport$Builder._(); 340 | 341 | CodeActionKinds codeActionKind; 342 | } 343 | 344 | class CodeLensOptions { 345 | CodeLensOptions._(this.resolveProvider); 346 | 347 | factory CodeLensOptions(void Function(CodeLensOptions$Builder) init) { 348 | final b = CodeLensOptions$Builder._(); 349 | init(b); 350 | return CodeLensOptions._(b.resolveProvider); 351 | } 352 | 353 | factory CodeLensOptions.fromJson(Map params) => CodeLensOptions._( 354 | params.containsKey('resolveProvider') && params['resolveProvider'] != null 355 | ? (params['resolveProvider'] as bool) 356 | : null); 357 | 358 | final bool resolveProvider; 359 | 360 | Map toJson() => {'resolveProvider': resolveProvider}; 361 | @override 362 | int get hashCode { 363 | var hash = 875601242; 364 | hash = _hashCombine(hash, _deepHashCode(resolveProvider)); 365 | return _hashComplete(hash); 366 | } 367 | 368 | @override 369 | bool operator ==(Object other) => 370 | other is CodeLensOptions && resolveProvider == other.resolveProvider; 371 | } 372 | 373 | class CodeLensOptions$Builder { 374 | CodeLensOptions$Builder._(); 375 | 376 | bool resolveProvider; 377 | } 378 | 379 | class Command { 380 | Command._(this.arguments, this.command, this.title); 381 | 382 | factory Command(void Function(Command$Builder) init) { 383 | final b = Command$Builder._(); 384 | init(b); 385 | return Command._(b.arguments, b.command, b.title); 386 | } 387 | 388 | factory Command.fromJson(Map params) => Command._( 389 | params.containsKey('arguments') && params['arguments'] != null 390 | ? (params['arguments'] as List).cast() 391 | : null, 392 | params.containsKey('command') && params['command'] != null 393 | ? (params['command'] as String) 394 | : null, 395 | params.containsKey('title') && params['title'] != null 396 | ? (params['title'] as String) 397 | : null); 398 | 399 | final List arguments; 400 | 401 | final String command; 402 | 403 | final String title; 404 | 405 | Map toJson() => {'arguments': arguments, 'command': command, 'title': title}; 406 | @override 407 | int get hashCode { 408 | var hash = 306969625; 409 | hash = _hashCombine(hash, _deepHashCode(arguments)); 410 | hash = _hashCombine(hash, _deepHashCode(command)); 411 | hash = _hashCombine(hash, _deepHashCode(title)); 412 | return _hashComplete(hash); 413 | } 414 | 415 | @override 416 | bool operator ==(Object other) => 417 | other is Command && 418 | _deepEquals(arguments, other.arguments) && 419 | command == other.command && 420 | title == other.title; 421 | } 422 | 423 | class Command$Builder { 424 | Command$Builder._(); 425 | 426 | List arguments; 427 | 428 | String command; 429 | 430 | String title; 431 | } 432 | 433 | class CompletionCapabilities { 434 | CompletionCapabilities._(this.completionItem, this.dynamicRegistration); 435 | 436 | factory CompletionCapabilities( 437 | void Function(CompletionCapabilities$Builder) init) { 438 | final b = CompletionCapabilities$Builder._(); 439 | init(b); 440 | return CompletionCapabilities._(b.completionItem, b.dynamicRegistration); 441 | } 442 | 443 | factory CompletionCapabilities.fromJson(Map params) => 444 | CompletionCapabilities._( 445 | params.containsKey('completionItem') && 446 | params['completionItem'] != null 447 | ? CompletionItemCapabilities.fromJson( 448 | (params['completionItem'] as Map)) 449 | : null, 450 | params.containsKey('dynamicRegistration') && 451 | params['dynamicRegistration'] != null 452 | ? (params['dynamicRegistration'] as bool) 453 | : null); 454 | 455 | final CompletionItemCapabilities completionItem; 456 | 457 | final bool dynamicRegistration; 458 | 459 | Map toJson() => { 460 | 'completionItem': completionItem?.toJson(), 461 | 'dynamicRegistration': dynamicRegistration 462 | }; 463 | @override 464 | int get hashCode { 465 | var hash = 490073846; 466 | hash = _hashCombine(hash, _deepHashCode(completionItem)); 467 | hash = _hashCombine(hash, _deepHashCode(dynamicRegistration)); 468 | return _hashComplete(hash); 469 | } 470 | 471 | @override 472 | bool operator ==(Object other) => 473 | other is CompletionCapabilities && 474 | completionItem == other.completionItem && 475 | dynamicRegistration == other.dynamicRegistration; 476 | } 477 | 478 | class CompletionCapabilities$Builder { 479 | CompletionCapabilities$Builder._(); 480 | 481 | CompletionItemCapabilities completionItem; 482 | 483 | bool dynamicRegistration; 484 | } 485 | 486 | class CompletionItem { 487 | CompletionItem._( 488 | this.additionalTextEdits, 489 | this.command, 490 | this.data, 491 | this.detail, 492 | this.documentation, 493 | this.filterText, 494 | this.insertText, 495 | this.insertTextFormat, 496 | this.kind, 497 | this.label, 498 | this.sortText, 499 | this.textEdit); 500 | 501 | factory CompletionItem(void Function(CompletionItem$Builder) init) { 502 | final b = CompletionItem$Builder._(); 503 | init(b); 504 | return CompletionItem._( 505 | b.additionalTextEdits, 506 | b.command, 507 | b.data, 508 | b.detail, 509 | b.documentation, 510 | b.filterText, 511 | b.insertText, 512 | b.insertTextFormat, 513 | b.kind, 514 | b.label, 515 | b.sortText, 516 | b.textEdit); 517 | } 518 | 519 | factory CompletionItem.fromJson(Map params) => CompletionItem._( 520 | params.containsKey('additionalTextEdits') && 521 | params['additionalTextEdits'] != null 522 | ? (params['additionalTextEdits'] as List) 523 | .map((v) => TextEdit.fromJson((v as Map))) 524 | .toList() 525 | : null, 526 | params.containsKey('command') && params['command'] != null 527 | ? Command.fromJson((params['command'] as Map)) 528 | : null, 529 | params.containsKey('data') && params['data'] != null 530 | ? (params['data'] as dynamic) 531 | : null, 532 | params.containsKey('detail') && params['detail'] != null 533 | ? (params['detail'] as String) 534 | : null, 535 | params.containsKey('documentation') && params['documentation'] != null 536 | ? (params['documentation'] as String) 537 | : null, 538 | params.containsKey('filterText') && params['filterText'] != null 539 | ? (params['filterText'] as String) 540 | : null, 541 | params.containsKey('insertText') && params['insertText'] != null 542 | ? (params['insertText'] as String) 543 | : null, 544 | params.containsKey('insertTextFormat') && 545 | params['insertTextFormat'] != null 546 | ? InsertTextFormat.fromJson((params['insertTextFormat'] as int)) 547 | : null, 548 | params.containsKey('kind') && params['kind'] != null 549 | ? CompletionItemKind.fromJson((params['kind'] as int)) 550 | : null, 551 | params.containsKey('label') && params['label'] != null 552 | ? (params['label'] as String) 553 | : null, 554 | params.containsKey('sortText') && params['sortText'] != null 555 | ? (params['sortText'] as String) 556 | : null, 557 | params.containsKey('textEdit') && params['textEdit'] != null 558 | ? TextEdit.fromJson((params['textEdit'] as Map)) 559 | : null); 560 | 561 | final List additionalTextEdits; 562 | 563 | final Command command; 564 | 565 | final dynamic data; 566 | 567 | final String detail; 568 | 569 | final String documentation; 570 | 571 | final String filterText; 572 | 573 | final String insertText; 574 | 575 | final InsertTextFormat insertTextFormat; 576 | 577 | final CompletionItemKind kind; 578 | 579 | final String label; 580 | 581 | final String sortText; 582 | 583 | final TextEdit textEdit; 584 | 585 | Map toJson() => { 586 | 'additionalTextEdits': 587 | additionalTextEdits?.map((v) => v?.toJson())?.toList(), 588 | 'command': command?.toJson(), 589 | 'data': data, 590 | 'detail': detail, 591 | 'documentation': documentation, 592 | 'filterText': filterText, 593 | 'insertText': insertText, 594 | 'insertTextFormat': insertTextFormat?.toJson(), 595 | 'kind': kind?.toJson(), 596 | 'label': label, 597 | 'sortText': sortText, 598 | 'textEdit': textEdit?.toJson() 599 | }; 600 | @override 601 | int get hashCode { 602 | var hash = 546046223; 603 | hash = _hashCombine(hash, _deepHashCode(additionalTextEdits)); 604 | hash = _hashCombine(hash, _deepHashCode(command)); 605 | hash = _hashCombine(hash, _deepHashCode(data)); 606 | hash = _hashCombine(hash, _deepHashCode(detail)); 607 | hash = _hashCombine(hash, _deepHashCode(documentation)); 608 | hash = _hashCombine(hash, _deepHashCode(filterText)); 609 | hash = _hashCombine(hash, _deepHashCode(insertText)); 610 | hash = _hashCombine(hash, _deepHashCode(insertTextFormat)); 611 | hash = _hashCombine(hash, _deepHashCode(kind)); 612 | hash = _hashCombine(hash, _deepHashCode(label)); 613 | hash = _hashCombine(hash, _deepHashCode(sortText)); 614 | hash = _hashCombine(hash, _deepHashCode(textEdit)); 615 | return _hashComplete(hash); 616 | } 617 | 618 | @override 619 | bool operator ==(Object other) => 620 | other is CompletionItem && 621 | _deepEquals(additionalTextEdits, other.additionalTextEdits) && 622 | command == other.command && 623 | data == other.data && 624 | detail == other.detail && 625 | documentation == other.documentation && 626 | filterText == other.filterText && 627 | insertText == other.insertText && 628 | insertTextFormat == other.insertTextFormat && 629 | kind == other.kind && 630 | label == other.label && 631 | sortText == other.sortText && 632 | textEdit == other.textEdit; 633 | } 634 | 635 | class CompletionItem$Builder { 636 | CompletionItem$Builder._(); 637 | 638 | List additionalTextEdits; 639 | 640 | Command command; 641 | 642 | dynamic data; 643 | 644 | String detail; 645 | 646 | String documentation; 647 | 648 | String filterText; 649 | 650 | String insertText; 651 | 652 | InsertTextFormat insertTextFormat; 653 | 654 | CompletionItemKind kind; 655 | 656 | String label; 657 | 658 | String sortText; 659 | 660 | TextEdit textEdit; 661 | } 662 | 663 | class CompletionItemCapabilities { 664 | CompletionItemCapabilities._(this.snippetSupport); 665 | 666 | factory CompletionItemCapabilities( 667 | void Function(CompletionItemCapabilities$Builder) init) { 668 | final b = CompletionItemCapabilities$Builder._(); 669 | init(b); 670 | return CompletionItemCapabilities._(b.snippetSupport); 671 | } 672 | 673 | factory CompletionItemCapabilities.fromJson(Map params) => 674 | CompletionItemCapabilities._(params.containsKey('snippetSupport') && 675 | params['snippetSupport'] != null 676 | ? (params['snippetSupport'] as bool) 677 | : null); 678 | 679 | final bool snippetSupport; 680 | 681 | Map toJson() => {'snippetSupport': snippetSupport}; 682 | @override 683 | int get hashCode { 684 | var hash = 402194464; 685 | hash = _hashCombine(hash, _deepHashCode(snippetSupport)); 686 | return _hashComplete(hash); 687 | } 688 | 689 | @override 690 | bool operator ==(Object other) => 691 | other is CompletionItemCapabilities && 692 | snippetSupport == other.snippetSupport; 693 | } 694 | 695 | class CompletionItemCapabilities$Builder { 696 | CompletionItemCapabilities$Builder._(); 697 | 698 | bool snippetSupport; 699 | } 700 | 701 | class CompletionItemKind { 702 | factory CompletionItemKind.fromJson(int value) { 703 | const values = { 704 | 7: CompletionItemKind.classKind, 705 | 16: CompletionItemKind.color, 706 | 4: CompletionItemKind.constructor, 707 | 13: CompletionItemKind.enumKind, 708 | 5: CompletionItemKind.field, 709 | 17: CompletionItemKind.file, 710 | 3: CompletionItemKind.function, 711 | 8: CompletionItemKind.interface, 712 | 14: CompletionItemKind.keyword, 713 | 2: CompletionItemKind.method, 714 | 9: CompletionItemKind.module, 715 | 10: CompletionItemKind.property, 716 | 18: CompletionItemKind.reference, 717 | 15: CompletionItemKind.snippet, 718 | 1: CompletionItemKind.text, 719 | 11: CompletionItemKind.unit, 720 | 12: CompletionItemKind.value, 721 | 6: CompletionItemKind.variable 722 | }; 723 | return values[value]; 724 | } 725 | 726 | const CompletionItemKind._(this._value); 727 | 728 | static const classKind = CompletionItemKind._(7); 729 | 730 | static const color = CompletionItemKind._(16); 731 | 732 | static const constructor = CompletionItemKind._(4); 733 | 734 | static const enumKind = CompletionItemKind._(13); 735 | 736 | static const field = CompletionItemKind._(5); 737 | 738 | static const file = CompletionItemKind._(17); 739 | 740 | static const function = CompletionItemKind._(3); 741 | 742 | static const interface = CompletionItemKind._(8); 743 | 744 | static const keyword = CompletionItemKind._(14); 745 | 746 | static const method = CompletionItemKind._(2); 747 | 748 | static const module = CompletionItemKind._(9); 749 | 750 | static const property = CompletionItemKind._(10); 751 | 752 | static const reference = CompletionItemKind._(18); 753 | 754 | static const snippet = CompletionItemKind._(15); 755 | 756 | static const text = CompletionItemKind._(1); 757 | 758 | static const unit = CompletionItemKind._(11); 759 | 760 | static const value = CompletionItemKind._(12); 761 | 762 | static const variable = CompletionItemKind._(6); 763 | 764 | final int _value; 765 | 766 | int toJson() => _value; 767 | } 768 | 769 | class CompletionList { 770 | CompletionList._(this.isIncomplete, this.items); 771 | 772 | factory CompletionList(void Function(CompletionList$Builder) init) { 773 | final b = CompletionList$Builder._(); 774 | init(b); 775 | return CompletionList._(b.isIncomplete, b.items); 776 | } 777 | 778 | factory CompletionList.fromJson(Map params) => CompletionList._( 779 | params.containsKey('isIncomplete') && params['isIncomplete'] != null 780 | ? (params['isIncomplete'] as bool) 781 | : null, 782 | params.containsKey('items') && params['items'] != null 783 | ? (params['items'] as List) 784 | .map((v) => CompletionItem.fromJson((v as Map))) 785 | .toList() 786 | : null); 787 | 788 | final bool isIncomplete; 789 | 790 | final List items; 791 | 792 | Map toJson() => { 793 | 'isIncomplete': isIncomplete, 794 | 'items': items?.map((v) => v?.toJson())?.toList() 795 | }; 796 | @override 797 | int get hashCode { 798 | var hash = 475661732; 799 | hash = _hashCombine(hash, _deepHashCode(isIncomplete)); 800 | hash = _hashCombine(hash, _deepHashCode(items)); 801 | return _hashComplete(hash); 802 | } 803 | 804 | @override 805 | bool operator ==(Object other) => 806 | other is CompletionList && 807 | isIncomplete == other.isIncomplete && 808 | _deepEquals(items, other.items); 809 | } 810 | 811 | class CompletionList$Builder { 812 | CompletionList$Builder._(); 813 | 814 | bool isIncomplete; 815 | 816 | List items; 817 | } 818 | 819 | class CompletionOptions { 820 | CompletionOptions._(this.resolveProvider, this.triggerCharacters); 821 | 822 | factory CompletionOptions(void Function(CompletionOptions$Builder) init) { 823 | final b = CompletionOptions$Builder._(); 824 | init(b); 825 | return CompletionOptions._(b.resolveProvider, b.triggerCharacters); 826 | } 827 | 828 | factory CompletionOptions.fromJson(Map params) => CompletionOptions._( 829 | params.containsKey('resolveProvider') && params['resolveProvider'] != null 830 | ? (params['resolveProvider'] as bool) 831 | : null, 832 | params.containsKey('triggerCharacters') && 833 | params['triggerCharacters'] != null 834 | ? (params['triggerCharacters'] as List).cast() 835 | : null); 836 | 837 | final bool resolveProvider; 838 | 839 | final List triggerCharacters; 840 | 841 | Map toJson() => { 842 | 'resolveProvider': resolveProvider, 843 | 'triggerCharacters': triggerCharacters 844 | }; 845 | @override 846 | int get hashCode { 847 | var hash = 251829316; 848 | hash = _hashCombine(hash, _deepHashCode(resolveProvider)); 849 | hash = _hashCombine(hash, _deepHashCode(triggerCharacters)); 850 | return _hashComplete(hash); 851 | } 852 | 853 | @override 854 | bool operator ==(Object other) => 855 | other is CompletionOptions && 856 | resolveProvider == other.resolveProvider && 857 | _deepEquals(triggerCharacters, other.triggerCharacters); 858 | } 859 | 860 | class CompletionOptions$Builder { 861 | CompletionOptions$Builder._(); 862 | 863 | bool resolveProvider; 864 | 865 | List triggerCharacters; 866 | } 867 | 868 | class Diagnostic { 869 | Diagnostic._(this.code, this.message, this.range, this.severity, this.source); 870 | 871 | factory Diagnostic(void Function(Diagnostic$Builder) init) { 872 | final b = Diagnostic$Builder._(); 873 | init(b); 874 | return Diagnostic._(b.code, b.message, b.range, b.severity, b.source); 875 | } 876 | 877 | factory Diagnostic.fromJson(Map params) => Diagnostic._( 878 | params.containsKey('code') && params['code'] != null 879 | ? (params['code'] as dynamic) 880 | : null, 881 | params.containsKey('message') && params['message'] != null 882 | ? (params['message'] as String) 883 | : null, 884 | params.containsKey('range') && params['range'] != null 885 | ? Range.fromJson((params['range'] as Map)) 886 | : null, 887 | params.containsKey('severity') && params['severity'] != null 888 | ? (params['severity'] as int) 889 | : null, 890 | params.containsKey('source') && params['source'] != null 891 | ? (params['source'] as String) 892 | : null); 893 | 894 | final dynamic code; 895 | 896 | final String message; 897 | 898 | final Range range; 899 | 900 | final int severity; 901 | 902 | final String source; 903 | 904 | Map toJson() => { 905 | 'code': code, 906 | 'message': message, 907 | 'range': range?.toJson(), 908 | 'severity': severity, 909 | 'source': source 910 | }; 911 | @override 912 | int get hashCode { 913 | var hash = 304962763; 914 | hash = _hashCombine(hash, _deepHashCode(code)); 915 | hash = _hashCombine(hash, _deepHashCode(message)); 916 | hash = _hashCombine(hash, _deepHashCode(range)); 917 | hash = _hashCombine(hash, _deepHashCode(severity)); 918 | hash = _hashCombine(hash, _deepHashCode(source)); 919 | return _hashComplete(hash); 920 | } 921 | 922 | @override 923 | bool operator ==(Object other) => 924 | other is Diagnostic && 925 | code == other.code && 926 | message == other.message && 927 | range == other.range && 928 | severity == other.severity && 929 | source == other.source; 930 | } 931 | 932 | class Diagnostic$Builder { 933 | Diagnostic$Builder._(); 934 | 935 | dynamic code; 936 | 937 | String message; 938 | 939 | Range range; 940 | 941 | int severity; 942 | 943 | String source; 944 | } 945 | 946 | class Diagnostics { 947 | Diagnostics._(this.diagnostics, this.uri); 948 | 949 | factory Diagnostics(void Function(Diagnostics$Builder) init) { 950 | final b = Diagnostics$Builder._(); 951 | init(b); 952 | return Diagnostics._(b.diagnostics, b.uri); 953 | } 954 | 955 | factory Diagnostics.fromJson(Map params) => Diagnostics._( 956 | params.containsKey('diagnostics') && params['diagnostics'] != null 957 | ? (params['diagnostics'] as List) 958 | .map((v) => Diagnostic.fromJson((v as Map))) 959 | .toList() 960 | : null, 961 | params.containsKey('uri') && params['uri'] != null 962 | ? (params['uri'] as String) 963 | : null); 964 | 965 | final List diagnostics; 966 | 967 | final String uri; 968 | 969 | Map toJson() => { 970 | 'diagnostics': diagnostics?.map((v) => v?.toJson())?.toList(), 971 | 'uri': uri 972 | }; 973 | @override 974 | int get hashCode { 975 | var hash = 133599092; 976 | hash = _hashCombine(hash, _deepHashCode(diagnostics)); 977 | hash = _hashCombine(hash, _deepHashCode(uri)); 978 | return _hashComplete(hash); 979 | } 980 | 981 | @override 982 | bool operator ==(Object other) => 983 | other is Diagnostics && 984 | _deepEquals(diagnostics, other.diagnostics) && 985 | uri == other.uri; 986 | } 987 | 988 | class Diagnostics$Builder { 989 | Diagnostics$Builder._(); 990 | 991 | List diagnostics; 992 | 993 | String uri; 994 | } 995 | 996 | class DocumentHighlight { 997 | DocumentHighlight._(this.kind, this.range); 998 | 999 | factory DocumentHighlight(void Function(DocumentHighlight$Builder) init) { 1000 | final b = DocumentHighlight$Builder._(); 1001 | init(b); 1002 | return DocumentHighlight._(b.kind, b.range); 1003 | } 1004 | 1005 | factory DocumentHighlight.fromJson(Map params) => DocumentHighlight._( 1006 | params.containsKey('kind') && params['kind'] != null 1007 | ? DocumentHighlightKind.fromJson((params['kind'] as int)) 1008 | : null, 1009 | params.containsKey('range') && params['range'] != null 1010 | ? Range.fromJson((params['range'] as Map)) 1011 | : null); 1012 | 1013 | final DocumentHighlightKind kind; 1014 | 1015 | final Range range; 1016 | 1017 | Map toJson() => {'kind': kind?.toJson(), 'range': range?.toJson()}; 1018 | @override 1019 | int get hashCode { 1020 | var hash = 33231655; 1021 | hash = _hashCombine(hash, _deepHashCode(kind)); 1022 | hash = _hashCombine(hash, _deepHashCode(range)); 1023 | return _hashComplete(hash); 1024 | } 1025 | 1026 | @override 1027 | bool operator ==(Object other) => 1028 | other is DocumentHighlight && kind == other.kind && range == other.range; 1029 | } 1030 | 1031 | class DocumentHighlight$Builder { 1032 | DocumentHighlight$Builder._(); 1033 | 1034 | DocumentHighlightKind kind; 1035 | 1036 | Range range; 1037 | } 1038 | 1039 | class DocumentHighlightKind { 1040 | factory DocumentHighlightKind.fromJson(int value) { 1041 | const values = { 1042 | 2: DocumentHighlightKind.read, 1043 | 1: DocumentHighlightKind.text, 1044 | 3: DocumentHighlightKind.write 1045 | }; 1046 | return values[value]; 1047 | } 1048 | 1049 | const DocumentHighlightKind._(this._value); 1050 | 1051 | static const read = DocumentHighlightKind._(2); 1052 | 1053 | static const text = DocumentHighlightKind._(1); 1054 | 1055 | static const write = DocumentHighlightKind._(3); 1056 | 1057 | final int _value; 1058 | 1059 | int toJson() => _value; 1060 | } 1061 | 1062 | class DocumentLinkOptions { 1063 | DocumentLinkOptions._(this.resolveProvider); 1064 | 1065 | factory DocumentLinkOptions(void Function(DocumentLinkOptions$Builder) init) { 1066 | final b = DocumentLinkOptions$Builder._(); 1067 | init(b); 1068 | return DocumentLinkOptions._(b.resolveProvider); 1069 | } 1070 | 1071 | factory DocumentLinkOptions.fromJson(Map params) => DocumentLinkOptions._( 1072 | params.containsKey('resolveProvider') && params['resolveProvider'] != null 1073 | ? (params['resolveProvider'] as bool) 1074 | : null); 1075 | 1076 | final bool resolveProvider; 1077 | 1078 | Map toJson() => {'resolveProvider': resolveProvider}; 1079 | @override 1080 | int get hashCode { 1081 | var hash = 370049515; 1082 | hash = _hashCombine(hash, _deepHashCode(resolveProvider)); 1083 | return _hashComplete(hash); 1084 | } 1085 | 1086 | @override 1087 | bool operator ==(Object other) => 1088 | other is DocumentLinkOptions && resolveProvider == other.resolveProvider; 1089 | } 1090 | 1091 | class DocumentLinkOptions$Builder { 1092 | DocumentLinkOptions$Builder._(); 1093 | 1094 | bool resolveProvider; 1095 | } 1096 | 1097 | class DocumentOnTypeFormattingOptions { 1098 | DocumentOnTypeFormattingOptions._( 1099 | this.firstTriggerCharacter, this.moreTriggerCharacter); 1100 | 1101 | factory DocumentOnTypeFormattingOptions( 1102 | void Function(DocumentOnTypeFormattingOptions$Builder) init) { 1103 | final b = DocumentOnTypeFormattingOptions$Builder._(); 1104 | init(b); 1105 | return DocumentOnTypeFormattingOptions._( 1106 | b.firstTriggerCharacter, b.moreTriggerCharacter); 1107 | } 1108 | 1109 | factory DocumentOnTypeFormattingOptions.fromJson(Map params) => 1110 | DocumentOnTypeFormattingOptions._( 1111 | params.containsKey('firstTriggerCharacter') && 1112 | params['firstTriggerCharacter'] != null 1113 | ? (params['firstTriggerCharacter'] as String) 1114 | : null, 1115 | params.containsKey('moreTriggerCharacter') && 1116 | params['moreTriggerCharacter'] != null 1117 | ? (params['moreTriggerCharacter'] as List).cast() 1118 | : null); 1119 | 1120 | final String firstTriggerCharacter; 1121 | 1122 | final List moreTriggerCharacter; 1123 | 1124 | Map toJson() => { 1125 | 'firstTriggerCharacter': firstTriggerCharacter, 1126 | 'moreTriggerCharacter': moreTriggerCharacter 1127 | }; 1128 | @override 1129 | int get hashCode { 1130 | var hash = 519038003; 1131 | hash = _hashCombine(hash, _deepHashCode(firstTriggerCharacter)); 1132 | hash = _hashCombine(hash, _deepHashCode(moreTriggerCharacter)); 1133 | return _hashComplete(hash); 1134 | } 1135 | 1136 | @override 1137 | bool operator ==(Object other) => 1138 | other is DocumentOnTypeFormattingOptions && 1139 | firstTriggerCharacter == other.firstTriggerCharacter && 1140 | _deepEquals(moreTriggerCharacter, other.moreTriggerCharacter); 1141 | } 1142 | 1143 | class DocumentOnTypeFormattingOptions$Builder { 1144 | DocumentOnTypeFormattingOptions$Builder._(); 1145 | 1146 | String firstTriggerCharacter; 1147 | 1148 | List moreTriggerCharacter; 1149 | } 1150 | 1151 | class DynamicRegistrationCapability { 1152 | DynamicRegistrationCapability._(this.dynamicRegistration); 1153 | 1154 | factory DynamicRegistrationCapability( 1155 | void Function(DynamicRegistrationCapability$Builder) init) { 1156 | final b = DynamicRegistrationCapability$Builder._(); 1157 | init(b); 1158 | return DynamicRegistrationCapability._(b.dynamicRegistration); 1159 | } 1160 | 1161 | factory DynamicRegistrationCapability.fromJson(Map params) => 1162 | DynamicRegistrationCapability._( 1163 | params.containsKey('dynamicRegistration') && 1164 | params['dynamicRegistration'] != null 1165 | ? (params['dynamicRegistration'] as bool) 1166 | : null); 1167 | 1168 | final bool dynamicRegistration; 1169 | 1170 | Map toJson() => {'dynamicRegistration': dynamicRegistration}; 1171 | @override 1172 | int get hashCode { 1173 | var hash = 400193199; 1174 | hash = _hashCombine(hash, _deepHashCode(dynamicRegistration)); 1175 | return _hashComplete(hash); 1176 | } 1177 | 1178 | @override 1179 | bool operator ==(Object other) => 1180 | other is DynamicRegistrationCapability && 1181 | dynamicRegistration == other.dynamicRegistration; 1182 | } 1183 | 1184 | class DynamicRegistrationCapability$Builder { 1185 | DynamicRegistrationCapability$Builder._(); 1186 | 1187 | bool dynamicRegistration; 1188 | } 1189 | 1190 | class ExecuteCommandOptions { 1191 | ExecuteCommandOptions._(this.commands); 1192 | 1193 | factory ExecuteCommandOptions( 1194 | void Function(ExecuteCommandOptions$Builder) init) { 1195 | final b = ExecuteCommandOptions$Builder._(); 1196 | init(b); 1197 | return ExecuteCommandOptions._(b.commands); 1198 | } 1199 | 1200 | factory ExecuteCommandOptions.fromJson(Map params) => ExecuteCommandOptions._( 1201 | params.containsKey('commands') && params['commands'] != null 1202 | ? (params['commands'] as List).cast() 1203 | : null); 1204 | 1205 | final List commands; 1206 | 1207 | Map toJson() => {'commands': commands}; 1208 | @override 1209 | int get hashCode { 1210 | var hash = 136451660; 1211 | hash = _hashCombine(hash, _deepHashCode(commands)); 1212 | return _hashComplete(hash); 1213 | } 1214 | 1215 | @override 1216 | bool operator ==(Object other) => 1217 | other is ExecuteCommandOptions && _deepEquals(commands, other.commands); 1218 | } 1219 | 1220 | class ExecuteCommandOptions$Builder { 1221 | ExecuteCommandOptions$Builder._(); 1222 | 1223 | List commands; 1224 | } 1225 | 1226 | class Hover { 1227 | Hover._(this.contents, this.range); 1228 | 1229 | factory Hover(void Function(Hover$Builder) init) { 1230 | final b = Hover$Builder._(); 1231 | init(b); 1232 | return Hover._(b.contents, b.range); 1233 | } 1234 | 1235 | factory Hover.fromJson(Map params) => Hover._( 1236 | params.containsKey('contents') && params['contents'] != null 1237 | ? (params['contents'] as String) 1238 | : null, 1239 | params.containsKey('range') && params['range'] != null 1240 | ? Range.fromJson((params['range'] as Map)) 1241 | : null); 1242 | 1243 | final String contents; 1244 | 1245 | final Range range; 1246 | 1247 | Map toJson() => {'contents': contents, 'range': range?.toJson()}; 1248 | @override 1249 | int get hashCode { 1250 | var hash = 624710494; 1251 | hash = _hashCombine(hash, _deepHashCode(contents)); 1252 | hash = _hashCombine(hash, _deepHashCode(range)); 1253 | return _hashComplete(hash); 1254 | } 1255 | 1256 | @override 1257 | bool operator ==(Object other) => 1258 | other is Hover && contents == other.contents && range == other.range; 1259 | } 1260 | 1261 | class Hover$Builder { 1262 | Hover$Builder._(); 1263 | 1264 | String contents; 1265 | 1266 | Range range; 1267 | } 1268 | 1269 | class HoverCapabilities { 1270 | HoverCapabilities._(this.contentFormat, this.dynamicRegistration); 1271 | 1272 | factory HoverCapabilities(void Function(HoverCapabilities$Builder) init) { 1273 | final b = HoverCapabilities$Builder._(); 1274 | init(b); 1275 | return HoverCapabilities._(b.contentFormat, b.dynamicRegistration); 1276 | } 1277 | 1278 | factory HoverCapabilities.fromJson(Map params) => HoverCapabilities._( 1279 | params.containsKey('contentFormat') && params['contentFormat'] != null 1280 | ? (params['contentFormat'] as List).cast() 1281 | : null, 1282 | params.containsKey('dynamicRegistration') && 1283 | params['dynamicRegistration'] != null 1284 | ? (params['dynamicRegistration'] as bool) 1285 | : null); 1286 | 1287 | final List contentFormat; 1288 | 1289 | final bool dynamicRegistration; 1290 | 1291 | Map toJson() => { 1292 | 'contentFormat': contentFormat, 1293 | 'dynamicRegistration': dynamicRegistration 1294 | }; 1295 | @override 1296 | int get hashCode { 1297 | var hash = 400081440; 1298 | hash = _hashCombine(hash, _deepHashCode(contentFormat)); 1299 | hash = _hashCombine(hash, _deepHashCode(dynamicRegistration)); 1300 | return _hashComplete(hash); 1301 | } 1302 | 1303 | @override 1304 | bool operator ==(Object other) => 1305 | other is HoverCapabilities && 1306 | _deepEquals(contentFormat, other.contentFormat) && 1307 | dynamicRegistration == other.dynamicRegistration; 1308 | } 1309 | 1310 | class HoverCapabilities$Builder { 1311 | HoverCapabilities$Builder._(); 1312 | 1313 | List contentFormat; 1314 | 1315 | bool dynamicRegistration; 1316 | } 1317 | 1318 | class HoverMarkup { 1319 | HoverMarkup._(this.contents, this.range); 1320 | 1321 | factory HoverMarkup(void Function(HoverMarkup$Builder) init) { 1322 | final b = HoverMarkup$Builder._(); 1323 | init(b); 1324 | return HoverMarkup._(b.contents, b.range); 1325 | } 1326 | 1327 | factory HoverMarkup.fromJson(Map params) => HoverMarkup._( 1328 | params.containsKey('contents') && params['contents'] != null 1329 | ? MarkupContent.fromJson((params['contents'] as Map)) 1330 | : null, 1331 | params.containsKey('range') && params['range'] != null 1332 | ? Range.fromJson((params['range'] as Map)) 1333 | : null); 1334 | 1335 | final MarkupContent contents; 1336 | 1337 | final Range range; 1338 | 1339 | Map toJson() => {'contents': contents?.toJson(), 'range': range?.toJson()}; 1340 | @override 1341 | int get hashCode { 1342 | var hash = 207034670; 1343 | hash = _hashCombine(hash, _deepHashCode(contents)); 1344 | hash = _hashCombine(hash, _deepHashCode(range)); 1345 | return _hashComplete(hash); 1346 | } 1347 | 1348 | @override 1349 | bool operator ==(Object other) => 1350 | other is HoverMarkup && 1351 | contents == other.contents && 1352 | range == other.range; 1353 | } 1354 | 1355 | class HoverMarkup$Builder { 1356 | HoverMarkup$Builder._(); 1357 | 1358 | MarkupContent contents; 1359 | 1360 | Range range; 1361 | } 1362 | 1363 | class InsertTextFormat { 1364 | factory InsertTextFormat.fromJson(int value) { 1365 | const values = {1: InsertTextFormat.plainText, 2: InsertTextFormat.snippet}; 1366 | return values[value]; 1367 | } 1368 | 1369 | const InsertTextFormat._(this._value); 1370 | 1371 | static const plainText = InsertTextFormat._(1); 1372 | 1373 | static const snippet = InsertTextFormat._(2); 1374 | 1375 | final int _value; 1376 | 1377 | int toJson() => _value; 1378 | } 1379 | 1380 | class Location { 1381 | Location._(this.range, this.uri); 1382 | 1383 | factory Location(void Function(Location$Builder) init) { 1384 | final b = Location$Builder._(); 1385 | init(b); 1386 | return Location._(b.range, b.uri); 1387 | } 1388 | 1389 | factory Location.fromJson(Map params) => Location._( 1390 | params.containsKey('range') && params['range'] != null 1391 | ? Range.fromJson((params['range'] as Map)) 1392 | : null, 1393 | params.containsKey('uri') && params['uri'] != null 1394 | ? (params['uri'] as String) 1395 | : null); 1396 | 1397 | final Range range; 1398 | 1399 | final String uri; 1400 | 1401 | Map toJson() => {'range': range?.toJson(), 'uri': uri}; 1402 | @override 1403 | int get hashCode { 1404 | var hash = 1015387949; 1405 | hash = _hashCombine(hash, _deepHashCode(range)); 1406 | hash = _hashCombine(hash, _deepHashCode(uri)); 1407 | return _hashComplete(hash); 1408 | } 1409 | 1410 | @override 1411 | bool operator ==(Object other) => 1412 | other is Location && range == other.range && uri == other.uri; 1413 | } 1414 | 1415 | class Location$Builder { 1416 | Location$Builder._(); 1417 | 1418 | Range range; 1419 | 1420 | String uri; 1421 | } 1422 | 1423 | class MarkupContent { 1424 | MarkupContent._(this.kind, this.value); 1425 | 1426 | factory MarkupContent(void Function(MarkupContent$Builder) init) { 1427 | final b = MarkupContent$Builder._(); 1428 | init(b); 1429 | return MarkupContent._(b.kind, b.value); 1430 | } 1431 | 1432 | factory MarkupContent.fromJson(Map params) => MarkupContent._( 1433 | params.containsKey('kind') && params['kind'] != null 1434 | ? MarkupContentKind.fromJson((params['kind'] as String)) 1435 | : null, 1436 | params.containsKey('value') && params['value'] != null 1437 | ? (params['value'] as String) 1438 | : null); 1439 | 1440 | final MarkupContentKind kind; 1441 | 1442 | final String value; 1443 | 1444 | Map toJson() => {'kind': kind?.toJson(), 'value': value}; 1445 | @override 1446 | int get hashCode { 1447 | var hash = 161892004; 1448 | hash = _hashCombine(hash, _deepHashCode(kind)); 1449 | hash = _hashCombine(hash, _deepHashCode(value)); 1450 | return _hashComplete(hash); 1451 | } 1452 | 1453 | @override 1454 | bool operator ==(Object other) => 1455 | other is MarkupContent && kind == other.kind && value == other.value; 1456 | } 1457 | 1458 | class MarkupContent$Builder { 1459 | MarkupContent$Builder._(); 1460 | 1461 | MarkupContentKind kind; 1462 | 1463 | String value; 1464 | } 1465 | 1466 | class MarkupContentKind { 1467 | factory MarkupContentKind.fromJson(String value) { 1468 | const values = { 1469 | 'markdown': MarkupContentKind.markdown, 1470 | 'plaintext': MarkupContentKind.plaintext 1471 | }; 1472 | return values[value]; 1473 | } 1474 | 1475 | const MarkupContentKind._(this._value); 1476 | 1477 | static const markdown = MarkupContentKind._('markdown'); 1478 | 1479 | static const plaintext = MarkupContentKind._('plaintext'); 1480 | 1481 | final String _value; 1482 | 1483 | String toJson() => _value; 1484 | } 1485 | 1486 | class MessageType { 1487 | factory MessageType.fromJson(int value) { 1488 | const values = { 1489 | 1: MessageType.error, 1490 | 3: MessageType.info, 1491 | 4: MessageType.log, 1492 | 2: MessageType.warning 1493 | }; 1494 | return values[value]; 1495 | } 1496 | 1497 | const MessageType._(this._value); 1498 | 1499 | static const error = MessageType._(1); 1500 | 1501 | static const info = MessageType._(3); 1502 | 1503 | static const log = MessageType._(4); 1504 | 1505 | static const warning = MessageType._(2); 1506 | 1507 | final int _value; 1508 | 1509 | int toJson() => _value; 1510 | } 1511 | 1512 | class Position { 1513 | Position._(this.character, this.line); 1514 | 1515 | factory Position(void Function(Position$Builder) init) { 1516 | final b = Position$Builder._(); 1517 | init(b); 1518 | return Position._(b.character, b.line); 1519 | } 1520 | 1521 | factory Position.fromJson(Map params) => Position._( 1522 | params.containsKey('character') && params['character'] != null 1523 | ? (params['character'] as int) 1524 | : null, 1525 | params.containsKey('line') && params['line'] != null 1526 | ? (params['line'] as int) 1527 | : null); 1528 | 1529 | final int character; 1530 | 1531 | final int line; 1532 | 1533 | Map toJson() => {'character': character, 'line': line}; 1534 | @override 1535 | int get hashCode { 1536 | var hash = 210930065; 1537 | hash = _hashCombine(hash, _deepHashCode(character)); 1538 | hash = _hashCombine(hash, _deepHashCode(line)); 1539 | return _hashComplete(hash); 1540 | } 1541 | 1542 | @override 1543 | bool operator ==(Object other) => 1544 | other is Position && character == other.character && line == other.line; 1545 | } 1546 | 1547 | class Position$Builder { 1548 | Position$Builder._(); 1549 | 1550 | int character; 1551 | 1552 | int line; 1553 | } 1554 | 1555 | class Range { 1556 | Range._(this.end, this.start); 1557 | 1558 | factory Range(void Function(Range$Builder) init) { 1559 | final b = Range$Builder._(); 1560 | init(b); 1561 | return Range._(b.end, b.start); 1562 | } 1563 | 1564 | factory Range.fromJson(Map params) => Range._( 1565 | params.containsKey('end') && params['end'] != null 1566 | ? Position.fromJson((params['end'] as Map)) 1567 | : null, 1568 | params.containsKey('start') && params['start'] != null 1569 | ? Position.fromJson((params['start'] as Map)) 1570 | : null); 1571 | 1572 | final Position end; 1573 | 1574 | final Position start; 1575 | 1576 | Map toJson() => {'end': end?.toJson(), 'start': start?.toJson()}; 1577 | @override 1578 | int get hashCode { 1579 | var hash = 682876634; 1580 | hash = _hashCombine(hash, _deepHashCode(end)); 1581 | hash = _hashCombine(hash, _deepHashCode(start)); 1582 | return _hashComplete(hash); 1583 | } 1584 | 1585 | @override 1586 | bool operator ==(Object other) => 1587 | other is Range && end == other.end && start == other.start; 1588 | } 1589 | 1590 | class Range$Builder { 1591 | Range$Builder._(); 1592 | 1593 | Position end; 1594 | 1595 | Position start; 1596 | } 1597 | 1598 | class ReferenceContext { 1599 | ReferenceContext._(this.includeDeclaration); 1600 | 1601 | factory ReferenceContext(void Function(ReferenceContext$Builder) init) { 1602 | final b = ReferenceContext$Builder._(); 1603 | init(b); 1604 | return ReferenceContext._(b.includeDeclaration); 1605 | } 1606 | 1607 | factory ReferenceContext.fromJson(Map params) => 1608 | ReferenceContext._(params.containsKey('includeDeclaration') && 1609 | params['includeDeclaration'] != null 1610 | ? (params['includeDeclaration'] as bool) 1611 | : null); 1612 | 1613 | final bool includeDeclaration; 1614 | 1615 | Map toJson() => {'includeDeclaration': includeDeclaration}; 1616 | @override 1617 | int get hashCode { 1618 | var hash = 82198676; 1619 | hash = _hashCombine(hash, _deepHashCode(includeDeclaration)); 1620 | return _hashComplete(hash); 1621 | } 1622 | 1623 | @override 1624 | bool operator ==(Object other) => 1625 | other is ReferenceContext && 1626 | includeDeclaration == other.includeDeclaration; 1627 | } 1628 | 1629 | class ReferenceContext$Builder { 1630 | ReferenceContext$Builder._(); 1631 | 1632 | bool includeDeclaration; 1633 | } 1634 | 1635 | class SaveOptions { 1636 | SaveOptions._(this.includeText); 1637 | 1638 | factory SaveOptions(void Function(SaveOptions$Builder) init) { 1639 | final b = SaveOptions$Builder._(); 1640 | init(b); 1641 | return SaveOptions._(b.includeText); 1642 | } 1643 | 1644 | factory SaveOptions.fromJson(Map params) => SaveOptions._( 1645 | params.containsKey('includeText') && params['includeText'] != null 1646 | ? (params['includeText'] as bool) 1647 | : null); 1648 | 1649 | final bool includeText; 1650 | 1651 | Map toJson() => {'includeText': includeText}; 1652 | @override 1653 | int get hashCode { 1654 | var hash = 11958891; 1655 | hash = _hashCombine(hash, _deepHashCode(includeText)); 1656 | return _hashComplete(hash); 1657 | } 1658 | 1659 | @override 1660 | bool operator ==(Object other) => 1661 | other is SaveOptions && includeText == other.includeText; 1662 | } 1663 | 1664 | class SaveOptions$Builder { 1665 | SaveOptions$Builder._(); 1666 | 1667 | bool includeText; 1668 | } 1669 | 1670 | class ServerCapabilities { 1671 | ServerCapabilities._( 1672 | this.codeActionProvider, 1673 | this.codeLensProvider, 1674 | this.completionProvider, 1675 | this.definitionProvider, 1676 | this.documentFormattingProvider, 1677 | this.documentHighlightProvider, 1678 | this.documentLinkProvider, 1679 | this.documentOnTypeFormattingProvider, 1680 | this.documentRangeFormattingProvider, 1681 | this.documentSymbolProvider, 1682 | this.executeCommandProvider, 1683 | this.hoverProvider, 1684 | this.implementationProvider, 1685 | this.referencesProvider, 1686 | this.renameProvider, 1687 | this.signatureHelpProvider, 1688 | this.textDocumentSync, 1689 | this.workspaceSymbolProvider); 1690 | 1691 | factory ServerCapabilities(void Function(ServerCapabilities$Builder) init) { 1692 | final b = ServerCapabilities$Builder._(); 1693 | init(b); 1694 | return ServerCapabilities._( 1695 | b.codeActionProvider, 1696 | b.codeLensProvider, 1697 | b.completionProvider, 1698 | b.definitionProvider, 1699 | b.documentFormattingProvider, 1700 | b.documentHighlightProvider, 1701 | b.documentLinkProvider, 1702 | b.documentOnTypeFormattingProvider, 1703 | b.documentRangeFormattingProvider, 1704 | b.documentSymbolProvider, 1705 | b.executeCommandProvider, 1706 | b.hoverProvider, 1707 | b.implementationProvider, 1708 | b.referencesProvider, 1709 | b.renameProvider, 1710 | b.signatureHelpProvider, 1711 | b.textDocumentSync, 1712 | b.workspaceSymbolProvider); 1713 | } 1714 | 1715 | factory ServerCapabilities.fromJson(Map params) => ServerCapabilities._( 1716 | params.containsKey('codeActionProvider') && params['codeActionProvider'] != null 1717 | ? (params['codeActionProvider'] as bool) 1718 | : null, 1719 | params.containsKey('codeLensProvider') && params['codeLensProvider'] != null 1720 | ? CodeLensOptions.fromJson((params['codeLensProvider'] as Map)) 1721 | : null, 1722 | params.containsKey('completionProvider') && params['completionProvider'] != null 1723 | ? CompletionOptions.fromJson((params['completionProvider'] as Map)) 1724 | : null, 1725 | params.containsKey('definitionProvider') && params['definitionProvider'] != null 1726 | ? (params['definitionProvider'] as bool) 1727 | : null, 1728 | params.containsKey('documentFormattingProvider') && params['documentFormattingProvider'] != null 1729 | ? (params['documentFormattingProvider'] as bool) 1730 | : null, 1731 | params.containsKey('documentHighlightProvider') && params['documentHighlightProvider'] != null 1732 | ? (params['documentHighlightProvider'] as bool) 1733 | : null, 1734 | params.containsKey('documentLinkProvider') && params['documentLinkProvider'] != null 1735 | ? DocumentLinkOptions.fromJson( 1736 | (params['documentLinkProvider'] as Map)) 1737 | : null, 1738 | params.containsKey('documentOnTypeFormattingProvider') && params['documentOnTypeFormattingProvider'] != null 1739 | ? DocumentOnTypeFormattingOptions.fromJson( 1740 | (params['documentOnTypeFormattingProvider'] as Map)) 1741 | : null, 1742 | params.containsKey('documentRangeFormattingProvider') && params['documentRangeFormattingProvider'] != null 1743 | ? (params['documentRangeFormattingProvider'] as bool) 1744 | : null, 1745 | params.containsKey('documentSymbolProvider') && params['documentSymbolProvider'] != null 1746 | ? (params['documentSymbolProvider'] as bool) 1747 | : null, 1748 | params.containsKey('executeCommandProvider') && params['executeCommandProvider'] != null 1749 | ? ExecuteCommandOptions.fromJson((params['executeCommandProvider'] as Map)) 1750 | : null, 1751 | params.containsKey('hoverProvider') && params['hoverProvider'] != null ? (params['hoverProvider'] as bool) : null, 1752 | params.containsKey('implementationProvider') && params['implementationProvider'] != null ? (params['implementationProvider'] as bool) : null, 1753 | params.containsKey('referencesProvider') && params['referencesProvider'] != null ? (params['referencesProvider'] as bool) : null, 1754 | params.containsKey('renameProvider') && params['renameProvider'] != null ? (params['renameProvider'] as bool) : null, 1755 | params.containsKey('signatureHelpProvider') && params['signatureHelpProvider'] != null ? SignatureHelpOptions.fromJson((params['signatureHelpProvider'] as Map)) : null, 1756 | params.containsKey('textDocumentSync') && params['textDocumentSync'] != null ? TextDocumentSyncOptions.fromJson((params['textDocumentSync'] as Map)) : null, 1757 | params.containsKey('workspaceSymbolProvider') && params['workspaceSymbolProvider'] != null ? (params['workspaceSymbolProvider'] as bool) : null); 1758 | 1759 | final bool codeActionProvider; 1760 | 1761 | final CodeLensOptions codeLensProvider; 1762 | 1763 | final CompletionOptions completionProvider; 1764 | 1765 | final bool definitionProvider; 1766 | 1767 | final bool documentFormattingProvider; 1768 | 1769 | final bool documentHighlightProvider; 1770 | 1771 | final DocumentLinkOptions documentLinkProvider; 1772 | 1773 | final DocumentOnTypeFormattingOptions documentOnTypeFormattingProvider; 1774 | 1775 | final bool documentRangeFormattingProvider; 1776 | 1777 | final bool documentSymbolProvider; 1778 | 1779 | final ExecuteCommandOptions executeCommandProvider; 1780 | 1781 | final bool hoverProvider; 1782 | 1783 | final bool implementationProvider; 1784 | 1785 | final bool referencesProvider; 1786 | 1787 | final bool renameProvider; 1788 | 1789 | final SignatureHelpOptions signatureHelpProvider; 1790 | 1791 | final TextDocumentSyncOptions textDocumentSync; 1792 | 1793 | final bool workspaceSymbolProvider; 1794 | 1795 | Map toJson() => { 1796 | 'codeActionProvider': codeActionProvider, 1797 | 'codeLensProvider': codeLensProvider?.toJson(), 1798 | 'completionProvider': completionProvider?.toJson(), 1799 | 'definitionProvider': definitionProvider, 1800 | 'documentFormattingProvider': documentFormattingProvider, 1801 | 'documentHighlightProvider': documentHighlightProvider, 1802 | 'documentLinkProvider': documentLinkProvider?.toJson(), 1803 | 'documentOnTypeFormattingProvider': 1804 | documentOnTypeFormattingProvider?.toJson(), 1805 | 'documentRangeFormattingProvider': documentRangeFormattingProvider, 1806 | 'documentSymbolProvider': documentSymbolProvider, 1807 | 'executeCommandProvider': executeCommandProvider?.toJson(), 1808 | 'hoverProvider': hoverProvider, 1809 | 'implementationProvider': implementationProvider, 1810 | 'referencesProvider': referencesProvider, 1811 | 'renameProvider': renameProvider, 1812 | 'signatureHelpProvider': signatureHelpProvider?.toJson(), 1813 | 'textDocumentSync': textDocumentSync?.toJson(), 1814 | 'workspaceSymbolProvider': workspaceSymbolProvider 1815 | }; 1816 | @override 1817 | int get hashCode { 1818 | var hash = 659932873; 1819 | hash = _hashCombine(hash, _deepHashCode(codeActionProvider)); 1820 | hash = _hashCombine(hash, _deepHashCode(codeLensProvider)); 1821 | hash = _hashCombine(hash, _deepHashCode(completionProvider)); 1822 | hash = _hashCombine(hash, _deepHashCode(definitionProvider)); 1823 | hash = _hashCombine(hash, _deepHashCode(documentFormattingProvider)); 1824 | hash = _hashCombine(hash, _deepHashCode(documentHighlightProvider)); 1825 | hash = _hashCombine(hash, _deepHashCode(documentLinkProvider)); 1826 | hash = _hashCombine(hash, _deepHashCode(documentOnTypeFormattingProvider)); 1827 | hash = _hashCombine(hash, _deepHashCode(documentRangeFormattingProvider)); 1828 | hash = _hashCombine(hash, _deepHashCode(documentSymbolProvider)); 1829 | hash = _hashCombine(hash, _deepHashCode(executeCommandProvider)); 1830 | hash = _hashCombine(hash, _deepHashCode(hoverProvider)); 1831 | hash = _hashCombine(hash, _deepHashCode(implementationProvider)); 1832 | hash = _hashCombine(hash, _deepHashCode(referencesProvider)); 1833 | hash = _hashCombine(hash, _deepHashCode(renameProvider)); 1834 | hash = _hashCombine(hash, _deepHashCode(signatureHelpProvider)); 1835 | hash = _hashCombine(hash, _deepHashCode(textDocumentSync)); 1836 | hash = _hashCombine(hash, _deepHashCode(workspaceSymbolProvider)); 1837 | return _hashComplete(hash); 1838 | } 1839 | 1840 | @override 1841 | bool operator ==(Object other) => 1842 | other is ServerCapabilities && 1843 | codeActionProvider == other.codeActionProvider && 1844 | codeLensProvider == other.codeLensProvider && 1845 | completionProvider == other.completionProvider && 1846 | definitionProvider == other.definitionProvider && 1847 | documentFormattingProvider == other.documentFormattingProvider && 1848 | documentHighlightProvider == other.documentHighlightProvider && 1849 | documentLinkProvider == other.documentLinkProvider && 1850 | documentOnTypeFormattingProvider == 1851 | other.documentOnTypeFormattingProvider && 1852 | documentRangeFormattingProvider == 1853 | other.documentRangeFormattingProvider && 1854 | documentSymbolProvider == other.documentSymbolProvider && 1855 | executeCommandProvider == other.executeCommandProvider && 1856 | hoverProvider == other.hoverProvider && 1857 | implementationProvider == other.implementationProvider && 1858 | referencesProvider == other.referencesProvider && 1859 | renameProvider == other.renameProvider && 1860 | signatureHelpProvider == other.signatureHelpProvider && 1861 | textDocumentSync == other.textDocumentSync && 1862 | workspaceSymbolProvider == other.workspaceSymbolProvider; 1863 | } 1864 | 1865 | class ServerCapabilities$Builder { 1866 | ServerCapabilities$Builder._(); 1867 | 1868 | bool codeActionProvider; 1869 | 1870 | CodeLensOptions codeLensProvider; 1871 | 1872 | CompletionOptions completionProvider; 1873 | 1874 | bool definitionProvider; 1875 | 1876 | bool documentFormattingProvider; 1877 | 1878 | bool documentHighlightProvider; 1879 | 1880 | DocumentLinkOptions documentLinkProvider; 1881 | 1882 | DocumentOnTypeFormattingOptions documentOnTypeFormattingProvider; 1883 | 1884 | bool documentRangeFormattingProvider; 1885 | 1886 | bool documentSymbolProvider; 1887 | 1888 | ExecuteCommandOptions executeCommandProvider; 1889 | 1890 | bool hoverProvider; 1891 | 1892 | bool implementationProvider; 1893 | 1894 | bool referencesProvider; 1895 | 1896 | bool renameProvider; 1897 | 1898 | SignatureHelpOptions signatureHelpProvider; 1899 | 1900 | TextDocumentSyncOptions textDocumentSync; 1901 | 1902 | bool workspaceSymbolProvider; 1903 | } 1904 | 1905 | class ShowMessageParams { 1906 | ShowMessageParams._(this.message, this.type); 1907 | 1908 | factory ShowMessageParams(void Function(ShowMessageParams$Builder) init) { 1909 | final b = ShowMessageParams$Builder._(); 1910 | init(b); 1911 | return ShowMessageParams._(b.message, b.type); 1912 | } 1913 | 1914 | factory ShowMessageParams.fromJson(Map params) => ShowMessageParams._( 1915 | params.containsKey('message') && params['message'] != null 1916 | ? (params['message'] as String) 1917 | : null, 1918 | params.containsKey('type') && params['type'] != null 1919 | ? MessageType.fromJson((params['type'] as int)) 1920 | : null); 1921 | 1922 | final String message; 1923 | 1924 | final MessageType type; 1925 | 1926 | Map toJson() => {'message': message, 'type': type?.toJson()}; 1927 | @override 1928 | int get hashCode { 1929 | var hash = 684261254; 1930 | hash = _hashCombine(hash, _deepHashCode(message)); 1931 | hash = _hashCombine(hash, _deepHashCode(type)); 1932 | return _hashComplete(hash); 1933 | } 1934 | 1935 | @override 1936 | bool operator ==(Object other) => 1937 | other is ShowMessageParams && 1938 | message == other.message && 1939 | type == other.type; 1940 | } 1941 | 1942 | class ShowMessageParams$Builder { 1943 | ShowMessageParams$Builder._(); 1944 | 1945 | String message; 1946 | 1947 | MessageType type; 1948 | } 1949 | 1950 | class SignatureHelpOptions { 1951 | SignatureHelpOptions._(this.triggerCharacters); 1952 | 1953 | factory SignatureHelpOptions( 1954 | void Function(SignatureHelpOptions$Builder) init) { 1955 | final b = SignatureHelpOptions$Builder._(); 1956 | init(b); 1957 | return SignatureHelpOptions._(b.triggerCharacters); 1958 | } 1959 | 1960 | factory SignatureHelpOptions.fromJson(Map params) => 1961 | SignatureHelpOptions._(params.containsKey('triggerCharacters') && 1962 | params['triggerCharacters'] != null 1963 | ? (params['triggerCharacters'] as List).cast() 1964 | : null); 1965 | 1966 | final List triggerCharacters; 1967 | 1968 | Map toJson() => {'triggerCharacters': triggerCharacters}; 1969 | @override 1970 | int get hashCode { 1971 | var hash = 979113728; 1972 | hash = _hashCombine(hash, _deepHashCode(triggerCharacters)); 1973 | return _hashComplete(hash); 1974 | } 1975 | 1976 | @override 1977 | bool operator ==(Object other) => 1978 | other is SignatureHelpOptions && 1979 | _deepEquals(triggerCharacters, other.triggerCharacters); 1980 | } 1981 | 1982 | class SignatureHelpOptions$Builder { 1983 | SignatureHelpOptions$Builder._(); 1984 | 1985 | List triggerCharacters; 1986 | } 1987 | 1988 | class SymbolInformation { 1989 | SymbolInformation._(this.containerName, this.kind, this.location, this.name); 1990 | 1991 | factory SymbolInformation(void Function(SymbolInformation$Builder) init) { 1992 | final b = SymbolInformation$Builder._(); 1993 | init(b); 1994 | return SymbolInformation._(b.containerName, b.kind, b.location, b.name); 1995 | } 1996 | 1997 | factory SymbolInformation.fromJson(Map params) => SymbolInformation._( 1998 | params.containsKey('containerName') && params['containerName'] != null 1999 | ? (params['containerName'] as String) 2000 | : null, 2001 | params.containsKey('kind') && params['kind'] != null 2002 | ? SymbolKind.fromJson((params['kind'] as int)) 2003 | : null, 2004 | params.containsKey('location') && params['location'] != null 2005 | ? Location.fromJson((params['location'] as Map)) 2006 | : null, 2007 | params.containsKey('name') && params['name'] != null 2008 | ? (params['name'] as String) 2009 | : null); 2010 | 2011 | final String containerName; 2012 | 2013 | final SymbolKind kind; 2014 | 2015 | final Location location; 2016 | 2017 | final String name; 2018 | 2019 | Map toJson() => { 2020 | 'containerName': containerName, 2021 | 'kind': kind?.toJson(), 2022 | 'location': location?.toJson(), 2023 | 'name': name 2024 | }; 2025 | @override 2026 | int get hashCode { 2027 | var hash = 260018179; 2028 | hash = _hashCombine(hash, _deepHashCode(containerName)); 2029 | hash = _hashCombine(hash, _deepHashCode(kind)); 2030 | hash = _hashCombine(hash, _deepHashCode(location)); 2031 | hash = _hashCombine(hash, _deepHashCode(name)); 2032 | return _hashComplete(hash); 2033 | } 2034 | 2035 | @override 2036 | bool operator ==(Object other) => 2037 | other is SymbolInformation && 2038 | containerName == other.containerName && 2039 | kind == other.kind && 2040 | location == other.location && 2041 | name == other.name; 2042 | } 2043 | 2044 | class SymbolInformation$Builder { 2045 | SymbolInformation$Builder._(); 2046 | 2047 | String containerName; 2048 | 2049 | SymbolKind kind; 2050 | 2051 | Location location; 2052 | 2053 | String name; 2054 | } 2055 | 2056 | class SymbolKind { 2057 | factory SymbolKind.fromJson(int value) { 2058 | const values = { 2059 | 18: SymbolKind.array, 2060 | 17: SymbolKind.boolean, 2061 | 5: SymbolKind.classSymbol, 2062 | 14: SymbolKind.constant, 2063 | 9: SymbolKind.constructor, 2064 | 22: SymbolKind.enumMember, 2065 | 10: SymbolKind.enumSymbol, 2066 | 24: SymbolKind.event, 2067 | 8: SymbolKind.field, 2068 | 1: SymbolKind.file, 2069 | 12: SymbolKind.function, 2070 | 11: SymbolKind.interface, 2071 | 20: SymbolKind.key, 2072 | 6: SymbolKind.method, 2073 | 2: SymbolKind.module, 2074 | 3: SymbolKind.namespace, 2075 | 21: SymbolKind.nullSymbol, 2076 | 16: SymbolKind.number, 2077 | 19: SymbolKind.object, 2078 | 25: SymbolKind.operator, 2079 | 4: SymbolKind.package, 2080 | 7: SymbolKind.property, 2081 | 15: SymbolKind.string, 2082 | 23: SymbolKind.struct, 2083 | 26: SymbolKind.typeParameter, 2084 | 13: SymbolKind.variable 2085 | }; 2086 | return values[value]; 2087 | } 2088 | 2089 | const SymbolKind._(this._value); 2090 | 2091 | static const array = SymbolKind._(18); 2092 | 2093 | static const boolean = SymbolKind._(17); 2094 | 2095 | static const classSymbol = SymbolKind._(5); 2096 | 2097 | static const constant = SymbolKind._(14); 2098 | 2099 | static const constructor = SymbolKind._(9); 2100 | 2101 | static const enumMember = SymbolKind._(22); 2102 | 2103 | static const enumSymbol = SymbolKind._(10); 2104 | 2105 | static const event = SymbolKind._(24); 2106 | 2107 | static const field = SymbolKind._(8); 2108 | 2109 | static const file = SymbolKind._(1); 2110 | 2111 | static const function = SymbolKind._(12); 2112 | 2113 | static const interface = SymbolKind._(11); 2114 | 2115 | static const key = SymbolKind._(20); 2116 | 2117 | static const method = SymbolKind._(6); 2118 | 2119 | static const module = SymbolKind._(2); 2120 | 2121 | static const namespace = SymbolKind._(3); 2122 | 2123 | static const nullSymbol = SymbolKind._(21); 2124 | 2125 | static const number = SymbolKind._(16); 2126 | 2127 | static const object = SymbolKind._(19); 2128 | 2129 | static const operator = SymbolKind._(25); 2130 | 2131 | static const package = SymbolKind._(4); 2132 | 2133 | static const property = SymbolKind._(7); 2134 | 2135 | static const string = SymbolKind._(15); 2136 | 2137 | static const struct = SymbolKind._(23); 2138 | 2139 | static const typeParameter = SymbolKind._(26); 2140 | 2141 | static const variable = SymbolKind._(13); 2142 | 2143 | final int _value; 2144 | 2145 | int toJson() => _value; 2146 | } 2147 | 2148 | class SynchronizationCapabilities { 2149 | SynchronizationCapabilities._(this.didSave, this.dynamicRegistration, 2150 | this.willSave, this.willSaveWaitUntil); 2151 | 2152 | factory SynchronizationCapabilities( 2153 | void Function(SynchronizationCapabilities$Builder) init) { 2154 | final b = SynchronizationCapabilities$Builder._(); 2155 | init(b); 2156 | return SynchronizationCapabilities._( 2157 | b.didSave, b.dynamicRegistration, b.willSave, b.willSaveWaitUntil); 2158 | } 2159 | 2160 | factory SynchronizationCapabilities.fromJson( 2161 | Map params) => 2162 | SynchronizationCapabilities._( 2163 | params.containsKey('didSave') && params['didSave'] != null 2164 | ? (params['didSave'] as bool) 2165 | : null, 2166 | params.containsKey('dynamicRegistration') && 2167 | params['dynamicRegistration'] != null 2168 | ? (params['dynamicRegistration'] as bool) 2169 | : null, 2170 | params.containsKey('willSave') && params['willSave'] != null 2171 | ? (params['willSave'] as bool) 2172 | : null, 2173 | params.containsKey('willSaveWaitUntil') && 2174 | params['willSaveWaitUntil'] != null 2175 | ? (params['willSaveWaitUntil'] as bool) 2176 | : null); 2177 | 2178 | final bool didSave; 2179 | 2180 | final bool dynamicRegistration; 2181 | 2182 | final bool willSave; 2183 | 2184 | final bool willSaveWaitUntil; 2185 | 2186 | Map toJson() => { 2187 | 'didSave': didSave, 2188 | 'dynamicRegistration': dynamicRegistration, 2189 | 'willSave': willSave, 2190 | 'willSaveWaitUntil': willSaveWaitUntil 2191 | }; 2192 | @override 2193 | int get hashCode { 2194 | var hash = 1050620504; 2195 | hash = _hashCombine(hash, _deepHashCode(didSave)); 2196 | hash = _hashCombine(hash, _deepHashCode(dynamicRegistration)); 2197 | hash = _hashCombine(hash, _deepHashCode(willSave)); 2198 | hash = _hashCombine(hash, _deepHashCode(willSaveWaitUntil)); 2199 | return _hashComplete(hash); 2200 | } 2201 | 2202 | @override 2203 | bool operator ==(Object other) => 2204 | other is SynchronizationCapabilities && 2205 | didSave == other.didSave && 2206 | dynamicRegistration == other.dynamicRegistration && 2207 | willSave == other.willSave && 2208 | willSaveWaitUntil == other.willSaveWaitUntil; 2209 | } 2210 | 2211 | class SynchronizationCapabilities$Builder { 2212 | SynchronizationCapabilities$Builder._(); 2213 | 2214 | bool didSave; 2215 | 2216 | bool dynamicRegistration; 2217 | 2218 | bool willSave; 2219 | 2220 | bool willSaveWaitUntil; 2221 | } 2222 | 2223 | class TextDocumentClientCapabilities { 2224 | TextDocumentClientCapabilities._( 2225 | this.codeAction, 2226 | this.codeLens, 2227 | this.completion, 2228 | this.definition, 2229 | this.documentHighlight, 2230 | this.documentLink, 2231 | this.documentSymbol, 2232 | this.formatting, 2233 | this.hover, 2234 | this.onTypeFormatting, 2235 | this.references, 2236 | this.rename, 2237 | this.synchronization); 2238 | 2239 | factory TextDocumentClientCapabilities( 2240 | void Function(TextDocumentClientCapabilities$Builder) init) { 2241 | final b = TextDocumentClientCapabilities$Builder._(); 2242 | init(b); 2243 | return TextDocumentClientCapabilities._( 2244 | b.codeAction, 2245 | b.codeLens, 2246 | b.completion, 2247 | b.definition, 2248 | b.documentHighlight, 2249 | b.documentLink, 2250 | b.documentSymbol, 2251 | b.formatting, 2252 | b.hover, 2253 | b.onTypeFormatting, 2254 | b.references, 2255 | b.rename, 2256 | b.synchronization); 2257 | } 2258 | 2259 | factory TextDocumentClientCapabilities.fromJson(Map params) => TextDocumentClientCapabilities._( 2260 | params.containsKey('codeAction') && params['codeAction'] != null 2261 | ? CodeActionCapabilities.fromJson((params['codeAction'] as Map)) 2262 | : null, 2263 | params.containsKey('codeLens') && params['codeLens'] != null 2264 | ? DynamicRegistrationCapability.fromJson((params['codeLens'] as Map)) 2265 | : null, 2266 | params.containsKey('completion') && params['completion'] != null 2267 | ? CompletionCapabilities.fromJson((params['completion'] as Map)) 2268 | : null, 2269 | params.containsKey('definition') && params['definition'] != null 2270 | ? DynamicRegistrationCapability.fromJson( 2271 | (params['definition'] as Map)) 2272 | : null, 2273 | params.containsKey('documentHighlight') && 2274 | params['documentHighlight'] != null 2275 | ? DynamicRegistrationCapability.fromJson( 2276 | (params['documentHighlight'] as Map)) 2277 | : null, 2278 | params.containsKey('documentLink') && params['documentLink'] != null 2279 | ? DynamicRegistrationCapability.fromJson( 2280 | (params['documentLink'] as Map)) 2281 | : null, 2282 | params.containsKey('documentSymbol') && params['documentSymbol'] != null 2283 | ? DynamicRegistrationCapability.fromJson( 2284 | (params['documentSymbol'] as Map)) 2285 | : null, 2286 | params.containsKey('formatting') && params['formatting'] != null 2287 | ? DynamicRegistrationCapability.fromJson( 2288 | (params['formatting'] as Map)) 2289 | : null, 2290 | params.containsKey('hover') && params['hover'] != null 2291 | ? HoverCapabilities.fromJson((params['hover'] as Map)) 2292 | : null, 2293 | params.containsKey('onTypeFormatting') && params['onTypeFormatting'] != null 2294 | ? DynamicRegistrationCapability.fromJson( 2295 | (params['onTypeFormatting'] as Map)) 2296 | : null, 2297 | params.containsKey('references') && params['references'] != null 2298 | ? DynamicRegistrationCapability.fromJson((params['references'] as Map)) 2299 | : null, 2300 | params.containsKey('rename') && params['rename'] != null ? DynamicRegistrationCapability.fromJson((params['rename'] as Map)) : null, 2301 | params.containsKey('synchronization') && params['synchronization'] != null ? SynchronizationCapabilities.fromJson((params['synchronization'] as Map)) : null); 2302 | 2303 | final CodeActionCapabilities codeAction; 2304 | 2305 | final DynamicRegistrationCapability codeLens; 2306 | 2307 | final CompletionCapabilities completion; 2308 | 2309 | final DynamicRegistrationCapability definition; 2310 | 2311 | final DynamicRegistrationCapability documentHighlight; 2312 | 2313 | final DynamicRegistrationCapability documentLink; 2314 | 2315 | final DynamicRegistrationCapability documentSymbol; 2316 | 2317 | final DynamicRegistrationCapability formatting; 2318 | 2319 | final HoverCapabilities hover; 2320 | 2321 | final DynamicRegistrationCapability onTypeFormatting; 2322 | 2323 | final DynamicRegistrationCapability references; 2324 | 2325 | final DynamicRegistrationCapability rename; 2326 | 2327 | final SynchronizationCapabilities synchronization; 2328 | 2329 | Map toJson() => { 2330 | 'codeAction': codeAction?.toJson(), 2331 | 'codeLens': codeLens?.toJson(), 2332 | 'completion': completion?.toJson(), 2333 | 'definition': definition?.toJson(), 2334 | 'documentHighlight': documentHighlight?.toJson(), 2335 | 'documentLink': documentLink?.toJson(), 2336 | 'documentSymbol': documentSymbol?.toJson(), 2337 | 'formatting': formatting?.toJson(), 2338 | 'hover': hover?.toJson(), 2339 | 'onTypeFormatting': onTypeFormatting?.toJson(), 2340 | 'references': references?.toJson(), 2341 | 'rename': rename?.toJson(), 2342 | 'synchronization': synchronization?.toJson() 2343 | }; 2344 | @override 2345 | int get hashCode { 2346 | var hash = 242077660; 2347 | hash = _hashCombine(hash, _deepHashCode(codeAction)); 2348 | hash = _hashCombine(hash, _deepHashCode(codeLens)); 2349 | hash = _hashCombine(hash, _deepHashCode(completion)); 2350 | hash = _hashCombine(hash, _deepHashCode(definition)); 2351 | hash = _hashCombine(hash, _deepHashCode(documentHighlight)); 2352 | hash = _hashCombine(hash, _deepHashCode(documentLink)); 2353 | hash = _hashCombine(hash, _deepHashCode(documentSymbol)); 2354 | hash = _hashCombine(hash, _deepHashCode(formatting)); 2355 | hash = _hashCombine(hash, _deepHashCode(hover)); 2356 | hash = _hashCombine(hash, _deepHashCode(onTypeFormatting)); 2357 | hash = _hashCombine(hash, _deepHashCode(references)); 2358 | hash = _hashCombine(hash, _deepHashCode(rename)); 2359 | hash = _hashCombine(hash, _deepHashCode(synchronization)); 2360 | return _hashComplete(hash); 2361 | } 2362 | 2363 | @override 2364 | bool operator ==(Object other) => 2365 | other is TextDocumentClientCapabilities && 2366 | codeAction == other.codeAction && 2367 | codeLens == other.codeLens && 2368 | completion == other.completion && 2369 | definition == other.definition && 2370 | documentHighlight == other.documentHighlight && 2371 | documentLink == other.documentLink && 2372 | documentSymbol == other.documentSymbol && 2373 | formatting == other.formatting && 2374 | hover == other.hover && 2375 | onTypeFormatting == other.onTypeFormatting && 2376 | references == other.references && 2377 | rename == other.rename && 2378 | synchronization == other.synchronization; 2379 | } 2380 | 2381 | class TextDocumentClientCapabilities$Builder { 2382 | TextDocumentClientCapabilities$Builder._(); 2383 | 2384 | CodeActionCapabilities codeAction; 2385 | 2386 | DynamicRegistrationCapability codeLens; 2387 | 2388 | CompletionCapabilities completion; 2389 | 2390 | DynamicRegistrationCapability definition; 2391 | 2392 | DynamicRegistrationCapability documentHighlight; 2393 | 2394 | DynamicRegistrationCapability documentLink; 2395 | 2396 | DynamicRegistrationCapability documentSymbol; 2397 | 2398 | DynamicRegistrationCapability formatting; 2399 | 2400 | HoverCapabilities hover; 2401 | 2402 | DynamicRegistrationCapability onTypeFormatting; 2403 | 2404 | DynamicRegistrationCapability references; 2405 | 2406 | DynamicRegistrationCapability rename; 2407 | 2408 | SynchronizationCapabilities synchronization; 2409 | } 2410 | 2411 | class TextDocumentContentChangeEvent { 2412 | TextDocumentContentChangeEvent._(this.range, this.rangeLength, this.text); 2413 | 2414 | factory TextDocumentContentChangeEvent( 2415 | void Function(TextDocumentContentChangeEvent$Builder) init) { 2416 | final b = TextDocumentContentChangeEvent$Builder._(); 2417 | init(b); 2418 | return TextDocumentContentChangeEvent._(b.range, b.rangeLength, b.text); 2419 | } 2420 | 2421 | factory TextDocumentContentChangeEvent.fromJson(Map params) => 2422 | TextDocumentContentChangeEvent._( 2423 | params.containsKey('range') && params['range'] != null 2424 | ? Range.fromJson((params['range'] as Map)) 2425 | : null, 2426 | params.containsKey('rangeLength') && params['rangeLength'] != null 2427 | ? (params['rangeLength'] as int) 2428 | : null, 2429 | params.containsKey('text') && params['text'] != null 2430 | ? (params['text'] as String) 2431 | : null); 2432 | 2433 | final Range range; 2434 | 2435 | final int rangeLength; 2436 | 2437 | final String text; 2438 | 2439 | Map toJson() => 2440 | {'range': range?.toJson(), 'rangeLength': rangeLength, 'text': text}; 2441 | @override 2442 | int get hashCode { 2443 | var hash = 180616113; 2444 | hash = _hashCombine(hash, _deepHashCode(range)); 2445 | hash = _hashCombine(hash, _deepHashCode(rangeLength)); 2446 | hash = _hashCombine(hash, _deepHashCode(text)); 2447 | return _hashComplete(hash); 2448 | } 2449 | 2450 | @override 2451 | bool operator ==(Object other) => 2452 | other is TextDocumentContentChangeEvent && 2453 | range == other.range && 2454 | rangeLength == other.rangeLength && 2455 | text == other.text; 2456 | } 2457 | 2458 | class TextDocumentContentChangeEvent$Builder { 2459 | TextDocumentContentChangeEvent$Builder._(); 2460 | 2461 | Range range; 2462 | 2463 | int rangeLength; 2464 | 2465 | String text; 2466 | } 2467 | 2468 | class TextDocumentIdentifier { 2469 | TextDocumentIdentifier._(this.uri); 2470 | 2471 | factory TextDocumentIdentifier( 2472 | void Function(TextDocumentIdentifier$Builder) init) { 2473 | final b = TextDocumentIdentifier$Builder._(); 2474 | init(b); 2475 | return TextDocumentIdentifier._(b.uri); 2476 | } 2477 | 2478 | factory TextDocumentIdentifier.fromJson(Map params) => 2479 | TextDocumentIdentifier._( 2480 | params.containsKey('uri') && params['uri'] != null 2481 | ? (params['uri'] as String) 2482 | : null); 2483 | 2484 | final String uri; 2485 | 2486 | Map toJson() => {'uri': uri}; 2487 | @override 2488 | int get hashCode { 2489 | var hash = 553241737; 2490 | hash = _hashCombine(hash, _deepHashCode(uri)); 2491 | return _hashComplete(hash); 2492 | } 2493 | 2494 | @override 2495 | bool operator ==(Object other) => 2496 | other is TextDocumentIdentifier && uri == other.uri; 2497 | } 2498 | 2499 | class TextDocumentIdentifier$Builder { 2500 | TextDocumentIdentifier$Builder._(); 2501 | 2502 | String uri; 2503 | } 2504 | 2505 | class TextDocumentItem { 2506 | TextDocumentItem._(this.languageId, this.text, this.uri, this.version); 2507 | 2508 | factory TextDocumentItem(void Function(TextDocumentItem$Builder) init) { 2509 | final b = TextDocumentItem$Builder._(); 2510 | init(b); 2511 | return TextDocumentItem._(b.languageId, b.text, b.uri, b.version); 2512 | } 2513 | 2514 | factory TextDocumentItem.fromJson(Map params) => TextDocumentItem._( 2515 | params.containsKey('languageId') && params['languageId'] != null 2516 | ? (params['languageId'] as String) 2517 | : null, 2518 | params.containsKey('text') && params['text'] != null 2519 | ? (params['text'] as String) 2520 | : null, 2521 | params.containsKey('uri') && params['uri'] != null 2522 | ? (params['uri'] as String) 2523 | : null, 2524 | params.containsKey('version') && params['version'] != null 2525 | ? (params['version'] as int) 2526 | : null); 2527 | 2528 | final String languageId; 2529 | 2530 | final String text; 2531 | 2532 | final String uri; 2533 | 2534 | final int version; 2535 | 2536 | Map toJson() => 2537 | {'languageId': languageId, 'text': text, 'uri': uri, 'version': version}; 2538 | @override 2539 | int get hashCode { 2540 | var hash = 448755309; 2541 | hash = _hashCombine(hash, _deepHashCode(languageId)); 2542 | hash = _hashCombine(hash, _deepHashCode(text)); 2543 | hash = _hashCombine(hash, _deepHashCode(uri)); 2544 | hash = _hashCombine(hash, _deepHashCode(version)); 2545 | return _hashComplete(hash); 2546 | } 2547 | 2548 | @override 2549 | bool operator ==(Object other) => 2550 | other is TextDocumentItem && 2551 | languageId == other.languageId && 2552 | text == other.text && 2553 | uri == other.uri && 2554 | version == other.version; 2555 | } 2556 | 2557 | class TextDocumentItem$Builder { 2558 | TextDocumentItem$Builder._(); 2559 | 2560 | String languageId; 2561 | 2562 | String text; 2563 | 2564 | String uri; 2565 | 2566 | int version; 2567 | } 2568 | 2569 | class TextDocumentSyncKind { 2570 | factory TextDocumentSyncKind.fromJson(int value) { 2571 | const values = { 2572 | 1: TextDocumentSyncKind.full, 2573 | 2: TextDocumentSyncKind.incremental, 2574 | 0: TextDocumentSyncKind.none 2575 | }; 2576 | return values[value]; 2577 | } 2578 | 2579 | const TextDocumentSyncKind._(this._value); 2580 | 2581 | static const full = TextDocumentSyncKind._(1); 2582 | 2583 | static const incremental = TextDocumentSyncKind._(2); 2584 | 2585 | static const none = TextDocumentSyncKind._(0); 2586 | 2587 | final int _value; 2588 | 2589 | int toJson() => _value; 2590 | } 2591 | 2592 | class TextDocumentSyncOptions { 2593 | TextDocumentSyncOptions._(this.change, this.openClose, this.save, 2594 | this.willSave, this.willSaveWaitUntil); 2595 | 2596 | factory TextDocumentSyncOptions( 2597 | void Function(TextDocumentSyncOptions$Builder) init) { 2598 | final b = TextDocumentSyncOptions$Builder._(); 2599 | init(b); 2600 | return TextDocumentSyncOptions._( 2601 | b.change, b.openClose, b.save, b.willSave, b.willSaveWaitUntil); 2602 | } 2603 | 2604 | factory TextDocumentSyncOptions.fromJson( 2605 | Map params) => 2606 | TextDocumentSyncOptions._( 2607 | params.containsKey('change') && params['change'] != null 2608 | ? TextDocumentSyncKind.fromJson((params['change'] as int)) 2609 | : null, 2610 | params.containsKey('openClose') && params['openClose'] != null 2611 | ? (params['openClose'] as bool) 2612 | : null, 2613 | params.containsKey('save') && params['save'] != null 2614 | ? SaveOptions.fromJson((params['save'] as Map)) 2615 | : null, 2616 | params.containsKey('willSave') && params['willSave'] != null 2617 | ? (params['willSave'] as bool) 2618 | : null, 2619 | params.containsKey('willSaveWaitUntil') && 2620 | params['willSaveWaitUntil'] != null 2621 | ? (params['willSaveWaitUntil'] as bool) 2622 | : null); 2623 | 2624 | final TextDocumentSyncKind change; 2625 | 2626 | final bool openClose; 2627 | 2628 | final SaveOptions save; 2629 | 2630 | final bool willSave; 2631 | 2632 | final bool willSaveWaitUntil; 2633 | 2634 | Map toJson() => { 2635 | 'change': change?.toJson(), 2636 | 'openClose': openClose, 2637 | 'save': save?.toJson(), 2638 | 'willSave': willSave, 2639 | 'willSaveWaitUntil': willSaveWaitUntil 2640 | }; 2641 | @override 2642 | int get hashCode { 2643 | var hash = 541969480; 2644 | hash = _hashCombine(hash, _deepHashCode(change)); 2645 | hash = _hashCombine(hash, _deepHashCode(openClose)); 2646 | hash = _hashCombine(hash, _deepHashCode(save)); 2647 | hash = _hashCombine(hash, _deepHashCode(willSave)); 2648 | hash = _hashCombine(hash, _deepHashCode(willSaveWaitUntil)); 2649 | return _hashComplete(hash); 2650 | } 2651 | 2652 | @override 2653 | bool operator ==(Object other) => 2654 | other is TextDocumentSyncOptions && 2655 | change == other.change && 2656 | openClose == other.openClose && 2657 | save == other.save && 2658 | willSave == other.willSave && 2659 | willSaveWaitUntil == other.willSaveWaitUntil; 2660 | } 2661 | 2662 | class TextDocumentSyncOptions$Builder { 2663 | TextDocumentSyncOptions$Builder._(); 2664 | 2665 | TextDocumentSyncKind change; 2666 | 2667 | bool openClose; 2668 | 2669 | SaveOptions save; 2670 | 2671 | bool willSave; 2672 | 2673 | bool willSaveWaitUntil; 2674 | } 2675 | 2676 | class TextEdit { 2677 | TextEdit._(this.newText, this.range); 2678 | 2679 | factory TextEdit(void Function(TextEdit$Builder) init) { 2680 | final b = TextEdit$Builder._(); 2681 | init(b); 2682 | return TextEdit._(b.newText, b.range); 2683 | } 2684 | 2685 | factory TextEdit.fromJson(Map params) => TextEdit._( 2686 | params.containsKey('newText') && params['newText'] != null 2687 | ? (params['newText'] as String) 2688 | : null, 2689 | params.containsKey('range') && params['range'] != null 2690 | ? Range.fromJson((params['range'] as Map)) 2691 | : null); 2692 | 2693 | final String newText; 2694 | 2695 | final Range range; 2696 | 2697 | Map toJson() => {'newText': newText, 'range': range?.toJson()}; 2698 | @override 2699 | int get hashCode { 2700 | var hash = 1034224162; 2701 | hash = _hashCombine(hash, _deepHashCode(newText)); 2702 | hash = _hashCombine(hash, _deepHashCode(range)); 2703 | return _hashComplete(hash); 2704 | } 2705 | 2706 | @override 2707 | bool operator ==(Object other) => 2708 | other is TextEdit && newText == other.newText && range == other.range; 2709 | } 2710 | 2711 | class TextEdit$Builder { 2712 | TextEdit$Builder._(); 2713 | 2714 | String newText; 2715 | 2716 | Range range; 2717 | } 2718 | 2719 | class VersionedTextDocumentIdentifier { 2720 | VersionedTextDocumentIdentifier._(this.uri, this.version); 2721 | 2722 | factory VersionedTextDocumentIdentifier( 2723 | void Function(VersionedTextDocumentIdentifier$Builder) init) { 2724 | final b = VersionedTextDocumentIdentifier$Builder._(); 2725 | init(b); 2726 | return VersionedTextDocumentIdentifier._(b.uri, b.version); 2727 | } 2728 | 2729 | factory VersionedTextDocumentIdentifier.fromJson(Map params) => 2730 | VersionedTextDocumentIdentifier._( 2731 | params.containsKey('uri') && params['uri'] != null 2732 | ? (params['uri'] as String) 2733 | : null, 2734 | params.containsKey('version') && params['version'] != null 2735 | ? (params['version'] as int) 2736 | : null); 2737 | 2738 | final String uri; 2739 | 2740 | final int version; 2741 | 2742 | Map toJson() => {'uri': uri, 'version': version}; 2743 | @override 2744 | int get hashCode { 2745 | var hash = 6046273; 2746 | hash = _hashCombine(hash, _deepHashCode(uri)); 2747 | hash = _hashCombine(hash, _deepHashCode(version)); 2748 | return _hashComplete(hash); 2749 | } 2750 | 2751 | @override 2752 | bool operator ==(Object other) => 2753 | other is VersionedTextDocumentIdentifier && 2754 | uri == other.uri && 2755 | version == other.version; 2756 | } 2757 | 2758 | class VersionedTextDocumentIdentifier$Builder { 2759 | VersionedTextDocumentIdentifier$Builder._(); 2760 | 2761 | String uri; 2762 | 2763 | int version; 2764 | } 2765 | 2766 | class WorkspaceClientCapabilities { 2767 | WorkspaceClientCapabilities._(this.applyEdit, this.didChangeConfiguration, 2768 | this.didChangeWatchedFiles, this.executeCommand, this.symbol); 2769 | 2770 | factory WorkspaceClientCapabilities( 2771 | void Function(WorkspaceClientCapabilities$Builder) init) { 2772 | final b = WorkspaceClientCapabilities$Builder._(); 2773 | init(b); 2774 | return WorkspaceClientCapabilities._(b.applyEdit, b.didChangeConfiguration, 2775 | b.didChangeWatchedFiles, b.executeCommand, b.symbol); 2776 | } 2777 | 2778 | factory WorkspaceClientCapabilities.fromJson( 2779 | Map params) => 2780 | WorkspaceClientCapabilities._( 2781 | params.containsKey('applyEdit') && params['applyEdit'] != null 2782 | ? (params['applyEdit'] as bool) 2783 | : null, 2784 | params.containsKey('didChangeConfiguration') && 2785 | params['didChangeConfiguration'] != null 2786 | ? DynamicRegistrationCapability.fromJson( 2787 | (params['didChangeConfiguration'] as Map)) 2788 | : null, 2789 | params.containsKey('didChangeWatchedFiles') && 2790 | params['didChangeWatchedFiles'] != null 2791 | ? DynamicRegistrationCapability.fromJson( 2792 | (params['didChangeWatchedFiles'] as Map)) 2793 | : null, 2794 | params.containsKey('executeCommand') && 2795 | params['executeCommand'] != null 2796 | ? DynamicRegistrationCapability.fromJson( 2797 | (params['executeCommand'] as Map)) 2798 | : null, 2799 | params.containsKey('symbol') && params['symbol'] != null 2800 | ? DynamicRegistrationCapability.fromJson( 2801 | (params['symbol'] as Map)) 2802 | : null); 2803 | 2804 | final bool applyEdit; 2805 | 2806 | final DynamicRegistrationCapability didChangeConfiguration; 2807 | 2808 | final DynamicRegistrationCapability didChangeWatchedFiles; 2809 | 2810 | final DynamicRegistrationCapability executeCommand; 2811 | 2812 | final DynamicRegistrationCapability symbol; 2813 | 2814 | Map toJson() => { 2815 | 'applyEdit': applyEdit, 2816 | 'didChangeConfiguration': didChangeConfiguration?.toJson(), 2817 | 'didChangeWatchedFiles': didChangeWatchedFiles?.toJson(), 2818 | 'executeCommand': executeCommand?.toJson(), 2819 | 'symbol': symbol?.toJson() 2820 | }; 2821 | @override 2822 | int get hashCode { 2823 | var hash = 1031534926; 2824 | hash = _hashCombine(hash, _deepHashCode(applyEdit)); 2825 | hash = _hashCombine(hash, _deepHashCode(didChangeConfiguration)); 2826 | hash = _hashCombine(hash, _deepHashCode(didChangeWatchedFiles)); 2827 | hash = _hashCombine(hash, _deepHashCode(executeCommand)); 2828 | hash = _hashCombine(hash, _deepHashCode(symbol)); 2829 | return _hashComplete(hash); 2830 | } 2831 | 2832 | @override 2833 | bool operator ==(Object other) => 2834 | other is WorkspaceClientCapabilities && 2835 | applyEdit == other.applyEdit && 2836 | didChangeConfiguration == other.didChangeConfiguration && 2837 | didChangeWatchedFiles == other.didChangeWatchedFiles && 2838 | executeCommand == other.executeCommand && 2839 | symbol == other.symbol; 2840 | } 2841 | 2842 | class WorkspaceClientCapabilities$Builder { 2843 | WorkspaceClientCapabilities$Builder._(); 2844 | 2845 | bool applyEdit; 2846 | 2847 | DynamicRegistrationCapability didChangeConfiguration; 2848 | 2849 | DynamicRegistrationCapability didChangeWatchedFiles; 2850 | 2851 | DynamicRegistrationCapability executeCommand; 2852 | 2853 | DynamicRegistrationCapability symbol; 2854 | } 2855 | 2856 | class WorkspaceEdit { 2857 | WorkspaceEdit._(this.changes); 2858 | 2859 | factory WorkspaceEdit(void Function(WorkspaceEdit$Builder) init) { 2860 | final b = WorkspaceEdit$Builder._(); 2861 | init(b); 2862 | return WorkspaceEdit._(b.changes); 2863 | } 2864 | 2865 | factory WorkspaceEdit.fromJson(Map params) => 2866 | WorkspaceEdit._(params.containsKey('changes') && params['changes'] != null 2867 | ? (params['changes'] as Map).map((k, v) => 2868 | MapEntry>( 2869 | (k as String), 2870 | (v as List) 2871 | .map((v) => TextEdit.fromJson((v as Map))) 2872 | .toList())) 2873 | : null); 2874 | 2875 | final Map> changes; 2876 | 2877 | Map toJson() => { 2878 | 'changes': changes?.map((k, v) => 2879 | MapEntry(k, v?.map((v) => v?.toJson())?.toList())) 2880 | }; 2881 | @override 2882 | int get hashCode { 2883 | var hash = 920194645; 2884 | hash = _hashCombine(hash, _deepHashCode(changes)); 2885 | return _hashComplete(hash); 2886 | } 2887 | 2888 | @override 2889 | bool operator ==(Object other) => 2890 | other is WorkspaceEdit && _deepEquals(changes, other.changes); 2891 | } 2892 | 2893 | class WorkspaceEdit$Builder { 2894 | WorkspaceEdit$Builder._(); 2895 | 2896 | Map> changes; 2897 | } 2898 | 2899 | int _hashCombine(int hash, int value) { 2900 | hash = 0x1fffffff & (hash + value); 2901 | hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); 2902 | return hash ^ (hash >> 6); 2903 | } 2904 | 2905 | int _hashComplete(int hash) { 2906 | hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); 2907 | hash = hash ^ (hash >> 11); 2908 | return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); 2909 | } 2910 | 2911 | int _deepHashCode(dynamic value) { 2912 | if (value is List) { 2913 | return value.map(_deepHashCode).reduce(_hashCombine); 2914 | } 2915 | if (value is Map) { 2916 | return (value.keys 2917 | .map((key) => _hashCombine(key.hashCode, _deepHashCode(value[key]))) 2918 | .toList(growable: false) 2919 | ..sort()) 2920 | .reduce(_hashCombine); 2921 | } 2922 | return value.hashCode; 2923 | } 2924 | 2925 | bool _deepEquals(dynamic left, dynamic right) { 2926 | if (left is List && right is List) { 2927 | final leftLength = left.length; 2928 | final rightLength = right.length; 2929 | if (leftLength != rightLength) return false; 2930 | for (var i = 0; i < leftLength; i++) { 2931 | if (!_deepEquals(left[i], right[i])) return false; 2932 | } 2933 | return true; 2934 | } 2935 | if (left is Map && right is Map) { 2936 | final leftLength = left.length; 2937 | final rightLength = right.length; 2938 | if (leftLength != rightLength) return false; 2939 | for (final key in left.keys) { 2940 | if (!_deepEquals(left[key], right[key])) return false; 2941 | } 2942 | return true; 2943 | } 2944 | return left == right; 2945 | } 2946 | --------------------------------------------------------------------------------