Update LSP spec to latest

Change-Id: I6f7ff3c6707f992aa618ad172e81857153b75795
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102360
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
index dc8817d..fb15b97 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
@@ -22,6 +22,9 @@
 const jsonEncoder = const JsonEncoder.withIndent('    ');
 
 class DartDiagnosticServer implements ToJsonable {
+  static const jsonHandler = const LspJsonHandler(
+      DartDiagnosticServer.canParse, DartDiagnosticServer.fromJson);
+
   DartDiagnosticServer(this.port) {
     if (port == null) {
       throw 'port is required but was not provided';
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
index 116d1e3..7706a53 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
@@ -84,36 +84,48 @@
   static const jsonHandler = const LspJsonHandler(
       ApplyWorkspaceEditResponse.canParse, ApplyWorkspaceEditResponse.fromJson);
 
-  ApplyWorkspaceEditResponse(this.applied) {
+  ApplyWorkspaceEditResponse(this.applied, this.failureReason) {
     if (applied == null) {
       throw 'applied is required but was not provided';
     }
   }
   static ApplyWorkspaceEditResponse fromJson(Map<String, dynamic> json) {
     final applied = json['applied'];
-    return new ApplyWorkspaceEditResponse(applied);
+    final failureReason = json['failureReason'];
+    return new ApplyWorkspaceEditResponse(applied, failureReason);
   }
 
   /// Indicates whether the edit was applied or not.
   final bool applied;
 
+  /// An optional textual description for why the edit was not applied. This may
+  /// be used may be used by the server for diagnostic logging or to provide a
+  /// suitable error for a request that triggered the edit.
+  final String failureReason;
+
   Map<String, dynamic> toJson() {
     Map<String, dynamic> __result = {};
     __result['applied'] =
         applied ?? (throw 'applied is required but was not set');
+    if (failureReason != null) {
+      __result['failureReason'] = failureReason;
+    }
     return __result;
   }
 
   static bool canParse(Object obj) {
     return obj is Map<String, dynamic> &&
         obj.containsKey('applied') &&
-        obj['applied'] is bool;
+        obj['applied'] is bool &&
+        (obj['failureReason'] == null || obj['failureReason'] is String);
   }
 
   @override
   bool operator ==(other) {
     if (other is ApplyWorkspaceEditResponse) {
-      return applied == other.applied && true;
+      return applied == other.applied &&
+          failureReason == other.failureReason &&
+          true;
     }
     return false;
   }
@@ -122,6 +134,7 @@
   int get hashCode {
     int hash = 0;
     hash = JenkinsSmiHash.combine(hash, applied.hashCode);
+    hash = JenkinsSmiHash.combine(hash, failureReason.hashCode);
     return JenkinsSmiHash.finish(hash);
   }
 
@@ -1536,7 +1549,7 @@
   /// will be ignored.
   final List<String> commitCharacters;
 
-  /// An data entry field that is preserved on a completion item between a
+  /// A data entry field that is preserved on a completion item between a
   /// completion and a completion resolve request.
   final dynamic data;
 
@@ -1572,7 +1585,8 @@
   final InsertTextFormat insertTextFormat;
 
   /// The kind of this completion item. Based of the kind an icon is chosen by
-  /// the editor.
+  /// the editor. The standardized set of available values is defined in
+  /// `CompletionItemKind`.
   final CompletionItemKind kind;
 
   /// The label of this completion item. By default also the text that is
@@ -1992,22 +2006,34 @@
       CompletionRegistrationOptions.canParse,
       CompletionRegistrationOptions.fromJson);
 
-  CompletionRegistrationOptions(
-      this.triggerCharacters, this.resolveProvider, this.documentSelector);
+  CompletionRegistrationOptions(this.triggerCharacters,
+      this.allCommitCharacters, this.resolveProvider, this.documentSelector);
   static CompletionRegistrationOptions fromJson(Map<String, dynamic> json) {
     final triggerCharacters = json['triggerCharacters']
         ?.map((item) => item)
         ?.cast<String>()
         ?.toList();
+    final allCommitCharacters = json['allCommitCharacters']
+        ?.map((item) => item)
+        ?.cast<String>()
+        ?.toList();
     final resolveProvider = json['resolveProvider'];
     final documentSelector = json['documentSelector']
         ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
         ?.cast<DocumentFilter>()
         ?.toList();
-    return new CompletionRegistrationOptions(
-        triggerCharacters, resolveProvider, documentSelector);
+    return new CompletionRegistrationOptions(triggerCharacters,
+        allCommitCharacters, resolveProvider, documentSelector);
   }
 
+  /// The list of all possible characters that commit a completion. This field
+  /// can be used if clients don't support individual commmit characters per
+  /// completion item. See
+  /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`
+  ///
+  /// Since 3.2.0
+  final List<String> allCommitCharacters;
+
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
   final List<DocumentFilter> documentSelector;
@@ -2033,6 +2059,9 @@
     if (triggerCharacters != null) {
       __result['triggerCharacters'] = triggerCharacters;
     }
+    if (allCommitCharacters != null) {
+      __result['allCommitCharacters'] = allCommitCharacters;
+    }
     if (resolveProvider != null) {
       __result['resolveProvider'] = resolveProvider;
     }
@@ -2045,6 +2074,10 @@
         (obj['triggerCharacters'] == null ||
             (obj['triggerCharacters'] is List &&
                 (obj['triggerCharacters'].every((item) => item is String)))) &&
+        (obj['allCommitCharacters'] == null ||
+            (obj['allCommitCharacters'] is List &&
+                (obj['allCommitCharacters']
+                    .every((item) => item is String)))) &&
         (obj['resolveProvider'] == null || obj['resolveProvider'] is bool) &&
         obj.containsKey('documentSelector') &&
         (obj['documentSelector'] == null ||
@@ -2058,6 +2091,8 @@
     if (other is CompletionRegistrationOptions) {
       return listEqual(triggerCharacters, other.triggerCharacters,
               (String a, String b) => a == b) &&
+          listEqual(allCommitCharacters, other.allCommitCharacters,
+              (String a, String b) => a == b) &&
           resolveProvider == other.resolveProvider &&
           documentSelector == other.documentSelector &&
           true;
@@ -2069,6 +2104,7 @@
   int get hashCode {
     int hash = 0;
     hash = JenkinsSmiHash.combine(hash, triggerCharacters.hashCode);
+    hash = JenkinsSmiHash.combine(hash, allCommitCharacters.hashCode);
     hash = JenkinsSmiHash.combine(hash, resolveProvider.hashCode);
     hash = JenkinsSmiHash.combine(hash, documentSelector.hashCode);
     return JenkinsSmiHash.finish(hash);
@@ -2889,8 +2925,7 @@
   String toString() => jsonEncoder.convert(toJson());
 }
 
-/// Describe options to be used when registering for text document change
-/// events.
+/// Describe options to be used when registering for file system change events.
 class DidChangeWatchedFilesRegistrationOptions implements ToJsonable {
   static const jsonHandler = const LspJsonHandler(
       DidChangeWatchedFilesRegistrationOptions.canParse,
@@ -7077,7 +7112,8 @@
   final Either2<num, String> id;
   final String jsonrpc;
 
-  /// The result of a request. This can be omitted in the case of an error.
+  /// The result of a request. This member is REQUIRED on success. This member
+  /// MUST NOT exist if there was an error invoking the method.
   final dynamic result;
 
   Map<String, dynamic> toJson() {
@@ -7202,6 +7238,7 @@
       this.documentLinkProvider,
       this.colorProvider,
       this.foldingRangeProvider,
+      this.declarationProvider,
       this.executeCommandProvider,
       this.workspace,
       this.experimental);
@@ -7226,12 +7263,8 @@
         ? SignatureHelpOptions.fromJson(json['signatureHelpProvider'])
         : null;
     final definitionProvider = json['definitionProvider'];
-    final typeDefinitionProvider = json['typeDefinitionProvider'] is bool
-        ? new Either2<bool, dynamic>.t1(json['typeDefinitionProvider'])
-        : (new Either2<bool, dynamic>.t2(json['typeDefinitionProvider']));
-    final implementationProvider = json['implementationProvider'] is bool
-        ? new Either2<bool, dynamic>.t1(json['implementationProvider'])
-        : (new Either2<bool, dynamic>.t2(json['implementationProvider']));
+    final typeDefinitionProvider = json['typeDefinitionProvider'];
+    final implementationProvider = json['implementationProvider'];
     final referencesProvider = json['referencesProvider'];
     final documentHighlightProvider = json['documentHighlightProvider'];
     final documentSymbolProvider = json['documentSymbolProvider'];
@@ -7269,27 +7302,9 @@
     final documentLinkProvider = json['documentLinkProvider'] != null
         ? DocumentLinkOptions.fromJson(json['documentLinkProvider'])
         : null;
-    final colorProvider = json['colorProvider'] is bool
-        ? new Either3<bool, ColorProviderOptions, dynamic>.t1(
-            json['colorProvider'])
-        : (ColorProviderOptions.canParse(json['colorProvider'])
-            ? new Either3<bool, ColorProviderOptions, dynamic>.t2(
-                json['colorProvider'] != null
-                    ? ColorProviderOptions.fromJson(json['colorProvider'])
-                    : null)
-            : (new Either3<bool, ColorProviderOptions, dynamic>.t3(
-                json['colorProvider'])));
-    final foldingRangeProvider = json['foldingRangeProvider'] is bool
-        ? new Either3<bool, FoldingRangeProviderOptions, dynamic>.t1(
-            json['foldingRangeProvider'])
-        : (FoldingRangeProviderOptions.canParse(json['foldingRangeProvider'])
-            ? new Either3<bool, FoldingRangeProviderOptions, dynamic>.t2(
-                json['foldingRangeProvider'] != null
-                    ? FoldingRangeProviderOptions.fromJson(
-                        json['foldingRangeProvider'])
-                    : null)
-            : (new Either3<bool, FoldingRangeProviderOptions, dynamic>.t3(
-                json['foldingRangeProvider'])));
+    final colorProvider = json['colorProvider'];
+    final foldingRangeProvider = json['foldingRangeProvider'];
+    final declarationProvider = json['declarationProvider'];
     final executeCommandProvider = json['executeCommandProvider'] != null
         ? ExecuteCommandOptions.fromJson(json['executeCommandProvider'])
         : null;
@@ -7318,6 +7333,7 @@
         documentLinkProvider,
         colorProvider,
         foldingRangeProvider,
+        declarationProvider,
         executeCommandProvider,
         workspace,
         experimental);
@@ -7334,11 +7350,16 @@
   /// The server provides color provider support.
   ///
   /// Since 3.6.0
-  final Either3<bool, ColorProviderOptions, dynamic> colorProvider;
+  final dynamic colorProvider;
 
   /// The server provides completion support.
   final CompletionOptions completionProvider;
 
+  /// The server provides go to declaration support.
+  ///
+  /// Since 3.14.0
+  final dynamic declarationProvider;
+
   /// The server provides goto definition support.
   final bool definitionProvider;
 
@@ -7369,8 +7390,7 @@
   /// The server provides folding provider support.
   ///
   /// Since 3.10.0
-  final Either3<bool, FoldingRangeProviderOptions, dynamic>
-      foldingRangeProvider;
+  final dynamic foldingRangeProvider;
 
   /// The server provides hover support.
   final bool hoverProvider;
@@ -7378,7 +7398,7 @@
   /// The server provides Goto Implementation support.
   ///
   /// Since 3.6.0
-  final Either2<bool, dynamic> implementationProvider;
+  final dynamic implementationProvider;
 
   /// The server provides find references support.
   final bool referencesProvider;
@@ -7400,7 +7420,7 @@
   /// The server provides Goto Type Definition support.
   ///
   /// Since 3.6.0
-  final Either2<bool, dynamic> typeDefinitionProvider;
+  final dynamic typeDefinitionProvider;
 
   /// Workspace specific server capabilities
   final ServerCapabilitiesWorkspace workspace;
@@ -7472,6 +7492,9 @@
     if (foldingRangeProvider != null) {
       __result['foldingRangeProvider'] = foldingRangeProvider;
     }
+    if (declarationProvider != null) {
+      __result['declarationProvider'] = declarationProvider;
+    }
     if (executeCommandProvider != null) {
       __result['executeCommandProvider'] = executeCommandProvider;
     }
@@ -7496,10 +7519,8 @@
             SignatureHelpOptions.canParse(obj['signatureHelpProvider'])) &&
         (obj['definitionProvider'] == null ||
             obj['definitionProvider'] is bool) &&
-        (obj['typeDefinitionProvider'] == null ||
-            (obj['typeDefinitionProvider'] is bool || true)) &&
-        (obj['implementationProvider'] == null ||
-            (obj['implementationProvider'] is bool || true)) &&
+        (obj['typeDefinitionProvider'] == null || true) &&
+        (obj['implementationProvider'] == null || true) &&
         (obj['referencesProvider'] == null ||
             obj['referencesProvider'] is bool) &&
         (obj['documentHighlightProvider'] == null ||
@@ -7525,15 +7546,9 @@
                 RenameOptions.canParse(obj['renameProvider']))) &&
         (obj['documentLinkProvider'] == null ||
             DocumentLinkOptions.canParse(obj['documentLinkProvider'])) &&
-        (obj['colorProvider'] == null ||
-            (obj['colorProvider'] is bool ||
-                ColorProviderOptions.canParse(obj['colorProvider']) ||
-                true)) &&
-        (obj['foldingRangeProvider'] == null ||
-            (obj['foldingRangeProvider'] is bool ||
-                FoldingRangeProviderOptions.canParse(
-                    obj['foldingRangeProvider']) ||
-                true)) &&
+        (obj['colorProvider'] == null || true) &&
+        (obj['foldingRangeProvider'] == null || true) &&
+        (obj['declarationProvider'] == null || true) &&
         (obj['executeCommandProvider'] == null ||
             ExecuteCommandOptions.canParse(obj['executeCommandProvider'])) &&
         (obj['workspace'] == null ||
@@ -7566,6 +7581,7 @@
           documentLinkProvider == other.documentLinkProvider &&
           colorProvider == other.colorProvider &&
           foldingRangeProvider == other.foldingRangeProvider &&
+          declarationProvider == other.declarationProvider &&
           executeCommandProvider == other.executeCommandProvider &&
           workspace == other.workspace &&
           experimental == other.experimental &&
@@ -7599,6 +7615,7 @@
     hash = JenkinsSmiHash.combine(hash, documentLinkProvider.hashCode);
     hash = JenkinsSmiHash.combine(hash, colorProvider.hashCode);
     hash = JenkinsSmiHash.combine(hash, foldingRangeProvider.hashCode);
+    hash = JenkinsSmiHash.combine(hash, declarationProvider.hashCode);
     hash = JenkinsSmiHash.combine(hash, executeCommandProvider.hashCode);
     hash = JenkinsSmiHash.combine(hash, workspace.hashCode);
     hash = JenkinsSmiHash.combine(hash, experimental.hashCode);
@@ -11205,16 +11222,20 @@
   /// TextDocumentSyncKind.None.
   final TextDocumentSyncKind change;
 
-  /// Open and close notifications are sent to the server.
+  /// Open and close notifications are sent to the server. If omitted open close
+  /// notification should not be sent.
   final bool openClose;
 
-  /// Save notifications are sent to the server.
+  /// If present save notifications are sent to the server. If omitted the
+  /// notification should not be sent.
   final SaveOptions save;
 
-  /// Will save notifications are sent to the server.
+  /// If present will save notifications are sent to the server. If omitted the
+  /// notification should not be sent.
   final bool willSave;
 
-  /// Will save wait until requests are sent to the server.
+  /// If present will save wait until requests are sent to the server. If
+  /// omitted the request should not be sent.
   final bool willSaveWaitUntil;
 
   Map<String, dynamic> toJson() {
@@ -12258,7 +12279,8 @@
     return new WorkspaceFolder(uri, name);
   }
 
-  /// The name of the workspace folder. Defaults to the uri's basename.
+  /// The name of the workspace folder. Used to refer to this workspace folder
+  /// in the user interface.
   final String name;
 
   /// The associated URI for this workspace folder.
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart
index 64c5877..46deabd 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart
@@ -63,7 +63,8 @@
     } else {
       return error(
         ServerErrorCodes.ClientFailedToApplyEdit,
-        'Client failed to apply workspace edit for $commandName',
+        'Client failed to apply workspace edit for $commandName '
+        '(reason: ${editResponseResult.failureReason ?? 'Client did not provide a reason'})',
         workspaceEdit.toString(),
       );
     }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
index 88423de..adec190 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
@@ -120,8 +120,9 @@
             : Either2<bool, RenameOptions>.t1(true),
         null,
         null,
-        Either3<bool, FoldingRangeProviderOptions, dynamic>.t1(true),
+        true, // foldingRangeProvider
         new ExecuteCommandOptions(Commands.serverSupportedCommands),
+        null, // declarationProvider
         new ServerCapabilitiesWorkspace(
             new ServerCapabilitiesWorkspaceFolders(true, true)),
         null);
diff --git a/pkg/analysis_server/test/lsp/code_actions_source_test.dart b/pkg/analysis_server/test/lsp/code_actions_source_test.dart
index a2ead0f..22c11ab 100644
--- a/pkg/analysis_server/test/lsp/code_actions_source_test.dart
+++ b/pkg/analysis_server/test/lsp/code_actions_source_test.dart
@@ -59,7 +59,7 @@
         // When the server sends the edit back, just keep a copy and say we
         // applied successfully (it'll be verified below).
         editParams = edit;
-        return new ApplyWorkspaceEditResponse(true);
+        return new ApplyWorkspaceEditResponse(true, null);
       },
     );
     // Successful edits return an empty success() response.
@@ -116,7 +116,7 @@
         // When the server sends the edit back, just keep a copy and say we
         // applied successfully (it'll be verified below).
         editParams = edit;
-        return new ApplyWorkspaceEditResponse(true);
+        return new ApplyWorkspaceEditResponse(true, null);
       },
     );
     // Successful edits return an empty success() response.
@@ -257,7 +257,7 @@
         // When the server sends the edit back, just keep a copy and say we
         // applied successfully (it'll be verified below).
         editParams = edit;
-        return new ApplyWorkspaceEditResponse(true);
+        return new ApplyWorkspaceEditResponse(true, null);
       },
     );
     // Successful edits return an empty success() response.
@@ -307,7 +307,7 @@
         // When the server sends the edit back, just keep a copy and say we
         // applied successfully (it'll be verified below).
         editParams = edit;
-        return new ApplyWorkspaceEditResponse(true);
+        return new ApplyWorkspaceEditResponse(true, null);
       },
     );
     // Successful edits return an empty success() response.
@@ -377,7 +377,8 @@
       // Claim that we failed tpo apply the edits. This is what the client
       // would do if the edits provided were for an old version of the
       // document.
-      handler: (edit) => new ApplyWorkspaceEditResponse(false),
+      handler: (edit) =>
+          new ApplyWorkspaceEditResponse(false, 'Document changed'),
     );
 
     // Ensure the request returned an error (error repsonses are thrown by
diff --git a/pkg/analysis_server/test/tool/lsp_spec/typescript_test.dart b/pkg/analysis_server/test/tool/lsp_spec/typescript_test.dart
index f100429..e3e874e 100644
--- a/pkg/analysis_server/test/tool/lsp_spec/typescript_test.dart
+++ b/pkg/analysis_server/test/tool/lsp_spec/typescript_test.dart
@@ -125,7 +125,7 @@
 	/**
 	 * The method's params.
 	 */
-	params?: Array<any> | object;
+	params?: Array<any> | string;
 }
     ''';
       final List<AstNode> output = parseString(input);
@@ -143,7 +143,7 @@
       UnionType union = field.type;
       expect(union.types, hasLength(2));
       expect(union.types[0], isArrayOf(isSimpleType('any')));
-      expect(union.types[1], isSimpleType('object'));
+      expect(union.types[1], isSimpleType('string'));
     });
 
     test('parses an interface with a map into a MapType', () {
@@ -304,5 +304,22 @@
       expect(union.types[0], isSimpleType('string'));
       expect(union.types[1], isArrayOf(isSimpleType('number')));
     });
+
+    test('parses an union including Object into a single type', () {
+      final String input = '''
+interface SomeInformation {
+	label: string | object;
+}
+    ''';
+      final List<AstNode> output = parseString(input);
+      expect(output, hasLength(1));
+      expect(output[0], const TypeMatcher<Interface>());
+      final Interface interface = output[0];
+      expect(interface.members, hasLength(1));
+      final Field field = interface.members.first;
+      expect(field, const TypeMatcher<Field>());
+      expect(field.name, equals('label'));
+      expect(field.type, isSimpleType('object'));
+    });
   });
 }
diff --git a/pkg/analysis_server/tool/lsp_spec/lsp_specification.md b/pkg/analysis_server/tool/lsp_spec/lsp_specification.md
index 2bb235d..38c8f2e 100644
--- a/pkg/analysis_server/tool/lsp_spec/lsp_specification.md
+++ b/pkg/analysis_server/tool/lsp_spec/lsp_specification.md
@@ -7,7 +7,6 @@
 download the latest version of the specification before regenerating the
 code, run the same script with an argument of "--download".
 
-
 ---
 
 Copyright (c) Microsoft Corporation.
@@ -129,10 +128,10 @@
 	id: number | string | null;
 
 	/**
-	 * The result of a request. This can be omitted in
-	 * the case of an error.
+	 * The result of a request. This member is REQUIRED on success.
+	 * This member MUST NOT exist if there was an error invoking the method.
 	 */
-	result?: any;
+	result?: string | number | boolean | object | null;
 
 	/**
 	 * The error object in case a request fails.
@@ -260,7 +259,7 @@
 
 #### Position
 
-Position in a text document expressed as zero-based line and zero-based character offset. A position is between two characters like an 'insert' cursor in a editor.
+Position in a text document expressed as zero-based line and zero-based character offset. A position is between two characters like an 'insert' cursor in a editor. Special values like for example `-1` to denote the end of a line are not supported.
 
 ```typescript
 interface Position {
@@ -608,7 +607,7 @@
 
 #### WorkspaceEdit
 
-A workspace edit represents changes to many resources managed in the workspace. The edit should either provide `changes` or `documentChanges`. If the client can handle versioned document edits and if `documentChange`s are present, the latter are preferred over `changes`.
+A workspace edit represents changes to many resources managed in the workspace. The edit should either provide `changes` or `documentChanges`. If the client can handle versioned document edits and if `documentChanges` are present, the latter are preferred over `changes`.
 
 ```typescript
 export interface WorkspaceEdit {
@@ -678,6 +677,7 @@
 
 Language | Identifier
 -------- | ----------
+ABAP | `abap`
 Windows Bat | `bat`
 BibTeX | `bibtex`
 Clojure | `clojure`
@@ -698,6 +698,7 @@
 Ini | `ini`
 Java | `java`
 JavaScript | `javascript`
+JavaScript React | `javascriptreact`
 JSON | `json`
 LaTeX | `latex`
 Less | `less`
@@ -706,7 +707,8 @@
 Markdown | `markdown`
 Objective-C | `objective-c`
 Objective-C++ | `objective-cpp`
-Perl | `perl` and `perl6`
+Perl | `perl`
+Perl 6 | `perl6`
 PHP | `php`
 Powershell | `powershell`
 Pug | `jade`
@@ -715,13 +717,14 @@
 Razor (cshtml) | `razor`
 Ruby | `ruby`
 Rust | `rust`
-Sass | `scss` (syntax using curly brackets), `sass` (indented syntax)
+SCSS | `scss` (syntax using curly brackets), `sass` (indented syntax)
 Scala | `scala`
 ShaderLab | `shaderlab`
 Shell Script (Bash) | `shellscript`
 SQL | `sql`
 Swift | `swift`
 TypeScript | `typescript`
+TypeScript React| `typescriptreact`
 TeX | `tex`
 Visual Basic | `vb`
 XML | `xml`
@@ -1760,7 +1763,8 @@
 
 export interface TextDocumentSyncOptions {
 	/**
-	 * Open and close notifications are sent to the server.
+	 * Open and close notifications are sent to the server. If omitted open close notification should not
+	 * be sent.
 	 */
 	openClose?: boolean;
 	/**
@@ -1769,15 +1773,18 @@
 	 */
 	change?: number;
 	/**
-	 * Will save notifications are sent to the server.
+	 * If present will save notifications are sent to the server. If omitted the notification should not be
+	 * sent.
 	 */
 	willSave?: boolean;
 	/**
-	 * Will save wait until requests are sent to the server.
+	 * If present will save wait until requests are sent to the server. If omitted the request should not be
+	 * sent.
 	 */
 	willSaveWaitUntil?: boolean;
 	/**
-	 * Save notifications are sent to the server.
+	 * If present save notifications are sent to the server. If omitted the notification should not be
+	 * sent.
 	 */
 	save?: SaveOptions;
 }
@@ -1888,6 +1895,12 @@
 	 */
 	foldingRangeProvider?: boolean | FoldingRangeProviderOptions | (FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions);
 	/**
+	 * The server provides go to declaration support.
+	 *
+	 * Since 3.14.0
+	 */
+	declarationProvider?: boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions);
+	/**
 	 * The server provides execute command support.
 	 */
 	executeCommandProvider?: ExecuteCommandOptions;
@@ -1939,7 +1952,7 @@
 
 #### <a href="#shutdown" name="shutdown" class="anchor">Shutdown Request (:leftwards_arrow_with_hook:)</a>
 
-The shutdown request is sent from the client to the server. It asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client). There is a separate exit notification that asks the server to exit.
+The shutdown request is sent from the client to the server. It asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client). There is a separate exit notification that asks the server to exit. Clients must not sent any notifications other than `exit` or requests to a server to which they have sent a shutdown requests. If a server receives requests after a shutdown request those requests should be errored with `InvalidRequest`.
 
 _Request_:
 * method: 'shutdown'
@@ -2229,8 +2242,8 @@
 	uri: string;
 
 	/**
-	 * The name of the workspace folder. Defaults to the
-	 * uri's basename.
+	 * The name of the workspace folder. Used to refer to this
+	 * workspace folder in the user interface.
 	 */
 	name: string;
 }
@@ -2395,7 +2408,7 @@
 
 ```typescript
 /**
- * Describe options to be used when registering for text document change events.
+ * Describe options to be used when registering for file system change events.
  */
 export interface DidChangeWatchedFilesRegistrationOptions {
 	/**
@@ -2549,6 +2562,14 @@
 	 * Indicates whether the edit was applied or not.
 	 */
 	applied: boolean;
+
+	/**
+	 * An optional textual description for why the edit was not applied.
+	 * This may be used may be used by the server for diagnostic
+	 * logging or to provide a suitable error for a request that
+	 * triggered the edit.
+	 */
+	failureReason?: string;
 }
 ```
 * error: code and message set in case an exception happens during the request.
@@ -2898,7 +2919,8 @@
 
 	/**
 	 * The kind of this completion item. Based of the kind
-	 * an icon is chosen by the editor.
+	 * an icon is chosen by the editor. The standardized set
+	 * of available values is defined in `CompletionItemKind`.
 	 */
 	kind?: number;
 
@@ -2995,7 +3017,7 @@
 	command?: Command;
 
 	/**
-	 * An data entry field that is preserved on a completion item between
+	 * A data entry field that is preserved on a completion item between
 	 * a completion and a completion resolve request.
 	 */
 	data?: any
@@ -3051,6 +3073,15 @@
 	triggerCharacters?: string[];
 
 	/**
+	 * The list of all possible characters that commit a completion. This field can be used
+	 * if clients don't support individual commmit characters per completion item. See
+	 * `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`
+	 *
+   * Since 3.2.0
+	 */
+	allCommitCharacters?: string[];
+
+	/**
 	 * The server provides support to resolve additional
 	 * information for a completion item.
 	 */
diff --git a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
index 2412309..3b06fd1 100644
--- a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
+++ b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
@@ -12,7 +12,8 @@
 
 final _validIdentifierCharacters = RegExp('[a-zA-Z0-9_]');
 
-bool isAnyType(TypeBase t) => t is Type && t.name == 'any';
+bool isAnyType(TypeBase t) =>
+    t is Type && (t.name == 'any' || t.name == 'object');
 
 bool isNullType(TypeBase t) => t is Type && t.name == 'null';
 
@@ -596,6 +597,15 @@
     final uniqueTypes = new Map.fromEntries(
       types.map((t) => new MapEntry(t.dartTypeWithTypeArgs, t)),
     ).values.toList();
+
+    // If our list includes something that maps to dynamic as well as other
+    // types, we should just treat the whole thing as dynamic as we get no value
+    // typing Either4<bool, String, num, dynamic> but it becomes much more
+    // difficult to use.
+    if (uniqueTypes.any(isAnyType)) {
+      return [uniqueTypes.firstWhere(isAnyType)];
+    }
+
     return uniqueTypes;
   }