From b6bd7172106647a5bfe53106d77cb6ef5a9de4d7 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 15:04:02 -0800 Subject: [PATCH 01/16] Generate init options --- internal/fourslash/fourslash.go | 10 +++---- internal/lsp/lsproto/_generate/generate.mts | 33 +++++++++++++++++++++ internal/lsp/lsproto/lsp_generated.go | 10 +++++-- internal/lsp/server.go | 9 ++---- 4 files changed, 49 insertions(+), 13 deletions(-) diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index cd4c486559..6529cacab8 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -252,14 +252,14 @@ func (f *FourslashTest) nextID() int32 { } func (f *FourslashTest) initialize(t *testing.T, capabilities *lsproto.ClientCapabilities) { - initOptions := map[string]any{ - // Hack: disable push diagnostics entirely, since the fourslash runner does not - // yet gracefully handle non-request messages. - "disablePushDiagnostics": true, + // Hack: disable push diagnostics entirely, since the fourslash runner does not + // yet gracefully handle non-request messages. + initOptions := &lsproto.InitializationOptions{ + DisablePushDiagnostics: ptrTo(true), } params := &lsproto.InitializeParams{ Locale: ptrTo("en-US"), - InitializationOptions: ptrTo[any](initOptions), + InitializationOptions: initOptions, } params.Capabilities = getCapabilitiesWithDefaults(capabilities) // !!! check for errors? diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 538e797ada..900dcc5c20 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -29,6 +29,22 @@ if (!fs.existsSync(metaModelPath)) { const model: MetaModel = JSON.parse(fs.readFileSync(metaModelPath, "utf-8")); +// Custom structures to add to the model +const customStructures: Structure[] = [ + { + name: "InitializationOptions", + properties: [ + { + name: "disablePushDiagnostics", + type: { kind: "base", name: "boolean" }, + optional: true, + documentation: "DisablePushDiagnostics disables automatic pushing of diagnostics to the client.", + }, + ], + documentation: "InitializationOptions contains user-provided initialization options.", + }, +]; + // Preprocess the model to inline extends/mixins contents function preprocessModel() { const structureMap = new Map(); @@ -76,6 +92,23 @@ function preprocessModel() { } } +// Add custom structures to the model +model.structures.unshift(...customStructures); + +// Patch the model to use custom types +function patchModel() { + for (const structure of model.structures) { + for (const prop of structure.properties) { + // Replace initializationOptions type with custom InitializationOptions + if (prop.name === "initializationOptions" && prop.type.kind === "reference" && prop.type.name === "LSPAny") { + prop.type = { kind: "reference", name: "InitializationOptions" }; + } + } + } +} + +patchModel(); + // Preprocess the model before proceeding preprocessModel(); diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 20121db109..53f9a21e13 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -13,6 +13,12 @@ import ( // Structures +// InitializationOptions contains user-provided initialization options. +type InitializationOptions struct { + // DisablePushDiagnostics disables automatic pushing of diagnostics to the client. + DisablePushDiagnostics *bool `json:"disablePushDiagnostics,omitzero"` +} + type ImplementationParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` @@ -5401,7 +5407,7 @@ type InitializeParams struct { Capabilities *ClientCapabilities `json:"capabilities"` // User provided initialization options. - InitializationOptions *any `json:"initializationOptions,omitzero"` + InitializationOptions *InitializationOptions `json:"initializationOptions,omitzero"` // The initial trace setting. If omitted trace is disabled ('off'). Trace *TraceValue `json:"trace,omitzero"` @@ -13480,7 +13486,7 @@ type InitializeParamsBase struct { Capabilities *ClientCapabilities `json:"capabilities"` // User provided initialization options. - InitializationOptions *any `json:"initializationOptions,omitzero"` + InitializationOptions *InitializationOptions `json:"initializationOptions,omitzero"` // The initial trace setting. If omitted trace is disabled ('off'). Trace *TraceValue `json:"trace,omitzero"` diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 2c3eafa3a7..2d63e51128 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -724,12 +724,9 @@ func (s *Server) handleInitialized(ctx context.Context, params *lsproto.Initiali } var disablePushDiagnostics bool - if s.initializeParams != nil && s.initializeParams.InitializationOptions != nil && *s.initializeParams.InitializationOptions != nil { - // Check for disablePushDiagnostics option - if initOpts, ok := (*s.initializeParams.InitializationOptions).(map[string]any); ok { - if disable, ok := initOpts["disablePushDiagnostics"].(bool); ok { - disablePushDiagnostics = disable - } + if s.initializeParams != nil && s.initializeParams.InitializationOptions != nil { + if s.initializeParams.InitializationOptions.DisablePushDiagnostics != nil { + disablePushDiagnostics = *s.initializeParams.InitializationOptions.DisablePushDiagnostics } } From 8c9eeeca618ef0e02971316eda6ad68c3c59d661 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:32:03 -0800 Subject: [PATCH 02/16] Fully static data fields --- .../fourslash/_scripts/convertFourslash.mts | 12 +- internal/fourslash/fourslash.go | 23 +- ...portCompletionAmbientMergedModule1_test.go | 5 +- ...CompletionExportEqualsWithDefault1_test.go | 5 +- ...tCompletionExportListAugmentation1_test.go | 5 +- ...tCompletionExportListAugmentation2_test.go | 5 +- ...tCompletionExportListAugmentation3_test.go | 5 +- ...tCompletionExportListAugmentation4_test.go | 5 +- .../autoImportFileExcludePatterns3_test.go | 12 +- .../tests/gen/autoImportModuleNone2_test.go | 6 +- .../autoImportPathsAliasesAndBarrels_test.go | 18 +- .../tests/gen/autoImportProvider6_test.go | 6 +- .../gen/autoImportProvider_exportMap1_test.go | 12 +- .../gen/autoImportProvider_exportMap2_test.go | 6 +- .../gen/autoImportProvider_exportMap3_test.go | 6 +- .../gen/autoImportProvider_exportMap4_test.go | 6 +- .../gen/autoImportProvider_exportMap5_test.go | 12 +- .../gen/autoImportProvider_exportMap6_test.go | 12 +- .../gen/autoImportProvider_exportMap7_test.go | 12 +- .../gen/autoImportProvider_exportMap8_test.go | 12 +- .../gen/autoImportProvider_exportMap9_test.go | 6 +- ...oImportProvider_globalTypingsCache_test.go | 6 +- ...vider_namespaceSameNameAsIntrinsic_test.go | 6 +- ...utoImportProvider_wildcardExports1_test.go | 30 +- ...utoImportProvider_wildcardExports2_test.go | 6 +- ...utoImportProvider_wildcardExports3_test.go | 6 +- ...utoImportReExportFromAmbientModule_test.go | 14 +- .../autoImportSameNameDefaultExported_test.go | 12 +- .../autoImportSortCaseSensitivity2_test.go | 6 +- .../gen/autoImportTypeOnlyPreferred1_test.go | 6 +- .../gen/autoImportVerbatimTypeOnly1_test.go | 6 +- .../gen/completionForObjectProperty_test.go | 36 +- ...PropertyShorthandForObjectLiteral5_test.go | 6 +- .../gen/completionsImportBaseUrl_test.go | 6 +- ...mpletionsImportDefaultExportCrash2_test.go | 12 +- .../completionsImportPathsConflict_test.go | 8 +- .../gen/completionsImportTypeKeyword_test.go | 6 +- .../tests/gen/completionsImport_46332_test.go | 8 +- .../gen/completionsImport_ambient_test.go | 12 +- .../completionsImport_augmentation_test.go | 12 +- ...etionsImport_compilerOptionsModule_test.go | 6 +- ...ionsImport_defaultAndNamedConflict_test.go | 14 +- ...letionsImport_defaultFalsePositive_test.go | 6 +- ...nsImport_default_addToNamedImports_test.go | 6 +- ...mport_default_addToNamespaceImport_test.go | 6 +- ...t_default_alreadyExistedWithRename_test.go | 6 +- ...ompletionsImport_default_anonymous_test.go | 6 +- ...nsImport_default_didNotExistBefore_test.go | 6 +- ...rt_default_exportDefaultIdentifier_test.go | 6 +- ...ort_default_fromMergedDeclarations_test.go | 6 +- ...completionsImport_default_reExport_test.go | 12 +- ...mpletionsImport_default_symbolName_test.go | 6 +- ...sImport_details_withMisspelledName_test.go | 4 +- ...atePackages_scopedTypesAndNotTypes_test.go | 12 +- ...port_duplicatePackages_scopedTypes_test.go | 12 +- ...onsImport_duplicatePackages_scoped_test.go | 12 +- ...duplicatePackages_typesAndNotTypes_test.go | 6 +- ...ionsImport_duplicatePackages_types_test.go | 12 +- ..._exportEqualsNamespace_noDuplicate_test.go | 6 +- ...tionsImport_exportEquals_anonymous_test.go | 6 +- .../completionsImport_exportEquals_test.go | 12 +- ...ilteredByInvalidPackageJson_direct_test.go | 12 +- ...lteredByPackageJson_@typesImplicit_test.go | 6 +- ...t_filteredByPackageJson_@typesOnly_test.go | 6 +- ...port_filteredByPackageJson_ambient_test.go | 24 +- ...mport_filteredByPackageJson_direct_test.go | 6 +- ...mport_filteredByPackageJson_nested_test.go | 12 +- ...eredByPackageJson_peerDependencies_test.go | 6 +- .../gen/completionsImport_importType_test.go | 12 +- ...sImport_jsxOpeningTagImportDefault_test.go | 6 +- .../completionsImport_mergedReExport_test.go | 12 +- ...letionsImport_multipleWithSameName_test.go | 12 +- ...ionsImport_named_addToNamedImports_test.go | 6 +- ...ionsImport_named_didNotExistBefore_test.go | 6 +- ...named_exportEqualsNamespace_merged_test.go | 6 +- ...Import_named_exportEqualsNamespace_test.go | 6 +- ...mport_named_fromMergedDeclarations_test.go | 6 +- ...Import_named_namespaceImportExists_test.go | 6 +- ...ionsImport_ofAlias_preferShortPath_test.go | 6 +- ...mport_packageJsonImportsPreference_test.go | 12 +- ...mport_preferUpdatingExistingImport_test.go | 6 +- ...onsImport_previousTokenIsSemicolon_test.go | 6 +- ...completionsImport_reExportDefault2_test.go | 6 +- .../completionsImport_reExportDefault_test.go | 6 +- ...mpletionsImport_reExport_wrongName_test.go | 12 +- ...ompletionsImport_reexportTransient_test.go | 6 +- .../completionsImport_require_addNew_test.go | 6 +- ...etionsImport_require_addToExisting_test.go | 6 +- .../gen/completionsImport_require_test.go | 6 +- ...ionsImport_sortingModuleSpecifiers_test.go | 18 +- .../tests/gen/completionsImport_tsx_test.go | 6 +- ...mpletionsImport_umdDefaultNoCrash1_test.go | 6 +- ...nsImport_umdModules2_moduleExports_test.go | 6 +- ...onsImport_uriStyleNodeCoreModules1_test.go | 24 +- ...onsImport_uriStyleNodeCoreModules2_test.go | 12 +- ...Import_windowsPathsProjectRelative_test.go | 36 +- .../completionsRecommended_namespace_test.go | 6 +- .../completionsUniqueSymbol_import_test.go | 6 +- .../completionsWithDeprecatedTag10_test.go | 6 +- ...rtSuggestionsCache_exportUndefined_test.go | 12 +- ...uggestionsCache_invalidPackageJson_test.go | 6 +- .../tests/gen/importTypeCompletions1_test.go | 7 +- .../tests/gen/importTypeCompletions3_test.go | 7 +- .../tests/gen/importTypeCompletions4_test.go | 7 +- .../tests/gen/importTypeCompletions5_test.go | 7 +- .../tests/gen/importTypeCompletions6_test.go | 7 +- .../tests/gen/importTypeCompletions7_test.go | 6 +- .../tests/gen/importTypeCompletions8_test.go | 7 +- .../tests/gen/importTypeCompletions9_test.go | 7 +- .../tests/gen/jsFileImportNoTypes2_test.go | 25 +- internal/ls/autoimports.go | 25 +- internal/ls/autoimportsexportinfo.go | 5 +- internal/ls/completions.go | 93 ++--- internal/lsp/lsproto/_generate/generate.mts | 155 ++++++++- internal/lsp/lsproto/lsp_generated.go | 329 +++++++++++++++++- internal/lsp/server.go | 5 +- 116 files changed, 989 insertions(+), 638 deletions(-) diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts index 3030976773..3573bec579 100644 --- a/internal/fourslash/_scripts/convertFourslash.mts +++ b/internal/fourslash/_scripts/convertFourslash.mts @@ -506,7 +506,7 @@ function parseVerifyApplyCodeActionArgs(arg: ts.Expression): string | undefined return undefined; } } - props.push(`AutoImportData: &ls.AutoImportData{\n${dataProps.join("\n")}\n},`); + props.push(`AutoImportData: &lsproto.AutoImportData{\n${dataProps.join("\n")}\n},`); break; case "description": descInit = getStringLiteralLike(init); @@ -944,16 +944,16 @@ function parseExpectedCompletionItem(expr: ts.Expression, codeActionArgs?: Verif if (sourceInit = getStringLiteralLike(init)) { if (propName === "source" && sourceInit.text.endsWith("/")) { // source: "ClassMemberSnippet/" - itemProps.push(`Data: PtrTo(any(&ls.CompletionItemData{ + itemProps.push(`Data: &lsproto.CompletionItemData{ Source: ${getGoStringLiteral(sourceInit.text)}, - })),`); + },`); break; } - itemProps.push(`Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + itemProps.push(`Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: ${getGoStringLiteral(sourceInit.text)}, }, - })),`); + },`); } else { console.error(`Expected string literal for source/sourceDisplay, got ${init.getText()}`); diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 6529cacab8..c8e6fa149e 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -717,8 +717,8 @@ func (f *FourslashTest) VerifyCompletions(t *testing.T, markerInput MarkerInput, if item.Label != expectedAction.Name || item.Data == nil { return false } - data, ok := (*item.Data).(*ls.CompletionItemData) - if !ok || data.AutoImport == nil { + data := item.Data + if data.AutoImport == nil { return false } return data.AutoImport.ModuleSpecifier == expectedAction.Source @@ -956,16 +956,12 @@ var ( ) func (f *FourslashTest) verifyCompletionItem(t *testing.T, prefix string, actual *lsproto.CompletionItem, expected *lsproto.CompletionItem) { - var actualAutoImportData, expectedAutoImportData *ls.AutoImportData + var actualAutoImportData, expectedAutoImportData *lsproto.AutoImportData if actual.Data != nil { - if data, ok := (*actual.Data).(*ls.CompletionItemData); ok { - actualAutoImportData = data.AutoImport - } + actualAutoImportData = actual.Data.AutoImport } if expected.Data != nil { - if data, ok := (*expected.Data).(*ls.CompletionItemData); ok { - expectedAutoImportData = data.AutoImport - } + expectedAutoImportData = expected.Data.AutoImport } if (actualAutoImportData == nil) != (expectedAutoImportData == nil) { t.Fatal(prefix + "Mismatch in auto-import data presence") @@ -1034,7 +1030,7 @@ func assertDeepEqual(t *testing.T, actual any, expected any, prefix string, opts type ApplyCodeActionFromCompletionOptions struct { Name string Source string - AutoImportData *ls.AutoImportData + AutoImportData *lsproto.AutoImportData Description string NewFileContent *string NewRangeContent *string @@ -1058,16 +1054,13 @@ func (f *FourslashTest) VerifyApplyCodeActionFromCompletion(t *testing.T, marker if item.Label != options.Name || item.Data == nil { return false } - data, ok := (*item.Data).(*ls.CompletionItemData) - if !ok { - return false - } + data := item.Data if options.AutoImportData != nil { return data.AutoImport != nil && ((data.AutoImport.FileName == options.AutoImportData.FileName) && (options.AutoImportData.ModuleSpecifier == "" || data.AutoImport.ModuleSpecifier == options.AutoImportData.ModuleSpecifier) && (options.AutoImportData.ExportName == "" || data.AutoImport.ExportName == options.AutoImportData.ExportName) && (options.AutoImportData.AmbientModuleName == nil || data.AutoImport.AmbientModuleName == options.AutoImportData.AmbientModuleName) && - (options.AutoImportData.IsPackageJsonImport == core.TSUnknown || data.AutoImport.IsPackageJsonImport == options.AutoImportData.IsPackageJsonImport)) + (options.AutoImportData.IsPackageJsonImport == nil || (data.AutoImport.IsPackageJsonImport != nil && *data.AutoImport.IsPackageJsonImport == *options.AutoImportData.IsPackageJsonImport))) } if data.AutoImport == nil && data.Source != "" && data.Source == options.Source { return true diff --git a/internal/fourslash/tests/gen/autoImportCompletionAmbientMergedModule1_test.go b/internal/fourslash/tests/gen/autoImportCompletionAmbientMergedModule1_test.go index 273f99b13e..9599c87624 100644 --- a/internal/fourslash/tests/gen/autoImportCompletionAmbientMergedModule1_test.go +++ b/internal/fourslash/tests/gen/autoImportCompletionAmbientMergedModule1_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -57,9 +56,9 @@ export class MoveInsideNextQuote extends MoveQuoteMatch {/*1*/ InsertText: PtrTo("public execActionWithCount(position: Position): Promise {\n}"), FilterText: PtrTo("execActionWithCount"), AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ + Data: &lsproto.CompletionItemData{ Source: "ClassMemberSnippet/", - })), + }, }, }, }, diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportEqualsWithDefault1_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportEqualsWithDefault1_test.go index c87ea24c91..d89cf56869 100644 --- a/internal/fourslash/tests/gen/autoImportCompletionExportEqualsWithDefault1_test.go +++ b/internal/fourslash/tests/gen/autoImportCompletionExportEqualsWithDefault1_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -75,9 +74,9 @@ export = Container;` InsertText: PtrTo("parent: Container_ | Document_ | undefined;"), FilterText: PtrTo("parent"), AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ + Data: &lsproto.CompletionItemData{ Source: "ClassMemberSnippet/", - })), + }, }, }, }, diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation1_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation1_test.go index 725856e637..56b7c820c4 100644 --- a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation1_test.go +++ b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation1_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -51,9 +50,9 @@ class FullPiece extends Piece { InsertText: PtrTo("container: Container;"), FilterText: PtrTo("container"), AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ + Data: &lsproto.CompletionItemData{ Source: "ClassMemberSnippet/", - })), + }, }, }, }, diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation2_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation2_test.go index 34b6d1c7eb..3f1a7938a6 100644 --- a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation2_test.go +++ b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation2_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -59,9 +58,9 @@ class PingCommand extends Command { InsertText: PtrTo("get container(): Container {\n}"), FilterText: PtrTo("container"), AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ + Data: &lsproto.CompletionItemData{ Source: "ClassMemberSnippet/", - })), + }, }, }, }, diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation3_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation3_test.go index 1877ab0244..ec0d324c52 100644 --- a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation3_test.go +++ b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation3_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -50,9 +49,9 @@ class FullPiece extends Piece { InsertText: PtrTo("container: Container;"), FilterText: PtrTo("container"), AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ + Data: &lsproto.CompletionItemData{ Source: "ClassMemberSnippet/", - })), + }, }, }, }, diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation4_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation4_test.go index b64b116e1b..38d77f6ddc 100644 --- a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation4_test.go +++ b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation4_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -57,9 +56,9 @@ class PingCommand extends CommandAlias { InsertText: PtrTo("get container(): Container {\n}"), FilterText: PtrTo("container"), AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ + Data: &lsproto.CompletionItemData{ Source: "ClassMemberSnippet/", - })), + }, }, }, }, diff --git a/internal/fourslash/tests/gen/autoImportFileExcludePatterns3_test.go b/internal/fourslash/tests/gen/autoImportFileExcludePatterns3_test.go index e693dda53e..3c8140f48d 100644 --- a/internal/fourslash/tests/gen/autoImportFileExcludePatterns3_test.go +++ b/internal/fourslash/tests/gen/autoImportFileExcludePatterns3_test.go @@ -37,21 +37,21 @@ declare module "foo" { []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "x", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "foo", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "y", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "foo", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/autoImportModuleNone2_test.go b/internal/fourslash/tests/gen/autoImportModuleNone2_test.go index ffa9951af4..9d4c927bd7 100644 --- a/internal/fourslash/tests/gen/autoImportModuleNone2_test.go +++ b/internal/fourslash/tests/gen/autoImportModuleNone2_test.go @@ -32,11 +32,11 @@ export const x: number; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "x", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dep", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/autoImportPathsAliasesAndBarrels_test.go b/internal/fourslash/tests/gen/autoImportPathsAliasesAndBarrels_test.go index 3848049ba1..1347985775 100644 --- a/internal/fourslash/tests/gen/autoImportPathsAliasesAndBarrels_test.go +++ b/internal/fourslash/tests/gen/autoImportPathsAliasesAndBarrels_test.go @@ -49,31 +49,31 @@ func TestAutoImportPathsAliasesAndBarrels(t *testing.T) { Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "Thing2A", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./thing2A", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "Thing1B", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "~/dirB", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "Thing2B", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "~/dirB", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/autoImportProvider6_test.go b/internal/fourslash/tests/gen/autoImportProvider6_test.go index 3321c43cc1..b523605594 100644 --- a/internal/fourslash/tests/gen/autoImportProvider6_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider6_test.go @@ -38,11 +38,11 @@ Component/**/` &lsproto.CompletionItem{ Label: "Component", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap1_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap1_test.go index 5e4fb14290..757031710f 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap1_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap1_test.go @@ -60,21 +60,21 @@ fooFrom/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromIndex", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, &lsproto.CompletionItem{ Label: "fooFromLol", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency/lol", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap2_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap2_test.go index 75c5e70f58..615dcc1d0e 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap2_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap2_test.go @@ -63,11 +63,11 @@ fooFrom/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromIndex", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap3_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap3_test.go index 3153dde6c0..55b3022f18 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap3_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap3_test.go @@ -53,11 +53,11 @@ fooFrom/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromLol", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap4_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap4_test.go index b5b60ce752..958bd9b242 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap4_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap4_test.go @@ -56,11 +56,11 @@ fooFrom/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromIndex", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap5_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap5_test.go index 5a986f145d..6ef04daf4d 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap5_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap5_test.go @@ -71,21 +71,21 @@ fooFrom/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromIndex", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, &lsproto.CompletionItem{ Label: "fooFromLol", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency/lol", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap6_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap6_test.go index 0e6df678fe..381a232b9e 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap6_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap6_test.go @@ -78,21 +78,21 @@ fooFrom/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromIndex", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, &lsproto.CompletionItem{ Label: "fooFromLol", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency/lol", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap7_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap7_test.go index 6f50518cf5..bb3b53e60e 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap7_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap7_test.go @@ -62,21 +62,21 @@ fooFrom/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromIndex", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, &lsproto.CompletionItem{ Label: "fooFromLol", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency/lol", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap8_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap8_test.go index 9cd47b19df..613d833138 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap8_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap8_test.go @@ -62,11 +62,11 @@ fooFrom/*mts*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromLol", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency/lol", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, @@ -87,11 +87,11 @@ fooFrom/*mts*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromIndex", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency/lol", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap9_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap9_test.go index 46917e438b..c8b835f5a8 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_exportMap9_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap9_test.go @@ -57,11 +57,11 @@ fooFrom/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooFromIndex", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dependency/lol", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_globalTypingsCache_test.go b/internal/fourslash/tests/gen/autoImportProvider_globalTypingsCache_test.go index 6b1da54d18..15bb9dce66 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_globalTypingsCache_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_globalTypingsCache_test.go @@ -44,11 +44,11 @@ BrowserRouter/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "BrowserRouterFromDts", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react-router-dom", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_namespaceSameNameAsIntrinsic_test.go b/internal/fourslash/tests/gen/autoImportProvider_namespaceSameNameAsIntrinsic_test.go index 3e5068a6ec..835b7f33a2 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_namespaceSameNameAsIntrinsic_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_namespaceSameNameAsIntrinsic_test.go @@ -45,11 +45,11 @@ type A = { name: string/**/ }` &lsproto.CompletionItem{ Label: "string", SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "fp-ts", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, }, }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports1_test.go b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports1_test.go index 1735b31c24..d82dc459d0 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports1_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports1_test.go @@ -66,51 +66,51 @@ export const d1: number; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "a1", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "pkg/a1", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "b1", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "pkg/b/b1.js", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "c1", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "pkg/c/c1.js", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "c2", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "pkg/c/subfolder/c2.mjs", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "d1", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "pkg/d/d1", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports2_test.go b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports2_test.go index c3ab6fe2be..1c8b937767 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports2_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports2_test.go @@ -54,11 +54,11 @@ export function test(): void; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "test", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "pkg/core/test", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports3_test.go b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports3_test.go index cb23c79e1b..1d16e505a9 100644 --- a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports3_test.go +++ b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports3_test.go @@ -58,11 +58,11 @@ export const Card = () => null; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "Card", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@repo/ui/Card", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/autoImportReExportFromAmbientModule_test.go b/internal/fourslash/tests/gen/autoImportReExportFromAmbientModule_test.go index ef77d2add2..6d08ef00ce 100644 --- a/internal/fourslash/tests/gen/autoImportReExportFromAmbientModule_test.go +++ b/internal/fourslash/tests/gen/autoImportReExportFromAmbientModule_test.go @@ -40,21 +40,21 @@ access/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "accessSync", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "fs", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "accessSync", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "fs-extra", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -68,7 +68,7 @@ access/**/` NewFileContent: PtrTo(`import { accessSync } from "fs-extra"; access`), - AutoImportData: &ls.AutoImportData{ + AutoImportData: &lsproto.AutoImportData{ ExportName: "accessSync", FileName: "/home/src/workspaces/project/node_modules/@types/fs-extra/index.d.ts", ModuleSpecifier: "fs-extra", diff --git a/internal/fourslash/tests/gen/autoImportSameNameDefaultExported_test.go b/internal/fourslash/tests/gen/autoImportSameNameDefaultExported_test.go index 1c4e6a85be..c39937400b 100644 --- a/internal/fourslash/tests/gen/autoImportSameNameDefaultExported_test.go +++ b/internal/fourslash/tests/gen/autoImportSameNameDefaultExported_test.go @@ -35,21 +35,21 @@ Table/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "Table", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "antd", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, &lsproto.CompletionItem{ Label: "Table", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "rc-table", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/autoImportSortCaseSensitivity2_test.go b/internal/fourslash/tests/gen/autoImportSortCaseSensitivity2_test.go index ff585d978d..1a053fd54e 100644 --- a/internal/fourslash/tests/gen/autoImportSortCaseSensitivity2_test.go +++ b/internal/fourslash/tests/gen/autoImportSortCaseSensitivity2_test.go @@ -33,11 +33,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function foo(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/autoImportTypeOnlyPreferred1_test.go b/internal/fourslash/tests/gen/autoImportTypeOnlyPreferred1_test.go index 3a89a0273c..72bc3617b7 100644 --- a/internal/fourslash/tests/gen/autoImportTypeOnlyPreferred1_test.go +++ b/internal/fourslash/tests/gen/autoImportTypeOnlyPreferred1_test.go @@ -40,11 +40,11 @@ export interface VFS { Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "ts", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./ts", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/autoImportVerbatimTypeOnly1_test.go b/internal/fourslash/tests/gen/autoImportVerbatimTypeOnly1_test.go index 6d8622d386..e3e8815481 100644 --- a/internal/fourslash/tests/gen/autoImportVerbatimTypeOnly1_test.go +++ b/internal/fourslash/tests/gen/autoImportVerbatimTypeOnly1_test.go @@ -5,7 +5,7 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -26,7 +26,7 @@ const x: /**/` Name: "I", Source: "./mod", Description: "Add import from \"./mod.js\"", - AutoImportData: &ls.AutoImportData{ + AutoImportData: &lsproto.AutoImportData{ ExportName: "I", FileName: "/mod.ts", ModuleSpecifier: "./mod.js", @@ -40,7 +40,7 @@ const x: `), Name: "C", Source: "./mod", Description: "Update import from \"./mod.js\"", - AutoImportData: &ls.AutoImportData{ + AutoImportData: &lsproto.AutoImportData{ ExportName: "C", FileName: "/mod.ts", ModuleSpecifier: "./mod.js", diff --git a/internal/fourslash/tests/gen/completionForObjectProperty_test.go b/internal/fourslash/tests/gen/completionForObjectProperty_test.go index 3ccb4b9527..d1fd378f99 100644 --- a/internal/fourslash/tests/gen/completionForObjectProperty_test.go +++ b/internal/fourslash/tests/gen/completionForObjectProperty_test.go @@ -43,11 +43,11 @@ const test8: { foo: string } = { foo/*8*/ }` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -64,11 +64,11 @@ const test8: { foo: string } = { foo/*8*/ }` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -85,11 +85,11 @@ const test8: { foo: string } = { foo/*8*/ }` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -106,11 +106,11 @@ const test8: { foo: string } = { foo/*8*/ }` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -127,11 +127,11 @@ const test8: { foo: string } = { foo/*8*/ }` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -148,11 +148,11 @@ const test8: { foo: string } = { foo/*8*/ }` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral5_test.go b/internal/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral5_test.go index be134f1c72..45c4549522 100644 --- a/internal/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral5_test.go +++ b/internal/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral5_test.go @@ -31,11 +31,11 @@ const obj = { exp/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "exportedConstant", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImportBaseUrl_test.go b/internal/fourslash/tests/gen/completionsImportBaseUrl_test.go index 524919274b..971082cf39 100644 --- a/internal/fourslash/tests/gen/completionsImportBaseUrl_test.go +++ b/internal/fourslash/tests/gen/completionsImportBaseUrl_test.go @@ -36,11 +36,11 @@ fo/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("const foo: 0"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImportDefaultExportCrash2_test.go b/internal/fourslash/tests/gen/completionsImportDefaultExportCrash2_test.go index f300628828..10c5ee50a6 100644 --- a/internal/fourslash/tests/gen/completionsImportDefaultExportCrash2_test.go +++ b/internal/fourslash/tests/gen/completionsImportDefaultExportCrash2_test.go @@ -54,21 +54,21 @@ export default methods.$; &lsproto.CompletionItem{ Label: "$", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dom7", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "Dom7", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./dom7", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImportPathsConflict_test.go b/internal/fourslash/tests/gen/completionsImportPathsConflict_test.go index da67a8a511..5fb7a8f139 100644 --- a/internal/fourslash/tests/gen/completionsImportPathsConflict_test.go +++ b/internal/fourslash/tests/gen/completionsImportPathsConflict_test.go @@ -42,11 +42,11 @@ import {} from "@reduxjs/toolkit"; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "configureStore", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@reduxjs/toolkit", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -56,7 +56,7 @@ import {} from "@reduxjs/toolkit"; f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ Name: "configureStore", Source: "@reduxjs/toolkit", - AutoImportData: &ls.AutoImportData{ + AutoImportData: &lsproto.AutoImportData{ ExportName: "configureStore", FileName: "/src/configureStore.ts", ModuleSpecifier: "@reduxjs/toolkit", diff --git a/internal/fourslash/tests/gen/completionsImportTypeKeyword_test.go b/internal/fourslash/tests/gen/completionsImportTypeKeyword_test.go index 42b83f978e..c6d307912d 100644 --- a/internal/fourslash/tests/gen/completionsImportTypeKeyword_test.go +++ b/internal/fourslash/tests/gen/completionsImportTypeKeyword_test.go @@ -36,11 +36,11 @@ type/**/` }, &lsproto.CompletionItem{ Label: "type", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "os", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_46332_test.go b/internal/fourslash/tests/gen/completionsImport_46332_test.go index bee727e2cc..1676ac368d 100644 --- a/internal/fourslash/tests/gen/completionsImport_46332_test.go +++ b/internal/fourslash/tests/gen/completionsImport_46332_test.go @@ -76,11 +76,11 @@ ref/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "ref", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "vue", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -91,7 +91,7 @@ ref/**/` Name: "ref", Source: "vue", Description: "Update import from \"vue\"", - AutoImportData: &ls.AutoImportData{ + AutoImportData: &lsproto.AutoImportData{ ExportName: "ref", FileName: "/node_modules/vue/dist/vue.d.ts", }, diff --git a/internal/fourslash/tests/gen/completionsImport_ambient_test.go b/internal/fourslash/tests/gen/completionsImport_ambient_test.go index 611fdb9572..041c2d61cf 100644 --- a/internal/fourslash/tests/gen/completionsImport_ambient_test.go +++ b/internal/fourslash/tests/gen/completionsImport_ambient_test.go @@ -44,21 +44,21 @@ Ba/**/` }, &lsproto.CompletionItem{ Label: "Bar", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "path1", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "Bar", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "path2longer", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_augmentation_test.go b/internal/fourslash/tests/gen/completionsImport_augmentation_test.go index 2c7cdce25b..324ebf3f95 100644 --- a/internal/fourslash/tests/gen/completionsImport_augmentation_test.go +++ b/internal/fourslash/tests/gen/completionsImport_augmentation_test.go @@ -35,22 +35,22 @@ declare module "./a" { &lsproto.CompletionItem{ Label: "foo", Detail: PtrTo("const foo: 0"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "bar", Detail: PtrTo("const bar: 0"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_compilerOptionsModule_test.go b/internal/fourslash/tests/gen/completionsImport_compilerOptionsModule_test.go index 62a31af0ac..f35fe5bd55 100644 --- a/internal/fourslash/tests/gen/completionsImport_compilerOptionsModule_test.go +++ b/internal/fourslash/tests/gen/completionsImport_compilerOptionsModule_test.go @@ -49,11 +49,11 @@ fo/*dts*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "a", }, - })), + }, Detail: PtrTo("const foo: 0"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_defaultAndNamedConflict_test.go b/internal/fourslash/tests/gen/completionsImport_defaultAndNamedConflict_test.go index f60bf9f376..7f48814987 100644 --- a/internal/fourslash/tests/gen/completionsImport_defaultAndNamedConflict_test.go +++ b/internal/fourslash/tests/gen/completionsImport_defaultAndNamedConflict_test.go @@ -32,11 +32,11 @@ someMo/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "someModule", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./someModule", }, - })), + }, Detail: PtrTo("(property) default: 1"), Kind: PtrTo(lsproto.CompletionItemKindField), AdditionalTextEdits: fourslash.AnyTextEdits, @@ -44,11 +44,11 @@ someMo/**/` }, &lsproto.CompletionItem{ Label: "someModule", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./someModule", }, - })), + }, Detail: PtrTo("const someModule: 0"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, @@ -60,7 +60,7 @@ someMo/**/` f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ Name: "someModule", Source: "./someModule", - AutoImportData: &ls.AutoImportData{ + AutoImportData: &lsproto.AutoImportData{ ExportName: "default", FileName: "/someModule.ts", }, diff --git a/internal/fourslash/tests/gen/completionsImport_defaultFalsePositive_test.go b/internal/fourslash/tests/gen/completionsImport_defaultFalsePositive_test.go index 38d4aef0f8..50c9e1f9b6 100644 --- a/internal/fourslash/tests/gen/completionsImport_defaultFalsePositive_test.go +++ b/internal/fourslash/tests/gen/completionsImport_defaultFalsePositive_test.go @@ -33,11 +33,11 @@ conca/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "concat", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "bar/concat", }, - })), + }, Detail: PtrTo("const concat: 0"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_default_addToNamedImports_test.go b/internal/fourslash/tests/gen/completionsImport_default_addToNamedImports_test.go index d98caac868..2a55384787 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_addToNamedImports_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_addToNamedImports_test.go @@ -31,11 +31,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function foo(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_default_addToNamespaceImport_test.go b/internal/fourslash/tests/gen/completionsImport_default_addToNamespaceImport_test.go index 23d8638a44..d94b59d904 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_addToNamespaceImport_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_addToNamespaceImport_test.go @@ -30,11 +30,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function foo(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_default_alreadyExistedWithRename_test.go b/internal/fourslash/tests/gen/completionsImport_default_alreadyExistedWithRename_test.go index 4ffdba061b..533d34449f 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_alreadyExistedWithRename_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_alreadyExistedWithRename_test.go @@ -30,11 +30,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function foo(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_default_anonymous_test.go b/internal/fourslash/tests/gen/completionsImport_default_anonymous_test.go index fc96c437da..c439845b41 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_anonymous_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_anonymous_test.go @@ -44,11 +44,11 @@ fooB/*1*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooBar", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo-bar", }, - })), + }, Detail: PtrTo("(property) default: 0"), Kind: PtrTo(lsproto.CompletionItemKindField), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_default_didNotExistBefore_test.go b/internal/fourslash/tests/gen/completionsImport_default_didNotExistBefore_test.go index 7e641a338e..25bc6bb562 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_didNotExistBefore_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_didNotExistBefore_test.go @@ -30,11 +30,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function foo(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_default_exportDefaultIdentifier_test.go b/internal/fourslash/tests/gen/completionsImport_default_exportDefaultIdentifier_test.go index 8af15aaa3f..ce3fe46687 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_exportDefaultIdentifier_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_exportDefaultIdentifier_test.go @@ -32,11 +32,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("(alias) const foo: 0\nexport default foo"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_default_fromMergedDeclarations_test.go b/internal/fourslash/tests/gen/completionsImport_default_fromMergedDeclarations_test.go index 5123c8e3cd..9f710f509d 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_fromMergedDeclarations_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_fromMergedDeclarations_test.go @@ -36,11 +36,11 @@ declare module "m" { Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "M", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "m", }, - })), + }, Detail: PtrTo("class M"), Kind: PtrTo(lsproto.CompletionItemKindClass), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_default_reExport_test.go b/internal/fourslash/tests/gen/completionsImport_default_reExport_test.go index 52e55cdecb..106dd7850d 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_reExport_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_reExport_test.go @@ -40,21 +40,21 @@ export default foo.b;` "foo", &lsproto.CompletionItem{ Label: "a", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./file1", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "b", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./file1", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_default_symbolName_test.go b/internal/fourslash/tests/gen/completionsImport_default_symbolName_test.go index bae20c6a6d..5f4ca45510 100644 --- a/internal/fourslash/tests/gen/completionsImport_default_symbolName_test.go +++ b/internal/fourslash/tests/gen/completionsImport_default_symbolName_test.go @@ -39,11 +39,11 @@ R/*0*/` &lsproto.CompletionItem{ Label: "RangeParser", Kind: PtrTo(lsproto.CompletionItemKindFunction), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "range-parser", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), Detail: PtrTo("namespace RangeParser\nfunction RangeParser(): string"), diff --git a/internal/fourslash/tests/gen/completionsImport_details_withMisspelledName_test.go b/internal/fourslash/tests/gen/completionsImport_details_withMisspelledName_test.go index f0201764ec..a1d9650f99 100644 --- a/internal/fourslash/tests/gen/completionsImport_details_withMisspelledName_test.go +++ b/internal/fourslash/tests/gen/completionsImport_details_withMisspelledName_test.go @@ -5,7 +5,7 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -33,7 +33,7 @@ acb;`), f.VerifyApplyCodeActionFromCompletion(t, PtrTo("2"), &fourslash.ApplyCodeActionFromCompletionOptions{ Name: "abc", Source: "./a", - AutoImportData: &ls.AutoImportData{ + AutoImportData: &lsproto.AutoImportData{ ExportName: "abc", FileName: "/a.ts", ModuleSpecifier: "./a", diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypesAndNotTypes_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypesAndNotTypes_test.go index 650cff95f6..4130e9a3c8 100644 --- a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypesAndNotTypes_test.go +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypesAndNotTypes_test.go @@ -50,21 +50,21 @@ import "react"; []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "render", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@scope/react-dom", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "useState", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@scope/react", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypes_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypes_test.go index ef1bbfc4b9..e33a97c857 100644 --- a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypes_test.go +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypes_test.go @@ -50,21 +50,21 @@ import "@scope/react"; []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "render", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@scope/react-dom", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "useState", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@scope/react", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scoped_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scoped_test.go index 7bdc35017a..92020a9638 100644 --- a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scoped_test.go +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scoped_test.go @@ -50,21 +50,21 @@ import "@scope/react"; []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "render", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@scope/react-dom", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "useState", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@scope/react", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_typesAndNotTypes_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_typesAndNotTypes_test.go index 380ddb701d..9d68899199 100644 --- a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_typesAndNotTypes_test.go +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_typesAndNotTypes_test.go @@ -50,11 +50,11 @@ useState/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "useState", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_types_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_types_test.go index 6653f114ec..9f6f5b5b2a 100644 --- a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_types_test.go +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_types_test.go @@ -50,21 +50,21 @@ import "react"; []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "render", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react-dom", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "useState", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_exportEqualsNamespace_noDuplicate_test.go b/internal/fourslash/tests/gen/completionsImport_exportEqualsNamespace_noDuplicate_test.go index df2677b55e..a4e9766d0a 100644 --- a/internal/fourslash/tests/gen/completionsImport_exportEqualsNamespace_noDuplicate_test.go +++ b/internal/fourslash/tests/gen/completionsImport_exportEqualsNamespace_noDuplicate_test.go @@ -38,11 +38,11 @@ import * as a from "a"; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_exportEquals_anonymous_test.go b/internal/fourslash/tests/gen/completionsImport_exportEquals_anonymous_test.go index 264ddff310..50e8885186 100644 --- a/internal/fourslash/tests/gen/completionsImport_exportEquals_anonymous_test.go +++ b/internal/fourslash/tests/gen/completionsImport_exportEquals_anonymous_test.go @@ -47,11 +47,11 @@ fooB/*1*/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "fooBar", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo-bar", }, - })), + }, Detail: PtrTo("(property) export=: 0"), Kind: PtrTo(lsproto.CompletionItemKindField), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_exportEquals_test.go b/internal/fourslash/tests/gen/completionsImport_exportEquals_test.go index 5a1ef9edd0..e1a9b2dc9d 100644 --- a/internal/fourslash/tests/gen/completionsImport_exportEquals_test.go +++ b/internal/fourslash/tests/gen/completionsImport_exportEquals_test.go @@ -37,11 +37,11 @@ let x: b/*1*/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "a", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -58,11 +58,11 @@ let x: b/*1*/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "b", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByInvalidPackageJson_direct_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByInvalidPackageJson_direct_test.go index 7d7f135186..3f3207d769 100644 --- a/internal/fourslash/tests/gen/completionsImport_filteredByInvalidPackageJson_direct_test.go +++ b/internal/fourslash/tests/gen/completionsImport_filteredByInvalidPackageJson_direct_test.go @@ -50,21 +50,21 @@ const x = Re/**/` &lsproto.CompletionItem{ Label: "React", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "ReactFake", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "fake-react", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesImplicit_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesImplicit_test.go index bd53aa7be8..f4889d38e8 100644 --- a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesImplicit_test.go +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesImplicit_test.go @@ -47,11 +47,11 @@ const x = Re/**/` &lsproto.CompletionItem{ Label: "React", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesOnly_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesOnly_test.go index 27ccbf38d8..72f2c11ca2 100644 --- a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesOnly_test.go +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesOnly_test.go @@ -47,11 +47,11 @@ const x = Re/**/` &lsproto.CompletionItem{ Label: "React", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_ambient_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_ambient_test.go index 69fd73678f..e62e7ed0dc 100644 --- a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_ambient_test.go +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_ambient_test.go @@ -76,11 +76,11 @@ loca/*5*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "agate", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react-syntax-highlighter/sub", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -97,11 +97,11 @@ loca/*5*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "somethingElse", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "something-else", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -118,11 +118,11 @@ loca/*5*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "declaredBySomethingNotInPackageJson", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "declared-by-foo", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -139,11 +139,11 @@ loca/*5*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "local", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "local", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_direct_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_direct_test.go index 52dee82f49..11a62d6f14 100644 --- a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_direct_test.go +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_direct_test.go @@ -49,11 +49,11 @@ const x = Re/**/` &lsproto.CompletionItem{ Label: "React", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_nested_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_nested_test.go index f2116414aa..973447640e 100644 --- a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_nested_test.go +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_nested_test.go @@ -55,11 +55,11 @@ const x = Re/**/` &lsproto.CompletionItem{ Label: "React", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, @@ -76,11 +76,11 @@ const x = Re/**/` &lsproto.CompletionItem{ Label: "Redux", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "redux", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_peerDependencies_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_peerDependencies_test.go index 8997b6e93a..48669d36da 100644 --- a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_peerDependencies_test.go +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_peerDependencies_test.go @@ -49,11 +49,11 @@ const x = Re/**/` &lsproto.CompletionItem{ Label: "React", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "react", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImport_importType_test.go b/internal/fourslash/tests/gen/completionsImport_importType_test.go index 9f71101db2..b74932bcfa 100644 --- a/internal/fourslash/tests/gen/completionsImport_importType_test.go +++ b/internal/fourslash/tests/gen/completionsImport_importType_test.go @@ -34,22 +34,22 @@ export const m = 0; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "C", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("class C"), AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "T", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("type T = number"), AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), diff --git a/internal/fourslash/tests/gen/completionsImport_jsxOpeningTagImportDefault_test.go b/internal/fourslash/tests/gen/completionsImport_jsxOpeningTagImportDefault_test.go index 1dc2706366..9a29a81114 100644 --- a/internal/fourslash/tests/gen/completionsImport_jsxOpeningTagImportDefault_test.go +++ b/internal/fourslash/tests/gen/completionsImport_jsxOpeningTagImportDefault_test.go @@ -34,11 +34,11 @@ export function Index() { Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "Component", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./component", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_mergedReExport_test.go b/internal/fourslash/tests/gen/completionsImport_mergedReExport_test.go index 0ade668075..6aeac12072 100644 --- a/internal/fourslash/tests/gen/completionsImport_mergedReExport_test.go +++ b/internal/fourslash/tests/gen/completionsImport_mergedReExport_test.go @@ -50,11 +50,11 @@ C/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "Config", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@jest/types", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -72,11 +72,11 @@ C/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "Config", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "@jest/types", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_multipleWithSameName_test.go b/internal/fourslash/tests/gen/completionsImport_multipleWithSameName_test.go index f455288f50..ed245bcceb 100644 --- a/internal/fourslash/tests/gen/completionsImport_multipleWithSameName_test.go +++ b/internal/fourslash/tests/gen/completionsImport_multipleWithSameName_test.go @@ -43,11 +43,11 @@ fo/**/` }, &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("const foo: 0"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, @@ -55,11 +55,11 @@ fo/**/` }, &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./b", }, - })), + }, Detail: PtrTo("const foo: 1"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_named_addToNamedImports_test.go b/internal/fourslash/tests/gen/completionsImport_named_addToNamedImports_test.go index faeeb7855d..028ab48d4b 100644 --- a/internal/fourslash/tests/gen/completionsImport_named_addToNamedImports_test.go +++ b/internal/fourslash/tests/gen/completionsImport_named_addToNamedImports_test.go @@ -31,11 +31,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function foo(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_named_didNotExistBefore_test.go b/internal/fourslash/tests/gen/completionsImport_named_didNotExistBefore_test.go index 73b4255412..9f6c5eaf1f 100644 --- a/internal/fourslash/tests/gen/completionsImport_named_didNotExistBefore_test.go +++ b/internal/fourslash/tests/gen/completionsImport_named_didNotExistBefore_test.go @@ -38,11 +38,11 @@ t/**/` }, &lsproto.CompletionItem{ Label: "Test1", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function Test1(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_merged_test.go b/internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_merged_test.go index 5c403f6d48..c47dcdfeb6 100644 --- a/internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_merged_test.go +++ b/internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_merged_test.go @@ -37,11 +37,11 @@ fo/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "n", }, - })), + }, Detail: PtrTo("const N.foo: number"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_test.go b/internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_test.go index 19df35a031..a6638c1d7d 100644 --- a/internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_test.go +++ b/internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_test.go @@ -33,11 +33,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("const N.foo: 0"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_named_fromMergedDeclarations_test.go b/internal/fourslash/tests/gen/completionsImport_named_fromMergedDeclarations_test.go index 7a216a296a..4d18a17ad8 100644 --- a/internal/fourslash/tests/gen/completionsImport_named_fromMergedDeclarations_test.go +++ b/internal/fourslash/tests/gen/completionsImport_named_fromMergedDeclarations_test.go @@ -36,11 +36,11 @@ declare module "m" { Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "M", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "m", }, - })), + }, Detail: PtrTo("class M\ninterface M"), Kind: PtrTo(lsproto.CompletionItemKindClass), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_named_namespaceImportExists_test.go b/internal/fourslash/tests/gen/completionsImport_named_namespaceImportExists_test.go index 2451350049..adfd584ab2 100644 --- a/internal/fourslash/tests/gen/completionsImport_named_namespaceImportExists_test.go +++ b/internal/fourslash/tests/gen/completionsImport_named_namespaceImportExists_test.go @@ -30,11 +30,11 @@ f/**/;` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function foo(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_ofAlias_preferShortPath_test.go b/internal/fourslash/tests/gen/completionsImport_ofAlias_preferShortPath_test.go index 008ee6d8c3..62baaab2e4 100644 --- a/internal/fourslash/tests/gen/completionsImport_ofAlias_preferShortPath_test.go +++ b/internal/fourslash/tests/gen/completionsImport_ofAlias_preferShortPath_test.go @@ -34,11 +34,11 @@ fo/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, Detail: PtrTo("(alias) const foo: 0\nexport foo"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_packageJsonImportsPreference_test.go b/internal/fourslash/tests/gen/completionsImport_packageJsonImportsPreference_test.go index 9fa94c1dec..5c20d1e079 100644 --- a/internal/fourslash/tests/gen/completionsImport_packageJsonImportsPreference_test.go +++ b/internal/fourslash/tests/gen/completionsImport_packageJsonImportsPreference_test.go @@ -42,11 +42,11 @@ internalFoo/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "internalFoo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "#internal/foo", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -63,11 +63,11 @@ internalFoo/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "internalFoo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./other", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_preferUpdatingExistingImport_test.go b/internal/fourslash/tests/gen/completionsImport_preferUpdatingExistingImport_test.go index 84f8381031..5583320c1d 100644 --- a/internal/fourslash/tests/gen/completionsImport_preferUpdatingExistingImport_test.go +++ b/internal/fourslash/tests/gen/completionsImport_preferUpdatingExistingImport_test.go @@ -38,11 +38,11 @@ y/**/` "x", &lsproto.CompletionItem{ Label: "y", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./deep/module/why/you/want/this/path", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), AdditionalTextEdits: fourslash.AnyTextEdits, }, diff --git a/internal/fourslash/tests/gen/completionsImport_previousTokenIsSemicolon_test.go b/internal/fourslash/tests/gen/completionsImport_previousTokenIsSemicolon_test.go index 084836b20b..bf7289b660 100644 --- a/internal/fourslash/tests/gen/completionsImport_previousTokenIsSemicolon_test.go +++ b/internal/fourslash/tests/gen/completionsImport_previousTokenIsSemicolon_test.go @@ -30,11 +30,11 @@ import * as a from 'a'; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("function foo(): void"), Kind: PtrTo(lsproto.CompletionItemKindFunction), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_reExportDefault2_test.go b/internal/fourslash/tests/gen/completionsImport_reExportDefault2_test.go index 4809f996c2..1d7a34c7d7 100644 --- a/internal/fourslash/tests/gen/completionsImport_reExportDefault2_test.go +++ b/internal/fourslash/tests/gen/completionsImport_reExportDefault2_test.go @@ -42,11 +42,11 @@ defaultExp/**/` "namedExport", &lsproto.CompletionItem{ Label: "defaultExport", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "example", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_reExportDefault_test.go b/internal/fourslash/tests/gen/completionsImport_reExportDefault_test.go index 97f460b0e1..e1a22cb24a 100644 --- a/internal/fourslash/tests/gen/completionsImport_reExportDefault_test.go +++ b/internal/fourslash/tests/gen/completionsImport_reExportDefault_test.go @@ -33,11 +33,11 @@ fo/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("(alias) function foo(): void\nexport foo"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_reExport_wrongName_test.go b/internal/fourslash/tests/gen/completionsImport_reExport_wrongName_test.go index 4651f917c1..852fa9809b 100644 --- a/internal/fourslash/tests/gen/completionsImport_reExport_wrongName_test.go +++ b/internal/fourslash/tests/gen/completionsImport_reExport_wrongName_test.go @@ -33,22 +33,22 @@ export { x as y } from "./a"; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "x", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("const x: 0"), AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "y", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: ".", }, - })), + }, Detail: PtrTo("(alias) const y: 0\nexport y"), AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), diff --git a/internal/fourslash/tests/gen/completionsImport_reexportTransient_test.go b/internal/fourslash/tests/gen/completionsImport_reexportTransient_test.go index 14e7c532c9..c98d13c8c7 100644 --- a/internal/fourslash/tests/gen/completionsImport_reexportTransient_test.go +++ b/internal/fourslash/tests/gen/completionsImport_reexportTransient_test.go @@ -37,11 +37,11 @@ one/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "one", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./transient", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_require_addNew_test.go b/internal/fourslash/tests/gen/completionsImport_require_addNew_test.go index 5f38f4b5b1..322627ab42 100644 --- a/internal/fourslash/tests/gen/completionsImport_require_addNew_test.go +++ b/internal/fourslash/tests/gen/completionsImport_require_addNew_test.go @@ -31,11 +31,11 @@ x/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "x", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("(alias) const x: 0\nimport x"), AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), diff --git a/internal/fourslash/tests/gen/completionsImport_require_addToExisting_test.go b/internal/fourslash/tests/gen/completionsImport_require_addToExisting_test.go index e0ee34df82..d05a627f8d 100644 --- a/internal/fourslash/tests/gen/completionsImport_require_addToExisting_test.go +++ b/internal/fourslash/tests/gen/completionsImport_require_addToExisting_test.go @@ -34,11 +34,11 @@ x/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "x", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("(alias) const x: 0\nimport x"), AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), diff --git a/internal/fourslash/tests/gen/completionsImport_require_test.go b/internal/fourslash/tests/gen/completionsImport_require_test.go index aab622f2ef..00aab91f5b 100644 --- a/internal/fourslash/tests/gen/completionsImport_require_test.go +++ b/internal/fourslash/tests/gen/completionsImport_require_test.go @@ -31,11 +31,11 @@ fo/*b*/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("const foo: 0"), Kind: PtrTo(lsproto.CompletionItemKindVariable), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsImport_sortingModuleSpecifiers_test.go b/internal/fourslash/tests/gen/completionsImport_sortingModuleSpecifiers_test.go index 55aef8a1b6..ce364ba799 100644 --- a/internal/fourslash/tests/gen/completionsImport_sortingModuleSpecifiers_test.go +++ b/internal/fourslash/tests/gen/completionsImport_sortingModuleSpecifiers_test.go @@ -41,31 +41,31 @@ normalize/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "normalize", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "path", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "normalize", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "path/posix", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "normalize", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "path/win32", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_tsx_test.go b/internal/fourslash/tests/gen/completionsImport_tsx_test.go index 4f8e7c38b5..6e394a5bf3 100644 --- a/internal/fourslash/tests/gen/completionsImport_tsx_test.go +++ b/internal/fourslash/tests/gen/completionsImport_tsx_test.go @@ -32,11 +32,11 @@ export default function Foo() {}; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "Foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash1_test.go b/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash1_test.go index f76355c039..6bc47c034c 100644 --- a/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash1_test.go +++ b/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash1_test.go @@ -57,11 +57,11 @@ func TestCompletionsImport_umdDefaultNoCrash1(t *testing.T) { &lsproto.CompletionItem{ Label: "Dottie", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "dottie", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImport_umdModules2_moduleExports_test.go b/internal/fourslash/tests/gen/completionsImport_umdModules2_moduleExports_test.go index a1dfd2d6d8..78e7991f2d 100644 --- a/internal/fourslash/tests/gen/completionsImport_umdModules2_moduleExports_test.go +++ b/internal/fourslash/tests/gen/completionsImport_umdModules2_moduleExports_test.go @@ -41,11 +41,11 @@ const el1 =
foo
;` &lsproto.CompletionItem{ Label: "classNames", AdditionalTextEdits: fourslash.AnyTextEdits, - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "classnames", }, - })), + }, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, }, diff --git a/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules1_test.go b/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules1_test.go index 993593f4d2..7293d6799b 100644 --- a/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules1_test.go +++ b/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules1_test.go @@ -34,41 +34,41 @@ write/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "writeFile", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "fs", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "writeFile", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "node:fs", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "writeFile", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "fs/promises", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "writeFile", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "node:fs/promises", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules2_test.go b/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules2_test.go index 5c295f65f2..cc1ebfc7d6 100644 --- a/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules2_test.go +++ b/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules2_test.go @@ -36,21 +36,21 @@ write/**/` []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "writeFile", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "node:fs", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "writeFile", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "node:fs/promises", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsImport_windowsPathsProjectRelative_test.go b/internal/fourslash/tests/gen/completionsImport_windowsPathsProjectRelative_test.go index 8533cb5bea..c0acb25aa4 100644 --- a/internal/fourslash/tests/gen/completionsImport_windowsPathsProjectRelative_test.go +++ b/internal/fourslash/tests/gen/completionsImport_windowsPathsProjectRelative_test.go @@ -45,21 +45,21 @@ myFunction/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "myFunctionA", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "~/noIndex/a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "myFunctionB", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "~/withIndex", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -76,21 +76,21 @@ myFunction/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "myFunctionA", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "../noIndex/a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "myFunctionB", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "../withIndex", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, @@ -107,21 +107,21 @@ myFunction/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "myFunctionA", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "../noIndex/a", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, &lsproto.CompletionItem{ Label: "myFunctionB", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "../withIndex", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/completionsRecommended_namespace_test.go b/internal/fourslash/tests/gen/completionsRecommended_namespace_test.go index f81d6b2f98..2640c1b108 100644 --- a/internal/fourslash/tests/gen/completionsRecommended_namespace_test.go +++ b/internal/fourslash/tests/gen/completionsRecommended_namespace_test.go @@ -58,11 +58,11 @@ alpha.f(new /*c1*/);` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "Name", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, Detail: PtrTo("namespace Name"), Kind: PtrTo(lsproto.CompletionItemKindModule), AdditionalTextEdits: fourslash.AnyTextEdits, diff --git a/internal/fourslash/tests/gen/completionsUniqueSymbol_import_test.go b/internal/fourslash/tests/gen/completionsUniqueSymbol_import_test.go index cf8f74f548..66bb27cb0a 100644 --- a/internal/fourslash/tests/gen/completionsUniqueSymbol_import_test.go +++ b/internal/fourslash/tests/gen/completionsUniqueSymbol_import_test.go @@ -43,11 +43,11 @@ i[|./**/|];` &lsproto.CompletionItem{ Label: "publicSym", InsertText: PtrTo("[publicSym]"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./a", }, - })), + }, SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), AdditionalTextEdits: fourslash.AnyTextEdits, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ diff --git a/internal/fourslash/tests/gen/completionsWithDeprecatedTag10_test.go b/internal/fourslash/tests/gen/completionsWithDeprecatedTag10_test.go index 104b77761c..788d453490 100644 --- a/internal/fourslash/tests/gen/completionsWithDeprecatedTag10_test.go +++ b/internal/fourslash/tests/gen/completionsWithDeprecatedTag10_test.go @@ -30,11 +30,11 @@ export const foo = 0; Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "foo", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, Kind: PtrTo(lsproto.CompletionItemKindVariable), SortText: PtrTo(string(ls.DeprecateSortText(ls.SortTextAutoImportSuggestions))), diff --git a/internal/fourslash/tests/gen/importSuggestionsCache_exportUndefined_test.go b/internal/fourslash/tests/gen/importSuggestionsCache_exportUndefined_test.go index 01958857fa..64e8f7ea11 100644 --- a/internal/fourslash/tests/gen/importSuggestionsCache_exportUndefined_test.go +++ b/internal/fourslash/tests/gen/importSuggestionsCache_exportUndefined_test.go @@ -38,11 +38,11 @@ export = x; Label: "x", AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./undefinedAlias", }, - })), + }, }, }, }, @@ -59,11 +59,11 @@ export = x; Label: "x", AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./undefinedAlias", }, - })), + }, }, }, }, diff --git a/internal/fourslash/tests/gen/importSuggestionsCache_invalidPackageJson_test.go b/internal/fourslash/tests/gen/importSuggestionsCache_invalidPackageJson_test.go index 93fa013317..38ebadef27 100644 --- a/internal/fourslash/tests/gen/importSuggestionsCache_invalidPackageJson_test.go +++ b/internal/fourslash/tests/gen/importSuggestionsCache_invalidPackageJson_test.go @@ -45,11 +45,11 @@ readF/**/` Includes: []fourslash.CompletionsExpectedItem{ &lsproto.CompletionItem{ Label: "readFile", - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "fs", }, - })), + }, AdditionalTextEdits: fourslash.AnyTextEdits, SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), }, diff --git a/internal/fourslash/tests/gen/importTypeCompletions1_test.go b/internal/fourslash/tests/gen/importTypeCompletions1_test.go index 3e586eb516..155e925d79 100644 --- a/internal/fourslash/tests/gen/importTypeCompletions1_test.go +++ b/internal/fourslash/tests/gen/importTypeCompletions1_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -32,11 +31,11 @@ export interface Foo {} &lsproto.CompletionItem{ Label: "Foo", InsertText: PtrTo("import type { Foo } from \"./foo\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ NewText: "Foo", diff --git a/internal/fourslash/tests/gen/importTypeCompletions3_test.go b/internal/fourslash/tests/gen/importTypeCompletions3_test.go index 64d207be07..dbce0bda89 100644 --- a/internal/fourslash/tests/gen/importTypeCompletions3_test.go +++ b/internal/fourslash/tests/gen/importTypeCompletions3_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -32,11 +31,11 @@ export interface Foo {} &lsproto.CompletionItem{ Label: "Foo", InsertText: PtrTo("import type { Foo } from \"./foo\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ NewText: "Foo", diff --git a/internal/fourslash/tests/gen/importTypeCompletions4_test.go b/internal/fourslash/tests/gen/importTypeCompletions4_test.go index ba2465a5e1..14cae4b8dc 100644 --- a/internal/fourslash/tests/gen/importTypeCompletions4_test.go +++ b/internal/fourslash/tests/gen/importTypeCompletions4_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -33,11 +32,11 @@ export = Foo; &lsproto.CompletionItem{ Label: "Foo", InsertText: PtrTo("import type Foo from \"./foo\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ NewText: "Foo", diff --git a/internal/fourslash/tests/gen/importTypeCompletions5_test.go b/internal/fourslash/tests/gen/importTypeCompletions5_test.go index a05887ff74..725b844260 100644 --- a/internal/fourslash/tests/gen/importTypeCompletions5_test.go +++ b/internal/fourslash/tests/gen/importTypeCompletions5_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -34,11 +33,11 @@ export = Foo; &lsproto.CompletionItem{ Label: "Foo", InsertText: PtrTo("import type Foo = require(\"./foo\");"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ NewText: "Foo", diff --git a/internal/fourslash/tests/gen/importTypeCompletions6_test.go b/internal/fourslash/tests/gen/importTypeCompletions6_test.go index 49d825be38..ec387c2ac4 100644 --- a/internal/fourslash/tests/gen/importTypeCompletions6_test.go +++ b/internal/fourslash/tests/gen/importTypeCompletions6_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -33,11 +32,11 @@ export interface Foo { }; &lsproto.CompletionItem{ Label: "Foo", InsertText: PtrTo("import type { Foo } from \"./foo\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ NewText: "Foo", diff --git a/internal/fourslash/tests/gen/importTypeCompletions7_test.go b/internal/fourslash/tests/gen/importTypeCompletions7_test.go index 1e2a29b9b5..82c46afe0f 100644 --- a/internal/fourslash/tests/gen/importTypeCompletions7_test.go +++ b/internal/fourslash/tests/gen/importTypeCompletions7_test.go @@ -34,11 +34,11 @@ export = Foo; &lsproto.CompletionItem{ Label: "Foo", InsertText: PtrTo("import Foo from \"./foo\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ NewText: "Foo", diff --git a/internal/fourslash/tests/gen/importTypeCompletions8_test.go b/internal/fourslash/tests/gen/importTypeCompletions8_test.go index 024b38ff05..221d24cf1a 100644 --- a/internal/fourslash/tests/gen/importTypeCompletions8_test.go +++ b/internal/fourslash/tests/gen/importTypeCompletions8_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -32,11 +31,11 @@ export interface Foo {} &lsproto.CompletionItem{ Label: "Foo", InsertText: PtrTo("import { type Foo } from \"./foo\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ NewText: "Foo", diff --git a/internal/fourslash/tests/gen/importTypeCompletions9_test.go b/internal/fourslash/tests/gen/importTypeCompletions9_test.go index d6460a2e54..8820440158 100644 --- a/internal/fourslash/tests/gen/importTypeCompletions9_test.go +++ b/internal/fourslash/tests/gen/importTypeCompletions9_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -32,11 +31,11 @@ export interface Foo {} &lsproto.CompletionItem{ Label: "Foo", InsertText: PtrTo("import { type Foo } from \"./foo\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./foo", }, - })), + }, TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ NewText: "Foo", diff --git a/internal/fourslash/tests/gen/jsFileImportNoTypes2_test.go b/internal/fourslash/tests/gen/jsFileImportNoTypes2_test.go index 84c2d97611..df3805e2b4 100644 --- a/internal/fourslash/tests/gen/jsFileImportNoTypes2_test.go +++ b/internal/fourslash/tests/gen/jsFileImportNoTypes2_test.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/fourslash" . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -45,38 +44,38 @@ import /**/` &lsproto.CompletionItem{ Label: "TestClassBaseline", InsertText: PtrTo("import { TestClassBaseline } from \"./baseline\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./baseline", }, - })), + }, }, &lsproto.CompletionItem{ Label: "TestClassExportList", InsertText: PtrTo("import { TestClassExportList } from \"./exportList\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./exportList", }, - })), + }, }, &lsproto.CompletionItem{ Label: "TestClassReExport", InsertText: PtrTo("import { TestClassReExport } from \"./reExport\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./reExport", }, - })), + }, }, &lsproto.CompletionItem{ Label: "TestDefaultClass", InsertText: PtrTo("import TestDefaultClass from \"./default\";"), - Data: PtrTo(any(&ls.CompletionItemData{ - AutoImport: &ls.AutoImportData{ + Data: &lsproto.CompletionItemData{ + AutoImport: &lsproto.AutoImportData{ ModuleSpecifier: "./default", }, - })), + }, }, }, }, diff --git a/internal/ls/autoimports.go b/internal/ls/autoimports.go index 6a44f28299..5af25f33ad 100644 --- a/internal/ls/autoimports.go +++ b/internal/ls/autoimports.go @@ -38,17 +38,10 @@ type symbolExportEntry struct { moduleSymbol *ast.Symbol } -type ExportInfoMapKey struct { - SymbolName string - SymbolId ast.SymbolId - AmbientModuleName string - ModuleFile tspath.Path -} - -func newExportInfoMapKey(importedName string, symbol *ast.Symbol, ambientModuleNameKey string, ch *checker.Checker) ExportInfoMapKey { - return ExportInfoMapKey{ +func newExportInfoMapKey(importedName string, symbol *ast.Symbol, ambientModuleNameKey string, ch *checker.Checker) lsproto.ExportInfoMapKey { + return lsproto.ExportInfoMapKey{ SymbolName: importedName, - SymbolId: ast.GetSymbolId(ch.SkipAlias(symbol)), + SymbolId: uint64(ast.GetSymbolId(ch.SkipAlias(symbol))), AmbientModuleName: ambientModuleNameKey, } } @@ -72,7 +65,7 @@ type CachedSymbolExportInfo struct { } type ExportInfoMap struct { - exportInfo collections.OrderedMap[ExportInfoMapKey, []*CachedSymbolExportInfo] + exportInfo collections.OrderedMap[lsproto.ExportInfoMapKey, []*CachedSymbolExportInfo] symbols map[int]symbolExportEntry exportInfoId int usableByFileName tspath.Path @@ -86,11 +79,11 @@ type ExportInfoMap struct { func (e *ExportInfoMap) clear() { e.symbols = map[int]symbolExportEntry{} - e.exportInfo = collections.OrderedMap[ExportInfoMapKey, []*CachedSymbolExportInfo]{} + e.exportInfo = collections.OrderedMap[lsproto.ExportInfoMapKey, []*CachedSymbolExportInfo]{} e.usableByFileName = "" } -func (e *ExportInfoMap) get(importingFile tspath.Path, ch *checker.Checker, key ExportInfoMapKey) []*SymbolExportInfo { +func (e *ExportInfoMap) get(importingFile tspath.Path, ch *checker.Checker, key lsproto.ExportInfoMapKey) []*SymbolExportInfo { if e.usableByFileName != importingFile { return nil } @@ -223,7 +216,7 @@ func (e *ExportInfoMap) search( importingFile tspath.Path, preferCapitalized bool, matches func(name string, targetFlags ast.SymbolFlags) bool, - action func(info []*SymbolExportInfo, symbolName string, isFromAmbientModule bool, key ExportInfoMapKey) []*SymbolExportInfo, + action func(info []*SymbolExportInfo, symbolName string, isFromAmbientModule bool, key lsproto.ExportInfoMapKey) []*SymbolExportInfo, ) []*SymbolExportInfo { if importingFile != e.usableByFileName { return nil @@ -355,7 +348,7 @@ func (l *LanguageService) getImportCompletionAction( moduleSymbol *ast.Symbol, sourceFile *ast.SourceFile, position int, - exportMapKey ExportInfoMapKey, + exportMapKey lsproto.ExportInfoMapKey, symbolName string, isJsxTagName bool, // formatContext *formattingContext, @@ -380,7 +373,7 @@ func NewExportInfoMap(globalsTypingCacheLocation string) *ExportInfoMap { return &ExportInfoMap{ packages: map[string]string{}, symbols: map[int]symbolExportEntry{}, - exportInfo: collections.OrderedMap[ExportInfoMapKey, []*CachedSymbolExportInfo]{}, + exportInfo: collections.OrderedMap[lsproto.ExportInfoMapKey, []*CachedSymbolExportInfo]{}, globalTypingsCacheLocation: globalsTypingCacheLocation, } } diff --git a/internal/ls/autoimportsexportinfo.go b/internal/ls/autoimportsexportinfo.go index 1d3c0ee771..1ff751d50b 100644 --- a/internal/ls/autoimportsexportinfo.go +++ b/internal/ls/autoimportsexportinfo.go @@ -7,6 +7,7 @@ import ( "github.com/microsoft/typescript-go/internal/checker" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/stringutil" ) @@ -15,7 +16,7 @@ func (l *LanguageService) getExportInfoMap( ctx context.Context, ch *checker.Checker, importingFile *ast.SourceFile, - exportMapKey ExportInfoMapKey, + exportMapKey lsproto.ExportInfoMapKey, ) []*SymbolExportInfo { expInfoMap := NewExportInfoMap(l.GetProgram().GetGlobalTypingsCacheLocation()) moduleCount := 0 @@ -83,7 +84,7 @@ func (l *LanguageService) searchExportInfosForCompletions( isRightOfOpenTag bool, isTypeOnlyLocation bool, lowerCaseTokenText string, - action func([]*SymbolExportInfo, string, bool, ExportInfoMapKey) []*SymbolExportInfo, + action func([]*SymbolExportInfo, string, bool, lsproto.ExportInfoMapKey) []*SymbolExportInfo, ) { symbolNameMatches := map[string]bool{} symbolNameMatch := func(symbolName string) bool { diff --git a/internal/ls/completions.go b/internal/ls/completions.go index 97edbdf59f..53e1db4d2f 100644 --- a/internal/ls/completions.go +++ b/internal/ls/completions.go @@ -11,7 +11,6 @@ import ( "unicode" "unicode/utf8" - "github.com/go-json-experiment/json" "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/astnav" "github.com/microsoft/typescript-go/internal/binder" @@ -59,12 +58,11 @@ func ensureItemData(fileName string, pos int, list *lsproto.CompletionList) *lsp } for _, item := range list.Items { if item.Data == nil { - var data any = &CompletionItemData{ + item.Data = &lsproto.CompletionItemData{ FileName: fileName, - Position: pos, + Position: int32(pos), Name: item.Label, } - item.Data = &data } } return list @@ -242,19 +240,19 @@ func (origin *symbolOriginInfo) moduleSymbol() *ast.Symbol { } } -func (origin *symbolOriginInfo) toCompletionEntryData() *AutoImportData { +func (origin *symbolOriginInfo) toCompletionEntryData() *lsproto.AutoImportData { debug.Assert(origin.kind&symbolOriginInfoKindExport != 0, fmt.Sprintf("completionEntryData is not generated for symbolOriginInfo of type %T", origin.data)) var ambientModuleName *string if origin.fileName == "" { ambientModuleName = strPtrTo(stringutil.StripQuotes(origin.moduleSymbol().Name)) } - var isPackageJsonImport core.Tristate + var isPackageJsonImport *bool if origin.isFromPackageJson { - isPackageJsonImport = core.TSTrue + isPackageJsonImport = ptrTo(true) } data := origin.data.(*symbolOriginInfoExport) - return &AutoImportData{ + return &lsproto.AutoImportData{ ExportName: data.exportName, ExportMapKey: data.exportMapKey, ModuleSpecifier: data.moduleSpecifier, @@ -268,7 +266,7 @@ type symbolOriginInfoExport struct { symbolName string moduleSymbol *ast.Symbol exportName string - exportMapKey ExportInfoMapKey + exportMapKey lsproto.ExportInfoMapKey moduleSpecifier string } @@ -1175,7 +1173,7 @@ func (l *LanguageService) getCompletionData( // !!! moduleSpecifierCache := host.getModuleSpecifierCache(); // !!! packageJsonAutoImportProvider := host.getPackageJsonAutoImportProvider(); - addSymbolToList := func(info []*SymbolExportInfo, symbolName string, isFromAmbientModule bool, exportMapKey ExportInfoMapKey) []*SymbolExportInfo { + addSymbolToList := func(info []*SymbolExportInfo, symbolName string, isFromAmbientModule bool, exportMapKey lsproto.ExportInfoMapKey) []*SymbolExportInfo { // Do a relatively cheap check to bail early if all re-exports are non-importable // due to file location or package.json dependency filtering. For non-node16+ // module resolution modes, getting past this point guarantees that we'll be @@ -2268,7 +2266,7 @@ func (l *LanguageService) createCompletionItem( } } - var autoImportData *AutoImportData + var autoImportData *lsproto.AutoImportData if originIsExport(origin) { autoImportData = origin.toCompletionEntryData() hasAction = data.importStatementCompletion == nil @@ -3272,10 +3270,9 @@ func compareCompletionEntries(entryInSlice *lsproto.CompletionItem, entryToInser result = compareStrings(entryInSlice.Label, entryToInsert.Label) } if result == stringutil.ComparisonEqual && entryInSlice.Data != nil && entryToInsert.Data != nil { - sliceEntryData, ok1 := (*entryInSlice.Data).(*CompletionItemData) - insertEntryData, ok2 := (*entryToInsert.Data).(*CompletionItemData) - if ok1 && ok2 && - sliceEntryData.AutoImport != nil && sliceEntryData.AutoImport.ModuleSpecifier != "" && + sliceEntryData := entryInSlice.Data + insertEntryData := entryToInsert.Data + if sliceEntryData.AutoImport != nil && sliceEntryData.AutoImport.ModuleSpecifier != "" && insertEntryData.AutoImport != nil && insertEntryData.AutoImport.ModuleSpecifier != "" { // Sort same-named auto-imports by module specifier result = tspath.CompareNumberOfDirectorySeparators( @@ -4494,12 +4491,12 @@ func (l *LanguageService) createLSPCompletionItem( hasAction bool, preselect bool, source string, - autoImportEntryData *AutoImportData, + autoImportEntryData *lsproto.AutoImportData, ) *lsproto.CompletionItem { kind := getCompletionsSymbolKind(elementKind) - var data any = &CompletionItemData{ + data := &lsproto.CompletionItemData{ FileName: file.FileName(), - Position: position, + Position: int32(position), Source: source, Name: name, AutoImport: autoImportEntryData, @@ -4577,7 +4574,7 @@ func (l *LanguageService) createLSPCompletionItem( InsertTextFormat: insertTextFormat, TextEdit: textEdit, CommitCharacters: commitCharacters, - Data: &data, + Data: data, } } @@ -4919,33 +4916,7 @@ func getArgumentInfoForCompletions(node *ast.Node, position int, file *ast.Sourc } } -type CompletionItemData struct { - FileName string `json:"fileName"` - Position int `json:"position"` - Source string `json:"source,omitempty"` - Name string `json:"name,omitempty"` - AutoImport *AutoImportData `json:"autoImport,omitempty"` -} - -type AutoImportData struct { - /** - * The name of the property or export in the module's symbol table. Differs from the completion name - * in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default. - */ - ExportName string `json:"exportName"` - ExportMapKey ExportInfoMapKey `json:"exportMapKey"` - ModuleSpecifier string `json:"moduleSpecifier"` - - /** The file name declaring the export's module symbol, if it was an external module */ - FileName string `json:"fileName"` - /** The module name (with quotes stripped) of the export's module symbol, if it was an ambient module */ - AmbientModuleName *string `json:"ambientModuleName"` - - /** True if the export was found in the package.json AutoImportProvider */ - IsPackageJsonImport core.Tristate `json:"isPackageJsonImport"` -} - -func (d *AutoImportData) toSymbolOriginExport(symbolName string, moduleSymbol *ast.Symbol, isDefaultExport bool) *symbolOriginInfoExport { +func autoImportDataToSymbolOriginExport(d *lsproto.AutoImportData, symbolName string, moduleSymbol *ast.Symbol, isDefaultExport bool) *symbolOriginInfoExport { return &symbolOriginInfoExport{ symbolName: symbolName, moduleSymbol: moduleSymbol, @@ -4982,7 +4953,7 @@ const ( func (l *LanguageService) ResolveCompletionItem( ctx context.Context, item *lsproto.CompletionItem, - data *CompletionItemData, + data *lsproto.CompletionItemData, ) (*lsproto.CompletionItem, error) { if data == nil { return nil, errors.New("completion item data is nil") @@ -4993,19 +4964,7 @@ func (l *LanguageService) ResolveCompletionItem( return nil, fmt.Errorf("file not found: %s", data.FileName) } - return l.getCompletionItemDetails(ctx, program, data.Position, file, item, data), nil -} - -func GetCompletionItemData(item *lsproto.CompletionItem) (*CompletionItemData, error) { - bytes, err := json.Marshal(item.Data) - if err != nil { - return nil, fmt.Errorf("failed to marshal completion item data: %w", err) - } - var itemData CompletionItemData - if err := json.Unmarshal(bytes, &itemData); err != nil { - return nil, fmt.Errorf("failed to unmarshal completion item data: %w", err) - } - return &itemData, nil + return l.getCompletionItemDetails(ctx, program, int(data.Position), file, item, data), nil } func getCompletionDocumentationFormat(ctx context.Context) lsproto.MarkupKind { @@ -5018,7 +4977,7 @@ func (l *LanguageService) getCompletionItemDetails( position int, file *ast.SourceFile, item *lsproto.CompletionItem, - data *CompletionItemData, + data *lsproto.CompletionItemData, ) *lsproto.CompletionItem { checker, done := program.GetTypeCheckerForFile(ctx, file) defer done() @@ -5117,7 +5076,7 @@ func (l *LanguageService) getSymbolCompletionFromItemData( ch *checker.Checker, file *ast.SourceFile, position int, - itemData *CompletionItemData, + itemData *lsproto.CompletionItemData, ) detailsData { if itemData.Source == SourceSwitchCases { return detailsData{ @@ -5189,7 +5148,7 @@ func (l *LanguageService) getSymbolCompletionFromItemData( return detailsData{} } -func (l *LanguageService) getAutoImportSymbolFromCompletionEntryData(ch *checker.Checker, name string, autoImportData *AutoImportData) *symbolDetails { +func (l *LanguageService) getAutoImportSymbolFromCompletionEntryData(ch *checker.Checker, name string, autoImportData *lsproto.AutoImportData) *symbolDetails { containingProgram := l.GetProgram() // !!! isPackageJson ? packageJsonAutoimportProvider : program var moduleSymbol *ast.Symbol if autoImportData.AmbientModuleName != nil { @@ -5224,9 +5183,9 @@ func (l *LanguageService) getAutoImportSymbolFromCompletionEntryData(ch *checker origin := &symbolOriginInfo{ kind: symbolOriginInfoKindExport, fileName: autoImportData.FileName, - isFromPackageJson: autoImportData.IsPackageJsonImport.IsTrue(), + isFromPackageJson: autoImportData.IsPackageJsonImport != nil && *autoImportData.IsPackageJsonImport, isDefaultExport: isDefaultExport, - data: autoImportData.toSymbolOriginExport(name, moduleSymbol, isDefaultExport), + data: autoImportDataToSymbolOriginExport(autoImportData, name, moduleSymbol, isDefaultExport), } return &symbolDetails{symbol: symbol, origin: origin} @@ -5291,7 +5250,7 @@ func (l *LanguageService) createCompletionDetailsForSymbol( } // !!! snippets -func (l *LanguageService) getCompletionItemActions(ctx context.Context, ch *checker.Checker, file *ast.SourceFile, position int, itemData *CompletionItemData, symbolDetails *symbolDetails) []codeAction { +func (l *LanguageService) getCompletionItemActions(ctx context.Context, ch *checker.Checker, file *ast.SourceFile, position int, itemData *lsproto.CompletionItemData, symbolDetails *symbolDetails) []codeAction { if itemData.AutoImport != nil && itemData.AutoImport.ModuleSpecifier != "" && symbolDetails.previousToken != nil { // Import statement completion: 'import c|' if symbolDetails.contextToken != nil && l.getImportStatementCompletionInfo(symbolDetails.contextToken, file).replacementSpan != nil { @@ -5321,7 +5280,7 @@ func (l *LanguageService) getCompletionItemActions(ctx context.Context, ch *chec moduleSymbol := symbolDetails.origin.moduleSymbol() - var exportMapkey ExportInfoMapKey + var exportMapkey lsproto.ExportInfoMapKey if itemData.AutoImport != nil { exportMapkey = itemData.AutoImport.ExportMapKey } diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 900dcc5c20..9e15f3de44 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -43,8 +43,143 @@ const customStructures: Structure[] = [ ], documentation: "InitializationOptions contains user-provided initialization options.", }, + { + name: "ExportInfoMapKey", + properties: [ + { + name: "symbolName", + type: { kind: "base", name: "string" }, + documentation: "The symbol name.", + }, + { + name: "symbolId", + type: { kind: "reference", name: "uint64" }, + documentation: "The symbol ID.", + }, + { + name: "ambientModuleName", + type: { kind: "base", name: "string" }, + documentation: "The ambient module name.", + }, + { + name: "moduleFile", + type: { kind: "base", name: "string" }, + documentation: "The module file path.", + }, + ], + documentation: "ExportInfoMapKey uniquely identifies an export for auto-import purposes.", + }, + { + name: "AutoImportData", + properties: [ + { + name: "exportName", + type: { kind: "base", name: "string" }, + documentation: "The name of the property or export in the module's symbol table. Differs from the completion name in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default.", + }, + { + name: "exportMapKey", + type: { kind: "reference", name: "ExportInfoMapKey" }, + documentation: "The export map key for this auto-import.", + }, + { + name: "moduleSpecifier", + type: { kind: "base", name: "string" }, + documentation: "The module specifier for this auto-import.", + }, + { + name: "fileName", + type: { kind: "base", name: "string" }, + documentation: "The file name declaring the export's module symbol, if it was an external module.", + }, + { + name: "ambientModuleName", + type: { kind: "base", name: "string" }, + optional: true, + documentation: "The module name (with quotes stripped) of the export's module symbol, if it was an ambient module.", + }, + { + name: "isPackageJsonImport", + type: { kind: "base", name: "boolean" }, + optional: true, + documentation: "True if the export was found in the package.json AutoImportProvider.", + }, + ], + documentation: "AutoImportData contains information about an auto-import suggestion.", + }, + { + name: "CompletionItemData", + properties: [ + { + name: "fileName", + type: { kind: "base", name: "string" }, + documentation: "The file name where the completion was requested.", + }, + { + name: "position", + type: { kind: "base", name: "integer" }, + documentation: "The position where the completion was requested.", + }, + { + name: "source", + type: { kind: "base", name: "string" }, + documentation: "Special source value for disambiguation.", + }, + { + name: "name", + type: { kind: "base", name: "string" }, + documentation: "The name of the completion item.", + }, + { + name: "autoImport", + type: { kind: "reference", name: "AutoImportData" }, + optional: true, + documentation: "Auto-import data for this completion item.", + }, + ], + documentation: "CompletionItemData is preserved on a CompletionItem between CompletionRequest and CompletionResolveRequest.", + }, ]; +// Track which custom Data structures were declared explicitly +const explicitDataStructures = new Set(customStructures.map(s => s.name)); + +// Patch the model to use custom types +function patchModel() { + // Track which Data types we need to create as placeholders + const neededDataStructures = new Set(); + + for (const structure of model.structures) { + for (const prop of structure.properties) { + // Replace initializationOptions type with custom InitializationOptions + if (prop.name === "initializationOptions" && prop.type.kind === "reference" && prop.type.name === "LSPAny") { + prop.type = { kind: "reference", name: "InitializationOptions" }; + } + + // Replace Data *any fields with custom typed Data fields + if (prop.name === "data" && prop.type.kind === "reference" && prop.type.name === "LSPAny") { + const customDataType = `${structure.name}Data`; + prop.type = { kind: "reference", name: customDataType }; + + // If we haven't explicitly declared this Data structure, we'll need a placeholder + if (!explicitDataStructures.has(customDataType)) { + neededDataStructures.add(customDataType); + } + } + } + } + + // Create placeholder structures for Data types that weren't explicitly declared + for (const dataTypeName of neededDataStructures) { + const baseName = dataTypeName.replace(/Data$/, ""); + customStructures.push({ + name: dataTypeName, + properties: [], + documentation: `${dataTypeName} is a placeholder for custom data preserved on a ${baseName}.`, + }); + } +} + // Preprocess the model to inline extends/mixins contents function preprocessModel() { const structureMap = new Map(); @@ -92,23 +227,11 @@ function preprocessModel() { } } -// Add custom structures to the model -model.structures.unshift(...customStructures); - -// Patch the model to use custom types -function patchModel() { - for (const structure of model.structures) { - for (const prop of structure.properties) { - // Replace initializationOptions type with custom InitializationOptions - if (prop.name === "initializationOptions" && prop.type.kind === "reference" && prop.type.name === "LSPAny") { - prop.type = { kind: "reference", name: "InitializationOptions" }; - } - } - } -} - patchModel(); +// Add custom structures to the model (including any placeholders created during patching) +model.structures.push(...customStructures); + // Preprocess the model before proceeding preprocessModel(); @@ -410,6 +533,7 @@ const typeAliasOverrides = new Map([ ["LSPAny", { name: "any", needsPointer: false }], ["LSPArray", { name: "[]any", needsPointer: false }], ["LSPObject", { name: "map[string]any", needsPointer: false }], + ["uint64", { name: "uint64", needsPointer: false }], ]); /** @@ -435,6 +559,7 @@ function collectTypeDefinitions() { "VersionedNotebookDocumentIdentifier", "VersionedTextDocumentIdentifier", "OptionalVersionedTextDocumentIdentifier", + "ExportInfoMapKey", ]); // Process all structures diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 53f9a21e13..86acb58e4b 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -13,12 +13,6 @@ import ( // Structures -// InitializationOptions contains user-provided initialization options. -type InitializationOptions struct { - // DisablePushDiagnostics disables automatic pushing of diagnostics to the client. - DisablePushDiagnostics *bool `json:"disablePushDiagnostics,omitzero"` -} - type ImplementationParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` @@ -1617,7 +1611,7 @@ type CallHierarchyItem struct { // A data entry field that is preserved between a call hierarchy prepare and // incoming calls or outgoing calls requests. - Data *any `json:"data,omitzero"` + Data *CallHierarchyItemData `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*CallHierarchyItem)(nil) @@ -3370,7 +3364,7 @@ type TypeHierarchyItem struct { // supertypes or subtypes requests. It could also be used to identify the // type hierarchy in the server, helping improve the performance on // resolving supertypes and subtypes. - Data *any `json:"data,omitzero"` + Data *TypeHierarchyItemData `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*TypeHierarchyItem)(nil) @@ -3911,7 +3905,7 @@ type InlayHint struct { // A data entry field that is preserved on an inlay hint between // a `textDocument/inlayHint` and a `inlayHint/resolve` request. - Data *any `json:"data,omitzero"` + Data *InlayHintData `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*InlayHint)(nil) @@ -6731,7 +6725,7 @@ type CompletionItem struct { // A data entry field that is preserved on a completion item between a // CompletionRequest and a CompletionResolveRequest. - Data *any `json:"data,omitzero"` + Data *CompletionItemData `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*CompletionItem)(nil) @@ -8496,7 +8490,7 @@ type CodeAction struct { // a `textDocument/codeAction` and a `codeAction/resolve` request. // // Since: 3.16.0 - Data *any `json:"data,omitzero"` + Data *CodeActionData `json:"data,omitzero"` // Tags for this code action. // @@ -8768,7 +8762,7 @@ type WorkspaceSymbol struct { // A data entry field that is preserved on a workspace symbol between a // workspace symbol request and a workspace symbol resolve request. - Data *any `json:"data,omitzero"` + Data *WorkspaceSymbolData `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*WorkspaceSymbol)(nil) @@ -8931,7 +8925,7 @@ type CodeLens struct { // A data entry field that is preserved on a code lens item between // a CodeLensRequest and a CodeLensResolveRequest - Data *any `json:"data,omitzero"` + Data *CodeLensData `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*CodeLens)(nil) @@ -9124,7 +9118,7 @@ type DocumentLink struct { // A data entry field that is preserved on a document link between a // DocumentLinkRequest and a DocumentLinkResolveRequest. - Data *any `json:"data,omitzero"` + Data *DocumentLinkData `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentLink)(nil) @@ -14010,7 +14004,7 @@ type Diagnostic struct { // notification and `textDocument/codeAction` request. // // Since: 3.16.0 - Data *any `json:"data,omitzero"` + Data *DiagnosticData `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*Diagnostic)(nil) @@ -14269,7 +14263,7 @@ type CompletionItemDefaults struct { // A default data value. // // Since: 3.17.0 - Data *any `json:"data,omitzero"` + Data *CompletionItemDefaultsData `json:"data,omitzero"` } // Specifies how fields from a completion item should be combined with those @@ -19753,6 +19747,309 @@ type ClientSemanticTokensRequestFullDelta struct { Delta *bool `json:"delta,omitzero"` } +// InitializationOptions contains user-provided initialization options. +type InitializationOptions struct { + // DisablePushDiagnostics disables automatic pushing of diagnostics to the client. + DisablePushDiagnostics *bool `json:"disablePushDiagnostics,omitzero"` +} + +// ExportInfoMapKey uniquely identifies an export for auto-import purposes. +type ExportInfoMapKey struct { + // The symbol name. + SymbolName string `json:"symbolName"` + + // The symbol ID. + SymbolId uint64 `json:"symbolId"` + + // The ambient module name. + AmbientModuleName string `json:"ambientModuleName"` + + // The module file path. + ModuleFile string `json:"moduleFile"` +} + +var _ json.UnmarshalerFrom = (*ExportInfoMapKey)(nil) + +func (s *ExportInfoMapKey) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + var ( + seenSymbolName bool + seenSymbolId bool + seenAmbientModuleName bool + seenModuleFile bool + ) + + if k := dec.PeekKind(); k != '{' { + return fmt.Errorf("expected object start, but encountered %v", k) + } + if _, err := dec.ReadToken(); err != nil { + return err + } + + for dec.PeekKind() != '}' { + name, err := dec.ReadValue() + if err != nil { + return err + } + switch string(name) { + case `"symbolName"`: + seenSymbolName = true + if err := json.UnmarshalDecode(dec, &s.SymbolName); err != nil { + return err + } + case `"symbolId"`: + seenSymbolId = true + if err := json.UnmarshalDecode(dec, &s.SymbolId); err != nil { + return err + } + case `"ambientModuleName"`: + seenAmbientModuleName = true + if err := json.UnmarshalDecode(dec, &s.AmbientModuleName); err != nil { + return err + } + case `"moduleFile"`: + seenModuleFile = true + if err := json.UnmarshalDecode(dec, &s.ModuleFile); err != nil { + return err + } + default: + // Ignore unknown properties. + } + } + + if _, err := dec.ReadToken(); err != nil { + return err + } + + if !seenSymbolName { + return fmt.Errorf("required property 'symbolName' is missing") + } + if !seenSymbolId { + return fmt.Errorf("required property 'symbolId' is missing") + } + if !seenAmbientModuleName { + return fmt.Errorf("required property 'ambientModuleName' is missing") + } + if !seenModuleFile { + return fmt.Errorf("required property 'moduleFile' is missing") + } + + return nil +} + +// AutoImportData contains information about an auto-import suggestion. +type AutoImportData struct { + // The name of the property or export in the module's symbol table. Differs from the completion name in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default. + ExportName string `json:"exportName"` + + // The export map key for this auto-import. + ExportMapKey ExportInfoMapKey `json:"exportMapKey"` + + // The module specifier for this auto-import. + ModuleSpecifier string `json:"moduleSpecifier"` + + // The file name declaring the export's module symbol, if it was an external module. + FileName string `json:"fileName"` + + // The module name (with quotes stripped) of the export's module symbol, if it was an ambient module. + AmbientModuleName *string `json:"ambientModuleName,omitzero"` + + // True if the export was found in the package.json AutoImportProvider. + IsPackageJsonImport *bool `json:"isPackageJsonImport,omitzero"` +} + +var _ json.UnmarshalerFrom = (*AutoImportData)(nil) + +func (s *AutoImportData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + var ( + seenExportName bool + seenExportMapKey bool + seenModuleSpecifier bool + seenFileName bool + ) + + if k := dec.PeekKind(); k != '{' { + return fmt.Errorf("expected object start, but encountered %v", k) + } + if _, err := dec.ReadToken(); err != nil { + return err + } + + for dec.PeekKind() != '}' { + name, err := dec.ReadValue() + if err != nil { + return err + } + switch string(name) { + case `"exportName"`: + seenExportName = true + if err := json.UnmarshalDecode(dec, &s.ExportName); err != nil { + return err + } + case `"exportMapKey"`: + seenExportMapKey = true + if err := json.UnmarshalDecode(dec, &s.ExportMapKey); err != nil { + return err + } + case `"moduleSpecifier"`: + seenModuleSpecifier = true + if err := json.UnmarshalDecode(dec, &s.ModuleSpecifier); err != nil { + return err + } + case `"fileName"`: + seenFileName = true + if err := json.UnmarshalDecode(dec, &s.FileName); err != nil { + return err + } + case `"ambientModuleName"`: + if err := json.UnmarshalDecode(dec, &s.AmbientModuleName); err != nil { + return err + } + case `"isPackageJsonImport"`: + if err := json.UnmarshalDecode(dec, &s.IsPackageJsonImport); err != nil { + return err + } + default: + // Ignore unknown properties. + } + } + + if _, err := dec.ReadToken(); err != nil { + return err + } + + if !seenExportName { + return fmt.Errorf("required property 'exportName' is missing") + } + if !seenExportMapKey { + return fmt.Errorf("required property 'exportMapKey' is missing") + } + if !seenModuleSpecifier { + return fmt.Errorf("required property 'moduleSpecifier' is missing") + } + if !seenFileName { + return fmt.Errorf("required property 'fileName' is missing") + } + + return nil +} + +// CompletionItemData is preserved on a CompletionItem between CompletionRequest and CompletionResolveRequest. +type CompletionItemData struct { + // The file name where the completion was requested. + FileName string `json:"fileName"` + + // The position where the completion was requested. + Position int32 `json:"position"` + + // Special source value for disambiguation. + Source string `json:"source"` + + // The name of the completion item. + Name string `json:"name"` + + // Auto-import data for this completion item. + AutoImport *AutoImportData `json:"autoImport,omitzero"` +} + +var _ json.UnmarshalerFrom = (*CompletionItemData)(nil) + +func (s *CompletionItemData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + var ( + seenFileName bool + seenPosition bool + seenSource bool + seenName bool + ) + + if k := dec.PeekKind(); k != '{' { + return fmt.Errorf("expected object start, but encountered %v", k) + } + if _, err := dec.ReadToken(); err != nil { + return err + } + + for dec.PeekKind() != '}' { + name, err := dec.ReadValue() + if err != nil { + return err + } + switch string(name) { + case `"fileName"`: + seenFileName = true + if err := json.UnmarshalDecode(dec, &s.FileName); err != nil { + return err + } + case `"position"`: + seenPosition = true + if err := json.UnmarshalDecode(dec, &s.Position); err != nil { + return err + } + case `"source"`: + seenSource = true + if err := json.UnmarshalDecode(dec, &s.Source); err != nil { + return err + } + case `"name"`: + seenName = true + if err := json.UnmarshalDecode(dec, &s.Name); err != nil { + return err + } + case `"autoImport"`: + if err := json.UnmarshalDecode(dec, &s.AutoImport); err != nil { + return err + } + default: + // Ignore unknown properties. + } + } + + if _, err := dec.ReadToken(); err != nil { + return err + } + + if !seenFileName { + return fmt.Errorf("required property 'fileName' is missing") + } + if !seenPosition { + return fmt.Errorf("required property 'position' is missing") + } + if !seenSource { + return fmt.Errorf("required property 'source' is missing") + } + if !seenName { + return fmt.Errorf("required property 'name' is missing") + } + + return nil +} + +// CallHierarchyItemData is a placeholder for custom data preserved on a CallHierarchyItem. +type CallHierarchyItemData struct{} + +// TypeHierarchyItemData is a placeholder for custom data preserved on a TypeHierarchyItem. +type TypeHierarchyItemData struct{} + +// InlayHintData is a placeholder for custom data preserved on a InlayHint. +type InlayHintData struct{} + +// CodeActionData is a placeholder for custom data preserved on a CodeAction. +type CodeActionData struct{} + +// WorkspaceSymbolData is a placeholder for custom data preserved on a WorkspaceSymbol. +type WorkspaceSymbolData struct{} + +// CodeLensData is a placeholder for custom data preserved on a CodeLens. +type CodeLensData struct{} + +// DocumentLinkData is a placeholder for custom data preserved on a DocumentLink. +type DocumentLinkData struct{} + +// DiagnosticData is a placeholder for custom data preserved on a Diagnostic. +type DiagnosticData struct{} + +// CompletionItemDefaultsData is a placeholder for custom data preserved on a CompletionItemDefaults. +type CompletionItemDefaultsData struct{} + // Enumerations // A set of predefined token types. This set is not fixed diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 2d63e51128..abcbfcbe65 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -891,10 +891,7 @@ func (s *Server) handleCompletion(ctx context.Context, languageService *ls.Langu } func (s *Server) handleCompletionItemResolve(ctx context.Context, params *lsproto.CompletionItem, reqMsg *lsproto.RequestMessage) (lsproto.CompletionResolveResponse, error) { - data, err := ls.GetCompletionItemData(params) - if err != nil { - return nil, err - } + data := params.Data languageService, err := s.session.GetLanguageService(ctx, lsconv.FileNameToDocumentURI(data.FileName)) if err != nil { return nil, err From ee12721e1c54b4a28de73d4489345421625e3649 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:46:26 -0800 Subject: [PATCH 03/16] Remove some any --- internal/lsp/lsproto/_generate/generate.mts | 5 +++++ internal/lsp/lsproto/lsp_generated.go | 9 --------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 9e15f3de44..cae7c8f3a9 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -224,6 +224,11 @@ function preprocessModel() { structure.properties = Array.from(propertyMap.values()); structure.extends = undefined; structure.mixins = undefined; + + // Remove experimental properties from ServerCapabilities and ClientCapabilities + if (structure.name === "ServerCapabilities" || structure.name === "ClientCapabilities") { + structure.properties = structure.properties.filter(p => p.name !== "experimental"); + } } } diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 86acb58e4b..3b5d3f5109 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -13723,9 +13723,6 @@ type ServerCapabilities struct { // Workspace specific server capabilities. Workspace *WorkspaceOptions `json:"workspace,omitzero"` - - // Experimental server capabilities. - Experimental *any `json:"experimental,omitzero"` } // Information about the server @@ -16205,9 +16202,6 @@ type ClientCapabilities struct { // // Since: 3.16.0 General *GeneralClientCapabilities `json:"general,omitzero"` - - // Experimental client capabilities. - Experimental *any `json:"experimental,omitzero"` } type TextDocumentSyncOptions struct { @@ -28510,8 +28504,6 @@ type ResolvedClientCapabilities struct { // // Since: 3.16.0 General ResolvedGeneralClientCapabilities `json:"general,omitzero"` - // Experimental client capabilities. - Experimental any `json:"experimental,omitzero"` } func ResolveClientCapabilities(v *ClientCapabilities) ResolvedClientCapabilities { @@ -28524,6 +28516,5 @@ func ResolveClientCapabilities(v *ClientCapabilities) ResolvedClientCapabilities NotebookDocument: resolveNotebookDocumentClientCapabilities(v.NotebookDocument), Window: resolveWindowClientCapabilities(v.Window), General: resolveGeneralClientCapabilities(v.General), - Experimental: derefOr(v.Experimental), } } From aa678348ef3ae1c7edc243a7018518cd35d8717b Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:49:48 -0800 Subject: [PATCH 04/16] improve --- internal/lsp/lsproto/_generate/generate.mts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index cae7c8f3a9..11ac1f950b 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -144,8 +144,8 @@ const customStructures: Structure[] = [ // Track which custom Data structures were declared explicitly const explicitDataStructures = new Set(customStructures.map(s => s.name)); -// Patch the model to use custom types -function patchModel() { +// Patch and preprocess the model +function patchAndPreprocessModel() { // Track which Data types we need to create as placeholders const neededDataStructures = new Set(); @@ -178,10 +178,11 @@ function patchModel() { documentation: `${dataTypeName} is a placeholder for custom data preserved on a ${baseName}.`, }); } -} -// Preprocess the model to inline extends/mixins contents -function preprocessModel() { + // Add custom structures to the model + model.structures.push(...customStructures); + + // Build structure map for preprocessing const structureMap = new Map(); for (const structure of model.structures) { structureMap.set(structure.name, structure); @@ -232,13 +233,7 @@ function preprocessModel() { } } -patchModel(); - -// Add custom structures to the model (including any placeholders created during patching) -model.structures.push(...customStructures); - -// Preprocess the model before proceeding -preprocessModel(); +patchAndPreprocessModel(); interface GoType { name: string; From 9415c1b7360e958d6f3263f0b66fdb4879d95298 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:52:14 -0800 Subject: [PATCH 05/16] Simplfy --- internal/lsp/lsproto/_generate/fetchModel.mts | 3 +- internal/lsp/lsproto/_generate/generate.mts | 3 + internal/lsp/lsproto/lsp_generated.go | 133 ------------------ 3 files changed, 4 insertions(+), 135 deletions(-) diff --git a/internal/lsp/lsproto/_generate/fetchModel.mts b/internal/lsp/lsproto/_generate/fetchModel.mts index cc31a5a41f..2497370a9c 100644 --- a/internal/lsp/lsproto/_generate/fetchModel.mts +++ b/internal/lsp/lsproto/_generate/fetchModel.mts @@ -14,8 +14,7 @@ const metaModelURL = `https://raw.githubusercontent.com/microsoft/vscode-languag const metaModelSchemaURL = `https://raw.githubusercontent.com/microsoft/vscode-languageserver-node/${hash}/tools/src/metaModel.ts`; const metaModelResponse = await fetch(metaModelURL); -let metaModel = await metaModelResponse.text(); -metaModel = metaModel.replaceAll('"_InitializeParams"', '"InitializeParamsBase"'); +const metaModel = await metaModelResponse.text(); fs.writeFileSync(metaModelPath, metaModel); const metaModelSchemaResponse = await fetch(metaModelSchemaURL); diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 11ac1f950b..4a01868f84 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -231,6 +231,9 @@ function patchAndPreprocessModel() { structure.properties = structure.properties.filter(p => p.name !== "experimental"); } } + + // Remove _InitializeParams structure after flattening (it was only needed for inheritance) + model.structures = model.structures.filter(s => s.name !== "_InitializeParams"); } patchAndPreprocessModel(); diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 3b5d3f5109..21182a71bd 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -13436,139 +13436,6 @@ func (s *Unregistration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return nil } -// The initialize parameters -type InitializeParamsBase struct { - // An optional token that a server can use to report work done progress. - WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` - - // The process Id of the parent process that started - // the server. - // - // Is `null` if the process has not been started by another process. - // If the parent process is not alive then the server should exit. - ProcessId IntegerOrNull `json:"processId"` - - // Information about the client - // - // Since: 3.15.0 - ClientInfo *ClientInfo `json:"clientInfo,omitzero"` - - // The locale the client is currently showing the user interface - // in. This must not necessarily be the locale of the operating - // system. - // - // Uses IETF language tags as the value's syntax - // (See https://en.wikipedia.org/wiki/IETF_language_tag) - // - // Since: 3.16.0 - Locale *string `json:"locale,omitzero"` - - // The rootPath of the workspace. Is null - // if no folder is open. - // - // Deprecated: in favour of rootUri. - RootPath *StringOrNull `json:"rootPath,omitzero"` - - // The rootUri of the workspace. Is null if no - // folder is open. If both `rootPath` and `rootUri` are set - // `rootUri` wins. - // - // Deprecated: in favour of workspaceFolders. - RootUri DocumentUriOrNull `json:"rootUri"` - - // The capabilities provided by the client (editor or tool) - Capabilities *ClientCapabilities `json:"capabilities"` - - // User provided initialization options. - InitializationOptions *InitializationOptions `json:"initializationOptions,omitzero"` - - // The initial trace setting. If omitted trace is disabled ('off'). - Trace *TraceValue `json:"trace,omitzero"` -} - -var _ json.UnmarshalerFrom = (*InitializeParamsBase)(nil) - -func (s *InitializeParamsBase) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenProcessId bool - seenRootUri bool - seenCapabilities bool - ) - - if k := dec.PeekKind(); k != '{' { - return fmt.Errorf("expected object start, but encountered %v", k) - } - if _, err := dec.ReadToken(); err != nil { - return err - } - - for dec.PeekKind() != '}' { - name, err := dec.ReadValue() - if err != nil { - return err - } - switch string(name) { - case `"workDoneToken"`: - if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { - return err - } - case `"processId"`: - seenProcessId = true - if err := json.UnmarshalDecode(dec, &s.ProcessId); err != nil { - return err - } - case `"clientInfo"`: - if err := json.UnmarshalDecode(dec, &s.ClientInfo); err != nil { - return err - } - case `"locale"`: - if err := json.UnmarshalDecode(dec, &s.Locale); err != nil { - return err - } - case `"rootPath"`: - if err := json.UnmarshalDecode(dec, &s.RootPath); err != nil { - return err - } - case `"rootUri"`: - seenRootUri = true - if err := json.UnmarshalDecode(dec, &s.RootUri); err != nil { - return err - } - case `"capabilities"`: - seenCapabilities = true - if err := json.UnmarshalDecode(dec, &s.Capabilities); err != nil { - return err - } - case `"initializationOptions"`: - if err := json.UnmarshalDecode(dec, &s.InitializationOptions); err != nil { - return err - } - case `"trace"`: - if err := json.UnmarshalDecode(dec, &s.Trace); err != nil { - return err - } - default: - // Ignore unknown properties. - } - } - - if _, err := dec.ReadToken(); err != nil { - return err - } - - if !seenProcessId { - return fmt.Errorf("required property 'processId' is missing") - } - if !seenRootUri { - return fmt.Errorf("required property 'rootUri' is missing") - } - if !seenCapabilities { - return fmt.Errorf("required property 'capabilities' is missing") - } - - return nil -} - type WorkspaceFoldersInitializeParams struct { // The workspace folders configured in the client when the server starts. // From d51f516eb0257f247329101f9b168b1415bed5cd Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:52:34 -0800 Subject: [PATCH 06/16] move --- internal/fourslash/fourslash.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index c8e6fa149e..5b045ea6c4 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -252,14 +252,13 @@ func (f *FourslashTest) nextID() int32 { } func (f *FourslashTest) initialize(t *testing.T, capabilities *lsproto.ClientCapabilities) { - // Hack: disable push diagnostics entirely, since the fourslash runner does not - // yet gracefully handle non-request messages. - initOptions := &lsproto.InitializationOptions{ - DisablePushDiagnostics: ptrTo(true), - } params := &lsproto.InitializeParams{ - Locale: ptrTo("en-US"), - InitializationOptions: initOptions, + Locale: ptrTo("en-US"), + InitializationOptions: &lsproto.InitializationOptions{ + // Hack: disable push diagnostics entirely, since the fourslash runner does not + // yet gracefully handle non-request messages. + DisablePushDiagnostics: ptrTo(true), + }, } params.Capabilities = getCapabilitiesWithDefaults(capabilities) // !!! check for errors? From bb719afe9ce2b961a7581983509105fd39d95627 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 19:26:29 -0800 Subject: [PATCH 07/16] Get rid of another any --- internal/lsp/lsproto/_generate/generate.mts | 69 +++- internal/lsp/lsproto/lsp_generated.go | 437 +++++++++++++++++++- internal/lsp/server.go | 22 +- 3 files changed, 516 insertions(+), 12 deletions(-) diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 4a01868f84..339825a1d2 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -144,11 +144,62 @@ const customStructures: Structure[] = [ // Track which custom Data structures were declared explicitly const explicitDataStructures = new Set(customStructures.map(s => s.name)); +// Global variable to track the RegisterOptions union type for special naming +let registerOptionsUnionType: OrType | undefined; + // Patch and preprocess the model function patchAndPreprocessModel() { // Track which Data types we need to create as placeholders const neededDataStructures = new Set(); + // Collect all registration option types from requests and notifications + const registrationOptionTypes: Type[] = []; + for (const request of [...model.requests, ...model.notifications]) { + if (request.registrationOptions) { + registrationOptionTypes.push(request.registrationOptions); + } + } + + // Create synthetic structures for "and" types in registration options + const syntheticStructures: Structure[] = []; + for (let i = 0; i < registrationOptionTypes.length; i++) { + const regOptType = registrationOptionTypes[i]; + if (regOptType.kind === "and") { + // Find which request/notification this registration option belongs to + const owner = [...model.requests, ...model.notifications].find(r => r.registrationOptions === regOptType); + if (!owner) { + throw new Error("Could not find owner for 'and' type registration option"); + } + + // Determine the proper name based on the typeName or method + let structureName: string; + if (owner.typeName) { + // Use typeName as base: "ColorPresentationRequest" -> "ColorPresentationRegistrationOptions" + structureName = owner.typeName.replace(/Request$/, "").replace(/Notification$/, "") + "RegistrationOptions"; + } + else { + // Fall back to method: "textDocument/colorPresentation" -> "ColorPresentationRegistrationOptions" + const methodParts = owner.method.split("/"); + const lastPart = methodParts[methodParts.length - 1]; + structureName = titleCase(lastPart) + "RegistrationOptions"; + } + + // Extract all reference types from the "and" + const refTypes = regOptType.items.filter((item): item is ReferenceType => item.kind === "reference"); + + // Create a synthetic structure that combines all the referenced structures + syntheticStructures.push({ + name: structureName, + properties: [], + extends: refTypes, + documentation: `Registration options for ${owner.method}.`, + }); + + // Replace the "and" type with a reference to the synthetic structure + registrationOptionTypes[i] = { kind: "reference", name: structureName }; + } + } + for (const structure of model.structures) { for (const prop of structure.properties) { // Replace initializationOptions type with custom InitializationOptions @@ -166,6 +217,15 @@ function patchAndPreprocessModel() { neededDataStructures.add(customDataType); } } + + // Replace registerOptions type with a custom RegisterOptions type + if (prop.name === "registerOptions" && prop.type.kind === "reference" && prop.type.name === "LSPAny") { + // Create a union type and save it for special naming + if (registrationOptionTypes.length > 0) { + registerOptionsUnionType = { kind: "or", items: registrationOptionTypes }; + prop.type = registerOptionsUnionType; + } + } } } @@ -179,8 +239,8 @@ function patchAndPreprocessModel() { }); } - // Add custom structures to the model - model.structures.push(...customStructures); + // Add custom structures and synthetic structures to the model + model.structures.push(...customStructures, ...syntheticStructures); // Build structure map for preprocessing const structureMap = new Map(); @@ -515,6 +575,11 @@ function handleOrType(orType: OrType): GoType { unionTypeName = memberNames.join("Or"); } + // Special case: if this is the RegisterOptions union, use a custom name + if (orType === registerOptionsUnionType) { + unionTypeName = "RegisterOptions"; + } + if (containedNull) { unionTypeName += "OrNull"; } diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 21182a71bd..594dfe5d0a 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -13319,7 +13319,7 @@ type Registration struct { Method string `json:"method"` // Options necessary for the registration. - RegisterOptions *any `json:"registerOptions,omitzero"` + RegisterOptions *RegisterOptions `json:"registerOptions,omitzero"` } var _ json.UnmarshalerFrom = (*Registration)(nil) @@ -19911,6 +19911,58 @@ type DiagnosticData struct{} // CompletionItemDefaultsData is a placeholder for custom data preserved on a CompletionItemDefaults. type CompletionItemDefaultsData struct{} +// Registration options for textDocument/colorPresentation. +type ColorPresentationRegistrationOptions struct { + WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` + + // 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. + DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` +} + +var _ json.UnmarshalerFrom = (*ColorPresentationRegistrationOptions)(nil) + +func (s *ColorPresentationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + var seenDocumentSelector bool + + if k := dec.PeekKind(); k != '{' { + return fmt.Errorf("expected object start, but encountered %v", k) + } + if _, err := dec.ReadToken(); err != nil { + return err + } + + for dec.PeekKind() != '}' { + name, err := dec.ReadValue() + if err != nil { + return err + } + switch string(name) { + case `"workDoneProgress"`: + if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { + return err + } + case `"documentSelector"`: + seenDocumentSelector = true + if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { + return err + } + default: + // Ignore unknown properties. + } + } + + if _, err := dec.ReadToken(); err != nil { + return err + } + + if !seenDocumentSelector { + return fmt.Errorf("required property 'documentSelector' is missing") + } + + return nil +} + // Enumerations // A set of predefined token types. This set is not fixed @@ -22822,6 +22874,389 @@ func (o *TextEditOrAnnotatedTextEditOrSnippetTextEdit) UnmarshalJSONFrom(dec *js return fmt.Errorf("invalid TextEditOrAnnotatedTextEditOrSnippetTextEdit: %s", data) } +type RegisterOptions struct { + ImplementationRegistrationOptions *ImplementationRegistrationOptions + TypeDefinitionRegistrationOptions *TypeDefinitionRegistrationOptions + DocumentColorRegistrationOptions *DocumentColorRegistrationOptions + ColorPresentationRegistrationOptions *ColorPresentationRegistrationOptions + FoldingRangeRegistrationOptions *FoldingRangeRegistrationOptions + DeclarationRegistrationOptions *DeclarationRegistrationOptions + SelectionRangeRegistrationOptions *SelectionRangeRegistrationOptions + CallHierarchyRegistrationOptions *CallHierarchyRegistrationOptions + SemanticTokensRegistrationOptions *SemanticTokensRegistrationOptions + LinkedEditingRangeRegistrationOptions *LinkedEditingRangeRegistrationOptions + FileOperationRegistrationOptions *FileOperationRegistrationOptions + MonikerRegistrationOptions *MonikerRegistrationOptions + TypeHierarchyRegistrationOptions *TypeHierarchyRegistrationOptions + InlineValueRegistrationOptions *InlineValueRegistrationOptions + InlayHintRegistrationOptions *InlayHintRegistrationOptions + DiagnosticRegistrationOptions *DiagnosticRegistrationOptions + InlineCompletionRegistrationOptions *InlineCompletionRegistrationOptions + TextDocumentContentRegistrationOptions *TextDocumentContentRegistrationOptions + TextDocumentRegistrationOptions *TextDocumentRegistrationOptions + CompletionRegistrationOptions *CompletionRegistrationOptions + HoverRegistrationOptions *HoverRegistrationOptions + SignatureHelpRegistrationOptions *SignatureHelpRegistrationOptions + DefinitionRegistrationOptions *DefinitionRegistrationOptions + ReferenceRegistrationOptions *ReferenceRegistrationOptions + DocumentHighlightRegistrationOptions *DocumentHighlightRegistrationOptions + DocumentSymbolRegistrationOptions *DocumentSymbolRegistrationOptions + CodeActionRegistrationOptions *CodeActionRegistrationOptions + WorkspaceSymbolRegistrationOptions *WorkspaceSymbolRegistrationOptions + CodeLensRegistrationOptions *CodeLensRegistrationOptions + DocumentLinkRegistrationOptions *DocumentLinkRegistrationOptions + DocumentFormattingRegistrationOptions *DocumentFormattingRegistrationOptions + DocumentRangeFormattingRegistrationOptions *DocumentRangeFormattingRegistrationOptions + DocumentOnTypeFormattingRegistrationOptions *DocumentOnTypeFormattingRegistrationOptions + RenameRegistrationOptions *RenameRegistrationOptions + ExecuteCommandRegistrationOptions *ExecuteCommandRegistrationOptions + NotebookDocumentSyncRegistrationOptions *NotebookDocumentSyncRegistrationOptions + DidChangeConfigurationRegistrationOptions *DidChangeConfigurationRegistrationOptions + TextDocumentChangeRegistrationOptions *TextDocumentChangeRegistrationOptions + TextDocumentSaveRegistrationOptions *TextDocumentSaveRegistrationOptions + DidChangeWatchedFilesRegistrationOptions *DidChangeWatchedFilesRegistrationOptions +} + +var _ json.MarshalerTo = (*RegisterOptions)(nil) + +func (o *RegisterOptions) MarshalJSONTo(enc *jsontext.Encoder) error { + assertOnlyOne("exactly one element of RegisterOptions should be set", o.ImplementationRegistrationOptions != nil, o.TypeDefinitionRegistrationOptions != nil, o.DocumentColorRegistrationOptions != nil, o.ColorPresentationRegistrationOptions != nil, o.FoldingRangeRegistrationOptions != nil, o.DeclarationRegistrationOptions != nil, o.SelectionRangeRegistrationOptions != nil, o.CallHierarchyRegistrationOptions != nil, o.SemanticTokensRegistrationOptions != nil, o.LinkedEditingRangeRegistrationOptions != nil, o.FileOperationRegistrationOptions != nil, o.MonikerRegistrationOptions != nil, o.TypeHierarchyRegistrationOptions != nil, o.InlineValueRegistrationOptions != nil, o.InlayHintRegistrationOptions != nil, o.DiagnosticRegistrationOptions != nil, o.InlineCompletionRegistrationOptions != nil, o.TextDocumentContentRegistrationOptions != nil, o.TextDocumentRegistrationOptions != nil, o.CompletionRegistrationOptions != nil, o.HoverRegistrationOptions != nil, o.SignatureHelpRegistrationOptions != nil, o.DefinitionRegistrationOptions != nil, o.ReferenceRegistrationOptions != nil, o.DocumentHighlightRegistrationOptions != nil, o.DocumentSymbolRegistrationOptions != nil, o.CodeActionRegistrationOptions != nil, o.WorkspaceSymbolRegistrationOptions != nil, o.CodeLensRegistrationOptions != nil, o.DocumentLinkRegistrationOptions != nil, o.DocumentFormattingRegistrationOptions != nil, o.DocumentRangeFormattingRegistrationOptions != nil, o.DocumentOnTypeFormattingRegistrationOptions != nil, o.RenameRegistrationOptions != nil, o.ExecuteCommandRegistrationOptions != nil, o.NotebookDocumentSyncRegistrationOptions != nil, o.DidChangeConfigurationRegistrationOptions != nil, o.TextDocumentChangeRegistrationOptions != nil, o.TextDocumentSaveRegistrationOptions != nil, o.DidChangeWatchedFilesRegistrationOptions != nil) + + if o.ImplementationRegistrationOptions != nil { + return json.MarshalEncode(enc, o.ImplementationRegistrationOptions) + } + if o.TypeDefinitionRegistrationOptions != nil { + return json.MarshalEncode(enc, o.TypeDefinitionRegistrationOptions) + } + if o.DocumentColorRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DocumentColorRegistrationOptions) + } + if o.ColorPresentationRegistrationOptions != nil { + return json.MarshalEncode(enc, o.ColorPresentationRegistrationOptions) + } + if o.FoldingRangeRegistrationOptions != nil { + return json.MarshalEncode(enc, o.FoldingRangeRegistrationOptions) + } + if o.DeclarationRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DeclarationRegistrationOptions) + } + if o.SelectionRangeRegistrationOptions != nil { + return json.MarshalEncode(enc, o.SelectionRangeRegistrationOptions) + } + if o.CallHierarchyRegistrationOptions != nil { + return json.MarshalEncode(enc, o.CallHierarchyRegistrationOptions) + } + if o.SemanticTokensRegistrationOptions != nil { + return json.MarshalEncode(enc, o.SemanticTokensRegistrationOptions) + } + if o.LinkedEditingRangeRegistrationOptions != nil { + return json.MarshalEncode(enc, o.LinkedEditingRangeRegistrationOptions) + } + if o.FileOperationRegistrationOptions != nil { + return json.MarshalEncode(enc, o.FileOperationRegistrationOptions) + } + if o.MonikerRegistrationOptions != nil { + return json.MarshalEncode(enc, o.MonikerRegistrationOptions) + } + if o.TypeHierarchyRegistrationOptions != nil { + return json.MarshalEncode(enc, o.TypeHierarchyRegistrationOptions) + } + if o.InlineValueRegistrationOptions != nil { + return json.MarshalEncode(enc, o.InlineValueRegistrationOptions) + } + if o.InlayHintRegistrationOptions != nil { + return json.MarshalEncode(enc, o.InlayHintRegistrationOptions) + } + if o.DiagnosticRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DiagnosticRegistrationOptions) + } + if o.InlineCompletionRegistrationOptions != nil { + return json.MarshalEncode(enc, o.InlineCompletionRegistrationOptions) + } + if o.TextDocumentContentRegistrationOptions != nil { + return json.MarshalEncode(enc, o.TextDocumentContentRegistrationOptions) + } + if o.TextDocumentRegistrationOptions != nil { + return json.MarshalEncode(enc, o.TextDocumentRegistrationOptions) + } + if o.CompletionRegistrationOptions != nil { + return json.MarshalEncode(enc, o.CompletionRegistrationOptions) + } + if o.HoverRegistrationOptions != nil { + return json.MarshalEncode(enc, o.HoverRegistrationOptions) + } + if o.SignatureHelpRegistrationOptions != nil { + return json.MarshalEncode(enc, o.SignatureHelpRegistrationOptions) + } + if o.DefinitionRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DefinitionRegistrationOptions) + } + if o.ReferenceRegistrationOptions != nil { + return json.MarshalEncode(enc, o.ReferenceRegistrationOptions) + } + if o.DocumentHighlightRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DocumentHighlightRegistrationOptions) + } + if o.DocumentSymbolRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DocumentSymbolRegistrationOptions) + } + if o.CodeActionRegistrationOptions != nil { + return json.MarshalEncode(enc, o.CodeActionRegistrationOptions) + } + if o.WorkspaceSymbolRegistrationOptions != nil { + return json.MarshalEncode(enc, o.WorkspaceSymbolRegistrationOptions) + } + if o.CodeLensRegistrationOptions != nil { + return json.MarshalEncode(enc, o.CodeLensRegistrationOptions) + } + if o.DocumentLinkRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DocumentLinkRegistrationOptions) + } + if o.DocumentFormattingRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DocumentFormattingRegistrationOptions) + } + if o.DocumentRangeFormattingRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DocumentRangeFormattingRegistrationOptions) + } + if o.DocumentOnTypeFormattingRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DocumentOnTypeFormattingRegistrationOptions) + } + if o.RenameRegistrationOptions != nil { + return json.MarshalEncode(enc, o.RenameRegistrationOptions) + } + if o.ExecuteCommandRegistrationOptions != nil { + return json.MarshalEncode(enc, o.ExecuteCommandRegistrationOptions) + } + if o.NotebookDocumentSyncRegistrationOptions != nil { + return json.MarshalEncode(enc, o.NotebookDocumentSyncRegistrationOptions) + } + if o.DidChangeConfigurationRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DidChangeConfigurationRegistrationOptions) + } + if o.TextDocumentChangeRegistrationOptions != nil { + return json.MarshalEncode(enc, o.TextDocumentChangeRegistrationOptions) + } + if o.TextDocumentSaveRegistrationOptions != nil { + return json.MarshalEncode(enc, o.TextDocumentSaveRegistrationOptions) + } + if o.DidChangeWatchedFilesRegistrationOptions != nil { + return json.MarshalEncode(enc, o.DidChangeWatchedFilesRegistrationOptions) + } + panic("unreachable") +} + +var _ json.UnmarshalerFrom = (*RegisterOptions)(nil) + +func (o *RegisterOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + *o = RegisterOptions{} + + data, err := dec.ReadValue() + if err != nil { + return err + } + var vImplementationRegistrationOptions ImplementationRegistrationOptions + if err := json.Unmarshal(data, &vImplementationRegistrationOptions); err == nil { + o.ImplementationRegistrationOptions = &vImplementationRegistrationOptions + return nil + } + var vTypeDefinitionRegistrationOptions TypeDefinitionRegistrationOptions + if err := json.Unmarshal(data, &vTypeDefinitionRegistrationOptions); err == nil { + o.TypeDefinitionRegistrationOptions = &vTypeDefinitionRegistrationOptions + return nil + } + var vDocumentColorRegistrationOptions DocumentColorRegistrationOptions + if err := json.Unmarshal(data, &vDocumentColorRegistrationOptions); err == nil { + o.DocumentColorRegistrationOptions = &vDocumentColorRegistrationOptions + return nil + } + var vColorPresentationRegistrationOptions ColorPresentationRegistrationOptions + if err := json.Unmarshal(data, &vColorPresentationRegistrationOptions); err == nil { + o.ColorPresentationRegistrationOptions = &vColorPresentationRegistrationOptions + return nil + } + var vFoldingRangeRegistrationOptions FoldingRangeRegistrationOptions + if err := json.Unmarshal(data, &vFoldingRangeRegistrationOptions); err == nil { + o.FoldingRangeRegistrationOptions = &vFoldingRangeRegistrationOptions + return nil + } + var vDeclarationRegistrationOptions DeclarationRegistrationOptions + if err := json.Unmarshal(data, &vDeclarationRegistrationOptions); err == nil { + o.DeclarationRegistrationOptions = &vDeclarationRegistrationOptions + return nil + } + var vSelectionRangeRegistrationOptions SelectionRangeRegistrationOptions + if err := json.Unmarshal(data, &vSelectionRangeRegistrationOptions); err == nil { + o.SelectionRangeRegistrationOptions = &vSelectionRangeRegistrationOptions + return nil + } + var vCallHierarchyRegistrationOptions CallHierarchyRegistrationOptions + if err := json.Unmarshal(data, &vCallHierarchyRegistrationOptions); err == nil { + o.CallHierarchyRegistrationOptions = &vCallHierarchyRegistrationOptions + return nil + } + var vSemanticTokensRegistrationOptions SemanticTokensRegistrationOptions + if err := json.Unmarshal(data, &vSemanticTokensRegistrationOptions); err == nil { + o.SemanticTokensRegistrationOptions = &vSemanticTokensRegistrationOptions + return nil + } + var vLinkedEditingRangeRegistrationOptions LinkedEditingRangeRegistrationOptions + if err := json.Unmarshal(data, &vLinkedEditingRangeRegistrationOptions); err == nil { + o.LinkedEditingRangeRegistrationOptions = &vLinkedEditingRangeRegistrationOptions + return nil + } + var vFileOperationRegistrationOptions FileOperationRegistrationOptions + if err := json.Unmarshal(data, &vFileOperationRegistrationOptions); err == nil { + o.FileOperationRegistrationOptions = &vFileOperationRegistrationOptions + return nil + } + var vMonikerRegistrationOptions MonikerRegistrationOptions + if err := json.Unmarshal(data, &vMonikerRegistrationOptions); err == nil { + o.MonikerRegistrationOptions = &vMonikerRegistrationOptions + return nil + } + var vTypeHierarchyRegistrationOptions TypeHierarchyRegistrationOptions + if err := json.Unmarshal(data, &vTypeHierarchyRegistrationOptions); err == nil { + o.TypeHierarchyRegistrationOptions = &vTypeHierarchyRegistrationOptions + return nil + } + var vInlineValueRegistrationOptions InlineValueRegistrationOptions + if err := json.Unmarshal(data, &vInlineValueRegistrationOptions); err == nil { + o.InlineValueRegistrationOptions = &vInlineValueRegistrationOptions + return nil + } + var vInlayHintRegistrationOptions InlayHintRegistrationOptions + if err := json.Unmarshal(data, &vInlayHintRegistrationOptions); err == nil { + o.InlayHintRegistrationOptions = &vInlayHintRegistrationOptions + return nil + } + var vDiagnosticRegistrationOptions DiagnosticRegistrationOptions + if err := json.Unmarshal(data, &vDiagnosticRegistrationOptions); err == nil { + o.DiagnosticRegistrationOptions = &vDiagnosticRegistrationOptions + return nil + } + var vInlineCompletionRegistrationOptions InlineCompletionRegistrationOptions + if err := json.Unmarshal(data, &vInlineCompletionRegistrationOptions); err == nil { + o.InlineCompletionRegistrationOptions = &vInlineCompletionRegistrationOptions + return nil + } + var vTextDocumentContentRegistrationOptions TextDocumentContentRegistrationOptions + if err := json.Unmarshal(data, &vTextDocumentContentRegistrationOptions); err == nil { + o.TextDocumentContentRegistrationOptions = &vTextDocumentContentRegistrationOptions + return nil + } + var vTextDocumentRegistrationOptions TextDocumentRegistrationOptions + if err := json.Unmarshal(data, &vTextDocumentRegistrationOptions); err == nil { + o.TextDocumentRegistrationOptions = &vTextDocumentRegistrationOptions + return nil + } + var vCompletionRegistrationOptions CompletionRegistrationOptions + if err := json.Unmarshal(data, &vCompletionRegistrationOptions); err == nil { + o.CompletionRegistrationOptions = &vCompletionRegistrationOptions + return nil + } + var vHoverRegistrationOptions HoverRegistrationOptions + if err := json.Unmarshal(data, &vHoverRegistrationOptions); err == nil { + o.HoverRegistrationOptions = &vHoverRegistrationOptions + return nil + } + var vSignatureHelpRegistrationOptions SignatureHelpRegistrationOptions + if err := json.Unmarshal(data, &vSignatureHelpRegistrationOptions); err == nil { + o.SignatureHelpRegistrationOptions = &vSignatureHelpRegistrationOptions + return nil + } + var vDefinitionRegistrationOptions DefinitionRegistrationOptions + if err := json.Unmarshal(data, &vDefinitionRegistrationOptions); err == nil { + o.DefinitionRegistrationOptions = &vDefinitionRegistrationOptions + return nil + } + var vReferenceRegistrationOptions ReferenceRegistrationOptions + if err := json.Unmarshal(data, &vReferenceRegistrationOptions); err == nil { + o.ReferenceRegistrationOptions = &vReferenceRegistrationOptions + return nil + } + var vDocumentHighlightRegistrationOptions DocumentHighlightRegistrationOptions + if err := json.Unmarshal(data, &vDocumentHighlightRegistrationOptions); err == nil { + o.DocumentHighlightRegistrationOptions = &vDocumentHighlightRegistrationOptions + return nil + } + var vDocumentSymbolRegistrationOptions DocumentSymbolRegistrationOptions + if err := json.Unmarshal(data, &vDocumentSymbolRegistrationOptions); err == nil { + o.DocumentSymbolRegistrationOptions = &vDocumentSymbolRegistrationOptions + return nil + } + var vCodeActionRegistrationOptions CodeActionRegistrationOptions + if err := json.Unmarshal(data, &vCodeActionRegistrationOptions); err == nil { + o.CodeActionRegistrationOptions = &vCodeActionRegistrationOptions + return nil + } + var vWorkspaceSymbolRegistrationOptions WorkspaceSymbolRegistrationOptions + if err := json.Unmarshal(data, &vWorkspaceSymbolRegistrationOptions); err == nil { + o.WorkspaceSymbolRegistrationOptions = &vWorkspaceSymbolRegistrationOptions + return nil + } + var vCodeLensRegistrationOptions CodeLensRegistrationOptions + if err := json.Unmarshal(data, &vCodeLensRegistrationOptions); err == nil { + o.CodeLensRegistrationOptions = &vCodeLensRegistrationOptions + return nil + } + var vDocumentLinkRegistrationOptions DocumentLinkRegistrationOptions + if err := json.Unmarshal(data, &vDocumentLinkRegistrationOptions); err == nil { + o.DocumentLinkRegistrationOptions = &vDocumentLinkRegistrationOptions + return nil + } + var vDocumentFormattingRegistrationOptions DocumentFormattingRegistrationOptions + if err := json.Unmarshal(data, &vDocumentFormattingRegistrationOptions); err == nil { + o.DocumentFormattingRegistrationOptions = &vDocumentFormattingRegistrationOptions + return nil + } + var vDocumentRangeFormattingRegistrationOptions DocumentRangeFormattingRegistrationOptions + if err := json.Unmarshal(data, &vDocumentRangeFormattingRegistrationOptions); err == nil { + o.DocumentRangeFormattingRegistrationOptions = &vDocumentRangeFormattingRegistrationOptions + return nil + } + var vDocumentOnTypeFormattingRegistrationOptions DocumentOnTypeFormattingRegistrationOptions + if err := json.Unmarshal(data, &vDocumentOnTypeFormattingRegistrationOptions); err == nil { + o.DocumentOnTypeFormattingRegistrationOptions = &vDocumentOnTypeFormattingRegistrationOptions + return nil + } + var vRenameRegistrationOptions RenameRegistrationOptions + if err := json.Unmarshal(data, &vRenameRegistrationOptions); err == nil { + o.RenameRegistrationOptions = &vRenameRegistrationOptions + return nil + } + var vExecuteCommandRegistrationOptions ExecuteCommandRegistrationOptions + if err := json.Unmarshal(data, &vExecuteCommandRegistrationOptions); err == nil { + o.ExecuteCommandRegistrationOptions = &vExecuteCommandRegistrationOptions + return nil + } + var vNotebookDocumentSyncRegistrationOptions NotebookDocumentSyncRegistrationOptions + if err := json.Unmarshal(data, &vNotebookDocumentSyncRegistrationOptions); err == nil { + o.NotebookDocumentSyncRegistrationOptions = &vNotebookDocumentSyncRegistrationOptions + return nil + } + var vDidChangeConfigurationRegistrationOptions DidChangeConfigurationRegistrationOptions + if err := json.Unmarshal(data, &vDidChangeConfigurationRegistrationOptions); err == nil { + o.DidChangeConfigurationRegistrationOptions = &vDidChangeConfigurationRegistrationOptions + return nil + } + var vTextDocumentChangeRegistrationOptions TextDocumentChangeRegistrationOptions + if err := json.Unmarshal(data, &vTextDocumentChangeRegistrationOptions); err == nil { + o.TextDocumentChangeRegistrationOptions = &vTextDocumentChangeRegistrationOptions + return nil + } + var vTextDocumentSaveRegistrationOptions TextDocumentSaveRegistrationOptions + if err := json.Unmarshal(data, &vTextDocumentSaveRegistrationOptions); err == nil { + o.TextDocumentSaveRegistrationOptions = &vTextDocumentSaveRegistrationOptions + return nil + } + var vDidChangeWatchedFilesRegistrationOptions DidChangeWatchedFilesRegistrationOptions + if err := json.Unmarshal(data, &vDidChangeWatchedFilesRegistrationOptions); err == nil { + o.DidChangeWatchedFilesRegistrationOptions = &vDidChangeWatchedFilesRegistrationOptions + return nil + } + return fmt.Errorf("invalid RegisterOptions: %s", data) +} + type TextDocumentSyncOptionsOrKind struct { Options *TextDocumentSyncOptions Kind *TextDocumentSyncKind diff --git a/internal/lsp/server.go b/internal/lsp/server.go index abcbfcbe65..48aca38f0c 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -170,9 +170,11 @@ func (s *Server) WatchFiles(ctx context.Context, id project.WatcherID, watchers { Id: string(id), Method: string(lsproto.MethodWorkspaceDidChangeWatchedFiles), - RegisterOptions: ptrTo(any(lsproto.DidChangeWatchedFilesRegistrationOptions{ - Watchers: watchers, - })), + RegisterOptions: &lsproto.RegisterOptions{ + DidChangeWatchedFilesRegistrationOptions: &lsproto.DidChangeWatchedFilesRegistrationOptions{ + Watchers: watchers, + }, + }, }, }, }) @@ -759,12 +761,14 @@ func (s *Server) handleInitialized(ctx context.Context, params *lsproto.Initiali { Id: "typescript-config-watch-id", Method: string(lsproto.MethodWorkspaceDidChangeConfiguration), - RegisterOptions: ptrTo(any(lsproto.DidChangeConfigurationRegistrationOptions{ - Section: &lsproto.StringOrStrings{ - // !!! Both the 'javascript' and 'js/ts' scopes need to be watched for settings as well. - Strings: &[]string{"typescript"}, - }, - })), + RegisterOptions: &lsproto.RegisterOptions{ + DidChangeConfigurationRegistrationOptions: ptrTo(lsproto.DidChangeConfigurationRegistrationOptions{ + Section: &lsproto.StringOrStrings{ + // !!! Both the 'javascript' and 'js/ts' scopes need to be watched for settings as well. + Strings: &[]string{"typescript"}, + }, + }), + }, }, }, }) From f376bf898fd7f3e200159e371b5e375099c1ddeb Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 19:46:49 -0800 Subject: [PATCH 08/16] smaller --- internal/lsp/lsproto/_generate/generate.mts | 9 + internal/lsp/lsproto/lsp_generated.go | 482 ++++++++++---------- internal/lsp/server.go | 4 +- 3 files changed, 252 insertions(+), 243 deletions(-) diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 339825a1d2..4847d38b21 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -576,8 +576,17 @@ function handleOrType(orType: OrType): GoType { } // Special case: if this is the RegisterOptions union, use a custom name + // and slice off the common suffix "RegistrationOptions" from member names if (orType === registerOptionsUnionType) { unionTypeName = "RegisterOptions"; + + // Remove the common suffix "RegistrationOptions" from all member names + memberNames = memberNames.map(name => { + if (name.endsWith("RegistrationOptions")) { + return name.slice(0, -"RegistrationOptions".length); + } + return name; + }); } if (containedNull) { diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 594dfe5d0a..127ab8ef46 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -22875,172 +22875,172 @@ func (o *TextEditOrAnnotatedTextEditOrSnippetTextEdit) UnmarshalJSONFrom(dec *js } type RegisterOptions struct { - ImplementationRegistrationOptions *ImplementationRegistrationOptions - TypeDefinitionRegistrationOptions *TypeDefinitionRegistrationOptions - DocumentColorRegistrationOptions *DocumentColorRegistrationOptions - ColorPresentationRegistrationOptions *ColorPresentationRegistrationOptions - FoldingRangeRegistrationOptions *FoldingRangeRegistrationOptions - DeclarationRegistrationOptions *DeclarationRegistrationOptions - SelectionRangeRegistrationOptions *SelectionRangeRegistrationOptions - CallHierarchyRegistrationOptions *CallHierarchyRegistrationOptions - SemanticTokensRegistrationOptions *SemanticTokensRegistrationOptions - LinkedEditingRangeRegistrationOptions *LinkedEditingRangeRegistrationOptions - FileOperationRegistrationOptions *FileOperationRegistrationOptions - MonikerRegistrationOptions *MonikerRegistrationOptions - TypeHierarchyRegistrationOptions *TypeHierarchyRegistrationOptions - InlineValueRegistrationOptions *InlineValueRegistrationOptions - InlayHintRegistrationOptions *InlayHintRegistrationOptions - DiagnosticRegistrationOptions *DiagnosticRegistrationOptions - InlineCompletionRegistrationOptions *InlineCompletionRegistrationOptions - TextDocumentContentRegistrationOptions *TextDocumentContentRegistrationOptions - TextDocumentRegistrationOptions *TextDocumentRegistrationOptions - CompletionRegistrationOptions *CompletionRegistrationOptions - HoverRegistrationOptions *HoverRegistrationOptions - SignatureHelpRegistrationOptions *SignatureHelpRegistrationOptions - DefinitionRegistrationOptions *DefinitionRegistrationOptions - ReferenceRegistrationOptions *ReferenceRegistrationOptions - DocumentHighlightRegistrationOptions *DocumentHighlightRegistrationOptions - DocumentSymbolRegistrationOptions *DocumentSymbolRegistrationOptions - CodeActionRegistrationOptions *CodeActionRegistrationOptions - WorkspaceSymbolRegistrationOptions *WorkspaceSymbolRegistrationOptions - CodeLensRegistrationOptions *CodeLensRegistrationOptions - DocumentLinkRegistrationOptions *DocumentLinkRegistrationOptions - DocumentFormattingRegistrationOptions *DocumentFormattingRegistrationOptions - DocumentRangeFormattingRegistrationOptions *DocumentRangeFormattingRegistrationOptions - DocumentOnTypeFormattingRegistrationOptions *DocumentOnTypeFormattingRegistrationOptions - RenameRegistrationOptions *RenameRegistrationOptions - ExecuteCommandRegistrationOptions *ExecuteCommandRegistrationOptions - NotebookDocumentSyncRegistrationOptions *NotebookDocumentSyncRegistrationOptions - DidChangeConfigurationRegistrationOptions *DidChangeConfigurationRegistrationOptions - TextDocumentChangeRegistrationOptions *TextDocumentChangeRegistrationOptions - TextDocumentSaveRegistrationOptions *TextDocumentSaveRegistrationOptions - DidChangeWatchedFilesRegistrationOptions *DidChangeWatchedFilesRegistrationOptions + Implementation *ImplementationRegistrationOptions + TypeDefinition *TypeDefinitionRegistrationOptions + DocumentColor *DocumentColorRegistrationOptions + ColorPresentation *ColorPresentationRegistrationOptions + FoldingRange *FoldingRangeRegistrationOptions + Declaration *DeclarationRegistrationOptions + SelectionRange *SelectionRangeRegistrationOptions + CallHierarchy *CallHierarchyRegistrationOptions + SemanticTokens *SemanticTokensRegistrationOptions + LinkedEditingRange *LinkedEditingRangeRegistrationOptions + FileOperation *FileOperationRegistrationOptions + Moniker *MonikerRegistrationOptions + TypeHierarchy *TypeHierarchyRegistrationOptions + InlineValue *InlineValueRegistrationOptions + InlayHint *InlayHintRegistrationOptions + Diagnostic *DiagnosticRegistrationOptions + InlineCompletion *InlineCompletionRegistrationOptions + TextDocumentContent *TextDocumentContentRegistrationOptions + TextDocument *TextDocumentRegistrationOptions + Completion *CompletionRegistrationOptions + Hover *HoverRegistrationOptions + SignatureHelp *SignatureHelpRegistrationOptions + Definition *DefinitionRegistrationOptions + Reference *ReferenceRegistrationOptions + DocumentHighlight *DocumentHighlightRegistrationOptions + DocumentSymbol *DocumentSymbolRegistrationOptions + CodeAction *CodeActionRegistrationOptions + WorkspaceSymbol *WorkspaceSymbolRegistrationOptions + CodeLens *CodeLensRegistrationOptions + DocumentLink *DocumentLinkRegistrationOptions + DocumentFormatting *DocumentFormattingRegistrationOptions + DocumentRangeFormatting *DocumentRangeFormattingRegistrationOptions + DocumentOnTypeFormatting *DocumentOnTypeFormattingRegistrationOptions + Rename *RenameRegistrationOptions + ExecuteCommand *ExecuteCommandRegistrationOptions + NotebookDocumentSync *NotebookDocumentSyncRegistrationOptions + DidChangeConfiguration *DidChangeConfigurationRegistrationOptions + TextDocumentChange *TextDocumentChangeRegistrationOptions + TextDocumentSave *TextDocumentSaveRegistrationOptions + DidChangeWatchedFiles *DidChangeWatchedFilesRegistrationOptions } var _ json.MarshalerTo = (*RegisterOptions)(nil) func (o *RegisterOptions) MarshalJSONTo(enc *jsontext.Encoder) error { - assertOnlyOne("exactly one element of RegisterOptions should be set", o.ImplementationRegistrationOptions != nil, o.TypeDefinitionRegistrationOptions != nil, o.DocumentColorRegistrationOptions != nil, o.ColorPresentationRegistrationOptions != nil, o.FoldingRangeRegistrationOptions != nil, o.DeclarationRegistrationOptions != nil, o.SelectionRangeRegistrationOptions != nil, o.CallHierarchyRegistrationOptions != nil, o.SemanticTokensRegistrationOptions != nil, o.LinkedEditingRangeRegistrationOptions != nil, o.FileOperationRegistrationOptions != nil, o.MonikerRegistrationOptions != nil, o.TypeHierarchyRegistrationOptions != nil, o.InlineValueRegistrationOptions != nil, o.InlayHintRegistrationOptions != nil, o.DiagnosticRegistrationOptions != nil, o.InlineCompletionRegistrationOptions != nil, o.TextDocumentContentRegistrationOptions != nil, o.TextDocumentRegistrationOptions != nil, o.CompletionRegistrationOptions != nil, o.HoverRegistrationOptions != nil, o.SignatureHelpRegistrationOptions != nil, o.DefinitionRegistrationOptions != nil, o.ReferenceRegistrationOptions != nil, o.DocumentHighlightRegistrationOptions != nil, o.DocumentSymbolRegistrationOptions != nil, o.CodeActionRegistrationOptions != nil, o.WorkspaceSymbolRegistrationOptions != nil, o.CodeLensRegistrationOptions != nil, o.DocumentLinkRegistrationOptions != nil, o.DocumentFormattingRegistrationOptions != nil, o.DocumentRangeFormattingRegistrationOptions != nil, o.DocumentOnTypeFormattingRegistrationOptions != nil, o.RenameRegistrationOptions != nil, o.ExecuteCommandRegistrationOptions != nil, o.NotebookDocumentSyncRegistrationOptions != nil, o.DidChangeConfigurationRegistrationOptions != nil, o.TextDocumentChangeRegistrationOptions != nil, o.TextDocumentSaveRegistrationOptions != nil, o.DidChangeWatchedFilesRegistrationOptions != nil) + assertOnlyOne("exactly one element of RegisterOptions should be set", o.Implementation != nil, o.TypeDefinition != nil, o.DocumentColor != nil, o.ColorPresentation != nil, o.FoldingRange != nil, o.Declaration != nil, o.SelectionRange != nil, o.CallHierarchy != nil, o.SemanticTokens != nil, o.LinkedEditingRange != nil, o.FileOperation != nil, o.Moniker != nil, o.TypeHierarchy != nil, o.InlineValue != nil, o.InlayHint != nil, o.Diagnostic != nil, o.InlineCompletion != nil, o.TextDocumentContent != nil, o.TextDocument != nil, o.Completion != nil, o.Hover != nil, o.SignatureHelp != nil, o.Definition != nil, o.Reference != nil, o.DocumentHighlight != nil, o.DocumentSymbol != nil, o.CodeAction != nil, o.WorkspaceSymbol != nil, o.CodeLens != nil, o.DocumentLink != nil, o.DocumentFormatting != nil, o.DocumentRangeFormatting != nil, o.DocumentOnTypeFormatting != nil, o.Rename != nil, o.ExecuteCommand != nil, o.NotebookDocumentSync != nil, o.DidChangeConfiguration != nil, o.TextDocumentChange != nil, o.TextDocumentSave != nil, o.DidChangeWatchedFiles != nil) - if o.ImplementationRegistrationOptions != nil { - return json.MarshalEncode(enc, o.ImplementationRegistrationOptions) + if o.Implementation != nil { + return json.MarshalEncode(enc, o.Implementation) } - if o.TypeDefinitionRegistrationOptions != nil { - return json.MarshalEncode(enc, o.TypeDefinitionRegistrationOptions) + if o.TypeDefinition != nil { + return json.MarshalEncode(enc, o.TypeDefinition) } - if o.DocumentColorRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DocumentColorRegistrationOptions) + if o.DocumentColor != nil { + return json.MarshalEncode(enc, o.DocumentColor) } - if o.ColorPresentationRegistrationOptions != nil { - return json.MarshalEncode(enc, o.ColorPresentationRegistrationOptions) + if o.ColorPresentation != nil { + return json.MarshalEncode(enc, o.ColorPresentation) } - if o.FoldingRangeRegistrationOptions != nil { - return json.MarshalEncode(enc, o.FoldingRangeRegistrationOptions) + if o.FoldingRange != nil { + return json.MarshalEncode(enc, o.FoldingRange) } - if o.DeclarationRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DeclarationRegistrationOptions) + if o.Declaration != nil { + return json.MarshalEncode(enc, o.Declaration) } - if o.SelectionRangeRegistrationOptions != nil { - return json.MarshalEncode(enc, o.SelectionRangeRegistrationOptions) + if o.SelectionRange != nil { + return json.MarshalEncode(enc, o.SelectionRange) } - if o.CallHierarchyRegistrationOptions != nil { - return json.MarshalEncode(enc, o.CallHierarchyRegistrationOptions) + if o.CallHierarchy != nil { + return json.MarshalEncode(enc, o.CallHierarchy) } - if o.SemanticTokensRegistrationOptions != nil { - return json.MarshalEncode(enc, o.SemanticTokensRegistrationOptions) + if o.SemanticTokens != nil { + return json.MarshalEncode(enc, o.SemanticTokens) } - if o.LinkedEditingRangeRegistrationOptions != nil { - return json.MarshalEncode(enc, o.LinkedEditingRangeRegistrationOptions) + if o.LinkedEditingRange != nil { + return json.MarshalEncode(enc, o.LinkedEditingRange) } - if o.FileOperationRegistrationOptions != nil { - return json.MarshalEncode(enc, o.FileOperationRegistrationOptions) + if o.FileOperation != nil { + return json.MarshalEncode(enc, o.FileOperation) } - if o.MonikerRegistrationOptions != nil { - return json.MarshalEncode(enc, o.MonikerRegistrationOptions) + if o.Moniker != nil { + return json.MarshalEncode(enc, o.Moniker) } - if o.TypeHierarchyRegistrationOptions != nil { - return json.MarshalEncode(enc, o.TypeHierarchyRegistrationOptions) + if o.TypeHierarchy != nil { + return json.MarshalEncode(enc, o.TypeHierarchy) } - if o.InlineValueRegistrationOptions != nil { - return json.MarshalEncode(enc, o.InlineValueRegistrationOptions) + if o.InlineValue != nil { + return json.MarshalEncode(enc, o.InlineValue) } - if o.InlayHintRegistrationOptions != nil { - return json.MarshalEncode(enc, o.InlayHintRegistrationOptions) + if o.InlayHint != nil { + return json.MarshalEncode(enc, o.InlayHint) } - if o.DiagnosticRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DiagnosticRegistrationOptions) + if o.Diagnostic != nil { + return json.MarshalEncode(enc, o.Diagnostic) } - if o.InlineCompletionRegistrationOptions != nil { - return json.MarshalEncode(enc, o.InlineCompletionRegistrationOptions) + if o.InlineCompletion != nil { + return json.MarshalEncode(enc, o.InlineCompletion) } - if o.TextDocumentContentRegistrationOptions != nil { - return json.MarshalEncode(enc, o.TextDocumentContentRegistrationOptions) + if o.TextDocumentContent != nil { + return json.MarshalEncode(enc, o.TextDocumentContent) } - if o.TextDocumentRegistrationOptions != nil { - return json.MarshalEncode(enc, o.TextDocumentRegistrationOptions) + if o.TextDocument != nil { + return json.MarshalEncode(enc, o.TextDocument) } - if o.CompletionRegistrationOptions != nil { - return json.MarshalEncode(enc, o.CompletionRegistrationOptions) + if o.Completion != nil { + return json.MarshalEncode(enc, o.Completion) } - if o.HoverRegistrationOptions != nil { - return json.MarshalEncode(enc, o.HoverRegistrationOptions) + if o.Hover != nil { + return json.MarshalEncode(enc, o.Hover) } - if o.SignatureHelpRegistrationOptions != nil { - return json.MarshalEncode(enc, o.SignatureHelpRegistrationOptions) + if o.SignatureHelp != nil { + return json.MarshalEncode(enc, o.SignatureHelp) } - if o.DefinitionRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DefinitionRegistrationOptions) + if o.Definition != nil { + return json.MarshalEncode(enc, o.Definition) } - if o.ReferenceRegistrationOptions != nil { - return json.MarshalEncode(enc, o.ReferenceRegistrationOptions) + if o.Reference != nil { + return json.MarshalEncode(enc, o.Reference) } - if o.DocumentHighlightRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DocumentHighlightRegistrationOptions) + if o.DocumentHighlight != nil { + return json.MarshalEncode(enc, o.DocumentHighlight) } - if o.DocumentSymbolRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DocumentSymbolRegistrationOptions) + if o.DocumentSymbol != nil { + return json.MarshalEncode(enc, o.DocumentSymbol) } - if o.CodeActionRegistrationOptions != nil { - return json.MarshalEncode(enc, o.CodeActionRegistrationOptions) + if o.CodeAction != nil { + return json.MarshalEncode(enc, o.CodeAction) } - if o.WorkspaceSymbolRegistrationOptions != nil { - return json.MarshalEncode(enc, o.WorkspaceSymbolRegistrationOptions) + if o.WorkspaceSymbol != nil { + return json.MarshalEncode(enc, o.WorkspaceSymbol) } - if o.CodeLensRegistrationOptions != nil { - return json.MarshalEncode(enc, o.CodeLensRegistrationOptions) + if o.CodeLens != nil { + return json.MarshalEncode(enc, o.CodeLens) } - if o.DocumentLinkRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DocumentLinkRegistrationOptions) + if o.DocumentLink != nil { + return json.MarshalEncode(enc, o.DocumentLink) } - if o.DocumentFormattingRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DocumentFormattingRegistrationOptions) + if o.DocumentFormatting != nil { + return json.MarshalEncode(enc, o.DocumentFormatting) } - if o.DocumentRangeFormattingRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DocumentRangeFormattingRegistrationOptions) + if o.DocumentRangeFormatting != nil { + return json.MarshalEncode(enc, o.DocumentRangeFormatting) } - if o.DocumentOnTypeFormattingRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DocumentOnTypeFormattingRegistrationOptions) + if o.DocumentOnTypeFormatting != nil { + return json.MarshalEncode(enc, o.DocumentOnTypeFormatting) } - if o.RenameRegistrationOptions != nil { - return json.MarshalEncode(enc, o.RenameRegistrationOptions) + if o.Rename != nil { + return json.MarshalEncode(enc, o.Rename) } - if o.ExecuteCommandRegistrationOptions != nil { - return json.MarshalEncode(enc, o.ExecuteCommandRegistrationOptions) + if o.ExecuteCommand != nil { + return json.MarshalEncode(enc, o.ExecuteCommand) } - if o.NotebookDocumentSyncRegistrationOptions != nil { - return json.MarshalEncode(enc, o.NotebookDocumentSyncRegistrationOptions) + if o.NotebookDocumentSync != nil { + return json.MarshalEncode(enc, o.NotebookDocumentSync) } - if o.DidChangeConfigurationRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DidChangeConfigurationRegistrationOptions) + if o.DidChangeConfiguration != nil { + return json.MarshalEncode(enc, o.DidChangeConfiguration) } - if o.TextDocumentChangeRegistrationOptions != nil { - return json.MarshalEncode(enc, o.TextDocumentChangeRegistrationOptions) + if o.TextDocumentChange != nil { + return json.MarshalEncode(enc, o.TextDocumentChange) } - if o.TextDocumentSaveRegistrationOptions != nil { - return json.MarshalEncode(enc, o.TextDocumentSaveRegistrationOptions) + if o.TextDocumentSave != nil { + return json.MarshalEncode(enc, o.TextDocumentSave) } - if o.DidChangeWatchedFilesRegistrationOptions != nil { - return json.MarshalEncode(enc, o.DidChangeWatchedFilesRegistrationOptions) + if o.DidChangeWatchedFiles != nil { + return json.MarshalEncode(enc, o.DidChangeWatchedFiles) } panic("unreachable") } @@ -23054,204 +23054,204 @@ func (o *RegisterOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { if err != nil { return err } - var vImplementationRegistrationOptions ImplementationRegistrationOptions - if err := json.Unmarshal(data, &vImplementationRegistrationOptions); err == nil { - o.ImplementationRegistrationOptions = &vImplementationRegistrationOptions + var vImplementation ImplementationRegistrationOptions + if err := json.Unmarshal(data, &vImplementation); err == nil { + o.Implementation = &vImplementation return nil } - var vTypeDefinitionRegistrationOptions TypeDefinitionRegistrationOptions - if err := json.Unmarshal(data, &vTypeDefinitionRegistrationOptions); err == nil { - o.TypeDefinitionRegistrationOptions = &vTypeDefinitionRegistrationOptions + var vTypeDefinition TypeDefinitionRegistrationOptions + if err := json.Unmarshal(data, &vTypeDefinition); err == nil { + o.TypeDefinition = &vTypeDefinition return nil } - var vDocumentColorRegistrationOptions DocumentColorRegistrationOptions - if err := json.Unmarshal(data, &vDocumentColorRegistrationOptions); err == nil { - o.DocumentColorRegistrationOptions = &vDocumentColorRegistrationOptions + var vDocumentColor DocumentColorRegistrationOptions + if err := json.Unmarshal(data, &vDocumentColor); err == nil { + o.DocumentColor = &vDocumentColor return nil } - var vColorPresentationRegistrationOptions ColorPresentationRegistrationOptions - if err := json.Unmarshal(data, &vColorPresentationRegistrationOptions); err == nil { - o.ColorPresentationRegistrationOptions = &vColorPresentationRegistrationOptions + var vColorPresentation ColorPresentationRegistrationOptions + if err := json.Unmarshal(data, &vColorPresentation); err == nil { + o.ColorPresentation = &vColorPresentation return nil } - var vFoldingRangeRegistrationOptions FoldingRangeRegistrationOptions - if err := json.Unmarshal(data, &vFoldingRangeRegistrationOptions); err == nil { - o.FoldingRangeRegistrationOptions = &vFoldingRangeRegistrationOptions + var vFoldingRange FoldingRangeRegistrationOptions + if err := json.Unmarshal(data, &vFoldingRange); err == nil { + o.FoldingRange = &vFoldingRange return nil } - var vDeclarationRegistrationOptions DeclarationRegistrationOptions - if err := json.Unmarshal(data, &vDeclarationRegistrationOptions); err == nil { - o.DeclarationRegistrationOptions = &vDeclarationRegistrationOptions + var vDeclaration DeclarationRegistrationOptions + if err := json.Unmarshal(data, &vDeclaration); err == nil { + o.Declaration = &vDeclaration return nil } - var vSelectionRangeRegistrationOptions SelectionRangeRegistrationOptions - if err := json.Unmarshal(data, &vSelectionRangeRegistrationOptions); err == nil { - o.SelectionRangeRegistrationOptions = &vSelectionRangeRegistrationOptions + var vSelectionRange SelectionRangeRegistrationOptions + if err := json.Unmarshal(data, &vSelectionRange); err == nil { + o.SelectionRange = &vSelectionRange return nil } - var vCallHierarchyRegistrationOptions CallHierarchyRegistrationOptions - if err := json.Unmarshal(data, &vCallHierarchyRegistrationOptions); err == nil { - o.CallHierarchyRegistrationOptions = &vCallHierarchyRegistrationOptions + var vCallHierarchy CallHierarchyRegistrationOptions + if err := json.Unmarshal(data, &vCallHierarchy); err == nil { + o.CallHierarchy = &vCallHierarchy return nil } - var vSemanticTokensRegistrationOptions SemanticTokensRegistrationOptions - if err := json.Unmarshal(data, &vSemanticTokensRegistrationOptions); err == nil { - o.SemanticTokensRegistrationOptions = &vSemanticTokensRegistrationOptions + var vSemanticTokens SemanticTokensRegistrationOptions + if err := json.Unmarshal(data, &vSemanticTokens); err == nil { + o.SemanticTokens = &vSemanticTokens return nil } - var vLinkedEditingRangeRegistrationOptions LinkedEditingRangeRegistrationOptions - if err := json.Unmarshal(data, &vLinkedEditingRangeRegistrationOptions); err == nil { - o.LinkedEditingRangeRegistrationOptions = &vLinkedEditingRangeRegistrationOptions + var vLinkedEditingRange LinkedEditingRangeRegistrationOptions + if err := json.Unmarshal(data, &vLinkedEditingRange); err == nil { + o.LinkedEditingRange = &vLinkedEditingRange return nil } - var vFileOperationRegistrationOptions FileOperationRegistrationOptions - if err := json.Unmarshal(data, &vFileOperationRegistrationOptions); err == nil { - o.FileOperationRegistrationOptions = &vFileOperationRegistrationOptions + var vFileOperation FileOperationRegistrationOptions + if err := json.Unmarshal(data, &vFileOperation); err == nil { + o.FileOperation = &vFileOperation return nil } - var vMonikerRegistrationOptions MonikerRegistrationOptions - if err := json.Unmarshal(data, &vMonikerRegistrationOptions); err == nil { - o.MonikerRegistrationOptions = &vMonikerRegistrationOptions + var vMoniker MonikerRegistrationOptions + if err := json.Unmarshal(data, &vMoniker); err == nil { + o.Moniker = &vMoniker return nil } - var vTypeHierarchyRegistrationOptions TypeHierarchyRegistrationOptions - if err := json.Unmarshal(data, &vTypeHierarchyRegistrationOptions); err == nil { - o.TypeHierarchyRegistrationOptions = &vTypeHierarchyRegistrationOptions + var vTypeHierarchy TypeHierarchyRegistrationOptions + if err := json.Unmarshal(data, &vTypeHierarchy); err == nil { + o.TypeHierarchy = &vTypeHierarchy return nil } - var vInlineValueRegistrationOptions InlineValueRegistrationOptions - if err := json.Unmarshal(data, &vInlineValueRegistrationOptions); err == nil { - o.InlineValueRegistrationOptions = &vInlineValueRegistrationOptions + var vInlineValue InlineValueRegistrationOptions + if err := json.Unmarshal(data, &vInlineValue); err == nil { + o.InlineValue = &vInlineValue return nil } - var vInlayHintRegistrationOptions InlayHintRegistrationOptions - if err := json.Unmarshal(data, &vInlayHintRegistrationOptions); err == nil { - o.InlayHintRegistrationOptions = &vInlayHintRegistrationOptions + var vInlayHint InlayHintRegistrationOptions + if err := json.Unmarshal(data, &vInlayHint); err == nil { + o.InlayHint = &vInlayHint return nil } - var vDiagnosticRegistrationOptions DiagnosticRegistrationOptions - if err := json.Unmarshal(data, &vDiagnosticRegistrationOptions); err == nil { - o.DiagnosticRegistrationOptions = &vDiagnosticRegistrationOptions + var vDiagnostic DiagnosticRegistrationOptions + if err := json.Unmarshal(data, &vDiagnostic); err == nil { + o.Diagnostic = &vDiagnostic return nil } - var vInlineCompletionRegistrationOptions InlineCompletionRegistrationOptions - if err := json.Unmarshal(data, &vInlineCompletionRegistrationOptions); err == nil { - o.InlineCompletionRegistrationOptions = &vInlineCompletionRegistrationOptions + var vInlineCompletion InlineCompletionRegistrationOptions + if err := json.Unmarshal(data, &vInlineCompletion); err == nil { + o.InlineCompletion = &vInlineCompletion return nil } - var vTextDocumentContentRegistrationOptions TextDocumentContentRegistrationOptions - if err := json.Unmarshal(data, &vTextDocumentContentRegistrationOptions); err == nil { - o.TextDocumentContentRegistrationOptions = &vTextDocumentContentRegistrationOptions + var vTextDocumentContent TextDocumentContentRegistrationOptions + if err := json.Unmarshal(data, &vTextDocumentContent); err == nil { + o.TextDocumentContent = &vTextDocumentContent return nil } - var vTextDocumentRegistrationOptions TextDocumentRegistrationOptions - if err := json.Unmarshal(data, &vTextDocumentRegistrationOptions); err == nil { - o.TextDocumentRegistrationOptions = &vTextDocumentRegistrationOptions + var vTextDocument TextDocumentRegistrationOptions + if err := json.Unmarshal(data, &vTextDocument); err == nil { + o.TextDocument = &vTextDocument return nil } - var vCompletionRegistrationOptions CompletionRegistrationOptions - if err := json.Unmarshal(data, &vCompletionRegistrationOptions); err == nil { - o.CompletionRegistrationOptions = &vCompletionRegistrationOptions + var vCompletion CompletionRegistrationOptions + if err := json.Unmarshal(data, &vCompletion); err == nil { + o.Completion = &vCompletion return nil } - var vHoverRegistrationOptions HoverRegistrationOptions - if err := json.Unmarshal(data, &vHoverRegistrationOptions); err == nil { - o.HoverRegistrationOptions = &vHoverRegistrationOptions + var vHover HoverRegistrationOptions + if err := json.Unmarshal(data, &vHover); err == nil { + o.Hover = &vHover return nil } - var vSignatureHelpRegistrationOptions SignatureHelpRegistrationOptions - if err := json.Unmarshal(data, &vSignatureHelpRegistrationOptions); err == nil { - o.SignatureHelpRegistrationOptions = &vSignatureHelpRegistrationOptions + var vSignatureHelp SignatureHelpRegistrationOptions + if err := json.Unmarshal(data, &vSignatureHelp); err == nil { + o.SignatureHelp = &vSignatureHelp return nil } - var vDefinitionRegistrationOptions DefinitionRegistrationOptions - if err := json.Unmarshal(data, &vDefinitionRegistrationOptions); err == nil { - o.DefinitionRegistrationOptions = &vDefinitionRegistrationOptions + var vDefinition DefinitionRegistrationOptions + if err := json.Unmarshal(data, &vDefinition); err == nil { + o.Definition = &vDefinition return nil } - var vReferenceRegistrationOptions ReferenceRegistrationOptions - if err := json.Unmarshal(data, &vReferenceRegistrationOptions); err == nil { - o.ReferenceRegistrationOptions = &vReferenceRegistrationOptions + var vReference ReferenceRegistrationOptions + if err := json.Unmarshal(data, &vReference); err == nil { + o.Reference = &vReference return nil } - var vDocumentHighlightRegistrationOptions DocumentHighlightRegistrationOptions - if err := json.Unmarshal(data, &vDocumentHighlightRegistrationOptions); err == nil { - o.DocumentHighlightRegistrationOptions = &vDocumentHighlightRegistrationOptions + var vDocumentHighlight DocumentHighlightRegistrationOptions + if err := json.Unmarshal(data, &vDocumentHighlight); err == nil { + o.DocumentHighlight = &vDocumentHighlight return nil } - var vDocumentSymbolRegistrationOptions DocumentSymbolRegistrationOptions - if err := json.Unmarshal(data, &vDocumentSymbolRegistrationOptions); err == nil { - o.DocumentSymbolRegistrationOptions = &vDocumentSymbolRegistrationOptions + var vDocumentSymbol DocumentSymbolRegistrationOptions + if err := json.Unmarshal(data, &vDocumentSymbol); err == nil { + o.DocumentSymbol = &vDocumentSymbol return nil } - var vCodeActionRegistrationOptions CodeActionRegistrationOptions - if err := json.Unmarshal(data, &vCodeActionRegistrationOptions); err == nil { - o.CodeActionRegistrationOptions = &vCodeActionRegistrationOptions + var vCodeAction CodeActionRegistrationOptions + if err := json.Unmarshal(data, &vCodeAction); err == nil { + o.CodeAction = &vCodeAction return nil } - var vWorkspaceSymbolRegistrationOptions WorkspaceSymbolRegistrationOptions - if err := json.Unmarshal(data, &vWorkspaceSymbolRegistrationOptions); err == nil { - o.WorkspaceSymbolRegistrationOptions = &vWorkspaceSymbolRegistrationOptions + var vWorkspaceSymbol WorkspaceSymbolRegistrationOptions + if err := json.Unmarshal(data, &vWorkspaceSymbol); err == nil { + o.WorkspaceSymbol = &vWorkspaceSymbol return nil } - var vCodeLensRegistrationOptions CodeLensRegistrationOptions - if err := json.Unmarshal(data, &vCodeLensRegistrationOptions); err == nil { - o.CodeLensRegistrationOptions = &vCodeLensRegistrationOptions + var vCodeLens CodeLensRegistrationOptions + if err := json.Unmarshal(data, &vCodeLens); err == nil { + o.CodeLens = &vCodeLens return nil } - var vDocumentLinkRegistrationOptions DocumentLinkRegistrationOptions - if err := json.Unmarshal(data, &vDocumentLinkRegistrationOptions); err == nil { - o.DocumentLinkRegistrationOptions = &vDocumentLinkRegistrationOptions + var vDocumentLink DocumentLinkRegistrationOptions + if err := json.Unmarshal(data, &vDocumentLink); err == nil { + o.DocumentLink = &vDocumentLink return nil } - var vDocumentFormattingRegistrationOptions DocumentFormattingRegistrationOptions - if err := json.Unmarshal(data, &vDocumentFormattingRegistrationOptions); err == nil { - o.DocumentFormattingRegistrationOptions = &vDocumentFormattingRegistrationOptions + var vDocumentFormatting DocumentFormattingRegistrationOptions + if err := json.Unmarshal(data, &vDocumentFormatting); err == nil { + o.DocumentFormatting = &vDocumentFormatting return nil } - var vDocumentRangeFormattingRegistrationOptions DocumentRangeFormattingRegistrationOptions - if err := json.Unmarshal(data, &vDocumentRangeFormattingRegistrationOptions); err == nil { - o.DocumentRangeFormattingRegistrationOptions = &vDocumentRangeFormattingRegistrationOptions + var vDocumentRangeFormatting DocumentRangeFormattingRegistrationOptions + if err := json.Unmarshal(data, &vDocumentRangeFormatting); err == nil { + o.DocumentRangeFormatting = &vDocumentRangeFormatting return nil } - var vDocumentOnTypeFormattingRegistrationOptions DocumentOnTypeFormattingRegistrationOptions - if err := json.Unmarshal(data, &vDocumentOnTypeFormattingRegistrationOptions); err == nil { - o.DocumentOnTypeFormattingRegistrationOptions = &vDocumentOnTypeFormattingRegistrationOptions + var vDocumentOnTypeFormatting DocumentOnTypeFormattingRegistrationOptions + if err := json.Unmarshal(data, &vDocumentOnTypeFormatting); err == nil { + o.DocumentOnTypeFormatting = &vDocumentOnTypeFormatting return nil } - var vRenameRegistrationOptions RenameRegistrationOptions - if err := json.Unmarshal(data, &vRenameRegistrationOptions); err == nil { - o.RenameRegistrationOptions = &vRenameRegistrationOptions + var vRename RenameRegistrationOptions + if err := json.Unmarshal(data, &vRename); err == nil { + o.Rename = &vRename return nil } - var vExecuteCommandRegistrationOptions ExecuteCommandRegistrationOptions - if err := json.Unmarshal(data, &vExecuteCommandRegistrationOptions); err == nil { - o.ExecuteCommandRegistrationOptions = &vExecuteCommandRegistrationOptions + var vExecuteCommand ExecuteCommandRegistrationOptions + if err := json.Unmarshal(data, &vExecuteCommand); err == nil { + o.ExecuteCommand = &vExecuteCommand return nil } - var vNotebookDocumentSyncRegistrationOptions NotebookDocumentSyncRegistrationOptions - if err := json.Unmarshal(data, &vNotebookDocumentSyncRegistrationOptions); err == nil { - o.NotebookDocumentSyncRegistrationOptions = &vNotebookDocumentSyncRegistrationOptions + var vNotebookDocumentSync NotebookDocumentSyncRegistrationOptions + if err := json.Unmarshal(data, &vNotebookDocumentSync); err == nil { + o.NotebookDocumentSync = &vNotebookDocumentSync return nil } - var vDidChangeConfigurationRegistrationOptions DidChangeConfigurationRegistrationOptions - if err := json.Unmarshal(data, &vDidChangeConfigurationRegistrationOptions); err == nil { - o.DidChangeConfigurationRegistrationOptions = &vDidChangeConfigurationRegistrationOptions + var vDidChangeConfiguration DidChangeConfigurationRegistrationOptions + if err := json.Unmarshal(data, &vDidChangeConfiguration); err == nil { + o.DidChangeConfiguration = &vDidChangeConfiguration return nil } - var vTextDocumentChangeRegistrationOptions TextDocumentChangeRegistrationOptions - if err := json.Unmarshal(data, &vTextDocumentChangeRegistrationOptions); err == nil { - o.TextDocumentChangeRegistrationOptions = &vTextDocumentChangeRegistrationOptions + var vTextDocumentChange TextDocumentChangeRegistrationOptions + if err := json.Unmarshal(data, &vTextDocumentChange); err == nil { + o.TextDocumentChange = &vTextDocumentChange return nil } - var vTextDocumentSaveRegistrationOptions TextDocumentSaveRegistrationOptions - if err := json.Unmarshal(data, &vTextDocumentSaveRegistrationOptions); err == nil { - o.TextDocumentSaveRegistrationOptions = &vTextDocumentSaveRegistrationOptions + var vTextDocumentSave TextDocumentSaveRegistrationOptions + if err := json.Unmarshal(data, &vTextDocumentSave); err == nil { + o.TextDocumentSave = &vTextDocumentSave return nil } - var vDidChangeWatchedFilesRegistrationOptions DidChangeWatchedFilesRegistrationOptions - if err := json.Unmarshal(data, &vDidChangeWatchedFilesRegistrationOptions); err == nil { - o.DidChangeWatchedFilesRegistrationOptions = &vDidChangeWatchedFilesRegistrationOptions + var vDidChangeWatchedFiles DidChangeWatchedFilesRegistrationOptions + if err := json.Unmarshal(data, &vDidChangeWatchedFiles); err == nil { + o.DidChangeWatchedFiles = &vDidChangeWatchedFiles return nil } return fmt.Errorf("invalid RegisterOptions: %s", data) diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 48aca38f0c..a6889cbbd4 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -171,7 +171,7 @@ func (s *Server) WatchFiles(ctx context.Context, id project.WatcherID, watchers Id: string(id), Method: string(lsproto.MethodWorkspaceDidChangeWatchedFiles), RegisterOptions: &lsproto.RegisterOptions{ - DidChangeWatchedFilesRegistrationOptions: &lsproto.DidChangeWatchedFilesRegistrationOptions{ + DidChangeWatchedFiles: &lsproto.DidChangeWatchedFilesRegistrationOptions{ Watchers: watchers, }, }, @@ -762,7 +762,7 @@ func (s *Server) handleInitialized(ctx context.Context, params *lsproto.Initiali Id: "typescript-config-watch-id", Method: string(lsproto.MethodWorkspaceDidChangeConfiguration), RegisterOptions: &lsproto.RegisterOptions{ - DidChangeConfigurationRegistrationOptions: ptrTo(lsproto.DidChangeConfigurationRegistrationOptions{ + DidChangeConfiguration: ptrTo(lsproto.DidChangeConfigurationRegistrationOptions{ Section: &lsproto.StringOrStrings{ // !!! Both the 'javascript' and 'js/ts' scopes need to be watched for settings as well. Strings: &[]string{"typescript"}, From 10c6548319c6968f1c67b5381dc7ff6d0c26cba5 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 20:18:15 -0800 Subject: [PATCH 09/16] IsPackageJsonImport can be bool --- internal/fourslash/fourslash.go | 2 +- internal/ls/completions.go | 8 ++------ internal/lsp/lsproto/_generate/generate.mts | 1 - internal/lsp/lsproto/lsp_generated.go | 15 ++++++++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 5b045ea6c4..630661857e 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -1059,7 +1059,7 @@ func (f *FourslashTest) VerifyApplyCodeActionFromCompletion(t *testing.T, marker (options.AutoImportData.ModuleSpecifier == "" || data.AutoImport.ModuleSpecifier == options.AutoImportData.ModuleSpecifier) && (options.AutoImportData.ExportName == "" || data.AutoImport.ExportName == options.AutoImportData.ExportName) && (options.AutoImportData.AmbientModuleName == nil || data.AutoImport.AmbientModuleName == options.AutoImportData.AmbientModuleName) && - (options.AutoImportData.IsPackageJsonImport == nil || (data.AutoImport.IsPackageJsonImport != nil && *data.AutoImport.IsPackageJsonImport == *options.AutoImportData.IsPackageJsonImport))) + data.AutoImport.IsPackageJsonImport == options.AutoImportData.IsPackageJsonImport) } if data.AutoImport == nil && data.Source != "" && data.Source == options.Source { return true diff --git a/internal/ls/completions.go b/internal/ls/completions.go index 53e1db4d2f..14942a1ebc 100644 --- a/internal/ls/completions.go +++ b/internal/ls/completions.go @@ -246,10 +246,6 @@ func (origin *symbolOriginInfo) toCompletionEntryData() *lsproto.AutoImportData if origin.fileName == "" { ambientModuleName = strPtrTo(stringutil.StripQuotes(origin.moduleSymbol().Name)) } - var isPackageJsonImport *bool - if origin.isFromPackageJson { - isPackageJsonImport = ptrTo(true) - } data := origin.data.(*symbolOriginInfoExport) return &lsproto.AutoImportData{ @@ -258,7 +254,7 @@ func (origin *symbolOriginInfo) toCompletionEntryData() *lsproto.AutoImportData ModuleSpecifier: data.moduleSpecifier, AmbientModuleName: ambientModuleName, FileName: origin.fileName, - IsPackageJsonImport: isPackageJsonImport, + IsPackageJsonImport: origin.isFromPackageJson, } } @@ -5183,7 +5179,7 @@ func (l *LanguageService) getAutoImportSymbolFromCompletionEntryData(ch *checker origin := &symbolOriginInfo{ kind: symbolOriginInfoKindExport, fileName: autoImportData.FileName, - isFromPackageJson: autoImportData.IsPackageJsonImport != nil && *autoImportData.IsPackageJsonImport, + isFromPackageJson: autoImportData.IsPackageJsonImport, isDefaultExport: isDefaultExport, data: autoImportDataToSymbolOriginExport(autoImportData, name, moduleSymbol, isDefaultExport), } diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 4847d38b21..567d1437dd 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -101,7 +101,6 @@ const customStructures: Structure[] = [ { name: "isPackageJsonImport", type: { kind: "base", name: "boolean" }, - optional: true, documentation: "True if the export was found in the package.json AutoImportProvider.", }, ], diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 127ab8ef46..28e07bd266 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -19715,17 +19715,18 @@ type AutoImportData struct { AmbientModuleName *string `json:"ambientModuleName,omitzero"` // True if the export was found in the package.json AutoImportProvider. - IsPackageJsonImport *bool `json:"isPackageJsonImport,omitzero"` + IsPackageJsonImport bool `json:"isPackageJsonImport"` } var _ json.UnmarshalerFrom = (*AutoImportData)(nil) func (s *AutoImportData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( - seenExportName bool - seenExportMapKey bool - seenModuleSpecifier bool - seenFileName bool + seenExportName bool + seenExportMapKey bool + seenModuleSpecifier bool + seenFileName bool + seenIsPackageJsonImport bool ) if k := dec.PeekKind(); k != '{' { @@ -19766,6 +19767,7 @@ func (s *AutoImportData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"isPackageJsonImport"`: + seenIsPackageJsonImport = true if err := json.UnmarshalDecode(dec, &s.IsPackageJsonImport); err != nil { return err } @@ -19790,6 +19792,9 @@ func (s *AutoImportData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { if !seenFileName { return fmt.Errorf("required property 'fileName' is missing") } + if !seenIsPackageJsonImport { + return fmt.Errorf("required property 'isPackageJsonImport' is missing") + } return nil } From 833cdd3799ec58706600cc3f2a0c4caf6505da93 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 20:28:56 -0800 Subject: [PATCH 10/16] Silly ptrTo --- internal/lsp/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/lsp/server.go b/internal/lsp/server.go index a6889cbbd4..7c6fbdc93a 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -762,12 +762,12 @@ func (s *Server) handleInitialized(ctx context.Context, params *lsproto.Initiali Id: "typescript-config-watch-id", Method: string(lsproto.MethodWorkspaceDidChangeConfiguration), RegisterOptions: &lsproto.RegisterOptions{ - DidChangeConfiguration: ptrTo(lsproto.DidChangeConfigurationRegistrationOptions{ + DidChangeConfiguration: &lsproto.DidChangeConfigurationRegistrationOptions{ Section: &lsproto.StringOrStrings{ // !!! Both the 'javascript' and 'js/ts' scopes need to be watched for settings as well. Strings: &[]string{"typescript"}, }, - }), + }, }, }, }, From 6644e43872b3d8feadee321019dbf6b0aaaf12ce Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 22:22:57 -0800 Subject: [PATCH 11/16] Convert one more string --- internal/fourslash/fourslash.go | 2 +- internal/ls/completions.go | 8 ++++---- internal/lsp/lsproto/_generate/generate.mts | 1 - internal/lsp/lsproto/lsp_generated.go | 7 ++++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 630661857e..b33a369889 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -1058,7 +1058,7 @@ func (f *FourslashTest) VerifyApplyCodeActionFromCompletion(t *testing.T, marker return data.AutoImport != nil && ((data.AutoImport.FileName == options.AutoImportData.FileName) && (options.AutoImportData.ModuleSpecifier == "" || data.AutoImport.ModuleSpecifier == options.AutoImportData.ModuleSpecifier) && (options.AutoImportData.ExportName == "" || data.AutoImport.ExportName == options.AutoImportData.ExportName) && - (options.AutoImportData.AmbientModuleName == nil || data.AutoImport.AmbientModuleName == options.AutoImportData.AmbientModuleName) && + (options.AutoImportData.AmbientModuleName == "" || data.AutoImport.AmbientModuleName == options.AutoImportData.AmbientModuleName) && data.AutoImport.IsPackageJsonImport == options.AutoImportData.IsPackageJsonImport) } if data.AutoImport == nil && data.Source != "" && data.Source == options.Source { diff --git a/internal/ls/completions.go b/internal/ls/completions.go index 14942a1ebc..b74f0000e3 100644 --- a/internal/ls/completions.go +++ b/internal/ls/completions.go @@ -242,9 +242,9 @@ func (origin *symbolOriginInfo) moduleSymbol() *ast.Symbol { func (origin *symbolOriginInfo) toCompletionEntryData() *lsproto.AutoImportData { debug.Assert(origin.kind&symbolOriginInfoKindExport != 0, fmt.Sprintf("completionEntryData is not generated for symbolOriginInfo of type %T", origin.data)) - var ambientModuleName *string + var ambientModuleName string if origin.fileName == "" { - ambientModuleName = strPtrTo(stringutil.StripQuotes(origin.moduleSymbol().Name)) + ambientModuleName = stringutil.StripQuotes(origin.moduleSymbol().Name) } data := origin.data.(*symbolOriginInfoExport) @@ -5147,8 +5147,8 @@ func (l *LanguageService) getSymbolCompletionFromItemData( func (l *LanguageService) getAutoImportSymbolFromCompletionEntryData(ch *checker.Checker, name string, autoImportData *lsproto.AutoImportData) *symbolDetails { containingProgram := l.GetProgram() // !!! isPackageJson ? packageJsonAutoimportProvider : program var moduleSymbol *ast.Symbol - if autoImportData.AmbientModuleName != nil { - moduleSymbol = ch.TryFindAmbientModule(*autoImportData.AmbientModuleName) + if autoImportData.AmbientModuleName != "" { + moduleSymbol = ch.TryFindAmbientModule(autoImportData.AmbientModuleName) } else if autoImportData.FileName != "" { moduleSymbolSourceFile := containingProgram.GetSourceFile(autoImportData.FileName) if moduleSymbolSourceFile == nil { diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 567d1437dd..3c239a1695 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -95,7 +95,6 @@ const customStructures: Structure[] = [ { name: "ambientModuleName", type: { kind: "base", name: "string" }, - optional: true, documentation: "The module name (with quotes stripped) of the export's module symbol, if it was an ambient module.", }, { diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 28e07bd266..522227764e 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -19712,7 +19712,7 @@ type AutoImportData struct { FileName string `json:"fileName"` // The module name (with quotes stripped) of the export's module symbol, if it was an ambient module. - AmbientModuleName *string `json:"ambientModuleName,omitzero"` + AmbientModuleName string `json:"ambientModuleName"` // True if the export was found in the package.json AutoImportProvider. IsPackageJsonImport bool `json:"isPackageJsonImport"` @@ -19726,6 +19726,7 @@ func (s *AutoImportData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { seenExportMapKey bool seenModuleSpecifier bool seenFileName bool + seenAmbientModuleName bool seenIsPackageJsonImport bool ) @@ -19763,6 +19764,7 @@ func (s *AutoImportData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"ambientModuleName"`: + seenAmbientModuleName = true if err := json.UnmarshalDecode(dec, &s.AmbientModuleName); err != nil { return err } @@ -19792,6 +19794,9 @@ func (s *AutoImportData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { if !seenFileName { return fmt.Errorf("required property 'fileName' is missing") } + if !seenAmbientModuleName { + return fmt.Errorf("required property 'ambientModuleName' is missing") + } if !seenIsPackageJsonImport { return fmt.Errorf("required property 'isPackageJsonImport' is missing") } From d07e6162aaa229ba914da3d4798b6f704d9e9f63 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 20 Nov 2025 22:40:29 -0800 Subject: [PATCH 12/16] Do not encode empty things in the data structs --- internal/lsp/lsproto/_generate/fetchModel.mts | 9 +- internal/lsp/lsproto/_generate/generate.mts | 28 +- .../lsp/lsproto/_generate/metaModelSchema.mts | 6 + internal/lsp/lsproto/lsp_generated.go | 254 +----------------- 4 files changed, 53 insertions(+), 244 deletions(-) diff --git a/internal/lsp/lsproto/_generate/fetchModel.mts b/internal/lsp/lsproto/_generate/fetchModel.mts index 2497370a9c..f37b224857 100644 --- a/internal/lsp/lsproto/_generate/fetchModel.mts +++ b/internal/lsp/lsproto/_generate/fetchModel.mts @@ -18,5 +18,12 @@ const metaModel = await metaModelResponse.text(); fs.writeFileSync(metaModelPath, metaModel); const metaModelSchemaResponse = await fetch(metaModelSchemaURL); -const metaModelSchema = await metaModelSchemaResponse.text(); +let metaModelSchema = await metaModelSchemaResponse.text(); + +// Patch the schema to add omitzeroValue property to Property type +metaModelSchema = metaModelSchema.replace( + /(\t \* Whether the property is deprecated or not\. If deprecated\n\t \* the property contains the deprecation message\.\n\t \*\/\n\tdeprecated\?: string;)\n}/m, + `$1\n\n\t/**\n\t * Whether this property uses omitzero without being a pointer.\n\t * Custom extension for special value types.\n\t */\n\tomitzeroValue?: boolean;\n}`, +); + fs.writeFileSync(metaModelSchemaPath, metaModelSchema); diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 3c239a1695..1c6ca9f457 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -50,21 +50,25 @@ const customStructures: Structure[] = [ name: "symbolName", type: { kind: "base", name: "string" }, documentation: "The symbol name.", + omitzeroValue: true, }, { name: "symbolId", type: { kind: "reference", name: "uint64" }, documentation: "The symbol ID.", + omitzeroValue: true, }, { name: "ambientModuleName", type: { kind: "base", name: "string" }, documentation: "The ambient module name.", + omitzeroValue: true, }, { name: "moduleFile", type: { kind: "base", name: "string" }, documentation: "The module file path.", + omitzeroValue: true, }, ], documentation: "ExportInfoMapKey uniquely identifies an export for auto-import purposes.", @@ -76,31 +80,37 @@ const customStructures: Structure[] = [ name: "exportName", type: { kind: "base", name: "string" }, documentation: "The name of the property or export in the module's symbol table. Differs from the completion name in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default.", + omitzeroValue: true, }, { name: "exportMapKey", type: { kind: "reference", name: "ExportInfoMapKey" }, documentation: "The export map key for this auto-import.", + omitzeroValue: true, }, { name: "moduleSpecifier", type: { kind: "base", name: "string" }, documentation: "The module specifier for this auto-import.", + omitzeroValue: true, }, { name: "fileName", type: { kind: "base", name: "string" }, documentation: "The file name declaring the export's module symbol, if it was an external module.", + omitzeroValue: true, }, { name: "ambientModuleName", type: { kind: "base", name: "string" }, documentation: "The module name (with quotes stripped) of the export's module symbol, if it was an ambient module.", + omitzeroValue: true, }, { name: "isPackageJsonImport", type: { kind: "base", name: "boolean" }, documentation: "True if the export was found in the package.json AutoImportProvider.", + omitzeroValue: true, }, ], documentation: "AutoImportData contains information about an auto-import suggestion.", @@ -112,21 +122,25 @@ const customStructures: Structure[] = [ name: "fileName", type: { kind: "base", name: "string" }, documentation: "The file name where the completion was requested.", + omitzeroValue: true, }, { name: "position", type: { kind: "base", name: "integer" }, documentation: "The position where the completion was requested.", + omitzeroValue: true, }, { name: "source", type: { kind: "base", name: "string" }, documentation: "Special source value for disambiguation.", + omitzeroValue: true, }, { name: "name", type: { kind: "base", name: "string" }, documentation: "The name of the completion item.", + omitzeroValue: true, }, { name: "autoImport", @@ -873,9 +887,12 @@ function generateCode() { } const type = resolveType(prop.type); - const goType = prop.optional || type.needsPointer ? `*${type.name}` : type.name; - writeLine(`\t${titleCase(prop.name)} ${goType} \`json:"${prop.name}${prop.optional ? ",omitzero" : ""}"\``); + // For properties marked with omitzeroValue, use value type with omitzero instead of pointer + const useOmitzero = prop.optional || prop.omitzeroValue; + const goType = (prop.optional || type.needsPointer) && !prop.omitzeroValue ? `*${type.name}` : type.name; + + writeLine(`\t${titleCase(prop.name)} ${goType} \`json:"${prop.name}${useOmitzero ? ",omitzero" : ""}"\``); if (includeDocumentation) { writeLine(""); @@ -898,7 +915,12 @@ function generateCode() { } // Generate UnmarshalJSONFrom method for structure validation - const requiredProps = structure.properties?.filter(p => !p.optional) || []; + // Skip properties marked with omitzeroValue since they're optional by nature + const requiredProps = structure.properties?.filter(p => { + if (p.optional) return false; + if (p.omitzeroValue) return false; + return true; + }) || []; if (requiredProps.length > 0) { writeLine(`\tvar _ json.UnmarshalerFrom = (*${structure.name})(nil)`); writeLine(""); diff --git a/internal/lsp/lsproto/_generate/metaModelSchema.mts b/internal/lsp/lsproto/_generate/metaModelSchema.mts index 3b4091e54c..89f964bfba 100644 --- a/internal/lsp/lsproto/_generate/metaModelSchema.mts +++ b/internal/lsp/lsproto/_generate/metaModelSchema.mts @@ -319,6 +319,12 @@ export type Property = { * the property contains the deprecation message. */ deprecated?: string; + + /** + * Whether this property uses omitzero without being a pointer. + * Custom extension for special value types. + */ + omitzeroValue?: boolean; }; /** diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 522227764e..d57777b3da 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -19617,283 +19617,57 @@ type InitializationOptions struct { // ExportInfoMapKey uniquely identifies an export for auto-import purposes. type ExportInfoMapKey struct { // The symbol name. - SymbolName string `json:"symbolName"` + SymbolName string `json:"symbolName,omitzero"` // The symbol ID. - SymbolId uint64 `json:"symbolId"` + SymbolId uint64 `json:"symbolId,omitzero"` // The ambient module name. - AmbientModuleName string `json:"ambientModuleName"` + AmbientModuleName string `json:"ambientModuleName,omitzero"` // The module file path. - ModuleFile string `json:"moduleFile"` -} - -var _ json.UnmarshalerFrom = (*ExportInfoMapKey)(nil) - -func (s *ExportInfoMapKey) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenSymbolName bool - seenSymbolId bool - seenAmbientModuleName bool - seenModuleFile bool - ) - - if k := dec.PeekKind(); k != '{' { - return fmt.Errorf("expected object start, but encountered %v", k) - } - if _, err := dec.ReadToken(); err != nil { - return err - } - - for dec.PeekKind() != '}' { - name, err := dec.ReadValue() - if err != nil { - return err - } - switch string(name) { - case `"symbolName"`: - seenSymbolName = true - if err := json.UnmarshalDecode(dec, &s.SymbolName); err != nil { - return err - } - case `"symbolId"`: - seenSymbolId = true - if err := json.UnmarshalDecode(dec, &s.SymbolId); err != nil { - return err - } - case `"ambientModuleName"`: - seenAmbientModuleName = true - if err := json.UnmarshalDecode(dec, &s.AmbientModuleName); err != nil { - return err - } - case `"moduleFile"`: - seenModuleFile = true - if err := json.UnmarshalDecode(dec, &s.ModuleFile); err != nil { - return err - } - default: - // Ignore unknown properties. - } - } - - if _, err := dec.ReadToken(); err != nil { - return err - } - - if !seenSymbolName { - return fmt.Errorf("required property 'symbolName' is missing") - } - if !seenSymbolId { - return fmt.Errorf("required property 'symbolId' is missing") - } - if !seenAmbientModuleName { - return fmt.Errorf("required property 'ambientModuleName' is missing") - } - if !seenModuleFile { - return fmt.Errorf("required property 'moduleFile' is missing") - } - - return nil + ModuleFile string `json:"moduleFile,omitzero"` } // AutoImportData contains information about an auto-import suggestion. type AutoImportData struct { // The name of the property or export in the module's symbol table. Differs from the completion name in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default. - ExportName string `json:"exportName"` + ExportName string `json:"exportName,omitzero"` // The export map key for this auto-import. - ExportMapKey ExportInfoMapKey `json:"exportMapKey"` + ExportMapKey ExportInfoMapKey `json:"exportMapKey,omitzero"` // The module specifier for this auto-import. - ModuleSpecifier string `json:"moduleSpecifier"` + ModuleSpecifier string `json:"moduleSpecifier,omitzero"` // The file name declaring the export's module symbol, if it was an external module. - FileName string `json:"fileName"` + FileName string `json:"fileName,omitzero"` // The module name (with quotes stripped) of the export's module symbol, if it was an ambient module. - AmbientModuleName string `json:"ambientModuleName"` + AmbientModuleName string `json:"ambientModuleName,omitzero"` // True if the export was found in the package.json AutoImportProvider. - IsPackageJsonImport bool `json:"isPackageJsonImport"` -} - -var _ json.UnmarshalerFrom = (*AutoImportData)(nil) - -func (s *AutoImportData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenExportName bool - seenExportMapKey bool - seenModuleSpecifier bool - seenFileName bool - seenAmbientModuleName bool - seenIsPackageJsonImport bool - ) - - if k := dec.PeekKind(); k != '{' { - return fmt.Errorf("expected object start, but encountered %v", k) - } - if _, err := dec.ReadToken(); err != nil { - return err - } - - for dec.PeekKind() != '}' { - name, err := dec.ReadValue() - if err != nil { - return err - } - switch string(name) { - case `"exportName"`: - seenExportName = true - if err := json.UnmarshalDecode(dec, &s.ExportName); err != nil { - return err - } - case `"exportMapKey"`: - seenExportMapKey = true - if err := json.UnmarshalDecode(dec, &s.ExportMapKey); err != nil { - return err - } - case `"moduleSpecifier"`: - seenModuleSpecifier = true - if err := json.UnmarshalDecode(dec, &s.ModuleSpecifier); err != nil { - return err - } - case `"fileName"`: - seenFileName = true - if err := json.UnmarshalDecode(dec, &s.FileName); err != nil { - return err - } - case `"ambientModuleName"`: - seenAmbientModuleName = true - if err := json.UnmarshalDecode(dec, &s.AmbientModuleName); err != nil { - return err - } - case `"isPackageJsonImport"`: - seenIsPackageJsonImport = true - if err := json.UnmarshalDecode(dec, &s.IsPackageJsonImport); err != nil { - return err - } - default: - // Ignore unknown properties. - } - } - - if _, err := dec.ReadToken(); err != nil { - return err - } - - if !seenExportName { - return fmt.Errorf("required property 'exportName' is missing") - } - if !seenExportMapKey { - return fmt.Errorf("required property 'exportMapKey' is missing") - } - if !seenModuleSpecifier { - return fmt.Errorf("required property 'moduleSpecifier' is missing") - } - if !seenFileName { - return fmt.Errorf("required property 'fileName' is missing") - } - if !seenAmbientModuleName { - return fmt.Errorf("required property 'ambientModuleName' is missing") - } - if !seenIsPackageJsonImport { - return fmt.Errorf("required property 'isPackageJsonImport' is missing") - } - - return nil + IsPackageJsonImport bool `json:"isPackageJsonImport,omitzero"` } // CompletionItemData is preserved on a CompletionItem between CompletionRequest and CompletionResolveRequest. type CompletionItemData struct { // The file name where the completion was requested. - FileName string `json:"fileName"` + FileName string `json:"fileName,omitzero"` // The position where the completion was requested. - Position int32 `json:"position"` + Position int32 `json:"position,omitzero"` // Special source value for disambiguation. - Source string `json:"source"` + Source string `json:"source,omitzero"` // The name of the completion item. - Name string `json:"name"` + Name string `json:"name,omitzero"` // Auto-import data for this completion item. AutoImport *AutoImportData `json:"autoImport,omitzero"` } -var _ json.UnmarshalerFrom = (*CompletionItemData)(nil) - -func (s *CompletionItemData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenFileName bool - seenPosition bool - seenSource bool - seenName bool - ) - - if k := dec.PeekKind(); k != '{' { - return fmt.Errorf("expected object start, but encountered %v", k) - } - if _, err := dec.ReadToken(); err != nil { - return err - } - - for dec.PeekKind() != '}' { - name, err := dec.ReadValue() - if err != nil { - return err - } - switch string(name) { - case `"fileName"`: - seenFileName = true - if err := json.UnmarshalDecode(dec, &s.FileName); err != nil { - return err - } - case `"position"`: - seenPosition = true - if err := json.UnmarshalDecode(dec, &s.Position); err != nil { - return err - } - case `"source"`: - seenSource = true - if err := json.UnmarshalDecode(dec, &s.Source); err != nil { - return err - } - case `"name"`: - seenName = true - if err := json.UnmarshalDecode(dec, &s.Name); err != nil { - return err - } - case `"autoImport"`: - if err := json.UnmarshalDecode(dec, &s.AutoImport); err != nil { - return err - } - default: - // Ignore unknown properties. - } - } - - if _, err := dec.ReadToken(); err != nil { - return err - } - - if !seenFileName { - return fmt.Errorf("required property 'fileName' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") - } - if !seenSource { - return fmt.Errorf("required property 'source' is missing") - } - if !seenName { - return fmt.Errorf("required property 'name' is missing") - } - - return nil -} - // CallHierarchyItemData is a placeholder for custom data preserved on a CallHierarchyItem. type CallHierarchyItemData struct{} From 3a23169ab5bec23cf9c2a31c0adda300db0f6a91 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 21 Nov 2025 09:11:36 -0800 Subject: [PATCH 13/16] Stop depending on core --- internal/lsp/lsproto/lsp.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/lsp/lsproto/lsp.go b/internal/lsp/lsproto/lsp.go index e251b444f1..c47151c278 100644 --- a/internal/lsp/lsproto/lsp.go +++ b/internal/lsp/lsproto/lsp.go @@ -8,7 +8,6 @@ import ( "github.com/go-json-experiment/json" "github.com/go-json-experiment/json/jsontext" - "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -16,7 +15,10 @@ type DocumentUri string // !!! func (uri DocumentUri) FileName() string { if strings.HasPrefix(string(uri), "file://") { - parsed := core.Must(url.Parse(string(uri))) + parsed, err := url.Parse(string(uri)) + if err != nil { + panic(fmt.Sprintf("invalid file URI: %s", uri)) + } if parsed.Host != "" { return "//" + parsed.Host + parsed.Path } From b9c39deca259d9d76a048f67dff2078a07323cb1 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 21 Nov 2025 09:30:52 -0800 Subject: [PATCH 14/16] Finally use bitwise ops for required decoding --- internal/lsp/lsproto/_generate/generate.mts | 22 +- internal/lsp/lsproto/lsp_generated.go | 5272 ++++++++++++------- 2 files changed, 3341 insertions(+), 1953 deletions(-) diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 1c6ca9f457..2c877f9f44 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -926,11 +926,15 @@ function generateCode() { writeLine(""); writeLine(`func (s *${structure.name}) UnmarshalJSONFrom(dec *jsontext.Decoder) error {`); - writeLine(`\tvar (`); - for (const prop of requiredProps) { - writeLine(`\t\tseen${titleCase(prop.name)} bool`); + writeLine(`\tconst (`); + for (let i = 0; i < requiredProps.length; i++) { + const prop = requiredProps[i]; + const iotaPrefix = i === 0 ? " uint = 1 << iota" : ""; + writeLine(`\t\tmissing${titleCase(prop.name)}${iotaPrefix}`); } + writeLine(`\t\t_missingLast`); writeLine(`\t)`); + writeLine(`\tmissing := _missingLast - 1`); writeLine(""); writeLine(`\tif k := dec.PeekKind(); k != '{' {`); @@ -950,8 +954,8 @@ function generateCode() { for (const prop of structure.properties) { writeLine(`\t\tcase \`"${prop.name}"\`:`); - if (!prop.optional) { - writeLine(`\t\t\tseen${titleCase(prop.name)} = true`); + if (!prop.optional && !prop.omitzeroValue) { + writeLine(`\t\t\tmissing &^= missing${titleCase(prop.name)}`); } writeLine(`\t\t\tif err := json.UnmarshalDecode(dec, &s.${titleCase(prop.name)}); err != nil {`); writeLine(`\t\t\t\treturn err`); @@ -969,11 +973,13 @@ function generateCode() { writeLine(`\t}`); writeLine(""); + writeLine(`\tif missing != 0 {`); for (const prop of requiredProps) { - writeLine(`\tif !seen${titleCase(prop.name)} {`); - writeLine(`\t\treturn fmt.Errorf("required property '${prop.name}' is missing")`); - writeLine(`\t}`); + writeLine(`\t\tif missing&missing${titleCase(prop.name)} != 0 {`); + writeLine(`\t\t\treturn fmt.Errorf("required property '${prop.name}' is missing")`); + writeLine(`\t\t}`); } + writeLine(`\t}`); writeLine(""); writeLine(`\treturn nil`); diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index d57777b3da..5c6b0d7d53 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -35,10 +35,12 @@ func (s *ImplementationParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*ImplementationParams)(nil) func (s *ImplementationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -54,12 +56,12 @@ func (s *ImplementationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -80,11 +82,13 @@ func (s *ImplementationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -101,10 +105,12 @@ type Location struct { var _ json.UnmarshalerFrom = (*Location)(nil) func (s *Location) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenRange bool + const ( + missingUri uint = 1 << iota + missingRange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -120,12 +126,12 @@ func (s *Location) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -138,11 +144,13 @@ func (s *Location) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -163,7 +171,11 @@ type ImplementationRegistrationOptions struct { var _ json.UnmarshalerFrom = (*ImplementationRegistrationOptions)(nil) func (s *ImplementationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -179,7 +191,7 @@ func (s *ImplementationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -200,8 +212,10 @@ func (s *ImplementationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -229,10 +243,12 @@ func (s *TypeDefinitionParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*TypeDefinitionParams)(nil) func (s *TypeDefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -248,12 +264,12 @@ func (s *TypeDefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -274,11 +290,13 @@ func (s *TypeDefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -299,7 +317,11 @@ type TypeDefinitionRegistrationOptions struct { var _ json.UnmarshalerFrom = (*TypeDefinitionRegistrationOptions)(nil) func (s *TypeDefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -315,7 +337,7 @@ func (s *TypeDefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -336,8 +358,10 @@ func (s *TypeDefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -356,10 +380,12 @@ type WorkspaceFolder struct { var _ json.UnmarshalerFrom = (*WorkspaceFolder)(nil) func (s *WorkspaceFolder) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenName bool + const ( + missingUri uint = 1 << iota + missingName + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -375,12 +401,12 @@ func (s *WorkspaceFolder) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } @@ -393,11 +419,13 @@ func (s *WorkspaceFolder) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenName { - return fmt.Errorf("required property 'name' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } } return nil @@ -412,7 +440,11 @@ type DidChangeWorkspaceFoldersParams struct { var _ json.UnmarshalerFrom = (*DidChangeWorkspaceFoldersParams)(nil) func (s *DidChangeWorkspaceFoldersParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenEvent bool + const ( + missingEvent uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -428,7 +460,7 @@ func (s *DidChangeWorkspaceFoldersParams) UnmarshalJSONFrom(dec *jsontext.Decode } switch string(name) { case `"event"`: - seenEvent = true + missing &^= missingEvent if err := json.UnmarshalDecode(dec, &s.Event); err != nil { return err } @@ -441,8 +473,10 @@ func (s *DidChangeWorkspaceFoldersParams) UnmarshalJSONFrom(dec *jsontext.Decode return err } - if !seenEvent { - return fmt.Errorf("required property 'event' is missing") + if missing != 0 { + if missing&missingEvent != 0 { + return fmt.Errorf("required property 'event' is missing") + } } return nil @@ -456,7 +490,11 @@ type ConfigurationParams struct { var _ json.UnmarshalerFrom = (*ConfigurationParams)(nil) func (s *ConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenItems bool + const ( + missingItems uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -472,7 +510,7 @@ func (s *ConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"items"`: - seenItems = true + missing &^= missingItems if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } @@ -485,8 +523,10 @@ func (s *ConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenItems { - return fmt.Errorf("required property 'items' is missing") + if missing != 0 { + if missing&missingItems != 0 { + return fmt.Errorf("required property 'items' is missing") + } } return nil @@ -512,7 +552,11 @@ func (s *DocumentColorParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentColorParams)(nil) func (s *DocumentColorParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -536,7 +580,7 @@ func (s *DocumentColorParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -549,8 +593,10 @@ func (s *DocumentColorParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -568,10 +614,12 @@ type ColorInformation struct { var _ json.UnmarshalerFrom = (*ColorInformation)(nil) func (s *ColorInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenColor bool + const ( + missingRange uint = 1 << iota + missingColor + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -587,12 +635,12 @@ func (s *ColorInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"color"`: - seenColor = true + missing &^= missingColor if err := json.UnmarshalDecode(dec, &s.Color); err != nil { return err } @@ -605,11 +653,13 @@ func (s *ColorInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenColor { - return fmt.Errorf("required property 'color' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingColor != 0 { + return fmt.Errorf("required property 'color' is missing") + } } return nil @@ -630,7 +680,11 @@ type DocumentColorRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DocumentColorRegistrationOptions)(nil) func (s *DocumentColorRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -646,7 +700,7 @@ func (s *DocumentColorRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -667,8 +721,10 @@ func (s *DocumentColorRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -700,11 +756,13 @@ func (s *ColorPresentationParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*ColorPresentationParams)(nil) func (s *ColorPresentationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenColor bool - seenRange bool + const ( + missingTextDocument uint = 1 << iota + missingColor + missingRange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -728,17 +786,17 @@ func (s *ColorPresentationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"color"`: - seenColor = true + missing &^= missingColor if err := json.UnmarshalDecode(dec, &s.Color); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -751,14 +809,16 @@ func (s *ColorPresentationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenColor { - return fmt.Errorf("required property 'color' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingColor != 0 { + return fmt.Errorf("required property 'color' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -783,7 +843,11 @@ type ColorPresentation struct { var _ json.UnmarshalerFrom = (*ColorPresentation)(nil) func (s *ColorPresentation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenLabel bool + const ( + missingLabel uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -799,7 +863,7 @@ func (s *ColorPresentation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"label"`: - seenLabel = true + missing &^= missingLabel if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } @@ -820,8 +884,10 @@ func (s *ColorPresentation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenLabel { - return fmt.Errorf("required property 'label' is missing") + if missing != 0 { + if missing&missingLabel != 0 { + return fmt.Errorf("required property 'label' is missing") + } } return nil @@ -841,7 +907,11 @@ type TextDocumentRegistrationOptions struct { var _ json.UnmarshalerFrom = (*TextDocumentRegistrationOptions)(nil) func (s *TextDocumentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -857,7 +927,7 @@ func (s *TextDocumentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -870,8 +940,10 @@ func (s *TextDocumentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -897,7 +969,11 @@ func (s *FoldingRangeParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*FoldingRangeParams)(nil) func (s *FoldingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -921,7 +997,7 @@ func (s *FoldingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -934,8 +1010,10 @@ func (s *FoldingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -974,10 +1052,12 @@ type FoldingRange struct { var _ json.UnmarshalerFrom = (*FoldingRange)(nil) func (s *FoldingRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenStartLine bool - seenEndLine bool + const ( + missingStartLine uint = 1 << iota + missingEndLine + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -993,7 +1073,7 @@ func (s *FoldingRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"startLine"`: - seenStartLine = true + missing &^= missingStartLine if err := json.UnmarshalDecode(dec, &s.StartLine); err != nil { return err } @@ -1002,7 +1082,7 @@ func (s *FoldingRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"endLine"`: - seenEndLine = true + missing &^= missingEndLine if err := json.UnmarshalDecode(dec, &s.EndLine); err != nil { return err } @@ -1027,11 +1107,13 @@ func (s *FoldingRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenStartLine { - return fmt.Errorf("required property 'startLine' is missing") - } - if !seenEndLine { - return fmt.Errorf("required property 'endLine' is missing") + if missing != 0 { + if missing&missingStartLine != 0 { + return fmt.Errorf("required property 'startLine' is missing") + } + if missing&missingEndLine != 0 { + return fmt.Errorf("required property 'endLine' is missing") + } } return nil @@ -1052,7 +1134,11 @@ type FoldingRangeRegistrationOptions struct { var _ json.UnmarshalerFrom = (*FoldingRangeRegistrationOptions)(nil) func (s *FoldingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1068,7 +1154,7 @@ func (s *FoldingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -1089,8 +1175,10 @@ func (s *FoldingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -1118,10 +1206,12 @@ func (s *DeclarationParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DeclarationParams)(nil) func (s *DeclarationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1137,12 +1227,12 @@ func (s *DeclarationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -1163,11 +1253,13 @@ func (s *DeclarationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -1188,7 +1280,11 @@ type DeclarationRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DeclarationRegistrationOptions)(nil) func (s *DeclarationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1208,7 +1304,7 @@ func (s *DeclarationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder return err } case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -1225,8 +1321,10 @@ func (s *DeclarationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -1255,10 +1353,12 @@ func (s *SelectionRangeParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*SelectionRangeParams)(nil) func (s *SelectionRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPositions bool + const ( + missingTextDocument uint = 1 << iota + missingPositions + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1282,12 +1382,12 @@ func (s *SelectionRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"positions"`: - seenPositions = true + missing &^= missingPositions if err := json.UnmarshalDecode(dec, &s.Positions); err != nil { return err } @@ -1300,11 +1400,13 @@ func (s *SelectionRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPositions { - return fmt.Errorf("required property 'positions' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPositions != 0 { + return fmt.Errorf("required property 'positions' is missing") + } } return nil @@ -1323,7 +1425,11 @@ type SelectionRange struct { var _ json.UnmarshalerFrom = (*SelectionRange)(nil) func (s *SelectionRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRange bool + const ( + missingRange uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1339,7 +1445,7 @@ func (s *SelectionRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -1356,8 +1462,10 @@ func (s *SelectionRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -1378,7 +1486,11 @@ type SelectionRangeRegistrationOptions struct { var _ json.UnmarshalerFrom = (*SelectionRangeRegistrationOptions)(nil) func (s *SelectionRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1398,7 +1510,7 @@ func (s *SelectionRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -1415,8 +1527,10 @@ func (s *SelectionRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -1430,7 +1544,11 @@ type WorkDoneProgressCreateParams struct { var _ json.UnmarshalerFrom = (*WorkDoneProgressCreateParams)(nil) func (s *WorkDoneProgressCreateParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenToken bool + const ( + missingToken uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1446,7 +1564,7 @@ func (s *WorkDoneProgressCreateParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"token"`: - seenToken = true + missing &^= missingToken if err := json.UnmarshalDecode(dec, &s.Token); err != nil { return err } @@ -1459,8 +1577,10 @@ func (s *WorkDoneProgressCreateParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenToken { - return fmt.Errorf("required property 'token' is missing") + if missing != 0 { + if missing&missingToken != 0 { + return fmt.Errorf("required property 'token' is missing") + } } return nil @@ -1474,7 +1594,11 @@ type WorkDoneProgressCancelParams struct { var _ json.UnmarshalerFrom = (*WorkDoneProgressCancelParams)(nil) func (s *WorkDoneProgressCancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenToken bool + const ( + missingToken uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1490,7 +1614,7 @@ func (s *WorkDoneProgressCancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"token"`: - seenToken = true + missing &^= missingToken if err := json.UnmarshalDecode(dec, &s.Token); err != nil { return err } @@ -1503,8 +1627,10 @@ func (s *WorkDoneProgressCancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenToken { - return fmt.Errorf("required property 'token' is missing") + if missing != 0 { + if missing&missingToken != 0 { + return fmt.Errorf("required property 'token' is missing") + } } return nil @@ -1531,10 +1657,12 @@ func (s *CallHierarchyPrepareParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*CallHierarchyPrepareParams)(nil) func (s *CallHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1550,12 +1678,12 @@ func (s *CallHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -1572,11 +1700,13 @@ func (s *CallHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -1617,13 +1747,15 @@ type CallHierarchyItem struct { var _ json.UnmarshalerFrom = (*CallHierarchyItem)(nil) func (s *CallHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenName bool - seenKind bool - seenUri bool - seenRange bool - seenSelectionRange bool + const ( + missingName uint = 1 << iota + missingKind + missingUri + missingRange + missingSelectionRange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1639,12 +1771,12 @@ func (s *CallHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -1657,17 +1789,17 @@ func (s *CallHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"selectionRange"`: - seenSelectionRange = true + missing &^= missingSelectionRange if err := json.UnmarshalDecode(dec, &s.SelectionRange); err != nil { return err } @@ -1684,20 +1816,22 @@ func (s *CallHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenName { - return fmt.Errorf("required property 'name' is missing") - } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenSelectionRange { - return fmt.Errorf("required property 'selectionRange' is missing") + if missing != 0 { + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingSelectionRange != 0 { + return fmt.Errorf("required property 'selectionRange' is missing") + } } return nil @@ -1721,7 +1855,11 @@ type CallHierarchyRegistrationOptions struct { var _ json.UnmarshalerFrom = (*CallHierarchyRegistrationOptions)(nil) func (s *CallHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1737,7 +1875,7 @@ func (s *CallHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -1758,8 +1896,10 @@ func (s *CallHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -1782,7 +1922,11 @@ type CallHierarchyIncomingCallsParams struct { var _ json.UnmarshalerFrom = (*CallHierarchyIncomingCallsParams)(nil) func (s *CallHierarchyIncomingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenItem bool + const ( + missingItem uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1806,7 +1950,7 @@ func (s *CallHierarchyIncomingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decod return err } case `"item"`: - seenItem = true + missing &^= missingItem if err := json.UnmarshalDecode(dec, &s.Item); err != nil { return err } @@ -1819,8 +1963,10 @@ func (s *CallHierarchyIncomingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenItem { - return fmt.Errorf("required property 'item' is missing") + if missing != 0 { + if missing&missingItem != 0 { + return fmt.Errorf("required property 'item' is missing") + } } return nil @@ -1841,10 +1987,12 @@ type CallHierarchyIncomingCall struct { var _ json.UnmarshalerFrom = (*CallHierarchyIncomingCall)(nil) func (s *CallHierarchyIncomingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenFrom bool - seenFromRanges bool + const ( + missingFrom uint = 1 << iota + missingFromRanges + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1860,12 +2008,12 @@ func (s *CallHierarchyIncomingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"from"`: - seenFrom = true + missing &^= missingFrom if err := json.UnmarshalDecode(dec, &s.From); err != nil { return err } case `"fromRanges"`: - seenFromRanges = true + missing &^= missingFromRanges if err := json.UnmarshalDecode(dec, &s.FromRanges); err != nil { return err } @@ -1878,11 +2026,13 @@ func (s *CallHierarchyIncomingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenFrom { - return fmt.Errorf("required property 'from' is missing") - } - if !seenFromRanges { - return fmt.Errorf("required property 'fromRanges' is missing") + if missing != 0 { + if missing&missingFrom != 0 { + return fmt.Errorf("required property 'from' is missing") + } + if missing&missingFromRanges != 0 { + return fmt.Errorf("required property 'fromRanges' is missing") + } } return nil @@ -1905,7 +2055,11 @@ type CallHierarchyOutgoingCallsParams struct { var _ json.UnmarshalerFrom = (*CallHierarchyOutgoingCallsParams)(nil) func (s *CallHierarchyOutgoingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenItem bool + const ( + missingItem uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1929,7 +2083,7 @@ func (s *CallHierarchyOutgoingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decod return err } case `"item"`: - seenItem = true + missing &^= missingItem if err := json.UnmarshalDecode(dec, &s.Item); err != nil { return err } @@ -1942,8 +2096,10 @@ func (s *CallHierarchyOutgoingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenItem { - return fmt.Errorf("required property 'item' is missing") + if missing != 0 { + if missing&missingItem != 0 { + return fmt.Errorf("required property 'item' is missing") + } } return nil @@ -1965,10 +2121,12 @@ type CallHierarchyOutgoingCall struct { var _ json.UnmarshalerFrom = (*CallHierarchyOutgoingCall)(nil) func (s *CallHierarchyOutgoingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTo bool - seenFromRanges bool + const ( + missingTo uint = 1 << iota + missingFromRanges + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -1984,12 +2142,12 @@ func (s *CallHierarchyOutgoingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"to"`: - seenTo = true + missing &^= missingTo if err := json.UnmarshalDecode(dec, &s.To); err != nil { return err } case `"fromRanges"`: - seenFromRanges = true + missing &^= missingFromRanges if err := json.UnmarshalDecode(dec, &s.FromRanges); err != nil { return err } @@ -2002,11 +2160,13 @@ func (s *CallHierarchyOutgoingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenTo { - return fmt.Errorf("required property 'to' is missing") - } - if !seenFromRanges { - return fmt.Errorf("required property 'fromRanges' is missing") + if missing != 0 { + if missing&missingTo != 0 { + return fmt.Errorf("required property 'to' is missing") + } + if missing&missingFromRanges != 0 { + return fmt.Errorf("required property 'fromRanges' is missing") + } } return nil @@ -2032,7 +2192,11 @@ func (s *SemanticTokensParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*SemanticTokensParams)(nil) func (s *SemanticTokensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2056,7 +2220,7 @@ func (s *SemanticTokensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -2069,8 +2233,10 @@ func (s *SemanticTokensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -2091,7 +2257,11 @@ type SemanticTokens struct { var _ json.UnmarshalerFrom = (*SemanticTokens)(nil) func (s *SemanticTokens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenData bool + const ( + missingData uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2111,7 +2281,7 @@ func (s *SemanticTokens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"data"`: - seenData = true + missing &^= missingData if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } @@ -2124,8 +2294,10 @@ func (s *SemanticTokens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenData { - return fmt.Errorf("required property 'data' is missing") + if missing != 0 { + if missing&missingData != 0 { + return fmt.Errorf("required property 'data' is missing") + } } return nil @@ -2139,7 +2311,11 @@ type SemanticTokensPartialResult struct { var _ json.UnmarshalerFrom = (*SemanticTokensPartialResult)(nil) func (s *SemanticTokensPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenData bool + const ( + missingData uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2155,7 +2331,7 @@ func (s *SemanticTokensPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"data"`: - seenData = true + missing &^= missingData if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } @@ -2168,8 +2344,10 @@ func (s *SemanticTokensPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenData { - return fmt.Errorf("required property 'data' is missing") + if missing != 0 { + if missing&missingData != 0 { + return fmt.Errorf("required property 'data' is missing") + } } return nil @@ -2201,10 +2379,12 @@ type SemanticTokensRegistrationOptions struct { var _ json.UnmarshalerFrom = (*SemanticTokensRegistrationOptions)(nil) func (s *SemanticTokensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenDocumentSelector bool - seenLegend bool + const ( + missingDocumentSelector uint = 1 << iota + missingLegend + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2220,7 +2400,7 @@ func (s *SemanticTokensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -2229,7 +2409,7 @@ func (s *SemanticTokensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } case `"legend"`: - seenLegend = true + missing &^= missingLegend if err := json.UnmarshalDecode(dec, &s.Legend); err != nil { return err } @@ -2254,11 +2434,13 @@ func (s *SemanticTokensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") - } - if !seenLegend { - return fmt.Errorf("required property 'legend' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } + if missing&missingLegend != 0 { + return fmt.Errorf("required property 'legend' is missing") + } } return nil @@ -2288,10 +2470,12 @@ func (s *SemanticTokensDeltaParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*SemanticTokensDeltaParams)(nil) func (s *SemanticTokensDeltaParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPreviousResultId bool + const ( + missingTextDocument uint = 1 << iota + missingPreviousResultId + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2315,12 +2499,12 @@ func (s *SemanticTokensDeltaParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"previousResultId"`: - seenPreviousResultId = true + missing &^= missingPreviousResultId if err := json.UnmarshalDecode(dec, &s.PreviousResultId); err != nil { return err } @@ -2333,11 +2517,13 @@ func (s *SemanticTokensDeltaParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPreviousResultId { - return fmt.Errorf("required property 'previousResultId' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPreviousResultId != 0 { + return fmt.Errorf("required property 'previousResultId' is missing") + } } return nil @@ -2354,7 +2540,11 @@ type SemanticTokensDelta struct { var _ json.UnmarshalerFrom = (*SemanticTokensDelta)(nil) func (s *SemanticTokensDelta) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenEdits bool + const ( + missingEdits uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2374,7 +2564,7 @@ func (s *SemanticTokensDelta) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"edits"`: - seenEdits = true + missing &^= missingEdits if err := json.UnmarshalDecode(dec, &s.Edits); err != nil { return err } @@ -2387,8 +2577,10 @@ func (s *SemanticTokensDelta) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenEdits { - return fmt.Errorf("required property 'edits' is missing") + if missing != 0 { + if missing&missingEdits != 0 { + return fmt.Errorf("required property 'edits' is missing") + } } return nil @@ -2402,7 +2594,11 @@ type SemanticTokensDeltaPartialResult struct { var _ json.UnmarshalerFrom = (*SemanticTokensDeltaPartialResult)(nil) func (s *SemanticTokensDeltaPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenEdits bool + const ( + missingEdits uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2418,7 +2614,7 @@ func (s *SemanticTokensDeltaPartialResult) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"edits"`: - seenEdits = true + missing &^= missingEdits if err := json.UnmarshalDecode(dec, &s.Edits); err != nil { return err } @@ -2431,8 +2627,10 @@ func (s *SemanticTokensDeltaPartialResult) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenEdits { - return fmt.Errorf("required property 'edits' is missing") + if missing != 0 { + if missing&missingEdits != 0 { + return fmt.Errorf("required property 'edits' is missing") + } } return nil @@ -2461,10 +2659,12 @@ func (s *SemanticTokensRangeParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*SemanticTokensRangeParams)(nil) func (s *SemanticTokensRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenRange bool + const ( + missingTextDocument uint = 1 << iota + missingRange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2488,12 +2688,12 @@ func (s *SemanticTokensRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -2506,11 +2706,13 @@ func (s *SemanticTokensRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -2544,7 +2746,11 @@ type ShowDocumentParams struct { var _ json.UnmarshalerFrom = (*ShowDocumentParams)(nil) func (s *ShowDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUri bool + const ( + missingUri uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2560,7 +2766,7 @@ func (s *ShowDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -2585,8 +2791,10 @@ func (s *ShowDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -2603,7 +2811,11 @@ type ShowDocumentResult struct { var _ json.UnmarshalerFrom = (*ShowDocumentResult)(nil) func (s *ShowDocumentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenSuccess bool + const ( + missingSuccess uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2619,7 +2831,7 @@ func (s *ShowDocumentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"success"`: - seenSuccess = true + missing &^= missingSuccess if err := json.UnmarshalDecode(dec, &s.Success); err != nil { return err } @@ -2632,8 +2844,10 @@ func (s *ShowDocumentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenSuccess { - return fmt.Errorf("required property 'success' is missing") + if missing != 0 { + if missing&missingSuccess != 0 { + return fmt.Errorf("required property 'success' is missing") + } } return nil @@ -2657,10 +2871,12 @@ func (s *LinkedEditingRangeParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*LinkedEditingRangeParams)(nil) func (s *LinkedEditingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2676,12 +2892,12 @@ func (s *LinkedEditingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -2698,11 +2914,13 @@ func (s *LinkedEditingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -2725,7 +2943,11 @@ type LinkedEditingRanges struct { var _ json.UnmarshalerFrom = (*LinkedEditingRanges)(nil) func (s *LinkedEditingRanges) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRanges bool + const ( + missingRanges uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2741,7 +2963,7 @@ func (s *LinkedEditingRanges) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"ranges"`: - seenRanges = true + missing &^= missingRanges if err := json.UnmarshalDecode(dec, &s.Ranges); err != nil { return err } @@ -2758,8 +2980,10 @@ func (s *LinkedEditingRanges) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRanges { - return fmt.Errorf("required property 'ranges' is missing") + if missing != 0 { + if missing&missingRanges != 0 { + return fmt.Errorf("required property 'ranges' is missing") + } } return nil @@ -2780,7 +3004,11 @@ type LinkedEditingRangeRegistrationOptions struct { var _ json.UnmarshalerFrom = (*LinkedEditingRangeRegistrationOptions)(nil) func (s *LinkedEditingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2796,7 +3024,7 @@ func (s *LinkedEditingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -2817,8 +3045,10 @@ func (s *LinkedEditingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -2836,7 +3066,11 @@ type CreateFilesParams struct { var _ json.UnmarshalerFrom = (*CreateFilesParams)(nil) func (s *CreateFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenFiles bool + const ( + missingFiles uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2852,7 +3086,7 @@ func (s *CreateFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"files"`: - seenFiles = true + missing &^= missingFiles if err := json.UnmarshalDecode(dec, &s.Files); err != nil { return err } @@ -2865,8 +3099,10 @@ func (s *CreateFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenFiles { - return fmt.Errorf("required property 'files' is missing") + if missing != 0 { + if missing&missingFiles != 0 { + return fmt.Errorf("required property 'files' is missing") + } } return nil @@ -2920,7 +3156,11 @@ type FileOperationRegistrationOptions struct { var _ json.UnmarshalerFrom = (*FileOperationRegistrationOptions)(nil) func (s *FileOperationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenFilters bool + const ( + missingFilters uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2936,7 +3176,7 @@ func (s *FileOperationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"filters"`: - seenFilters = true + missing &^= missingFilters if err := json.UnmarshalDecode(dec, &s.Filters); err != nil { return err } @@ -2949,8 +3189,10 @@ func (s *FileOperationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenFilters { - return fmt.Errorf("required property 'filters' is missing") + if missing != 0 { + if missing&missingFilters != 0 { + return fmt.Errorf("required property 'filters' is missing") + } } return nil @@ -2969,7 +3211,11 @@ type RenameFilesParams struct { var _ json.UnmarshalerFrom = (*RenameFilesParams)(nil) func (s *RenameFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenFiles bool + const ( + missingFiles uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -2985,7 +3231,7 @@ func (s *RenameFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"files"`: - seenFiles = true + missing &^= missingFiles if err := json.UnmarshalDecode(dec, &s.Files); err != nil { return err } @@ -2998,8 +3244,10 @@ func (s *RenameFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenFiles { - return fmt.Errorf("required property 'files' is missing") + if missing != 0 { + if missing&missingFiles != 0 { + return fmt.Errorf("required property 'files' is missing") + } } return nil @@ -3017,7 +3265,11 @@ type DeleteFilesParams struct { var _ json.UnmarshalerFrom = (*DeleteFilesParams)(nil) func (s *DeleteFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenFiles bool + const ( + missingFiles uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3033,7 +3285,7 @@ func (s *DeleteFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"files"`: - seenFiles = true + missing &^= missingFiles if err := json.UnmarshalDecode(dec, &s.Files); err != nil { return err } @@ -3046,8 +3298,10 @@ func (s *DeleteFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenFiles { - return fmt.Errorf("required property 'files' is missing") + if missing != 0 { + if missing&missingFiles != 0 { + return fmt.Errorf("required property 'files' is missing") + } } return nil @@ -3075,10 +3329,12 @@ func (s *MonikerParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*MonikerParams)(nil) func (s *MonikerParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3094,12 +3350,12 @@ func (s *MonikerParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -3120,11 +3376,13 @@ func (s *MonikerParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -3151,11 +3409,13 @@ type Moniker struct { var _ json.UnmarshalerFrom = (*Moniker)(nil) func (s *Moniker) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenScheme bool - seenIdentifier bool - seenUnique bool + const ( + missingScheme uint = 1 << iota + missingIdentifier + missingUnique + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3171,17 +3431,17 @@ func (s *Moniker) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"scheme"`: - seenScheme = true + missing &^= missingScheme if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"identifier"`: - seenIdentifier = true + missing &^= missingIdentifier if err := json.UnmarshalDecode(dec, &s.Identifier); err != nil { return err } case `"unique"`: - seenUnique = true + missing &^= missingUnique if err := json.UnmarshalDecode(dec, &s.Unique); err != nil { return err } @@ -3198,14 +3458,16 @@ func (s *Moniker) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenScheme { - return fmt.Errorf("required property 'scheme' is missing") - } - if !seenIdentifier { - return fmt.Errorf("required property 'identifier' is missing") - } - if !seenUnique { - return fmt.Errorf("required property 'unique' is missing") + if missing != 0 { + if missing&missingScheme != 0 { + return fmt.Errorf("required property 'scheme' is missing") + } + if missing&missingIdentifier != 0 { + return fmt.Errorf("required property 'identifier' is missing") + } + if missing&missingUnique != 0 { + return fmt.Errorf("required property 'unique' is missing") + } } return nil @@ -3222,7 +3484,11 @@ type MonikerRegistrationOptions struct { var _ json.UnmarshalerFrom = (*MonikerRegistrationOptions)(nil) func (s *MonikerRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3238,7 +3504,7 @@ func (s *MonikerRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -3255,8 +3521,10 @@ func (s *MonikerRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -3283,10 +3551,12 @@ func (s *TypeHierarchyPrepareParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*TypeHierarchyPrepareParams)(nil) func (s *TypeHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3302,12 +3572,12 @@ func (s *TypeHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -3324,11 +3594,13 @@ func (s *TypeHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -3370,13 +3642,15 @@ type TypeHierarchyItem struct { var _ json.UnmarshalerFrom = (*TypeHierarchyItem)(nil) func (s *TypeHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenName bool - seenKind bool - seenUri bool - seenRange bool - seenSelectionRange bool + const ( + missingName uint = 1 << iota + missingKind + missingUri + missingRange + missingSelectionRange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3392,12 +3666,12 @@ func (s *TypeHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -3410,17 +3684,17 @@ func (s *TypeHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"selectionRange"`: - seenSelectionRange = true + missing &^= missingSelectionRange if err := json.UnmarshalDecode(dec, &s.SelectionRange); err != nil { return err } @@ -3437,20 +3711,22 @@ func (s *TypeHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenName { - return fmt.Errorf("required property 'name' is missing") - } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenSelectionRange { - return fmt.Errorf("required property 'selectionRange' is missing") + if missing != 0 { + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingSelectionRange != 0 { + return fmt.Errorf("required property 'selectionRange' is missing") + } } return nil @@ -3474,7 +3750,11 @@ type TypeHierarchyRegistrationOptions struct { var _ json.UnmarshalerFrom = (*TypeHierarchyRegistrationOptions)(nil) func (s *TypeHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3490,7 +3770,7 @@ func (s *TypeHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -3511,8 +3791,10 @@ func (s *TypeHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -3535,7 +3817,11 @@ type TypeHierarchySupertypesParams struct { var _ json.UnmarshalerFrom = (*TypeHierarchySupertypesParams)(nil) func (s *TypeHierarchySupertypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenItem bool + const ( + missingItem uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3559,7 +3845,7 @@ func (s *TypeHierarchySupertypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } case `"item"`: - seenItem = true + missing &^= missingItem if err := json.UnmarshalDecode(dec, &s.Item); err != nil { return err } @@ -3572,8 +3858,10 @@ func (s *TypeHierarchySupertypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenItem { - return fmt.Errorf("required property 'item' is missing") + if missing != 0 { + if missing&missingItem != 0 { + return fmt.Errorf("required property 'item' is missing") + } } return nil @@ -3596,7 +3884,11 @@ type TypeHierarchySubtypesParams struct { var _ json.UnmarshalerFrom = (*TypeHierarchySubtypesParams)(nil) func (s *TypeHierarchySubtypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenItem bool + const ( + missingItem uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3620,7 +3912,7 @@ func (s *TypeHierarchySubtypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } case `"item"`: - seenItem = true + missing &^= missingItem if err := json.UnmarshalDecode(dec, &s.Item); err != nil { return err } @@ -3633,8 +3925,10 @@ func (s *TypeHierarchySubtypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenItem { - return fmt.Errorf("required property 'item' is missing") + if missing != 0 { + if missing&missingItem != 0 { + return fmt.Errorf("required property 'item' is missing") + } } return nil @@ -3665,11 +3959,13 @@ func (s *InlineValueParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*InlineValueParams)(nil) func (s *InlineValueParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenRange bool - seenContext bool + const ( + missingTextDocument uint = 1 << iota + missingRange + missingContext + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3689,17 +3985,17 @@ func (s *InlineValueParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"context"`: - seenContext = true + missing &^= missingContext if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } @@ -3712,14 +4008,16 @@ func (s *InlineValueParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenContext { - return fmt.Errorf("required property 'context' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingContext != 0 { + return fmt.Errorf("required property 'context' is missing") + } } return nil @@ -3743,7 +4041,11 @@ type InlineValueRegistrationOptions struct { var _ json.UnmarshalerFrom = (*InlineValueRegistrationOptions)(nil) func (s *InlineValueRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3763,7 +4065,7 @@ func (s *InlineValueRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder return err } case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -3780,8 +4082,10 @@ func (s *InlineValueRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -3808,10 +4112,12 @@ func (s *InlayHintParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*InlayHintParams)(nil) func (s *InlayHintParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenRange bool + const ( + missingTextDocument uint = 1 << iota + missingRange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3831,12 +4137,12 @@ func (s *InlayHintParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -3849,11 +4155,13 @@ func (s *InlayHintParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -3911,10 +4219,12 @@ type InlayHint struct { var _ json.UnmarshalerFrom = (*InlayHint)(nil) func (s *InlayHint) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenPosition bool - seenLabel bool + const ( + missingPosition uint = 1 << iota + missingLabel + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -3930,12 +4240,12 @@ func (s *InlayHint) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"label"`: - seenLabel = true + missing &^= missingLabel if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } @@ -3972,11 +4282,13 @@ func (s *InlayHint) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") - } - if !seenLabel { - return fmt.Errorf("required property 'label' is missing") + if missing != 0 { + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } + if missing&missingLabel != 0 { + return fmt.Errorf("required property 'label' is missing") + } } return nil @@ -4004,7 +4316,11 @@ type InlayHintRegistrationOptions struct { var _ json.UnmarshalerFrom = (*InlayHintRegistrationOptions)(nil) func (s *InlayHintRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4028,7 +4344,7 @@ func (s *InlayHintRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -4045,8 +4361,10 @@ func (s *InlayHintRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -4080,7 +4398,11 @@ func (s *DocumentDiagnosticParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentDiagnosticParams)(nil) func (s *DocumentDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4104,7 +4426,7 @@ func (s *DocumentDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -4125,8 +4447,10 @@ func (s *DocumentDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -4142,7 +4466,11 @@ type DocumentDiagnosticReportPartialResult struct { var _ json.UnmarshalerFrom = (*DocumentDiagnosticReportPartialResult)(nil) func (s *DocumentDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRelatedDocuments bool + const ( + missingRelatedDocuments uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4158,7 +4486,7 @@ func (s *DocumentDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext. } switch string(name) { case `"relatedDocuments"`: - seenRelatedDocuments = true + missing &^= missingRelatedDocuments if err := json.UnmarshalDecode(dec, &s.RelatedDocuments); err != nil { return err } @@ -4171,8 +4499,10 @@ func (s *DocumentDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext. return err } - if !seenRelatedDocuments { - return fmt.Errorf("required property 'relatedDocuments' is missing") + if missing != 0 { + if missing&missingRelatedDocuments != 0 { + return fmt.Errorf("required property 'relatedDocuments' is missing") + } } return nil @@ -4188,7 +4518,11 @@ type DiagnosticServerCancellationData struct { var _ json.UnmarshalerFrom = (*DiagnosticServerCancellationData)(nil) func (s *DiagnosticServerCancellationData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRetriggerRequest bool + const ( + missingRetriggerRequest uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4204,7 +4538,7 @@ func (s *DiagnosticServerCancellationData) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"retriggerRequest"`: - seenRetriggerRequest = true + missing &^= missingRetriggerRequest if err := json.UnmarshalDecode(dec, &s.RetriggerRequest); err != nil { return err } @@ -4217,8 +4551,10 @@ func (s *DiagnosticServerCancellationData) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenRetriggerRequest { - return fmt.Errorf("required property 'retriggerRequest' is missing") + if missing != 0 { + if missing&missingRetriggerRequest != 0 { + return fmt.Errorf("required property 'retriggerRequest' is missing") + } } return nil @@ -4255,11 +4591,13 @@ type DiagnosticRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DiagnosticRegistrationOptions)(nil) func (s *DiagnosticRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenDocumentSelector bool - seenInterFileDependencies bool - seenWorkspaceDiagnostics bool + const ( + missingDocumentSelector uint = 1 << iota + missingInterFileDependencies + missingWorkspaceDiagnostics + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4275,7 +4613,7 @@ func (s *DiagnosticRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -4288,12 +4626,12 @@ func (s *DiagnosticRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } case `"interFileDependencies"`: - seenInterFileDependencies = true + missing &^= missingInterFileDependencies if err := json.UnmarshalDecode(dec, &s.InterFileDependencies); err != nil { return err } case `"workspaceDiagnostics"`: - seenWorkspaceDiagnostics = true + missing &^= missingWorkspaceDiagnostics if err := json.UnmarshalDecode(dec, &s.WorkspaceDiagnostics); err != nil { return err } @@ -4310,14 +4648,16 @@ func (s *DiagnosticRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") - } - if !seenInterFileDependencies { - return fmt.Errorf("required property 'interFileDependencies' is missing") - } - if !seenWorkspaceDiagnostics { - return fmt.Errorf("required property 'workspaceDiagnostics' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } + if missing&missingInterFileDependencies != 0 { + return fmt.Errorf("required property 'interFileDependencies' is missing") + } + if missing&missingWorkspaceDiagnostics != 0 { + return fmt.Errorf("required property 'workspaceDiagnostics' is missing") + } } return nil @@ -4345,7 +4685,11 @@ type WorkspaceDiagnosticParams struct { var _ json.UnmarshalerFrom = (*WorkspaceDiagnosticParams)(nil) func (s *WorkspaceDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenPreviousResultIds bool + const ( + missingPreviousResultIds uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4373,7 +4717,7 @@ func (s *WorkspaceDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } case `"previousResultIds"`: - seenPreviousResultIds = true + missing &^= missingPreviousResultIds if err := json.UnmarshalDecode(dec, &s.PreviousResultIds); err != nil { return err } @@ -4386,8 +4730,10 @@ func (s *WorkspaceDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenPreviousResultIds { - return fmt.Errorf("required property 'previousResultIds' is missing") + if missing != 0 { + if missing&missingPreviousResultIds != 0 { + return fmt.Errorf("required property 'previousResultIds' is missing") + } } return nil @@ -4403,7 +4749,11 @@ type WorkspaceDiagnosticReport struct { var _ json.UnmarshalerFrom = (*WorkspaceDiagnosticReport)(nil) func (s *WorkspaceDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenItems bool + const ( + missingItems uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4419,7 +4769,7 @@ func (s *WorkspaceDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"items"`: - seenItems = true + missing &^= missingItems if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } @@ -4432,8 +4782,10 @@ func (s *WorkspaceDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenItems { - return fmt.Errorf("required property 'items' is missing") + if missing != 0 { + if missing&missingItems != 0 { + return fmt.Errorf("required property 'items' is missing") + } } return nil @@ -4449,7 +4801,11 @@ type WorkspaceDiagnosticReportPartialResult struct { var _ json.UnmarshalerFrom = (*WorkspaceDiagnosticReportPartialResult)(nil) func (s *WorkspaceDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenItems bool + const ( + missingItems uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4465,7 +4821,7 @@ func (s *WorkspaceDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext } switch string(name) { case `"items"`: - seenItems = true + missing &^= missingItems if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } @@ -4478,8 +4834,10 @@ func (s *WorkspaceDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext return err } - if !seenItems { - return fmt.Errorf("required property 'items' is missing") + if missing != 0 { + if missing&missingItems != 0 { + return fmt.Errorf("required property 'items' is missing") + } } return nil @@ -4500,10 +4858,12 @@ type DidOpenNotebookDocumentParams struct { var _ json.UnmarshalerFrom = (*DidOpenNotebookDocumentParams)(nil) func (s *DidOpenNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenNotebookDocument bool - seenCellTextDocuments bool + const ( + missingNotebookDocument uint = 1 << iota + missingCellTextDocuments + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4519,12 +4879,12 @@ func (s *DidOpenNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"notebookDocument"`: - seenNotebookDocument = true + missing &^= missingNotebookDocument if err := json.UnmarshalDecode(dec, &s.NotebookDocument); err != nil { return err } case `"cellTextDocuments"`: - seenCellTextDocuments = true + missing &^= missingCellTextDocuments if err := json.UnmarshalDecode(dec, &s.CellTextDocuments); err != nil { return err } @@ -4537,11 +4897,13 @@ func (s *DidOpenNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenNotebookDocument { - return fmt.Errorf("required property 'notebookDocument' is missing") - } - if !seenCellTextDocuments { - return fmt.Errorf("required property 'cellTextDocuments' is missing") + if missing != 0 { + if missing&missingNotebookDocument != 0 { + return fmt.Errorf("required property 'notebookDocument' is missing") + } + if missing&missingCellTextDocuments != 0 { + return fmt.Errorf("required property 'cellTextDocuments' is missing") + } } return nil @@ -4566,7 +4928,11 @@ type NotebookDocumentSyncRegistrationOptions struct { var _ json.UnmarshalerFrom = (*NotebookDocumentSyncRegistrationOptions)(nil) func (s *NotebookDocumentSyncRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenNotebookSelector bool + const ( + missingNotebookSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4582,7 +4948,7 @@ func (s *NotebookDocumentSyncRegistrationOptions) UnmarshalJSONFrom(dec *jsontex } switch string(name) { case `"notebookSelector"`: - seenNotebookSelector = true + missing &^= missingNotebookSelector if err := json.UnmarshalDecode(dec, &s.NotebookSelector); err != nil { return err } @@ -4603,8 +4969,10 @@ func (s *NotebookDocumentSyncRegistrationOptions) UnmarshalJSONFrom(dec *jsontex return err } - if !seenNotebookSelector { - return fmt.Errorf("required property 'notebookSelector' is missing") + if missing != 0 { + if missing&missingNotebookSelector != 0 { + return fmt.Errorf("required property 'notebookSelector' is missing") + } } return nil @@ -4639,10 +5007,12 @@ type DidChangeNotebookDocumentParams struct { var _ json.UnmarshalerFrom = (*DidChangeNotebookDocumentParams)(nil) func (s *DidChangeNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenNotebookDocument bool - seenChange bool + const ( + missingNotebookDocument uint = 1 << iota + missingChange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4658,12 +5028,12 @@ func (s *DidChangeNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decode } switch string(name) { case `"notebookDocument"`: - seenNotebookDocument = true + missing &^= missingNotebookDocument if err := json.UnmarshalDecode(dec, &s.NotebookDocument); err != nil { return err } case `"change"`: - seenChange = true + missing &^= missingChange if err := json.UnmarshalDecode(dec, &s.Change); err != nil { return err } @@ -4676,11 +5046,13 @@ func (s *DidChangeNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decode return err } - if !seenNotebookDocument { - return fmt.Errorf("required property 'notebookDocument' is missing") - } - if !seenChange { - return fmt.Errorf("required property 'change' is missing") + if missing != 0 { + if missing&missingNotebookDocument != 0 { + return fmt.Errorf("required property 'notebookDocument' is missing") + } + if missing&missingChange != 0 { + return fmt.Errorf("required property 'change' is missing") + } } return nil @@ -4697,7 +5069,11 @@ type DidSaveNotebookDocumentParams struct { var _ json.UnmarshalerFrom = (*DidSaveNotebookDocumentParams)(nil) func (s *DidSaveNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenNotebookDocument bool + const ( + missingNotebookDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4713,7 +5089,7 @@ func (s *DidSaveNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"notebookDocument"`: - seenNotebookDocument = true + missing &^= missingNotebookDocument if err := json.UnmarshalDecode(dec, &s.NotebookDocument); err != nil { return err } @@ -4726,8 +5102,10 @@ func (s *DidSaveNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenNotebookDocument { - return fmt.Errorf("required property 'notebookDocument' is missing") + if missing != 0 { + if missing&missingNotebookDocument != 0 { + return fmt.Errorf("required property 'notebookDocument' is missing") + } } return nil @@ -4748,10 +5126,12 @@ type DidCloseNotebookDocumentParams struct { var _ json.UnmarshalerFrom = (*DidCloseNotebookDocumentParams)(nil) func (s *DidCloseNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenNotebookDocument bool - seenCellTextDocuments bool + const ( + missingNotebookDocument uint = 1 << iota + missingCellTextDocuments + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4767,12 +5147,12 @@ func (s *DidCloseNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder } switch string(name) { case `"notebookDocument"`: - seenNotebookDocument = true + missing &^= missingNotebookDocument if err := json.UnmarshalDecode(dec, &s.NotebookDocument); err != nil { return err } case `"cellTextDocuments"`: - seenCellTextDocuments = true + missing &^= missingCellTextDocuments if err := json.UnmarshalDecode(dec, &s.CellTextDocuments); err != nil { return err } @@ -4785,11 +5165,13 @@ func (s *DidCloseNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenNotebookDocument { - return fmt.Errorf("required property 'notebookDocument' is missing") - } - if !seenCellTextDocuments { - return fmt.Errorf("required property 'cellTextDocuments' is missing") + if missing != 0 { + if missing&missingNotebookDocument != 0 { + return fmt.Errorf("required property 'notebookDocument' is missing") + } + if missing&missingCellTextDocuments != 0 { + return fmt.Errorf("required property 'cellTextDocuments' is missing") + } } return nil @@ -4822,11 +5204,13 @@ func (s *InlineCompletionParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*InlineCompletionParams)(nil) func (s *InlineCompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool - seenContext bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + missingContext + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4842,12 +5226,12 @@ func (s *InlineCompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -4856,7 +5240,7 @@ func (s *InlineCompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } case `"context"`: - seenContext = true + missing &^= missingContext if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } @@ -4869,14 +5253,16 @@ func (s *InlineCompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") - } - if !seenContext { - return fmt.Errorf("required property 'context' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } + if missing&missingContext != 0 { + return fmt.Errorf("required property 'context' is missing") + } } return nil @@ -4895,7 +5281,11 @@ type InlineCompletionList struct { var _ json.UnmarshalerFrom = (*InlineCompletionList)(nil) func (s *InlineCompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenItems bool + const ( + missingItems uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4911,7 +5301,7 @@ func (s *InlineCompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"items"`: - seenItems = true + missing &^= missingItems if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } @@ -4924,8 +5314,10 @@ func (s *InlineCompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenItems { - return fmt.Errorf("required property 'items' is missing") + if missing != 0 { + if missing&missingItems != 0 { + return fmt.Errorf("required property 'items' is missing") + } } return nil @@ -4953,7 +5345,11 @@ type InlineCompletionItem struct { var _ json.UnmarshalerFrom = (*InlineCompletionItem)(nil) func (s *InlineCompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenInsertText bool + const ( + missingInsertText uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -4969,7 +5365,7 @@ func (s *InlineCompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"insertText"`: - seenInsertText = true + missing &^= missingInsertText if err := json.UnmarshalDecode(dec, &s.InsertText); err != nil { return err } @@ -4994,8 +5390,10 @@ func (s *InlineCompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenInsertText { - return fmt.Errorf("required property 'insertText' is missing") + if missing != 0 { + if missing&missingInsertText != 0 { + return fmt.Errorf("required property 'insertText' is missing") + } } return nil @@ -5021,7 +5419,11 @@ type InlineCompletionRegistrationOptions struct { var _ json.UnmarshalerFrom = (*InlineCompletionRegistrationOptions)(nil) func (s *InlineCompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5041,7 +5443,7 @@ func (s *InlineCompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.De return err } case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -5058,8 +5460,10 @@ func (s *InlineCompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.De return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -5078,7 +5482,11 @@ type TextDocumentContentParams struct { var _ json.UnmarshalerFrom = (*TextDocumentContentParams)(nil) func (s *TextDocumentContentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUri bool + const ( + missingUri uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5094,7 +5502,7 @@ func (s *TextDocumentContentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -5107,8 +5515,10 @@ func (s *TextDocumentContentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -5130,7 +5540,11 @@ type TextDocumentContentResult struct { var _ json.UnmarshalerFrom = (*TextDocumentContentResult)(nil) func (s *TextDocumentContentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenText bool + const ( + missingText uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5146,7 +5560,7 @@ func (s *TextDocumentContentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"text"`: - seenText = true + missing &^= missingText if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } @@ -5159,8 +5573,10 @@ func (s *TextDocumentContentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenText { - return fmt.Errorf("required property 'text' is missing") + if missing != 0 { + if missing&missingText != 0 { + return fmt.Errorf("required property 'text' is missing") + } } return nil @@ -5183,7 +5599,11 @@ type TextDocumentContentRegistrationOptions struct { var _ json.UnmarshalerFrom = (*TextDocumentContentRegistrationOptions)(nil) func (s *TextDocumentContentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenSchemes bool + const ( + missingSchemes uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5199,7 +5619,7 @@ func (s *TextDocumentContentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext } switch string(name) { case `"schemes"`: - seenSchemes = true + missing &^= missingSchemes if err := json.UnmarshalDecode(dec, &s.Schemes); err != nil { return err } @@ -5216,8 +5636,10 @@ func (s *TextDocumentContentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext return err } - if !seenSchemes { - return fmt.Errorf("required property 'schemes' is missing") + if missing != 0 { + if missing&missingSchemes != 0 { + return fmt.Errorf("required property 'schemes' is missing") + } } return nil @@ -5236,7 +5658,11 @@ type TextDocumentContentRefreshParams struct { var _ json.UnmarshalerFrom = (*TextDocumentContentRefreshParams)(nil) func (s *TextDocumentContentRefreshParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUri bool + const ( + missingUri uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5252,7 +5678,7 @@ func (s *TextDocumentContentRefreshParams) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -5265,8 +5691,10 @@ func (s *TextDocumentContentRefreshParams) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -5279,7 +5707,11 @@ type RegistrationParams struct { var _ json.UnmarshalerFrom = (*RegistrationParams)(nil) func (s *RegistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRegistrations bool + const ( + missingRegistrations uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5295,7 +5727,7 @@ func (s *RegistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"registrations"`: - seenRegistrations = true + missing &^= missingRegistrations if err := json.UnmarshalDecode(dec, &s.Registrations); err != nil { return err } @@ -5308,8 +5740,10 @@ func (s *RegistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRegistrations { - return fmt.Errorf("required property 'registrations' is missing") + if missing != 0 { + if missing&missingRegistrations != 0 { + return fmt.Errorf("required property 'registrations' is missing") + } } return nil @@ -5322,7 +5756,11 @@ type UnregistrationParams struct { var _ json.UnmarshalerFrom = (*UnregistrationParams)(nil) func (s *UnregistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUnregisterations bool + const ( + missingUnregisterations uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5338,7 +5776,7 @@ func (s *UnregistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"unregisterations"`: - seenUnregisterations = true + missing &^= missingUnregisterations if err := json.UnmarshalDecode(dec, &s.Unregisterations); err != nil { return err } @@ -5351,8 +5789,10 @@ func (s *UnregistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUnregisterations { - return fmt.Errorf("required property 'unregisterations' is missing") + if missing != 0 { + if missing&missingUnregisterations != 0 { + return fmt.Errorf("required property 'unregisterations' is missing") + } } return nil @@ -5419,11 +5859,13 @@ type InitializeParams struct { var _ json.UnmarshalerFrom = (*InitializeParams)(nil) func (s *InitializeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenProcessId bool - seenRootUri bool - seenCapabilities bool + const ( + missingProcessId uint = 1 << iota + missingRootUri + missingCapabilities + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5443,7 +5885,7 @@ func (s *InitializeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"processId"`: - seenProcessId = true + missing &^= missingProcessId if err := json.UnmarshalDecode(dec, &s.ProcessId); err != nil { return err } @@ -5460,12 +5902,12 @@ func (s *InitializeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"rootUri"`: - seenRootUri = true + missing &^= missingRootUri if err := json.UnmarshalDecode(dec, &s.RootUri); err != nil { return err } case `"capabilities"`: - seenCapabilities = true + missing &^= missingCapabilities if err := json.UnmarshalDecode(dec, &s.Capabilities); err != nil { return err } @@ -5490,14 +5932,16 @@ func (s *InitializeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenProcessId { - return fmt.Errorf("required property 'processId' is missing") - } - if !seenRootUri { - return fmt.Errorf("required property 'rootUri' is missing") - } - if !seenCapabilities { - return fmt.Errorf("required property 'capabilities' is missing") + if missing != 0 { + if missing&missingProcessId != 0 { + return fmt.Errorf("required property 'processId' is missing") + } + if missing&missingRootUri != 0 { + return fmt.Errorf("required property 'rootUri' is missing") + } + if missing&missingCapabilities != 0 { + return fmt.Errorf("required property 'capabilities' is missing") + } } return nil @@ -5517,7 +5961,11 @@ type InitializeResult struct { var _ json.UnmarshalerFrom = (*InitializeResult)(nil) func (s *InitializeResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenCapabilities bool + const ( + missingCapabilities uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5533,7 +5981,7 @@ func (s *InitializeResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"capabilities"`: - seenCapabilities = true + missing &^= missingCapabilities if err := json.UnmarshalDecode(dec, &s.Capabilities); err != nil { return err } @@ -5550,8 +5998,10 @@ func (s *InitializeResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenCapabilities { - return fmt.Errorf("required property 'capabilities' is missing") + if missing != 0 { + if missing&missingCapabilities != 0 { + return fmt.Errorf("required property 'capabilities' is missing") + } } return nil @@ -5570,7 +6020,11 @@ type InitializeError struct { var _ json.UnmarshalerFrom = (*InitializeError)(nil) func (s *InitializeError) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRetry bool + const ( + missingRetry uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5586,7 +6040,7 @@ func (s *InitializeError) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"retry"`: - seenRetry = true + missing &^= missingRetry if err := json.UnmarshalDecode(dec, &s.Retry); err != nil { return err } @@ -5599,8 +6053,10 @@ func (s *InitializeError) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRetry { - return fmt.Errorf("required property 'retry' is missing") + if missing != 0 { + if missing&missingRetry != 0 { + return fmt.Errorf("required property 'retry' is missing") + } } return nil @@ -5617,7 +6073,11 @@ type DidChangeConfigurationParams struct { var _ json.UnmarshalerFrom = (*DidChangeConfigurationParams)(nil) func (s *DidChangeConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenSettings bool + const ( + missingSettings uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5633,7 +6093,7 @@ func (s *DidChangeConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"settings"`: - seenSettings = true + missing &^= missingSettings if err := json.UnmarshalDecode(dec, &s.Settings); err != nil { return err } @@ -5646,8 +6106,10 @@ func (s *DidChangeConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenSettings { - return fmt.Errorf("required property 'settings' is missing") + if missing != 0 { + if missing&missingSettings != 0 { + return fmt.Errorf("required property 'settings' is missing") + } } return nil @@ -5669,10 +6131,12 @@ type ShowMessageParams struct { var _ json.UnmarshalerFrom = (*ShowMessageParams)(nil) func (s *ShowMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenType bool - seenMessage bool + const ( + missingType uint = 1 << iota + missingMessage + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5688,12 +6152,12 @@ func (s *ShowMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"type"`: - seenType = true + missing &^= missingType if err := json.UnmarshalDecode(dec, &s.Type); err != nil { return err } case `"message"`: - seenMessage = true + missing &^= missingMessage if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } @@ -5706,11 +6170,13 @@ func (s *ShowMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenType { - return fmt.Errorf("required property 'type' is missing") - } - if !seenMessage { - return fmt.Errorf("required property 'message' is missing") + if missing != 0 { + if missing&missingType != 0 { + return fmt.Errorf("required property 'type' is missing") + } + if missing&missingMessage != 0 { + return fmt.Errorf("required property 'message' is missing") + } } return nil @@ -5730,10 +6196,12 @@ type ShowMessageRequestParams struct { var _ json.UnmarshalerFrom = (*ShowMessageRequestParams)(nil) func (s *ShowMessageRequestParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenType bool - seenMessage bool + const ( + missingType uint = 1 << iota + missingMessage + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5749,12 +6217,12 @@ func (s *ShowMessageRequestParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } switch string(name) { case `"type"`: - seenType = true + missing &^= missingType if err := json.UnmarshalDecode(dec, &s.Type); err != nil { return err } case `"message"`: - seenMessage = true + missing &^= missingMessage if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } @@ -5771,11 +6239,13 @@ func (s *ShowMessageRequestParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenType { - return fmt.Errorf("required property 'type' is missing") - } - if !seenMessage { - return fmt.Errorf("required property 'message' is missing") + if missing != 0 { + if missing&missingType != 0 { + return fmt.Errorf("required property 'type' is missing") + } + if missing&missingMessage != 0 { + return fmt.Errorf("required property 'message' is missing") + } } return nil @@ -5789,7 +6259,11 @@ type MessageActionItem struct { var _ json.UnmarshalerFrom = (*MessageActionItem)(nil) func (s *MessageActionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTitle bool + const ( + missingTitle uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5805,7 +6279,7 @@ func (s *MessageActionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"title"`: - seenTitle = true + missing &^= missingTitle if err := json.UnmarshalDecode(dec, &s.Title); err != nil { return err } @@ -5818,8 +6292,10 @@ func (s *MessageActionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTitle { - return fmt.Errorf("required property 'title' is missing") + if missing != 0 { + if missing&missingTitle != 0 { + return fmt.Errorf("required property 'title' is missing") + } } return nil @@ -5837,10 +6313,12 @@ type LogMessageParams struct { var _ json.UnmarshalerFrom = (*LogMessageParams)(nil) func (s *LogMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenType bool - seenMessage bool + const ( + missingType uint = 1 << iota + missingMessage + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5856,12 +6334,12 @@ func (s *LogMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"type"`: - seenType = true + missing &^= missingType if err := json.UnmarshalDecode(dec, &s.Type); err != nil { return err } case `"message"`: - seenMessage = true + missing &^= missingMessage if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } @@ -5874,11 +6352,13 @@ func (s *LogMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenType { - return fmt.Errorf("required property 'type' is missing") - } - if !seenMessage { - return fmt.Errorf("required property 'message' is missing") + if missing != 0 { + if missing&missingType != 0 { + return fmt.Errorf("required property 'type' is missing") + } + if missing&missingMessage != 0 { + return fmt.Errorf("required property 'message' is missing") + } } return nil @@ -5893,7 +6373,11 @@ type DidOpenTextDocumentParams struct { var _ json.UnmarshalerFrom = (*DidOpenTextDocumentParams)(nil) func (s *DidOpenTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5909,7 +6393,7 @@ func (s *DidOpenTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -5922,8 +6406,10 @@ func (s *DidOpenTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -5953,10 +6439,12 @@ type DidChangeTextDocumentParams struct { var _ json.UnmarshalerFrom = (*DidChangeTextDocumentParams)(nil) func (s *DidChangeTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenContentChanges bool + const ( + missingTextDocument uint = 1 << iota + missingContentChanges + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -5972,12 +6460,12 @@ func (s *DidChangeTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"contentChanges"`: - seenContentChanges = true + missing &^= missingContentChanges if err := json.UnmarshalDecode(dec, &s.ContentChanges); err != nil { return err } @@ -5990,11 +6478,13 @@ func (s *DidChangeTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenContentChanges { - return fmt.Errorf("required property 'contentChanges' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingContentChanges != 0 { + return fmt.Errorf("required property 'contentChanges' is missing") + } } return nil @@ -6013,10 +6503,12 @@ type TextDocumentChangeRegistrationOptions struct { var _ json.UnmarshalerFrom = (*TextDocumentChangeRegistrationOptions)(nil) func (s *TextDocumentChangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenDocumentSelector bool - seenSyncKind bool + const ( + missingDocumentSelector uint = 1 << iota + missingSyncKind + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6032,12 +6524,12 @@ func (s *TextDocumentChangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"syncKind"`: - seenSyncKind = true + missing &^= missingSyncKind if err := json.UnmarshalDecode(dec, &s.SyncKind); err != nil { return err } @@ -6050,11 +6542,13 @@ func (s *TextDocumentChangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") - } - if !seenSyncKind { - return fmt.Errorf("required property 'syncKind' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } + if missing&missingSyncKind != 0 { + return fmt.Errorf("required property 'syncKind' is missing") + } } return nil @@ -6073,7 +6567,11 @@ func (s *DidCloseTextDocumentParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DidCloseTextDocumentParams)(nil) func (s *DidCloseTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6089,7 +6587,7 @@ func (s *DidCloseTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -6102,8 +6600,10 @@ func (s *DidCloseTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -6126,7 +6626,11 @@ func (s *DidSaveTextDocumentParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DidSaveTextDocumentParams)(nil) func (s *DidSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6142,7 +6646,7 @@ func (s *DidSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -6159,8 +6663,10 @@ func (s *DidSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -6179,7 +6685,11 @@ type TextDocumentSaveRegistrationOptions struct { var _ json.UnmarshalerFrom = (*TextDocumentSaveRegistrationOptions)(nil) func (s *TextDocumentSaveRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6195,7 +6705,7 @@ func (s *TextDocumentSaveRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.De } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -6212,8 +6722,10 @@ func (s *TextDocumentSaveRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.De return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -6235,10 +6747,12 @@ func (s *WillSaveTextDocumentParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*WillSaveTextDocumentParams)(nil) func (s *WillSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenReason bool + const ( + missingTextDocument uint = 1 << iota + missingReason + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6254,12 +6768,12 @@ func (s *WillSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"reason"`: - seenReason = true + missing &^= missingReason if err := json.UnmarshalDecode(dec, &s.Reason); err != nil { return err } @@ -6272,11 +6786,13 @@ func (s *WillSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenReason { - return fmt.Errorf("required property 'reason' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingReason != 0 { + return fmt.Errorf("required property 'reason' is missing") + } } return nil @@ -6296,10 +6812,12 @@ type TextEdit struct { var _ json.UnmarshalerFrom = (*TextEdit)(nil) func (s *TextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenNewText bool + const ( + missingRange uint = 1 << iota + missingNewText + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6315,12 +6833,12 @@ func (s *TextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"newText"`: - seenNewText = true + missing &^= missingNewText if err := json.UnmarshalDecode(dec, &s.NewText); err != nil { return err } @@ -6333,11 +6851,13 @@ func (s *TextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenNewText { - return fmt.Errorf("required property 'newText' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingNewText != 0 { + return fmt.Errorf("required property 'newText' is missing") + } } return nil @@ -6352,7 +6872,11 @@ type DidChangeWatchedFilesParams struct { var _ json.UnmarshalerFrom = (*DidChangeWatchedFilesParams)(nil) func (s *DidChangeWatchedFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenChanges bool + const ( + missingChanges uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6368,7 +6892,7 @@ func (s *DidChangeWatchedFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"changes"`: - seenChanges = true + missing &^= missingChanges if err := json.UnmarshalDecode(dec, &s.Changes); err != nil { return err } @@ -6381,8 +6905,10 @@ func (s *DidChangeWatchedFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenChanges { - return fmt.Errorf("required property 'changes' is missing") + if missing != 0 { + if missing&missingChanges != 0 { + return fmt.Errorf("required property 'changes' is missing") + } } return nil @@ -6397,7 +6923,11 @@ type DidChangeWatchedFilesRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DidChangeWatchedFilesRegistrationOptions)(nil) func (s *DidChangeWatchedFilesRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenWatchers bool + const ( + missingWatchers uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6413,7 +6943,7 @@ func (s *DidChangeWatchedFilesRegistrationOptions) UnmarshalJSONFrom(dec *jsonte } switch string(name) { case `"watchers"`: - seenWatchers = true + missing &^= missingWatchers if err := json.UnmarshalDecode(dec, &s.Watchers); err != nil { return err } @@ -6426,8 +6956,10 @@ func (s *DidChangeWatchedFilesRegistrationOptions) UnmarshalJSONFrom(dec *jsonte return err } - if !seenWatchers { - return fmt.Errorf("required property 'watchers' is missing") + if missing != 0 { + if missing&missingWatchers != 0 { + return fmt.Errorf("required property 'watchers' is missing") + } } return nil @@ -6450,10 +6982,12 @@ type PublishDiagnosticsParams struct { var _ json.UnmarshalerFrom = (*PublishDiagnosticsParams)(nil) func (s *PublishDiagnosticsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenDiagnostics bool + const ( + missingUri uint = 1 << iota + missingDiagnostics + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6469,7 +7003,7 @@ func (s *PublishDiagnosticsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -6478,7 +7012,7 @@ func (s *PublishDiagnosticsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } case `"diagnostics"`: - seenDiagnostics = true + missing &^= missingDiagnostics if err := json.UnmarshalDecode(dec, &s.Diagnostics); err != nil { return err } @@ -6491,11 +7025,13 @@ func (s *PublishDiagnosticsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenDiagnostics { - return fmt.Errorf("required property 'diagnostics' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingDiagnostics != 0 { + return fmt.Errorf("required property 'diagnostics' is missing") + } } return nil @@ -6528,10 +7064,12 @@ func (s *CompletionParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*CompletionParams)(nil) func (s *CompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6547,12 +7085,12 @@ func (s *CompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -6577,11 +7115,13 @@ func (s *CompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -6731,7 +7271,11 @@ type CompletionItem struct { var _ json.UnmarshalerFrom = (*CompletionItem)(nil) func (s *CompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenLabel bool + const ( + missingLabel uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6747,7 +7291,7 @@ func (s *CompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"label"`: - seenLabel = true + missing &^= missingLabel if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } @@ -6832,8 +7376,10 @@ func (s *CompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenLabel { - return fmt.Errorf("required property 'label' is missing") + if missing != 0 { + if missing&missingLabel != 0 { + return fmt.Errorf("required property 'label' is missing") + } } return nil @@ -6891,10 +7437,12 @@ type CompletionList struct { var _ json.UnmarshalerFrom = (*CompletionList)(nil) func (s *CompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenIsIncomplete bool - seenItems bool + const ( + missingIsIncomplete uint = 1 << iota + missingItems + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -6910,7 +7458,7 @@ func (s *CompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"isIncomplete"`: - seenIsIncomplete = true + missing &^= missingIsIncomplete if err := json.UnmarshalDecode(dec, &s.IsIncomplete); err != nil { return err } @@ -6923,7 +7471,7 @@ func (s *CompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"items"`: - seenItems = true + missing &^= missingItems if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } @@ -6936,11 +7484,13 @@ func (s *CompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenIsIncomplete { - return fmt.Errorf("required property 'isIncomplete' is missing") - } - if !seenItems { - return fmt.Errorf("required property 'items' is missing") + if missing != 0 { + if missing&missingIsIncomplete != 0 { + return fmt.Errorf("required property 'isIncomplete' is missing") + } + if missing&missingItems != 0 { + return fmt.Errorf("required property 'items' is missing") + } } return nil @@ -6988,7 +7538,11 @@ type CompletionRegistrationOptions struct { var _ json.UnmarshalerFrom = (*CompletionRegistrationOptions)(nil) func (s *CompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7004,7 +7558,7 @@ func (s *CompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -7037,8 +7591,10 @@ func (s *CompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -7063,10 +7619,12 @@ func (s *HoverParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*HoverParams)(nil) func (s *HoverParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7082,12 +7640,12 @@ func (s *HoverParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -7104,11 +7662,13 @@ func (s *HoverParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -7127,7 +7687,11 @@ type Hover struct { var _ json.UnmarshalerFrom = (*Hover)(nil) func (s *Hover) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenContents bool + const ( + missingContents uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7143,7 +7707,7 @@ func (s *Hover) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"contents"`: - seenContents = true + missing &^= missingContents if err := json.UnmarshalDecode(dec, &s.Contents); err != nil { return err } @@ -7160,8 +7724,10 @@ func (s *Hover) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenContents { - return fmt.Errorf("required property 'contents' is missing") + if missing != 0 { + if missing&missingContents != 0 { + return fmt.Errorf("required property 'contents' is missing") + } } return nil @@ -7179,7 +7745,11 @@ type HoverRegistrationOptions struct { var _ json.UnmarshalerFrom = (*HoverRegistrationOptions)(nil) func (s *HoverRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7195,7 +7765,7 @@ func (s *HoverRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -7212,8 +7782,10 @@ func (s *HoverRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -7244,10 +7816,12 @@ func (s *SignatureHelpParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*SignatureHelpParams)(nil) func (s *SignatureHelpParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7263,12 +7837,12 @@ func (s *SignatureHelpParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -7289,11 +7863,13 @@ func (s *SignatureHelpParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -7339,7 +7915,11 @@ type SignatureHelp struct { var _ json.UnmarshalerFrom = (*SignatureHelp)(nil) func (s *SignatureHelp) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenSignatures bool + const ( + missingSignatures uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7355,7 +7935,7 @@ func (s *SignatureHelp) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"signatures"`: - seenSignatures = true + missing &^= missingSignatures if err := json.UnmarshalDecode(dec, &s.Signatures); err != nil { return err } @@ -7376,8 +7956,10 @@ func (s *SignatureHelp) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenSignatures { - return fmt.Errorf("required property 'signatures' is missing") + if missing != 0 { + if missing&missingSignatures != 0 { + return fmt.Errorf("required property 'signatures' is missing") + } } return nil @@ -7406,7 +7988,11 @@ type SignatureHelpRegistrationOptions struct { var _ json.UnmarshalerFrom = (*SignatureHelpRegistrationOptions)(nil) func (s *SignatureHelpRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7422,7 +8008,7 @@ func (s *SignatureHelpRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -7447,8 +8033,10 @@ func (s *SignatureHelpRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -7477,10 +8065,12 @@ func (s *DefinitionParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DefinitionParams)(nil) func (s *DefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7496,12 +8086,12 @@ func (s *DefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -7522,11 +8112,13 @@ func (s *DefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -7544,7 +8136,11 @@ type DefinitionRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DefinitionRegistrationOptions)(nil) func (s *DefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7560,7 +8156,7 @@ func (s *DefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -7577,8 +8173,10 @@ func (s *DefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -7609,11 +8207,13 @@ func (s *ReferenceParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*ReferenceParams)(nil) func (s *ReferenceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool - seenContext bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + missingContext + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7629,12 +8229,12 @@ func (s *ReferenceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -7647,7 +8247,7 @@ func (s *ReferenceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"context"`: - seenContext = true + missing &^= missingContext if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } @@ -7660,14 +8260,16 @@ func (s *ReferenceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") - } - if !seenContext { - return fmt.Errorf("required property 'context' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } + if missing&missingContext != 0 { + return fmt.Errorf("required property 'context' is missing") + } } return nil @@ -7685,7 +8287,11 @@ type ReferenceRegistrationOptions struct { var _ json.UnmarshalerFrom = (*ReferenceRegistrationOptions)(nil) func (s *ReferenceRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7701,7 +8307,7 @@ func (s *ReferenceRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -7718,8 +8324,10 @@ func (s *ReferenceRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -7748,10 +8356,12 @@ func (s *DocumentHighlightParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentHighlightParams)(nil) func (s *DocumentHighlightParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7767,12 +8377,12 @@ func (s *DocumentHighlightParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -7793,11 +8403,13 @@ func (s *DocumentHighlightParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -7817,7 +8429,11 @@ type DocumentHighlight struct { var _ json.UnmarshalerFrom = (*DocumentHighlight)(nil) func (s *DocumentHighlight) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRange bool + const ( + missingRange uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7833,7 +8449,7 @@ func (s *DocumentHighlight) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -7850,8 +8466,10 @@ func (s *DocumentHighlight) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -7869,7 +8487,11 @@ type DocumentHighlightRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DocumentHighlightRegistrationOptions)(nil) func (s *DocumentHighlightRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7885,7 +8507,7 @@ func (s *DocumentHighlightRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.D } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -7902,8 +8524,10 @@ func (s *DocumentHighlightRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.D return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -7929,7 +8553,11 @@ func (s *DocumentSymbolParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentSymbolParams)(nil) func (s *DocumentSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -7953,7 +8581,7 @@ func (s *DocumentSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -7966,8 +8594,10 @@ func (s *DocumentSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -8013,11 +8643,13 @@ type SymbolInformation struct { var _ json.UnmarshalerFrom = (*SymbolInformation)(nil) func (s *SymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenName bool - seenKind bool - seenLocation bool + const ( + missingName uint = 1 << iota + missingKind + missingLocation + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8033,12 +8665,12 @@ func (s *SymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -8055,7 +8687,7 @@ func (s *SymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"location"`: - seenLocation = true + missing &^= missingLocation if err := json.UnmarshalDecode(dec, &s.Location); err != nil { return err } @@ -8068,14 +8700,16 @@ func (s *SymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenName { - return fmt.Errorf("required property 'name' is missing") - } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenLocation { - return fmt.Errorf("required property 'location' is missing") + if missing != 0 { + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingLocation != 0 { + return fmt.Errorf("required property 'location' is missing") + } } return nil @@ -8122,12 +8756,14 @@ type DocumentSymbol struct { var _ json.UnmarshalerFrom = (*DocumentSymbol)(nil) func (s *DocumentSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenName bool - seenKind bool - seenRange bool - seenSelectionRange bool + const ( + missingName uint = 1 << iota + missingKind + missingRange + missingSelectionRange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8143,7 +8779,7 @@ func (s *DocumentSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } @@ -8152,7 +8788,7 @@ func (s *DocumentSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -8165,12 +8801,12 @@ func (s *DocumentSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"selectionRange"`: - seenSelectionRange = true + missing &^= missingSelectionRange if err := json.UnmarshalDecode(dec, &s.SelectionRange); err != nil { return err } @@ -8187,17 +8823,19 @@ func (s *DocumentSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenName { - return fmt.Errorf("required property 'name' is missing") - } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenSelectionRange { - return fmt.Errorf("required property 'selectionRange' is missing") + if missing != 0 { + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingSelectionRange != 0 { + return fmt.Errorf("required property 'selectionRange' is missing") + } } return nil @@ -8221,7 +8859,11 @@ type DocumentSymbolRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DocumentSymbolRegistrationOptions)(nil) func (s *DocumentSymbolRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8237,7 +8879,7 @@ func (s *DocumentSymbolRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -8258,8 +8900,10 @@ func (s *DocumentSymbolRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -8291,11 +8935,13 @@ func (s *CodeActionParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*CodeActionParams)(nil) func (s *CodeActionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenRange bool - seenContext bool + const ( + missingTextDocument uint = 1 << iota + missingRange + missingContext + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8319,17 +8965,17 @@ func (s *CodeActionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"context"`: - seenContext = true + missing &^= missingContext if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } @@ -8342,14 +8988,16 @@ func (s *CodeActionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenContext { - return fmt.Errorf("required property 'context' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingContext != 0 { + return fmt.Errorf("required property 'context' is missing") + } } return nil @@ -8381,10 +9029,12 @@ type Command struct { var _ json.UnmarshalerFrom = (*Command)(nil) func (s *Command) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTitle bool - seenCommand bool + const ( + missingTitle uint = 1 << iota + missingCommand + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8400,7 +9050,7 @@ func (s *Command) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"title"`: - seenTitle = true + missing &^= missingTitle if err := json.UnmarshalDecode(dec, &s.Title); err != nil { return err } @@ -8409,7 +9059,7 @@ func (s *Command) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"command"`: - seenCommand = true + missing &^= missingCommand if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } @@ -8426,11 +9076,13 @@ func (s *Command) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTitle { - return fmt.Errorf("required property 'title' is missing") - } - if !seenCommand { - return fmt.Errorf("required property 'command' is missing") + if missing != 0 { + if missing&missingTitle != 0 { + return fmt.Errorf("required property 'title' is missing") + } + if missing&missingCommand != 0 { + return fmt.Errorf("required property 'command' is missing") + } } return nil @@ -8501,7 +9153,11 @@ type CodeAction struct { var _ json.UnmarshalerFrom = (*CodeAction)(nil) func (s *CodeAction) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTitle bool + const ( + missingTitle uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8517,7 +9173,7 @@ func (s *CodeAction) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"title"`: - seenTitle = true + missing &^= missingTitle if err := json.UnmarshalDecode(dec, &s.Title); err != nil { return err } @@ -8562,8 +9218,10 @@ func (s *CodeAction) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTitle { - return fmt.Errorf("required property 'title' is missing") + if missing != 0 { + if missing&missingTitle != 0 { + return fmt.Errorf("required property 'title' is missing") + } } return nil @@ -8611,7 +9269,11 @@ type CodeActionRegistrationOptions struct { var _ json.UnmarshalerFrom = (*CodeActionRegistrationOptions)(nil) func (s *CodeActionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8627,7 +9289,7 @@ func (s *CodeActionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -8656,8 +9318,10 @@ func (s *CodeActionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -8686,7 +9350,11 @@ type WorkspaceSymbolParams struct { var _ json.UnmarshalerFrom = (*WorkspaceSymbolParams)(nil) func (s *WorkspaceSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenQuery bool + const ( + missingQuery uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8710,7 +9378,7 @@ func (s *WorkspaceSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"query"`: - seenQuery = true + missing &^= missingQuery if err := json.UnmarshalDecode(dec, &s.Query); err != nil { return err } @@ -8723,8 +9391,10 @@ func (s *WorkspaceSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenQuery { - return fmt.Errorf("required property 'query' is missing") + if missing != 0 { + if missing&missingQuery != 0 { + return fmt.Errorf("required property 'query' is missing") + } } return nil @@ -8768,11 +9438,13 @@ type WorkspaceSymbol struct { var _ json.UnmarshalerFrom = (*WorkspaceSymbol)(nil) func (s *WorkspaceSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenName bool - seenKind bool - seenLocation bool + const ( + missingName uint = 1 << iota + missingKind + missingLocation + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8788,12 +9460,12 @@ func (s *WorkspaceSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -8806,7 +9478,7 @@ func (s *WorkspaceSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"location"`: - seenLocation = true + missing &^= missingLocation if err := json.UnmarshalDecode(dec, &s.Location); err != nil { return err } @@ -8823,14 +9495,16 @@ func (s *WorkspaceSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenName { - return fmt.Errorf("required property 'name' is missing") - } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenLocation { - return fmt.Errorf("required property 'location' is missing") + if missing != 0 { + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingLocation != 0 { + return fmt.Errorf("required property 'location' is missing") + } } return nil @@ -8867,7 +9541,11 @@ func (s *CodeLensParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*CodeLensParams)(nil) func (s *CodeLensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8891,7 +9569,7 @@ func (s *CodeLensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -8904,8 +9582,10 @@ func (s *CodeLensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -8931,7 +9611,11 @@ type CodeLens struct { var _ json.UnmarshalerFrom = (*CodeLens)(nil) func (s *CodeLens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRange bool + const ( + missingRange uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -8947,7 +9631,7 @@ func (s *CodeLens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -8968,8 +9652,10 @@ func (s *CodeLens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -8990,7 +9676,11 @@ type CodeLensRegistrationOptions struct { var _ json.UnmarshalerFrom = (*CodeLensRegistrationOptions)(nil) func (s *CodeLensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9006,7 +9696,7 @@ func (s *CodeLensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -9027,8 +9717,10 @@ func (s *CodeLensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -9054,7 +9746,11 @@ func (s *DocumentLinkParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentLinkParams)(nil) func (s *DocumentLinkParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTextDocument bool + const ( + missingTextDocument uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9078,7 +9774,7 @@ func (s *DocumentLinkParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } @@ -9091,8 +9787,10 @@ func (s *DocumentLinkParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } } return nil @@ -9124,7 +9822,11 @@ type DocumentLink struct { var _ json.UnmarshalerFrom = (*DocumentLink)(nil) func (s *DocumentLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRange bool + const ( + missingRange uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9140,7 +9842,7 @@ func (s *DocumentLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -9165,8 +9867,10 @@ func (s *DocumentLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -9187,7 +9891,11 @@ type DocumentLinkRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DocumentLinkRegistrationOptions)(nil) func (s *DocumentLinkRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9203,7 +9911,7 @@ func (s *DocumentLinkRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -9224,8 +9932,10 @@ func (s *DocumentLinkRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -9250,10 +9960,12 @@ func (s *DocumentFormattingParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentFormattingParams)(nil) func (s *DocumentFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenOptions bool + const ( + missingTextDocument uint = 1 << iota + missingOptions + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9273,12 +9985,12 @@ func (s *DocumentFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"options"`: - seenOptions = true + missing &^= missingOptions if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } @@ -9291,11 +10003,13 @@ func (s *DocumentFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenOptions { - return fmt.Errorf("required property 'options' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingOptions != 0 { + return fmt.Errorf("required property 'options' is missing") + } } return nil @@ -9313,7 +10027,11 @@ type DocumentFormattingRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DocumentFormattingRegistrationOptions)(nil) func (s *DocumentFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9329,7 +10047,7 @@ func (s *DocumentFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -9346,8 +10064,10 @@ func (s *DocumentFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -9375,11 +10095,13 @@ func (s *DocumentRangeFormattingParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentRangeFormattingParams)(nil) func (s *DocumentRangeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenRange bool - seenOptions bool + const ( + missingTextDocument uint = 1 << iota + missingRange + missingOptions + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9399,17 +10121,17 @@ func (s *DocumentRangeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"options"`: - seenOptions = true + missing &^= missingOptions if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } @@ -9422,14 +10144,16 @@ func (s *DocumentRangeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenOptions { - return fmt.Errorf("required property 'options' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingOptions != 0 { + return fmt.Errorf("required property 'options' is missing") + } } return nil @@ -9454,7 +10178,11 @@ type DocumentRangeFormattingRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DocumentRangeFormattingRegistrationOptions)(nil) func (s *DocumentRangeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9470,7 +10198,7 @@ func (s *DocumentRangeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *json } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -9491,8 +10219,10 @@ func (s *DocumentRangeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *json return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -9524,11 +10254,13 @@ func (s *DocumentRangesFormattingParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentRangesFormattingParams)(nil) func (s *DocumentRangesFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenRanges bool - seenOptions bool + const ( + missingTextDocument uint = 1 << iota + missingRanges + missingOptions + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9548,17 +10280,17 @@ func (s *DocumentRangesFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"ranges"`: - seenRanges = true + missing &^= missingRanges if err := json.UnmarshalDecode(dec, &s.Ranges); err != nil { return err } case `"options"`: - seenOptions = true + missing &^= missingOptions if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } @@ -9571,14 +10303,16 @@ func (s *DocumentRangesFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenRanges { - return fmt.Errorf("required property 'ranges' is missing") - } - if !seenOptions { - return fmt.Errorf("required property 'options' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingRanges != 0 { + return fmt.Errorf("required property 'ranges' is missing") + } + if missing&missingOptions != 0 { + return fmt.Errorf("required property 'options' is missing") + } } return nil @@ -9611,12 +10345,14 @@ func (s *DocumentOnTypeFormattingParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*DocumentOnTypeFormattingParams)(nil) func (s *DocumentOnTypeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool - seenCh bool - seenOptions bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + missingCh + missingOptions + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9632,22 +10368,22 @@ func (s *DocumentOnTypeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"ch"`: - seenCh = true + missing &^= missingCh if err := json.UnmarshalDecode(dec, &s.Ch); err != nil { return err } case `"options"`: - seenOptions = true + missing &^= missingOptions if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } @@ -9660,17 +10396,19 @@ func (s *DocumentOnTypeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") - } - if !seenCh { - return fmt.Errorf("required property 'ch' is missing") - } - if !seenOptions { - return fmt.Errorf("required property 'options' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } + if missing&missingCh != 0 { + return fmt.Errorf("required property 'ch' is missing") + } + if missing&missingOptions != 0 { + return fmt.Errorf("required property 'options' is missing") + } } return nil @@ -9692,10 +10430,12 @@ type DocumentOnTypeFormattingRegistrationOptions struct { var _ json.UnmarshalerFrom = (*DocumentOnTypeFormattingRegistrationOptions)(nil) func (s *DocumentOnTypeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenDocumentSelector bool - seenFirstTriggerCharacter bool + const ( + missingDocumentSelector uint = 1 << iota + missingFirstTriggerCharacter + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9711,12 +10451,12 @@ func (s *DocumentOnTypeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jso } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"firstTriggerCharacter"`: - seenFirstTriggerCharacter = true + missing &^= missingFirstTriggerCharacter if err := json.UnmarshalDecode(dec, &s.FirstTriggerCharacter); err != nil { return err } @@ -9733,11 +10473,13 @@ func (s *DocumentOnTypeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jso return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") - } - if !seenFirstTriggerCharacter { - return fmt.Errorf("required property 'firstTriggerCharacter' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } + if missing&missingFirstTriggerCharacter != 0 { + return fmt.Errorf("required property 'firstTriggerCharacter' is missing") + } } return nil @@ -9767,11 +10509,13 @@ func (s *RenameParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*RenameParams)(nil) func (s *RenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool - seenNewName bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + missingNewName + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9791,17 +10535,17 @@ func (s *RenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"newName"`: - seenNewName = true + missing &^= missingNewName if err := json.UnmarshalDecode(dec, &s.NewName); err != nil { return err } @@ -9814,14 +10558,16 @@ func (s *RenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") - } - if !seenNewName { - return fmt.Errorf("required property 'newName' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } + if missing&missingNewName != 0 { + return fmt.Errorf("required property 'newName' is missing") + } } return nil @@ -9844,7 +10590,11 @@ type RenameRegistrationOptions struct { var _ json.UnmarshalerFrom = (*RenameRegistrationOptions)(nil) func (s *RenameRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9860,7 +10610,7 @@ func (s *RenameRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -9881,8 +10631,10 @@ func (s *RenameRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil @@ -9906,10 +10658,12 @@ func (s *PrepareRenameParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*PrepareRenameParams)(nil) func (s *PrepareRenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9925,12 +10679,12 @@ func (s *PrepareRenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -9947,11 +10701,13 @@ func (s *PrepareRenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -9972,7 +10728,11 @@ type ExecuteCommandParams struct { var _ json.UnmarshalerFrom = (*ExecuteCommandParams)(nil) func (s *ExecuteCommandParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenCommand bool + const ( + missingCommand uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -9992,7 +10752,7 @@ func (s *ExecuteCommandParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"command"`: - seenCommand = true + missing &^= missingCommand if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } @@ -10009,8 +10769,10 @@ func (s *ExecuteCommandParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenCommand { - return fmt.Errorf("required property 'command' is missing") + if missing != 0 { + if missing&missingCommand != 0 { + return fmt.Errorf("required property 'command' is missing") + } } return nil @@ -10027,7 +10789,11 @@ type ExecuteCommandRegistrationOptions struct { var _ json.UnmarshalerFrom = (*ExecuteCommandRegistrationOptions)(nil) func (s *ExecuteCommandRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenCommands bool + const ( + missingCommands uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10047,7 +10813,7 @@ func (s *ExecuteCommandRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } case `"commands"`: - seenCommands = true + missing &^= missingCommands if err := json.UnmarshalDecode(dec, &s.Commands); err != nil { return err } @@ -10060,8 +10826,10 @@ func (s *ExecuteCommandRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco return err } - if !seenCommands { - return fmt.Errorf("required property 'commands' is missing") + if missing != 0 { + if missing&missingCommands != 0 { + return fmt.Errorf("required property 'commands' is missing") + } } return nil @@ -10088,7 +10856,11 @@ type ApplyWorkspaceEditParams struct { var _ json.UnmarshalerFrom = (*ApplyWorkspaceEditParams)(nil) func (s *ApplyWorkspaceEditParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenEdit bool + const ( + missingEdit uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10108,7 +10880,7 @@ func (s *ApplyWorkspaceEditParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } case `"edit"`: - seenEdit = true + missing &^= missingEdit if err := json.UnmarshalDecode(dec, &s.Edit); err != nil { return err } @@ -10125,8 +10897,10 @@ func (s *ApplyWorkspaceEditParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenEdit { - return fmt.Errorf("required property 'edit' is missing") + if missing != 0 { + if missing&missingEdit != 0 { + return fmt.Errorf("required property 'edit' is missing") + } } return nil @@ -10153,7 +10927,11 @@ type ApplyWorkspaceEditResult struct { var _ json.UnmarshalerFrom = (*ApplyWorkspaceEditResult)(nil) func (s *ApplyWorkspaceEditResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenApplied bool + const ( + missingApplied uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10169,7 +10947,7 @@ func (s *ApplyWorkspaceEditResult) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } switch string(name) { case `"applied"`: - seenApplied = true + missing &^= missingApplied if err := json.UnmarshalDecode(dec, &s.Applied); err != nil { return err } @@ -10190,8 +10968,10 @@ func (s *ApplyWorkspaceEditResult) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenApplied { - return fmt.Errorf("required property 'applied' is missing") + if missing != 0 { + if missing&missingApplied != 0 { + return fmt.Errorf("required property 'applied' is missing") + } } return nil @@ -10230,10 +11010,12 @@ type WorkDoneProgressBegin struct { var _ json.UnmarshalerFrom = (*WorkDoneProgressBegin)(nil) func (s *WorkDoneProgressBegin) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenTitle bool + const ( + missingKind uint = 1 << iota + missingTitle + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10249,12 +11031,12 @@ func (s *WorkDoneProgressBegin) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"title"`: - seenTitle = true + missing &^= missingTitle if err := json.UnmarshalDecode(dec, &s.Title); err != nil { return err } @@ -10279,11 +11061,13 @@ func (s *WorkDoneProgressBegin) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenTitle { - return fmt.Errorf("required property 'title' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingTitle != 0 { + return fmt.Errorf("required property 'title' is missing") + } } return nil @@ -10317,7 +11101,11 @@ type WorkDoneProgressReport struct { var _ json.UnmarshalerFrom = (*WorkDoneProgressReport)(nil) func (s *WorkDoneProgressReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenKind bool + const ( + missingKind uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10333,7 +11121,7 @@ func (s *WorkDoneProgressReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -10358,8 +11146,10 @@ func (s *WorkDoneProgressReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } } return nil @@ -10376,7 +11166,11 @@ type WorkDoneProgressEnd struct { var _ json.UnmarshalerFrom = (*WorkDoneProgressEnd)(nil) func (s *WorkDoneProgressEnd) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenKind bool + const ( + missingKind uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10392,7 +11186,7 @@ func (s *WorkDoneProgressEnd) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -10409,8 +11203,10 @@ func (s *WorkDoneProgressEnd) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } } return nil @@ -10423,7 +11219,11 @@ type SetTraceParams struct { var _ json.UnmarshalerFrom = (*SetTraceParams)(nil) func (s *SetTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenValue bool + const ( + missingValue uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10439,7 +11239,7 @@ func (s *SetTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"value"`: - seenValue = true + missing &^= missingValue if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } @@ -10452,8 +11252,10 @@ func (s *SetTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenValue { - return fmt.Errorf("required property 'value' is missing") + if missing != 0 { + if missing&missingValue != 0 { + return fmt.Errorf("required property 'value' is missing") + } } return nil @@ -10468,7 +11270,11 @@ type LogTraceParams struct { var _ json.UnmarshalerFrom = (*LogTraceParams)(nil) func (s *LogTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenMessage bool + const ( + missingMessage uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10484,7 +11290,7 @@ func (s *LogTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"message"`: - seenMessage = true + missing &^= missingMessage if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } @@ -10501,8 +11307,10 @@ func (s *LogTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenMessage { - return fmt.Errorf("required property 'message' is missing") + if missing != 0 { + if missing&missingMessage != 0 { + return fmt.Errorf("required property 'message' is missing") + } } return nil @@ -10516,7 +11324,11 @@ type CancelParams struct { var _ json.UnmarshalerFrom = (*CancelParams)(nil) func (s *CancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenId bool + const ( + missingId uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10532,7 +11344,7 @@ func (s *CancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"id"`: - seenId = true + missing &^= missingId if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } @@ -10545,8 +11357,10 @@ func (s *CancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenId { - return fmt.Errorf("required property 'id' is missing") + if missing != 0 { + if missing&missingId != 0 { + return fmt.Errorf("required property 'id' is missing") + } } return nil @@ -10563,10 +11377,12 @@ type ProgressParams struct { var _ json.UnmarshalerFrom = (*ProgressParams)(nil) func (s *ProgressParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenToken bool - seenValue bool + const ( + missingToken uint = 1 << iota + missingValue + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10582,12 +11398,12 @@ func (s *ProgressParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"token"`: - seenToken = true + missing &^= missingToken if err := json.UnmarshalDecode(dec, &s.Token); err != nil { return err } case `"value"`: - seenValue = true + missing &^= missingValue if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } @@ -10600,11 +11416,13 @@ func (s *ProgressParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenToken { - return fmt.Errorf("required property 'token' is missing") - } - if !seenValue { - return fmt.Errorf("required property 'value' is missing") + if missing != 0 { + if missing&missingToken != 0 { + return fmt.Errorf("required property 'token' is missing") + } + if missing&missingValue != 0 { + return fmt.Errorf("required property 'value' is missing") + } } return nil @@ -10627,10 +11445,12 @@ func (s *TextDocumentPositionParams) TextDocumentURI() DocumentUri { var _ json.UnmarshalerFrom = (*TextDocumentPositionParams)(nil) func (s *TextDocumentPositionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenPosition bool + const ( + missingTextDocument uint = 1 << iota + missingPosition + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10646,12 +11466,12 @@ func (s *TextDocumentPositionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: - seenPosition = true + missing &^= missingPosition if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } @@ -10664,11 +11484,13 @@ func (s *TextDocumentPositionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenPosition { - return fmt.Errorf("required property 'position' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingPosition != 0 { + return fmt.Errorf("required property 'position' is missing") + } } return nil @@ -10710,11 +11532,13 @@ type LocationLink struct { var _ json.UnmarshalerFrom = (*LocationLink)(nil) func (s *LocationLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTargetUri bool - seenTargetRange bool - seenTargetSelectionRange bool + const ( + missingTargetUri uint = 1 << iota + missingTargetRange + missingTargetSelectionRange + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10734,17 +11558,17 @@ func (s *LocationLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"targetUri"`: - seenTargetUri = true + missing &^= missingTargetUri if err := json.UnmarshalDecode(dec, &s.TargetUri); err != nil { return err } case `"targetRange"`: - seenTargetRange = true + missing &^= missingTargetRange if err := json.UnmarshalDecode(dec, &s.TargetRange); err != nil { return err } case `"targetSelectionRange"`: - seenTargetSelectionRange = true + missing &^= missingTargetSelectionRange if err := json.UnmarshalDecode(dec, &s.TargetSelectionRange); err != nil { return err } @@ -10757,14 +11581,16 @@ func (s *LocationLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTargetUri { - return fmt.Errorf("required property 'targetUri' is missing") - } - if !seenTargetRange { - return fmt.Errorf("required property 'targetRange' is missing") - } - if !seenTargetSelectionRange { - return fmt.Errorf("required property 'targetSelectionRange' is missing") + if missing != 0 { + if missing&missingTargetUri != 0 { + return fmt.Errorf("required property 'targetUri' is missing") + } + if missing&missingTargetRange != 0 { + return fmt.Errorf("required property 'targetRange' is missing") + } + if missing&missingTargetSelectionRange != 0 { + return fmt.Errorf("required property 'targetSelectionRange' is missing") + } } return nil @@ -10794,10 +11620,12 @@ type Range struct { var _ json.UnmarshalerFrom = (*Range)(nil) func (s *Range) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenStart bool - seenEnd bool + const ( + missingStart uint = 1 << iota + missingEnd + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10813,12 +11641,12 @@ func (s *Range) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"start"`: - seenStart = true + missing &^= missingStart if err := json.UnmarshalDecode(dec, &s.Start); err != nil { return err } case `"end"`: - seenEnd = true + missing &^= missingEnd if err := json.UnmarshalDecode(dec, &s.End); err != nil { return err } @@ -10831,11 +11659,13 @@ func (s *Range) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenStart { - return fmt.Errorf("required property 'start' is missing") - } - if !seenEnd { - return fmt.Errorf("required property 'end' is missing") + if missing != 0 { + if missing&missingStart != 0 { + return fmt.Errorf("required property 'start' is missing") + } + if missing&missingEnd != 0 { + return fmt.Errorf("required property 'end' is missing") + } } return nil @@ -10869,10 +11699,12 @@ type WorkspaceFoldersChangeEvent struct { var _ json.UnmarshalerFrom = (*WorkspaceFoldersChangeEvent)(nil) func (s *WorkspaceFoldersChangeEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenAdded bool - seenRemoved bool + const ( + missingAdded uint = 1 << iota + missingRemoved + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10888,12 +11720,12 @@ func (s *WorkspaceFoldersChangeEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"added"`: - seenAdded = true + missing &^= missingAdded if err := json.UnmarshalDecode(dec, &s.Added); err != nil { return err } case `"removed"`: - seenRemoved = true + missing &^= missingRemoved if err := json.UnmarshalDecode(dec, &s.Removed); err != nil { return err } @@ -10906,11 +11738,13 @@ func (s *WorkspaceFoldersChangeEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenAdded { - return fmt.Errorf("required property 'added' is missing") - } - if !seenRemoved { - return fmt.Errorf("required property 'removed' is missing") + if missing != 0 { + if missing&missingAdded != 0 { + return fmt.Errorf("required property 'added' is missing") + } + if missing&missingRemoved != 0 { + return fmt.Errorf("required property 'removed' is missing") + } } return nil @@ -10933,7 +11767,11 @@ type TextDocumentIdentifier struct { var _ json.UnmarshalerFrom = (*TextDocumentIdentifier)(nil) func (s *TextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUri bool + const ( + missingUri uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -10949,7 +11787,7 @@ func (s *TextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -10962,8 +11800,10 @@ func (s *TextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -10987,12 +11827,14 @@ type Color struct { var _ json.UnmarshalerFrom = (*Color)(nil) func (s *Color) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRed bool - seenGreen bool - seenBlue bool - seenAlpha bool + const ( + missingRed uint = 1 << iota + missingGreen + missingBlue + missingAlpha + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11008,22 +11850,22 @@ func (s *Color) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"red"`: - seenRed = true + missing &^= missingRed if err := json.UnmarshalDecode(dec, &s.Red); err != nil { return err } case `"green"`: - seenGreen = true + missing &^= missingGreen if err := json.UnmarshalDecode(dec, &s.Green); err != nil { return err } case `"blue"`: - seenBlue = true + missing &^= missingBlue if err := json.UnmarshalDecode(dec, &s.Blue); err != nil { return err } case `"alpha"`: - seenAlpha = true + missing &^= missingAlpha if err := json.UnmarshalDecode(dec, &s.Alpha); err != nil { return err } @@ -11036,17 +11878,19 @@ func (s *Color) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRed { - return fmt.Errorf("required property 'red' is missing") - } - if !seenGreen { - return fmt.Errorf("required property 'green' is missing") - } - if !seenBlue { - return fmt.Errorf("required property 'blue' is missing") - } - if !seenAlpha { - return fmt.Errorf("required property 'alpha' is missing") + if missing != 0 { + if missing&missingRed != 0 { + return fmt.Errorf("required property 'red' is missing") + } + if missing&missingGreen != 0 { + return fmt.Errorf("required property 'green' is missing") + } + if missing&missingBlue != 0 { + return fmt.Errorf("required property 'blue' is missing") + } + if missing&missingAlpha != 0 { + return fmt.Errorf("required property 'alpha' is missing") + } } return nil @@ -11105,10 +11949,12 @@ type Position struct { var _ json.UnmarshalerFrom = (*Position)(nil) func (s *Position) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenLine bool - seenCharacter bool + const ( + missingLine uint = 1 << iota + missingCharacter + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11124,12 +11970,12 @@ func (s *Position) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"line"`: - seenLine = true + missing &^= missingLine if err := json.UnmarshalDecode(dec, &s.Line); err != nil { return err } case `"character"`: - seenCharacter = true + missing &^= missingCharacter if err := json.UnmarshalDecode(dec, &s.Character); err != nil { return err } @@ -11142,11 +11988,13 @@ func (s *Position) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenLine { - return fmt.Errorf("required property 'line' is missing") - } - if !seenCharacter { - return fmt.Errorf("required property 'character' is missing") + if missing != 0 { + if missing&missingLine != 0 { + return fmt.Errorf("required property 'line' is missing") + } + if missing&missingCharacter != 0 { + return fmt.Errorf("required property 'character' is missing") + } } return nil @@ -11181,7 +12029,11 @@ type SemanticTokensOptions struct { var _ json.UnmarshalerFrom = (*SemanticTokensOptions)(nil) func (s *SemanticTokensOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenLegend bool + const ( + missingLegend uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11201,7 +12053,7 @@ func (s *SemanticTokensOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"legend"`: - seenLegend = true + missing &^= missingLegend if err := json.UnmarshalDecode(dec, &s.Legend); err != nil { return err } @@ -11222,8 +12074,10 @@ func (s *SemanticTokensOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenLegend { - return fmt.Errorf("required property 'legend' is missing") + if missing != 0 { + if missing&missingLegend != 0 { + return fmt.Errorf("required property 'legend' is missing") + } } return nil @@ -11244,10 +12098,12 @@ type SemanticTokensEdit struct { var _ json.UnmarshalerFrom = (*SemanticTokensEdit)(nil) func (s *SemanticTokensEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenStart bool - seenDeleteCount bool + const ( + missingStart uint = 1 << iota + missingDeleteCount + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11263,12 +12119,12 @@ func (s *SemanticTokensEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"start"`: - seenStart = true + missing &^= missingStart if err := json.UnmarshalDecode(dec, &s.Start); err != nil { return err } case `"deleteCount"`: - seenDeleteCount = true + missing &^= missingDeleteCount if err := json.UnmarshalDecode(dec, &s.DeleteCount); err != nil { return err } @@ -11285,11 +12141,13 @@ func (s *SemanticTokensEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenStart { - return fmt.Errorf("required property 'start' is missing") - } - if !seenDeleteCount { - return fmt.Errorf("required property 'deleteCount' is missing") + if missing != 0 { + if missing&missingStart != 0 { + return fmt.Errorf("required property 'start' is missing") + } + if missing&missingDeleteCount != 0 { + return fmt.Errorf("required property 'deleteCount' is missing") + } } return nil @@ -11310,7 +12168,11 @@ type FileCreate struct { var _ json.UnmarshalerFrom = (*FileCreate)(nil) func (s *FileCreate) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUri bool + const ( + missingUri uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11326,7 +12188,7 @@ func (s *FileCreate) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -11339,8 +12201,10 @@ func (s *FileCreate) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -11367,10 +12231,12 @@ type TextDocumentEdit struct { var _ json.UnmarshalerFrom = (*TextDocumentEdit)(nil) func (s *TextDocumentEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTextDocument bool - seenEdits bool + const ( + missingTextDocument uint = 1 << iota + missingEdits + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11386,12 +12252,12 @@ func (s *TextDocumentEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"textDocument"`: - seenTextDocument = true + missing &^= missingTextDocument if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"edits"`: - seenEdits = true + missing &^= missingEdits if err := json.UnmarshalDecode(dec, &s.Edits); err != nil { return err } @@ -11404,11 +12270,13 @@ func (s *TextDocumentEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTextDocument { - return fmt.Errorf("required property 'textDocument' is missing") - } - if !seenEdits { - return fmt.Errorf("required property 'edits' is missing") + if missing != 0 { + if missing&missingTextDocument != 0 { + return fmt.Errorf("required property 'textDocument' is missing") + } + if missing&missingEdits != 0 { + return fmt.Errorf("required property 'edits' is missing") + } } return nil @@ -11434,10 +12302,12 @@ type CreateFile struct { var _ json.UnmarshalerFrom = (*CreateFile)(nil) func (s *CreateFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenUri bool + const ( + missingKind uint = 1 << iota + missingUri + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11453,7 +12323,7 @@ func (s *CreateFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -11462,7 +12332,7 @@ func (s *CreateFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -11479,11 +12349,13 @@ func (s *CreateFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -11512,11 +12384,13 @@ type RenameFile struct { var _ json.UnmarshalerFrom = (*RenameFile)(nil) func (s *RenameFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenOldUri bool - seenNewUri bool + const ( + missingKind uint = 1 << iota + missingOldUri + missingNewUri + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11532,7 +12406,7 @@ func (s *RenameFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -11541,12 +12415,12 @@ func (s *RenameFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"oldUri"`: - seenOldUri = true + missing &^= missingOldUri if err := json.UnmarshalDecode(dec, &s.OldUri); err != nil { return err } case `"newUri"`: - seenNewUri = true + missing &^= missingNewUri if err := json.UnmarshalDecode(dec, &s.NewUri); err != nil { return err } @@ -11563,14 +12437,16 @@ func (s *RenameFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenOldUri { - return fmt.Errorf("required property 'oldUri' is missing") - } - if !seenNewUri { - return fmt.Errorf("required property 'newUri' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingOldUri != 0 { + return fmt.Errorf("required property 'oldUri' is missing") + } + if missing&missingNewUri != 0 { + return fmt.Errorf("required property 'newUri' is missing") + } } return nil @@ -11596,10 +12472,12 @@ type DeleteFile struct { var _ json.UnmarshalerFrom = (*DeleteFile)(nil) func (s *DeleteFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenUri bool + const ( + missingKind uint = 1 << iota + missingUri + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11615,7 +12493,7 @@ func (s *DeleteFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -11624,7 +12502,7 @@ func (s *DeleteFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -11641,11 +12519,13 @@ func (s *DeleteFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -11671,7 +12551,11 @@ type ChangeAnnotation struct { var _ json.UnmarshalerFrom = (*ChangeAnnotation)(nil) func (s *ChangeAnnotation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenLabel bool + const ( + missingLabel uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11687,7 +12571,7 @@ func (s *ChangeAnnotation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"label"`: - seenLabel = true + missing &^= missingLabel if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } @@ -11708,8 +12592,10 @@ func (s *ChangeAnnotation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenLabel { - return fmt.Errorf("required property 'label' is missing") + if missing != 0 { + if missing&missingLabel != 0 { + return fmt.Errorf("required property 'label' is missing") + } } return nil @@ -11730,7 +12616,11 @@ type FileOperationFilter struct { var _ json.UnmarshalerFrom = (*FileOperationFilter)(nil) func (s *FileOperationFilter) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenPattern bool + const ( + missingPattern uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11750,7 +12640,7 @@ func (s *FileOperationFilter) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"pattern"`: - seenPattern = true + missing &^= missingPattern if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } @@ -11763,8 +12653,10 @@ func (s *FileOperationFilter) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenPattern { - return fmt.Errorf("required property 'pattern' is missing") + if missing != 0 { + if missing&missingPattern != 0 { + return fmt.Errorf("required property 'pattern' is missing") + } } return nil @@ -11784,10 +12676,12 @@ type FileRename struct { var _ json.UnmarshalerFrom = (*FileRename)(nil) func (s *FileRename) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenOldUri bool - seenNewUri bool + const ( + missingOldUri uint = 1 << iota + missingNewUri + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11803,12 +12697,12 @@ func (s *FileRename) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"oldUri"`: - seenOldUri = true + missing &^= missingOldUri if err := json.UnmarshalDecode(dec, &s.OldUri); err != nil { return err } case `"newUri"`: - seenNewUri = true + missing &^= missingNewUri if err := json.UnmarshalDecode(dec, &s.NewUri); err != nil { return err } @@ -11821,11 +12715,13 @@ func (s *FileRename) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenOldUri { - return fmt.Errorf("required property 'oldUri' is missing") - } - if !seenNewUri { - return fmt.Errorf("required property 'newUri' is missing") + if missing != 0 { + if missing&missingOldUri != 0 { + return fmt.Errorf("required property 'oldUri' is missing") + } + if missing&missingNewUri != 0 { + return fmt.Errorf("required property 'newUri' is missing") + } } return nil @@ -11842,7 +12738,11 @@ type FileDelete struct { var _ json.UnmarshalerFrom = (*FileDelete)(nil) func (s *FileDelete) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUri bool + const ( + missingUri uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11858,7 +12758,7 @@ func (s *FileDelete) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -11871,8 +12771,10 @@ func (s *FileDelete) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -11902,10 +12804,12 @@ type InlineValueContext struct { var _ json.UnmarshalerFrom = (*InlineValueContext)(nil) func (s *InlineValueContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenFrameId bool - seenStoppedLocation bool + const ( + missingFrameId uint = 1 << iota + missingStoppedLocation + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11921,12 +12825,12 @@ func (s *InlineValueContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"frameId"`: - seenFrameId = true + missing &^= missingFrameId if err := json.UnmarshalDecode(dec, &s.FrameId); err != nil { return err } case `"stoppedLocation"`: - seenStoppedLocation = true + missing &^= missingStoppedLocation if err := json.UnmarshalDecode(dec, &s.StoppedLocation); err != nil { return err } @@ -11939,11 +12843,13 @@ func (s *InlineValueContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenFrameId { - return fmt.Errorf("required property 'frameId' is missing") - } - if !seenStoppedLocation { - return fmt.Errorf("required property 'stoppedLocation' is missing") + if missing != 0 { + if missing&missingFrameId != 0 { + return fmt.Errorf("required property 'frameId' is missing") + } + if missing&missingStoppedLocation != 0 { + return fmt.Errorf("required property 'stoppedLocation' is missing") + } } return nil @@ -11963,10 +12869,12 @@ type InlineValueText struct { var _ json.UnmarshalerFrom = (*InlineValueText)(nil) func (s *InlineValueText) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenText bool + const ( + missingRange uint = 1 << iota + missingText + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -11982,12 +12890,12 @@ func (s *InlineValueText) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"text"`: - seenText = true + missing &^= missingText if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } @@ -12000,11 +12908,13 @@ func (s *InlineValueText) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenText { - return fmt.Errorf("required property 'text' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingText != 0 { + return fmt.Errorf("required property 'text' is missing") + } } return nil @@ -12030,10 +12940,12 @@ type InlineValueVariableLookup struct { var _ json.UnmarshalerFrom = (*InlineValueVariableLookup)(nil) func (s *InlineValueVariableLookup) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenCaseSensitiveLookup bool + const ( + missingRange uint = 1 << iota + missingCaseSensitiveLookup + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12049,7 +12961,7 @@ func (s *InlineValueVariableLookup) UnmarshalJSONFrom(dec *jsontext.Decoder) err } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -12058,7 +12970,7 @@ func (s *InlineValueVariableLookup) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } case `"caseSensitiveLookup"`: - seenCaseSensitiveLookup = true + missing &^= missingCaseSensitiveLookup if err := json.UnmarshalDecode(dec, &s.CaseSensitiveLookup); err != nil { return err } @@ -12071,11 +12983,13 @@ func (s *InlineValueVariableLookup) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenCaseSensitiveLookup { - return fmt.Errorf("required property 'caseSensitiveLookup' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingCaseSensitiveLookup != 0 { + return fmt.Errorf("required property 'caseSensitiveLookup' is missing") + } } return nil @@ -12098,7 +13012,11 @@ type InlineValueEvaluatableExpression struct { var _ json.UnmarshalerFrom = (*InlineValueEvaluatableExpression)(nil) func (s *InlineValueEvaluatableExpression) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenRange bool + const ( + missingRange uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12114,7 +13032,7 @@ func (s *InlineValueEvaluatableExpression) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -12131,8 +13049,10 @@ func (s *InlineValueEvaluatableExpression) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } } return nil @@ -12181,7 +13101,11 @@ type InlayHintLabelPart struct { var _ json.UnmarshalerFrom = (*InlayHintLabelPart)(nil) func (s *InlayHintLabelPart) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenValue bool + const ( + missingValue uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12197,7 +13121,7 @@ func (s *InlayHintLabelPart) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"value"`: - seenValue = true + missing &^= missingValue if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } @@ -12222,8 +13146,10 @@ func (s *InlayHintLabelPart) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenValue { - return fmt.Errorf("required property 'value' is missing") + if missing != 0 { + if missing&missingValue != 0 { + return fmt.Errorf("required property 'value' is missing") + } } return nil @@ -12264,10 +13190,12 @@ type MarkupContent struct { var _ json.UnmarshalerFrom = (*MarkupContent)(nil) func (s *MarkupContent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenValue bool + const ( + missingKind uint = 1 << iota + missingValue + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12283,12 +13211,12 @@ func (s *MarkupContent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"value"`: - seenValue = true + missing &^= missingValue if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } @@ -12301,11 +13229,13 @@ func (s *MarkupContent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenValue { - return fmt.Errorf("required property 'value' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingValue != 0 { + return fmt.Errorf("required property 'value' is missing") + } } return nil @@ -12350,10 +13280,12 @@ type RelatedFullDocumentDiagnosticReport struct { var _ json.UnmarshalerFrom = (*RelatedFullDocumentDiagnosticReport)(nil) func (s *RelatedFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenItems bool + const ( + missingKind uint = 1 << iota + missingItems + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12369,7 +13301,7 @@ func (s *RelatedFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.De } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -12378,7 +13310,7 @@ func (s *RelatedFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.De return err } case `"items"`: - seenItems = true + missing &^= missingItems if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } @@ -12395,11 +13327,13 @@ func (s *RelatedFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.De return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenItems { - return fmt.Errorf("required property 'items' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingItems != 0 { + return fmt.Errorf("required property 'items' is missing") + } } return nil @@ -12432,10 +13366,12 @@ type RelatedUnchangedDocumentDiagnosticReport struct { var _ json.UnmarshalerFrom = (*RelatedUnchangedDocumentDiagnosticReport)(nil) func (s *RelatedUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenResultId bool + const ( + missingKind uint = 1 << iota + missingResultId + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12451,12 +13387,12 @@ func (s *RelatedUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsonte } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: - seenResultId = true + missing &^= missingResultId if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } @@ -12473,11 +13409,13 @@ func (s *RelatedUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsonte return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenResultId { - return fmt.Errorf("required property 'resultId' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingResultId != 0 { + return fmt.Errorf("required property 'resultId' is missing") + } } return nil @@ -12502,10 +13440,12 @@ type FullDocumentDiagnosticReport struct { var _ json.UnmarshalerFrom = (*FullDocumentDiagnosticReport)(nil) func (s *FullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenItems bool + const ( + missingKind uint = 1 << iota + missingItems + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12521,7 +13461,7 @@ func (s *FullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -12530,7 +13470,7 @@ func (s *FullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } case `"items"`: - seenItems = true + missing &^= missingItems if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } @@ -12543,11 +13483,13 @@ func (s *FullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenItems { - return fmt.Errorf("required property 'items' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingItems != 0 { + return fmt.Errorf("required property 'items' is missing") + } } return nil @@ -12572,10 +13514,12 @@ type UnchangedDocumentDiagnosticReport struct { var _ json.UnmarshalerFrom = (*UnchangedDocumentDiagnosticReport)(nil) func (s *UnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenResultId bool + const ( + missingKind uint = 1 << iota + missingResultId + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12591,12 +13535,12 @@ func (s *UnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Deco } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: - seenResultId = true + missing &^= missingResultId if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } @@ -12609,11 +13553,13 @@ func (s *UnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Deco return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenResultId { - return fmt.Errorf("required property 'resultId' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingResultId != 0 { + return fmt.Errorf("required property 'resultId' is missing") + } } return nil @@ -12642,10 +13588,12 @@ type DiagnosticOptions struct { var _ json.UnmarshalerFrom = (*DiagnosticOptions)(nil) func (s *DiagnosticOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenInterFileDependencies bool - seenWorkspaceDiagnostics bool + const ( + missingInterFileDependencies uint = 1 << iota + missingWorkspaceDiagnostics + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12669,12 +13617,12 @@ func (s *DiagnosticOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"interFileDependencies"`: - seenInterFileDependencies = true + missing &^= missingInterFileDependencies if err := json.UnmarshalDecode(dec, &s.InterFileDependencies); err != nil { return err } case `"workspaceDiagnostics"`: - seenWorkspaceDiagnostics = true + missing &^= missingWorkspaceDiagnostics if err := json.UnmarshalDecode(dec, &s.WorkspaceDiagnostics); err != nil { return err } @@ -12687,11 +13635,13 @@ func (s *DiagnosticOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenInterFileDependencies { - return fmt.Errorf("required property 'interFileDependencies' is missing") - } - if !seenWorkspaceDiagnostics { - return fmt.Errorf("required property 'workspaceDiagnostics' is missing") + if missing != 0 { + if missing&missingInterFileDependencies != 0 { + return fmt.Errorf("required property 'interFileDependencies' is missing") + } + if missing&missingWorkspaceDiagnostics != 0 { + return fmt.Errorf("required property 'workspaceDiagnostics' is missing") + } } return nil @@ -12712,10 +13662,12 @@ type PreviousResultId struct { var _ json.UnmarshalerFrom = (*PreviousResultId)(nil) func (s *PreviousResultId) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenValue bool + const ( + missingUri uint = 1 << iota + missingValue + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12731,12 +13683,12 @@ func (s *PreviousResultId) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"value"`: - seenValue = true + missing &^= missingValue if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } @@ -12749,11 +13701,13 @@ func (s *PreviousResultId) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenValue { - return fmt.Errorf("required property 'value' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingValue != 0 { + return fmt.Errorf("required property 'value' is missing") + } } return nil @@ -12786,12 +13740,14 @@ type NotebookDocument struct { var _ json.UnmarshalerFrom = (*NotebookDocument)(nil) func (s *NotebookDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenNotebookType bool - seenVersion bool - seenCells bool + const ( + missingUri uint = 1 << iota + missingNotebookType + missingVersion + missingCells + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12807,17 +13763,17 @@ func (s *NotebookDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"notebookType"`: - seenNotebookType = true + missing &^= missingNotebookType if err := json.UnmarshalDecode(dec, &s.NotebookType); err != nil { return err } case `"version"`: - seenVersion = true + missing &^= missingVersion if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } @@ -12826,7 +13782,7 @@ func (s *NotebookDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"cells"`: - seenCells = true + missing &^= missingCells if err := json.UnmarshalDecode(dec, &s.Cells); err != nil { return err } @@ -12839,17 +13795,19 @@ func (s *NotebookDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenNotebookType { - return fmt.Errorf("required property 'notebookType' is missing") - } - if !seenVersion { - return fmt.Errorf("required property 'version' is missing") - } - if !seenCells { - return fmt.Errorf("required property 'cells' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingNotebookType != 0 { + return fmt.Errorf("required property 'notebookType' is missing") + } + if missing&missingVersion != 0 { + return fmt.Errorf("required property 'version' is missing") + } + if missing&missingCells != 0 { + return fmt.Errorf("required property 'cells' is missing") + } } return nil @@ -12875,12 +13833,14 @@ type TextDocumentItem struct { var _ json.UnmarshalerFrom = (*TextDocumentItem)(nil) func (s *TextDocumentItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenLanguageId bool - seenVersion bool - seenText bool + const ( + missingUri uint = 1 << iota + missingLanguageId + missingVersion + missingText + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12896,22 +13856,22 @@ func (s *TextDocumentItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"languageId"`: - seenLanguageId = true + missing &^= missingLanguageId if err := json.UnmarshalDecode(dec, &s.LanguageId); err != nil { return err } case `"version"`: - seenVersion = true + missing &^= missingVersion if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } case `"text"`: - seenText = true + missing &^= missingText if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } @@ -12924,17 +13884,19 @@ func (s *TextDocumentItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenLanguageId { - return fmt.Errorf("required property 'languageId' is missing") - } - if !seenVersion { - return fmt.Errorf("required property 'version' is missing") - } - if !seenText { - return fmt.Errorf("required property 'text' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingLanguageId != 0 { + return fmt.Errorf("required property 'languageId' is missing") + } + if missing&missingVersion != 0 { + return fmt.Errorf("required property 'version' is missing") + } + if missing&missingText != 0 { + return fmt.Errorf("required property 'text' is missing") + } } return nil @@ -12965,7 +13927,11 @@ type NotebookDocumentSyncOptions struct { var _ json.UnmarshalerFrom = (*NotebookDocumentSyncOptions)(nil) func (s *NotebookDocumentSyncOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenNotebookSelector bool + const ( + missingNotebookSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -12981,7 +13947,7 @@ func (s *NotebookDocumentSyncOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"notebookSelector"`: - seenNotebookSelector = true + missing &^= missingNotebookSelector if err := json.UnmarshalDecode(dec, &s.NotebookSelector); err != nil { return err } @@ -12998,8 +13964,10 @@ func (s *NotebookDocumentSyncOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenNotebookSelector { - return fmt.Errorf("required property 'notebookSelector' is missing") + if missing != 0 { + if missing&missingNotebookSelector != 0 { + return fmt.Errorf("required property 'notebookSelector' is missing") + } } return nil @@ -13019,10 +13987,12 @@ type VersionedNotebookDocumentIdentifier struct { var _ json.UnmarshalerFrom = (*VersionedNotebookDocumentIdentifier)(nil) func (s *VersionedNotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenVersion bool - seenUri bool + const ( + missingVersion uint = 1 << iota + missingUri + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13038,12 +14008,12 @@ func (s *VersionedNotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.De } switch string(name) { case `"version"`: - seenVersion = true + missing &^= missingVersion if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -13056,11 +14026,13 @@ func (s *VersionedNotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.De return err } - if !seenVersion { - return fmt.Errorf("required property 'version' is missing") - } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingVersion != 0 { + return fmt.Errorf("required property 'version' is missing") + } + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -13090,7 +14062,11 @@ type NotebookDocumentIdentifier struct { var _ json.UnmarshalerFrom = (*NotebookDocumentIdentifier)(nil) func (s *NotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUri bool + const ( + missingUri uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13106,7 +14082,7 @@ func (s *NotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -13119,8 +14095,10 @@ func (s *NotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -13142,7 +14120,11 @@ type InlineCompletionContext struct { var _ json.UnmarshalerFrom = (*InlineCompletionContext)(nil) func (s *InlineCompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTriggerKind bool + const ( + missingTriggerKind uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13158,7 +14140,7 @@ func (s *InlineCompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error } switch string(name) { case `"triggerKind"`: - seenTriggerKind = true + missing &^= missingTriggerKind if err := json.UnmarshalDecode(dec, &s.TriggerKind); err != nil { return err } @@ -13175,8 +14157,10 @@ func (s *InlineCompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenTriggerKind { - return fmt.Errorf("required property 'triggerKind' is missing") + if missing != 0 { + if missing&missingTriggerKind != 0 { + return fmt.Errorf("required property 'triggerKind' is missing") + } } return nil @@ -13204,10 +14188,12 @@ type StringValue struct { var _ json.UnmarshalerFrom = (*StringValue)(nil) func (s *StringValue) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenValue bool + const ( + missingKind uint = 1 << iota + missingValue + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13223,12 +14209,12 @@ func (s *StringValue) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"value"`: - seenValue = true + missing &^= missingValue if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } @@ -13241,11 +14227,13 @@ func (s *StringValue) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenValue { - return fmt.Errorf("required property 'value' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingValue != 0 { + return fmt.Errorf("required property 'value' is missing") + } } return nil @@ -13273,7 +14261,11 @@ type TextDocumentContentOptions struct { var _ json.UnmarshalerFrom = (*TextDocumentContentOptions)(nil) func (s *TextDocumentContentOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenSchemes bool + const ( + missingSchemes uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13289,7 +14281,7 @@ func (s *TextDocumentContentOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"schemes"`: - seenSchemes = true + missing &^= missingSchemes if err := json.UnmarshalDecode(dec, &s.Schemes); err != nil { return err } @@ -13302,8 +14294,10 @@ func (s *TextDocumentContentOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenSchemes { - return fmt.Errorf("required property 'schemes' is missing") + if missing != 0 { + if missing&missingSchemes != 0 { + return fmt.Errorf("required property 'schemes' is missing") + } } return nil @@ -13325,10 +14319,12 @@ type Registration struct { var _ json.UnmarshalerFrom = (*Registration)(nil) func (s *Registration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenId bool - seenMethod bool + const ( + missingId uint = 1 << iota + missingMethod + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13344,12 +14340,12 @@ func (s *Registration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"id"`: - seenId = true + missing &^= missingId if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } case `"method"`: - seenMethod = true + missing &^= missingMethod if err := json.UnmarshalDecode(dec, &s.Method); err != nil { return err } @@ -13366,11 +14362,13 @@ func (s *Registration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenId { - return fmt.Errorf("required property 'id' is missing") - } - if !seenMethod { - return fmt.Errorf("required property 'method' is missing") + if missing != 0 { + if missing&missingId != 0 { + return fmt.Errorf("required property 'id' is missing") + } + if missing&missingMethod != 0 { + return fmt.Errorf("required property 'method' is missing") + } } return nil @@ -13389,10 +14387,12 @@ type Unregistration struct { var _ json.UnmarshalerFrom = (*Unregistration)(nil) func (s *Unregistration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenId bool - seenMethod bool + const ( + missingId uint = 1 << iota + missingMethod + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13408,12 +14408,12 @@ func (s *Unregistration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"id"`: - seenId = true + missing &^= missingId if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } case `"method"`: - seenMethod = true + missing &^= missingMethod if err := json.UnmarshalDecode(dec, &s.Method); err != nil { return err } @@ -13426,11 +14426,13 @@ func (s *Unregistration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenId { - return fmt.Errorf("required property 'id' is missing") - } - if !seenMethod { - return fmt.Errorf("required property 'method' is missing") + if missing != 0 { + if missing&missingId != 0 { + return fmt.Errorf("required property 'id' is missing") + } + if missing&missingMethod != 0 { + return fmt.Errorf("required property 'method' is missing") + } } return nil @@ -13608,7 +14610,11 @@ type ServerInfo struct { var _ json.UnmarshalerFrom = (*ServerInfo)(nil) func (s *ServerInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenName bool + const ( + missingName uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13624,7 +14630,7 @@ func (s *ServerInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } @@ -13641,8 +14647,10 @@ func (s *ServerInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenName { - return fmt.Errorf("required property 'name' is missing") + if missing != 0 { + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } } return nil @@ -13660,10 +14668,12 @@ type VersionedTextDocumentIdentifier struct { var _ json.UnmarshalerFrom = (*VersionedTextDocumentIdentifier)(nil) func (s *VersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenVersion bool + const ( + missingUri uint = 1 << iota + missingVersion + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13679,12 +14689,12 @@ func (s *VersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decode } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: - seenVersion = true + missing &^= missingVersion if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } @@ -13697,11 +14707,13 @@ func (s *VersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decode return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenVersion { - return fmt.Errorf("required property 'version' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingVersion != 0 { + return fmt.Errorf("required property 'version' is missing") + } } return nil @@ -13725,10 +14737,12 @@ type FileEvent struct { var _ json.UnmarshalerFrom = (*FileEvent)(nil) func (s *FileEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenType bool + const ( + missingUri uint = 1 << iota + missingType + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13744,12 +14758,12 @@ func (s *FileEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"type"`: - seenType = true + missing &^= missingType if err := json.UnmarshalDecode(dec, &s.Type); err != nil { return err } @@ -13762,11 +14776,13 @@ func (s *FileEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenType { - return fmt.Errorf("required property 'type' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingType != 0 { + return fmt.Errorf("required property 'type' is missing") + } } return nil @@ -13787,7 +14803,11 @@ type FileSystemWatcher struct { var _ json.UnmarshalerFrom = (*FileSystemWatcher)(nil) func (s *FileSystemWatcher) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenGlobPattern bool + const ( + missingGlobPattern uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13803,7 +14823,7 @@ func (s *FileSystemWatcher) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"globPattern"`: - seenGlobPattern = true + missing &^= missingGlobPattern if err := json.UnmarshalDecode(dec, &s.GlobPattern); err != nil { return err } @@ -13820,8 +14840,10 @@ func (s *FileSystemWatcher) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenGlobPattern { - return fmt.Errorf("required property 'globPattern' is missing") + if missing != 0 { + if missing&missingGlobPattern != 0 { + return fmt.Errorf("required property 'globPattern' is missing") + } } return nil @@ -13874,10 +14896,12 @@ type Diagnostic struct { var _ json.UnmarshalerFrom = (*Diagnostic)(nil) func (s *Diagnostic) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenMessage bool + const ( + missingRange uint = 1 << iota + missingMessage + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13893,7 +14917,7 @@ func (s *Diagnostic) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -13914,7 +14938,7 @@ func (s *Diagnostic) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"message"`: - seenMessage = true + missing &^= missingMessage if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } @@ -13939,11 +14963,13 @@ func (s *Diagnostic) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenMessage { - return fmt.Errorf("required property 'message' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingMessage != 0 { + return fmt.Errorf("required property 'message' is missing") + } } return nil @@ -13962,7 +14988,11 @@ type CompletionContext struct { var _ json.UnmarshalerFrom = (*CompletionContext)(nil) func (s *CompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenTriggerKind bool + const ( + missingTriggerKind uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -13978,7 +15008,7 @@ func (s *CompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"triggerKind"`: - seenTriggerKind = true + missing &^= missingTriggerKind if err := json.UnmarshalDecode(dec, &s.TriggerKind); err != nil { return err } @@ -13995,8 +15025,10 @@ func (s *CompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTriggerKind { - return fmt.Errorf("required property 'triggerKind' is missing") + if missing != 0 { + if missing&missingTriggerKind != 0 { + return fmt.Errorf("required property 'triggerKind' is missing") + } } return nil @@ -14032,11 +15064,13 @@ type InsertReplaceEdit struct { var _ json.UnmarshalerFrom = (*InsertReplaceEdit)(nil) func (s *InsertReplaceEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenNewText bool - seenInsert bool - seenReplace bool + const ( + missingNewText uint = 1 << iota + missingInsert + missingReplace + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14052,17 +15086,17 @@ func (s *InsertReplaceEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"newText"`: - seenNewText = true + missing &^= missingNewText if err := json.UnmarshalDecode(dec, &s.NewText); err != nil { return err } case `"insert"`: - seenInsert = true + missing &^= missingInsert if err := json.UnmarshalDecode(dec, &s.Insert); err != nil { return err } case `"replace"`: - seenReplace = true + missing &^= missingReplace if err := json.UnmarshalDecode(dec, &s.Replace); err != nil { return err } @@ -14075,14 +15109,16 @@ func (s *InsertReplaceEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenNewText { - return fmt.Errorf("required property 'newText' is missing") - } - if !seenInsert { - return fmt.Errorf("required property 'insert' is missing") - } - if !seenReplace { - return fmt.Errorf("required property 'replace' is missing") + if missing != 0 { + if missing&missingNewText != 0 { + return fmt.Errorf("required property 'newText' is missing") + } + if missing&missingInsert != 0 { + return fmt.Errorf("required property 'insert' is missing") + } + if missing&missingReplace != 0 { + return fmt.Errorf("required property 'replace' is missing") + } } return nil @@ -14258,10 +15294,12 @@ type SignatureHelpContext struct { var _ json.UnmarshalerFrom = (*SignatureHelpContext)(nil) func (s *SignatureHelpContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTriggerKind bool - seenIsRetrigger bool + const ( + missingTriggerKind uint = 1 << iota + missingIsRetrigger + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14277,7 +15315,7 @@ func (s *SignatureHelpContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"triggerKind"`: - seenTriggerKind = true + missing &^= missingTriggerKind if err := json.UnmarshalDecode(dec, &s.TriggerKind); err != nil { return err } @@ -14286,7 +15324,7 @@ func (s *SignatureHelpContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"isRetrigger"`: - seenIsRetrigger = true + missing &^= missingIsRetrigger if err := json.UnmarshalDecode(dec, &s.IsRetrigger); err != nil { return err } @@ -14303,11 +15341,13 @@ func (s *SignatureHelpContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTriggerKind { - return fmt.Errorf("required property 'triggerKind' is missing") - } - if !seenIsRetrigger { - return fmt.Errorf("required property 'isRetrigger' is missing") + if missing != 0 { + if missing&missingTriggerKind != 0 { + return fmt.Errorf("required property 'triggerKind' is missing") + } + if missing&missingIsRetrigger != 0 { + return fmt.Errorf("required property 'isRetrigger' is missing") + } } return nil @@ -14345,7 +15385,11 @@ type SignatureInformation struct { var _ json.UnmarshalerFrom = (*SignatureInformation)(nil) func (s *SignatureInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenLabel bool + const ( + missingLabel uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14361,7 +15405,7 @@ func (s *SignatureInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"label"`: - seenLabel = true + missing &^= missingLabel if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } @@ -14386,8 +15430,10 @@ func (s *SignatureInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenLabel { - return fmt.Errorf("required property 'label' is missing") + if missing != 0 { + if missing&missingLabel != 0 { + return fmt.Errorf("required property 'label' is missing") + } } return nil @@ -14424,7 +15470,11 @@ type ReferenceContext struct { var _ json.UnmarshalerFrom = (*ReferenceContext)(nil) func (s *ReferenceContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenIncludeDeclaration bool + const ( + missingIncludeDeclaration uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14440,7 +15490,7 @@ func (s *ReferenceContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"includeDeclaration"`: - seenIncludeDeclaration = true + missing &^= missingIncludeDeclaration if err := json.UnmarshalDecode(dec, &s.IncludeDeclaration); err != nil { return err } @@ -14453,8 +15503,10 @@ func (s *ReferenceContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenIncludeDeclaration { - return fmt.Errorf("required property 'includeDeclaration' is missing") + if missing != 0 { + if missing&missingIncludeDeclaration != 0 { + return fmt.Errorf("required property 'includeDeclaration' is missing") + } } return nil @@ -14493,10 +15545,12 @@ type BaseSymbolInformation struct { var _ json.UnmarshalerFrom = (*BaseSymbolInformation)(nil) func (s *BaseSymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenName bool - seenKind bool + const ( + missingName uint = 1 << iota + missingKind + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14512,12 +15566,12 @@ func (s *BaseSymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -14538,11 +15592,13 @@ func (s *BaseSymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenName { - return fmt.Errorf("required property 'name' is missing") - } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") + if missing != 0 { + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } } return nil @@ -14584,7 +15640,11 @@ type CodeActionContext struct { var _ json.UnmarshalerFrom = (*CodeActionContext)(nil) func (s *CodeActionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDiagnostics bool + const ( + missingDiagnostics uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14600,7 +15660,7 @@ func (s *CodeActionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"diagnostics"`: - seenDiagnostics = true + missing &^= missingDiagnostics if err := json.UnmarshalDecode(dec, &s.Diagnostics); err != nil { return err } @@ -14621,8 +15681,10 @@ func (s *CodeActionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenDiagnostics { - return fmt.Errorf("required property 'diagnostics' is missing") + if missing != 0 { + if missing&missingDiagnostics != 0 { + return fmt.Errorf("required property 'diagnostics' is missing") + } } return nil @@ -14641,7 +15703,11 @@ type CodeActionDisabled struct { var _ json.UnmarshalerFrom = (*CodeActionDisabled)(nil) func (s *CodeActionDisabled) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenReason bool + const ( + missingReason uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14657,7 +15723,7 @@ func (s *CodeActionDisabled) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"reason"`: - seenReason = true + missing &^= missingReason if err := json.UnmarshalDecode(dec, &s.Reason); err != nil { return err } @@ -14670,8 +15736,10 @@ func (s *CodeActionDisabled) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenReason { - return fmt.Errorf("required property 'reason' is missing") + if missing != 0 { + if missing&missingReason != 0 { + return fmt.Errorf("required property 'reason' is missing") + } } return nil @@ -14722,7 +15790,11 @@ type LocationUriOnly struct { var _ json.UnmarshalerFrom = (*LocationUriOnly)(nil) func (s *LocationUriOnly) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenUri bool + const ( + missingUri uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14738,7 +15810,7 @@ func (s *LocationUriOnly) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } @@ -14751,8 +15823,10 @@ func (s *LocationUriOnly) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } } return nil @@ -14812,10 +15886,12 @@ type FormattingOptions struct { var _ json.UnmarshalerFrom = (*FormattingOptions)(nil) func (s *FormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTabSize bool - seenInsertSpaces bool + const ( + missingTabSize uint = 1 << iota + missingInsertSpaces + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14831,12 +15907,12 @@ func (s *FormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"tabSize"`: - seenTabSize = true + missing &^= missingTabSize if err := json.UnmarshalDecode(dec, &s.TabSize); err != nil { return err } case `"insertSpaces"`: - seenInsertSpaces = true + missing &^= missingInsertSpaces if err := json.UnmarshalDecode(dec, &s.InsertSpaces); err != nil { return err } @@ -14861,11 +15937,13 @@ func (s *FormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTabSize { - return fmt.Errorf("required property 'tabSize' is missing") - } - if !seenInsertSpaces { - return fmt.Errorf("required property 'insertSpaces' is missing") + if missing != 0 { + if missing&missingTabSize != 0 { + return fmt.Errorf("required property 'tabSize' is missing") + } + if missing&missingInsertSpaces != 0 { + return fmt.Errorf("required property 'insertSpaces' is missing") + } } return nil @@ -14900,7 +15978,11 @@ type DocumentOnTypeFormattingOptions struct { var _ json.UnmarshalerFrom = (*DocumentOnTypeFormattingOptions)(nil) func (s *DocumentOnTypeFormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenFirstTriggerCharacter bool + const ( + missingFirstTriggerCharacter uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14916,7 +15998,7 @@ func (s *DocumentOnTypeFormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decode } switch string(name) { case `"firstTriggerCharacter"`: - seenFirstTriggerCharacter = true + missing &^= missingFirstTriggerCharacter if err := json.UnmarshalDecode(dec, &s.FirstTriggerCharacter); err != nil { return err } @@ -14933,8 +16015,10 @@ func (s *DocumentOnTypeFormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decode return err } - if !seenFirstTriggerCharacter { - return fmt.Errorf("required property 'firstTriggerCharacter' is missing") + if missing != 0 { + if missing&missingFirstTriggerCharacter != 0 { + return fmt.Errorf("required property 'firstTriggerCharacter' is missing") + } } return nil @@ -14960,10 +16044,12 @@ type PrepareRenamePlaceholder struct { var _ json.UnmarshalerFrom = (*PrepareRenamePlaceholder)(nil) func (s *PrepareRenamePlaceholder) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenPlaceholder bool + const ( + missingRange uint = 1 << iota + missingPlaceholder + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -14979,12 +16065,12 @@ func (s *PrepareRenamePlaceholder) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"placeholder"`: - seenPlaceholder = true + missing &^= missingPlaceholder if err := json.UnmarshalDecode(dec, &s.Placeholder); err != nil { return err } @@ -14997,11 +16083,13 @@ func (s *PrepareRenamePlaceholder) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenPlaceholder { - return fmt.Errorf("required property 'placeholder' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingPlaceholder != 0 { + return fmt.Errorf("required property 'placeholder' is missing") + } } return nil @@ -15015,7 +16103,11 @@ type PrepareRenameDefaultBehavior struct { var _ json.UnmarshalerFrom = (*PrepareRenameDefaultBehavior)(nil) func (s *PrepareRenameDefaultBehavior) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDefaultBehavior bool + const ( + missingDefaultBehavior uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15031,7 +16123,7 @@ func (s *PrepareRenameDefaultBehavior) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"defaultBehavior"`: - seenDefaultBehavior = true + missing &^= missingDefaultBehavior if err := json.UnmarshalDecode(dec, &s.DefaultBehavior); err != nil { return err } @@ -15044,8 +16136,10 @@ func (s *PrepareRenameDefaultBehavior) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenDefaultBehavior { - return fmt.Errorf("required property 'defaultBehavior' is missing") + if missing != 0 { + if missing&missingDefaultBehavior != 0 { + return fmt.Errorf("required property 'defaultBehavior' is missing") + } } return nil @@ -15062,7 +16156,11 @@ type ExecuteCommandOptions struct { var _ json.UnmarshalerFrom = (*ExecuteCommandOptions)(nil) func (s *ExecuteCommandOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenCommands bool + const ( + missingCommands uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15082,7 +16180,7 @@ func (s *ExecuteCommandOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } case `"commands"`: - seenCommands = true + missing &^= missingCommands if err := json.UnmarshalDecode(dec, &s.Commands); err != nil { return err } @@ -15095,8 +16193,10 @@ func (s *ExecuteCommandOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenCommands { - return fmt.Errorf("required property 'commands' is missing") + if missing != 0 { + if missing&missingCommands != 0 { + return fmt.Errorf("required property 'commands' is missing") + } } return nil @@ -15124,10 +16224,12 @@ type SemanticTokensLegend struct { var _ json.UnmarshalerFrom = (*SemanticTokensLegend)(nil) func (s *SemanticTokensLegend) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenTokenTypes bool - seenTokenModifiers bool + const ( + missingTokenTypes uint = 1 << iota + missingTokenModifiers + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15143,12 +16245,12 @@ func (s *SemanticTokensLegend) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"tokenTypes"`: - seenTokenTypes = true + missing &^= missingTokenTypes if err := json.UnmarshalDecode(dec, &s.TokenTypes); err != nil { return err } case `"tokenModifiers"`: - seenTokenModifiers = true + missing &^= missingTokenModifiers if err := json.UnmarshalDecode(dec, &s.TokenModifiers); err != nil { return err } @@ -15161,11 +16263,13 @@ func (s *SemanticTokensLegend) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenTokenTypes { - return fmt.Errorf("required property 'tokenTypes' is missing") - } - if !seenTokenModifiers { - return fmt.Errorf("required property 'tokenModifiers' is missing") + if missing != 0 { + if missing&missingTokenTypes != 0 { + return fmt.Errorf("required property 'tokenTypes' is missing") + } + if missing&missingTokenModifiers != 0 { + return fmt.Errorf("required property 'tokenModifiers' is missing") + } } return nil @@ -15195,10 +16299,12 @@ type OptionalVersionedTextDocumentIdentifier struct { var _ json.UnmarshalerFrom = (*OptionalVersionedTextDocumentIdentifier)(nil) func (s *OptionalVersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenUri bool - seenVersion bool + const ( + missingUri uint = 1 << iota + missingVersion + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15214,12 +16320,12 @@ func (s *OptionalVersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontex } switch string(name) { case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: - seenVersion = true + missing &^= missingVersion if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } @@ -15232,11 +16338,13 @@ func (s *OptionalVersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontex return err } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenVersion { - return fmt.Errorf("required property 'version' is missing") + if missing != 0 { + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingVersion != 0 { + return fmt.Errorf("required property 'version' is missing") + } } return nil @@ -15261,11 +16369,13 @@ type AnnotatedTextEdit struct { var _ json.UnmarshalerFrom = (*AnnotatedTextEdit)(nil) func (s *AnnotatedTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenNewText bool - seenAnnotationId bool + const ( + missingRange uint = 1 << iota + missingNewText + missingAnnotationId + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15281,17 +16391,17 @@ func (s *AnnotatedTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"newText"`: - seenNewText = true + missing &^= missingNewText if err := json.UnmarshalDecode(dec, &s.NewText); err != nil { return err } case `"annotationId"`: - seenAnnotationId = true + missing &^= missingAnnotationId if err := json.UnmarshalDecode(dec, &s.AnnotationId); err != nil { return err } @@ -15304,14 +16414,16 @@ func (s *AnnotatedTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenNewText { - return fmt.Errorf("required property 'newText' is missing") - } - if !seenAnnotationId { - return fmt.Errorf("required property 'annotationId' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingNewText != 0 { + return fmt.Errorf("required property 'newText' is missing") + } + if missing&missingAnnotationId != 0 { + return fmt.Errorf("required property 'annotationId' is missing") + } } return nil @@ -15336,10 +16448,12 @@ type SnippetTextEdit struct { var _ json.UnmarshalerFrom = (*SnippetTextEdit)(nil) func (s *SnippetTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenSnippet bool + const ( + missingRange uint = 1 << iota + missingSnippet + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15355,12 +16469,12 @@ func (s *SnippetTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"snippet"`: - seenSnippet = true + missing &^= missingSnippet if err := json.UnmarshalDecode(dec, &s.Snippet); err != nil { return err } @@ -15377,11 +16491,13 @@ func (s *SnippetTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenSnippet { - return fmt.Errorf("required property 'snippet' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingSnippet != 0 { + return fmt.Errorf("required property 'snippet' is missing") + } } return nil @@ -15401,7 +16517,11 @@ type ResourceOperation struct { var _ json.UnmarshalerFrom = (*ResourceOperation)(nil) func (s *ResourceOperation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenKind bool + const ( + missingKind uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15417,7 +16537,7 @@ func (s *ResourceOperation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -15434,8 +16554,10 @@ func (s *ResourceOperation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } } return nil @@ -15494,7 +16616,11 @@ type FileOperationPattern struct { var _ json.UnmarshalerFrom = (*FileOperationPattern)(nil) func (s *FileOperationPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenGlob bool + const ( + missingGlob uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15510,7 +16636,7 @@ func (s *FileOperationPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"glob"`: - seenGlob = true + missing &^= missingGlob if err := json.UnmarshalDecode(dec, &s.Glob); err != nil { return err } @@ -15531,8 +16657,10 @@ func (s *FileOperationPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenGlob { - return fmt.Errorf("required property 'glob' is missing") + if missing != 0 { + if missing&missingGlob != 0 { + return fmt.Errorf("required property 'glob' is missing") + } } return nil @@ -15564,12 +16692,14 @@ type WorkspaceFullDocumentDiagnosticReport struct { var _ json.UnmarshalerFrom = (*WorkspaceFullDocumentDiagnosticReport)(nil) func (s *WorkspaceFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenItems bool - seenUri bool - seenVersion bool + const ( + missingKind uint = 1 << iota + missingItems + missingUri + missingVersion + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15585,7 +16715,7 @@ func (s *WorkspaceFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext. } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } @@ -15594,17 +16724,17 @@ func (s *WorkspaceFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext. return err } case `"items"`: - seenItems = true + missing &^= missingItems if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: - seenVersion = true + missing &^= missingVersion if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } @@ -15617,17 +16747,19 @@ func (s *WorkspaceFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext. return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenItems { - return fmt.Errorf("required property 'items' is missing") - } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenVersion { - return fmt.Errorf("required property 'version' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingItems != 0 { + return fmt.Errorf("required property 'items' is missing") + } + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingVersion != 0 { + return fmt.Errorf("required property 'version' is missing") + } } return nil @@ -15658,12 +16790,14 @@ type WorkspaceUnchangedDocumentDiagnosticReport struct { var _ json.UnmarshalerFrom = (*WorkspaceUnchangedDocumentDiagnosticReport)(nil) func (s *WorkspaceUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenResultId bool - seenUri bool - seenVersion bool + const ( + missingKind uint = 1 << iota + missingResultId + missingUri + missingVersion + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15679,22 +16813,22 @@ func (s *WorkspaceUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *json } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: - seenResultId = true + missing &^= missingResultId if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } case `"uri"`: - seenUri = true + missing &^= missingUri if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: - seenVersion = true + missing &^= missingVersion if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } @@ -15707,17 +16841,19 @@ func (s *WorkspaceUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *json return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenResultId { - return fmt.Errorf("required property 'resultId' is missing") - } - if !seenUri { - return fmt.Errorf("required property 'uri' is missing") - } - if !seenVersion { - return fmt.Errorf("required property 'version' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingResultId != 0 { + return fmt.Errorf("required property 'resultId' is missing") + } + if missing&missingUri != 0 { + return fmt.Errorf("required property 'uri' is missing") + } + if missing&missingVersion != 0 { + return fmt.Errorf("required property 'version' is missing") + } } return nil @@ -15751,10 +16887,12 @@ type NotebookCell struct { var _ json.UnmarshalerFrom = (*NotebookCell)(nil) func (s *NotebookCell) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenDocument bool + const ( + missingKind uint = 1 << iota + missingDocument + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15770,12 +16908,12 @@ func (s *NotebookCell) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"document"`: - seenDocument = true + missing &^= missingDocument if err := json.UnmarshalDecode(dec, &s.Document); err != nil { return err } @@ -15796,11 +16934,13 @@ func (s *NotebookCell) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenDocument { - return fmt.Errorf("required property 'document' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingDocument != 0 { + return fmt.Errorf("required property 'document' is missing") + } } return nil @@ -15820,7 +16960,11 @@ type NotebookDocumentFilterWithNotebook struct { var _ json.UnmarshalerFrom = (*NotebookDocumentFilterWithNotebook)(nil) func (s *NotebookDocumentFilterWithNotebook) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenNotebook bool + const ( + missingNotebook uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15836,7 +16980,7 @@ func (s *NotebookDocumentFilterWithNotebook) UnmarshalJSONFrom(dec *jsontext.Dec } switch string(name) { case `"notebook"`: - seenNotebook = true + missing &^= missingNotebook if err := json.UnmarshalDecode(dec, &s.Notebook); err != nil { return err } @@ -15853,8 +16997,10 @@ func (s *NotebookDocumentFilterWithNotebook) UnmarshalJSONFrom(dec *jsontext.Dec return err } - if !seenNotebook { - return fmt.Errorf("required property 'notebook' is missing") + if missing != 0 { + if missing&missingNotebook != 0 { + return fmt.Errorf("required property 'notebook' is missing") + } } return nil @@ -15874,7 +17020,11 @@ type NotebookDocumentFilterWithCells struct { var _ json.UnmarshalerFrom = (*NotebookDocumentFilterWithCells)(nil) func (s *NotebookDocumentFilterWithCells) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenCells bool + const ( + missingCells uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15894,7 +17044,7 @@ func (s *NotebookDocumentFilterWithCells) UnmarshalJSONFrom(dec *jsontext.Decode return err } case `"cells"`: - seenCells = true + missing &^= missingCells if err := json.UnmarshalDecode(dec, &s.Cells); err != nil { return err } @@ -15907,8 +17057,10 @@ func (s *NotebookDocumentFilterWithCells) UnmarshalJSONFrom(dec *jsontext.Decode return err } - if !seenCells { - return fmt.Errorf("required property 'cells' is missing") + if missing != 0 { + if missing&missingCells != 0 { + return fmt.Errorf("required property 'cells' is missing") + } } return nil @@ -15946,10 +17098,12 @@ type SelectedCompletionInfo struct { var _ json.UnmarshalerFrom = (*SelectedCompletionInfo)(nil) func (s *SelectedCompletionInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenText bool + const ( + missingRange uint = 1 << iota + missingText + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -15965,12 +17119,12 @@ func (s *SelectedCompletionInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"text"`: - seenText = true + missing &^= missingText if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } @@ -15983,11 +17137,13 @@ func (s *SelectedCompletionInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenText { - return fmt.Errorf("required property 'text' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingText != 0 { + return fmt.Errorf("required property 'text' is missing") + } } return nil @@ -16009,7 +17165,11 @@ type ClientInfo struct { var _ json.UnmarshalerFrom = (*ClientInfo)(nil) func (s *ClientInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenName bool + const ( + missingName uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16025,7 +17185,7 @@ func (s *ClientInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"name"`: - seenName = true + missing &^= missingName if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } @@ -16042,8 +17202,10 @@ func (s *ClientInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenName { - return fmt.Errorf("required property 'name' is missing") + if missing != 0 { + if missing&missingName != 0 { + return fmt.Errorf("required property 'name' is missing") + } } return nil @@ -16132,10 +17294,12 @@ type TextDocumentContentChangePartial struct { var _ json.UnmarshalerFrom = (*TextDocumentContentChangePartial)(nil) func (s *TextDocumentContentChangePartial) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRange bool - seenText bool + const ( + missingRange uint = 1 << iota + missingText + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16151,7 +17315,7 @@ func (s *TextDocumentContentChangePartial) UnmarshalJSONFrom(dec *jsontext.Decod } switch string(name) { case `"range"`: - seenRange = true + missing &^= missingRange if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } @@ -16160,7 +17324,7 @@ func (s *TextDocumentContentChangePartial) UnmarshalJSONFrom(dec *jsontext.Decod return err } case `"text"`: - seenText = true + missing &^= missingText if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } @@ -16173,11 +17337,13 @@ func (s *TextDocumentContentChangePartial) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenRange { - return fmt.Errorf("required property 'range' is missing") - } - if !seenText { - return fmt.Errorf("required property 'text' is missing") + if missing != 0 { + if missing&missingRange != 0 { + return fmt.Errorf("required property 'range' is missing") + } + if missing&missingText != 0 { + return fmt.Errorf("required property 'text' is missing") + } } return nil @@ -16192,7 +17358,11 @@ type TextDocumentContentChangeWholeDocument struct { var _ json.UnmarshalerFrom = (*TextDocumentContentChangeWholeDocument)(nil) func (s *TextDocumentContentChangeWholeDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenText bool + const ( + missingText uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16208,7 +17378,7 @@ func (s *TextDocumentContentChangeWholeDocument) UnmarshalJSONFrom(dec *jsontext } switch string(name) { case `"text"`: - seenText = true + missing &^= missingText if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } @@ -16221,8 +17391,10 @@ func (s *TextDocumentContentChangeWholeDocument) UnmarshalJSONFrom(dec *jsontext return err } - if !seenText { - return fmt.Errorf("required property 'text' is missing") + if missing != 0 { + if missing&missingText != 0 { + return fmt.Errorf("required property 'text' is missing") + } } return nil @@ -16239,7 +17411,11 @@ type CodeDescription struct { var _ json.UnmarshalerFrom = (*CodeDescription)(nil) func (s *CodeDescription) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenHref bool + const ( + missingHref uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16255,7 +17431,7 @@ func (s *CodeDescription) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"href"`: - seenHref = true + missing &^= missingHref if err := json.UnmarshalDecode(dec, &s.Href); err != nil { return err } @@ -16268,8 +17444,10 @@ func (s *CodeDescription) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenHref { - return fmt.Errorf("required property 'href' is missing") + if missing != 0 { + if missing&missingHref != 0 { + return fmt.Errorf("required property 'href' is missing") + } } return nil @@ -16289,10 +17467,12 @@ type DiagnosticRelatedInformation struct { var _ json.UnmarshalerFrom = (*DiagnosticRelatedInformation)(nil) func (s *DiagnosticRelatedInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenLocation bool - seenMessage bool + const ( + missingLocation uint = 1 << iota + missingMessage + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16308,12 +17488,12 @@ func (s *DiagnosticRelatedInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"location"`: - seenLocation = true + missing &^= missingLocation if err := json.UnmarshalDecode(dec, &s.Location); err != nil { return err } case `"message"`: - seenMessage = true + missing &^= missingMessage if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } @@ -16326,11 +17506,13 @@ func (s *DiagnosticRelatedInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenLocation { - return fmt.Errorf("required property 'location' is missing") - } - if !seenMessage { - return fmt.Errorf("required property 'message' is missing") + if missing != 0 { + if missing&missingLocation != 0 { + return fmt.Errorf("required property 'location' is missing") + } + if missing&missingMessage != 0 { + return fmt.Errorf("required property 'message' is missing") + } } return nil @@ -16348,10 +17530,12 @@ type EditRangeWithInsertReplace struct { var _ json.UnmarshalerFrom = (*EditRangeWithInsertReplace)(nil) func (s *EditRangeWithInsertReplace) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenInsert bool - seenReplace bool + const ( + missingInsert uint = 1 << iota + missingReplace + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16367,12 +17551,12 @@ func (s *EditRangeWithInsertReplace) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"insert"`: - seenInsert = true + missing &^= missingInsert if err := json.UnmarshalDecode(dec, &s.Insert); err != nil { return err } case `"replace"`: - seenReplace = true + missing &^= missingReplace if err := json.UnmarshalDecode(dec, &s.Replace); err != nil { return err } @@ -16385,11 +17569,13 @@ func (s *EditRangeWithInsertReplace) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenInsert { - return fmt.Errorf("required property 'insert' is missing") - } - if !seenReplace { - return fmt.Errorf("required property 'replace' is missing") + if missing != 0 { + if missing&missingInsert != 0 { + return fmt.Errorf("required property 'insert' is missing") + } + if missing&missingReplace != 0 { + return fmt.Errorf("required property 'replace' is missing") + } } return nil @@ -16417,10 +17603,12 @@ type MarkedStringWithLanguage struct { var _ json.UnmarshalerFrom = (*MarkedStringWithLanguage)(nil) func (s *MarkedStringWithLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenLanguage bool - seenValue bool + const ( + missingLanguage uint = 1 << iota + missingValue + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16436,12 +17624,12 @@ func (s *MarkedStringWithLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } switch string(name) { case `"language"`: - seenLanguage = true + missing &^= missingLanguage if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } case `"value"`: - seenValue = true + missing &^= missingValue if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } @@ -16454,11 +17642,13 @@ func (s *MarkedStringWithLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenLanguage { - return fmt.Errorf("required property 'language' is missing") - } - if !seenValue { - return fmt.Errorf("required property 'value' is missing") + if missing != 0 { + if missing&missingLanguage != 0 { + return fmt.Errorf("required property 'language' is missing") + } + if missing&missingValue != 0 { + return fmt.Errorf("required property 'value' is missing") + } } return nil @@ -16489,7 +17679,11 @@ type ParameterInformation struct { var _ json.UnmarshalerFrom = (*ParameterInformation)(nil) func (s *ParameterInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenLabel bool + const ( + missingLabel uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16505,7 +17699,7 @@ func (s *ParameterInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"label"`: - seenLabel = true + missing &^= missingLabel if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } @@ -16522,8 +17716,10 @@ func (s *ParameterInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenLabel { - return fmt.Errorf("required property 'label' is missing") + if missing != 0 { + if missing&missingLabel != 0 { + return fmt.Errorf("required property 'label' is missing") + } } return nil @@ -16551,10 +17747,12 @@ type CodeActionKindDocumentation struct { var _ json.UnmarshalerFrom = (*CodeActionKindDocumentation)(nil) func (s *CodeActionKindDocumentation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenKind bool - seenCommand bool + const ( + missingKind uint = 1 << iota + missingCommand + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16570,12 +17768,12 @@ func (s *CodeActionKindDocumentation) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"kind"`: - seenKind = true + missing &^= missingKind if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"command"`: - seenCommand = true + missing &^= missingCommand if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } @@ -16588,11 +17786,13 @@ func (s *CodeActionKindDocumentation) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenKind { - return fmt.Errorf("required property 'kind' is missing") - } - if !seenCommand { - return fmt.Errorf("required property 'command' is missing") + if missing != 0 { + if missing&missingKind != 0 { + return fmt.Errorf("required property 'kind' is missing") + } + if missing&missingCommand != 0 { + return fmt.Errorf("required property 'command' is missing") + } } return nil @@ -16619,7 +17819,11 @@ type NotebookCellTextDocumentFilter struct { var _ json.UnmarshalerFrom = (*NotebookCellTextDocumentFilter)(nil) func (s *NotebookCellTextDocumentFilter) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenNotebook bool + const ( + missingNotebook uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16635,7 +17839,7 @@ func (s *NotebookCellTextDocumentFilter) UnmarshalJSONFrom(dec *jsontext.Decoder } switch string(name) { case `"notebook"`: - seenNotebook = true + missing &^= missingNotebook if err := json.UnmarshalDecode(dec, &s.Notebook); err != nil { return err } @@ -16652,8 +17856,10 @@ func (s *NotebookCellTextDocumentFilter) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenNotebook { - return fmt.Errorf("required property 'notebook' is missing") + if missing != 0 { + if missing&missingNotebook != 0 { + return fmt.Errorf("required property 'notebook' is missing") + } } return nil @@ -16681,7 +17887,11 @@ type ExecutionSummary struct { var _ json.UnmarshalerFrom = (*ExecutionSummary)(nil) func (s *ExecutionSummary) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenExecutionOrder bool + const ( + missingExecutionOrder uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16697,7 +17907,7 @@ func (s *ExecutionSummary) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"executionOrder"`: - seenExecutionOrder = true + missing &^= missingExecutionOrder if err := json.UnmarshalDecode(dec, &s.ExecutionOrder); err != nil { return err } @@ -16714,8 +17924,10 @@ func (s *ExecutionSummary) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenExecutionOrder { - return fmt.Errorf("required property 'executionOrder' is missing") + if missing != 0 { + if missing&missingExecutionOrder != 0 { + return fmt.Errorf("required property 'executionOrder' is missing") + } } return nil @@ -16729,7 +17941,11 @@ type NotebookCellLanguage struct { var _ json.UnmarshalerFrom = (*NotebookCellLanguage)(nil) func (s *NotebookCellLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenLanguage bool + const ( + missingLanguage uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16745,7 +17961,7 @@ func (s *NotebookCellLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"language"`: - seenLanguage = true + missing &^= missingLanguage if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } @@ -16758,8 +17974,10 @@ func (s *NotebookCellLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenLanguage { - return fmt.Errorf("required property 'language' is missing") + if missing != 0 { + if missing&missingLanguage != 0 { + return fmt.Errorf("required property 'language' is missing") + } } return nil @@ -16782,7 +18000,11 @@ type NotebookDocumentCellChangeStructure struct { var _ json.UnmarshalerFrom = (*NotebookDocumentCellChangeStructure)(nil) func (s *NotebookDocumentCellChangeStructure) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenArray bool + const ( + missingArray uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16798,7 +18020,7 @@ func (s *NotebookDocumentCellChangeStructure) UnmarshalJSONFrom(dec *jsontext.De } switch string(name) { case `"array"`: - seenArray = true + missing &^= missingArray if err := json.UnmarshalDecode(dec, &s.Array); err != nil { return err } @@ -16819,8 +18041,10 @@ func (s *NotebookDocumentCellChangeStructure) UnmarshalJSONFrom(dec *jsontext.De return err } - if !seenArray { - return fmt.Errorf("required property 'array' is missing") + if missing != 0 { + if missing&missingArray != 0 { + return fmt.Errorf("required property 'array' is missing") + } } return nil @@ -16838,10 +18062,12 @@ type NotebookDocumentCellContentChanges struct { var _ json.UnmarshalerFrom = (*NotebookDocumentCellContentChanges)(nil) func (s *NotebookDocumentCellContentChanges) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenDocument bool - seenChanges bool + const ( + missingDocument uint = 1 << iota + missingChanges + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -16857,12 +18083,12 @@ func (s *NotebookDocumentCellContentChanges) UnmarshalJSONFrom(dec *jsontext.Dec } switch string(name) { case `"document"`: - seenDocument = true + missing &^= missingDocument if err := json.UnmarshalDecode(dec, &s.Document); err != nil { return err } case `"changes"`: - seenChanges = true + missing &^= missingChanges if err := json.UnmarshalDecode(dec, &s.Changes); err != nil { return err } @@ -16875,11 +18101,13 @@ func (s *NotebookDocumentCellContentChanges) UnmarshalJSONFrom(dec *jsontext.Dec return err } - if !seenDocument { - return fmt.Errorf("required property 'document' is missing") - } - if !seenChanges { - return fmt.Errorf("required property 'changes' is missing") + if missing != 0 { + if missing&missingDocument != 0 { + return fmt.Errorf("required property 'document' is missing") + } + if missing&missingChanges != 0 { + return fmt.Errorf("required property 'changes' is missing") + } } return nil @@ -17114,7 +18342,11 @@ type NotebookDocumentClientCapabilities struct { var _ json.UnmarshalerFrom = (*NotebookDocumentClientCapabilities)(nil) func (s *NotebookDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenSynchronization bool + const ( + missingSynchronization uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17130,7 +18362,7 @@ func (s *NotebookDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Dec } switch string(name) { case `"synchronization"`: - seenSynchronization = true + missing &^= missingSynchronization if err := json.UnmarshalDecode(dec, &s.Synchronization); err != nil { return err } @@ -17143,8 +18375,10 @@ func (s *NotebookDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Dec return err } - if !seenSynchronization { - return fmt.Errorf("required property 'synchronization' is missing") + if missing != 0 { + if missing&missingSynchronization != 0 { + return fmt.Errorf("required property 'synchronization' is missing") + } } return nil @@ -17270,10 +18504,12 @@ type RelativePattern struct { var _ json.UnmarshalerFrom = (*RelativePattern)(nil) func (s *RelativePattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenBaseUri bool - seenPattern bool + const ( + missingBaseUri uint = 1 << iota + missingPattern + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17289,12 +18525,12 @@ func (s *RelativePattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"baseUri"`: - seenBaseUri = true + missing &^= missingBaseUri if err := json.UnmarshalDecode(dec, &s.BaseUri); err != nil { return err } case `"pattern"`: - seenPattern = true + missing &^= missingPattern if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } @@ -17307,11 +18543,13 @@ func (s *RelativePattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenBaseUri { - return fmt.Errorf("required property 'baseUri' is missing") - } - if !seenPattern { - return fmt.Errorf("required property 'pattern' is missing") + if missing != 0 { + if missing&missingBaseUri != 0 { + return fmt.Errorf("required property 'baseUri' is missing") + } + if missing&missingPattern != 0 { + return fmt.Errorf("required property 'pattern' is missing") + } } return nil @@ -17338,7 +18576,11 @@ type TextDocumentFilterLanguage struct { var _ json.UnmarshalerFrom = (*TextDocumentFilterLanguage)(nil) func (s *TextDocumentFilterLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenLanguage bool + const ( + missingLanguage uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17354,7 +18596,7 @@ func (s *TextDocumentFilterLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"language"`: - seenLanguage = true + missing &^= missingLanguage if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } @@ -17375,8 +18617,10 @@ func (s *TextDocumentFilterLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenLanguage { - return fmt.Errorf("required property 'language' is missing") + if missing != 0 { + if missing&missingLanguage != 0 { + return fmt.Errorf("required property 'language' is missing") + } } return nil @@ -17403,7 +18647,11 @@ type TextDocumentFilterScheme struct { var _ json.UnmarshalerFrom = (*TextDocumentFilterScheme)(nil) func (s *TextDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenScheme bool + const ( + missingScheme uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17423,7 +18671,7 @@ func (s *TextDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } case `"scheme"`: - seenScheme = true + missing &^= missingScheme if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } @@ -17440,8 +18688,10 @@ func (s *TextDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenScheme { - return fmt.Errorf("required property 'scheme' is missing") + if missing != 0 { + if missing&missingScheme != 0 { + return fmt.Errorf("required property 'scheme' is missing") + } } return nil @@ -17468,7 +18718,11 @@ type TextDocumentFilterPattern struct { var _ json.UnmarshalerFrom = (*TextDocumentFilterPattern)(nil) func (s *TextDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenPattern bool + const ( + missingPattern uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17492,7 +18746,7 @@ func (s *TextDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } case `"pattern"`: - seenPattern = true + missing &^= missingPattern if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } @@ -17505,8 +18759,10 @@ func (s *TextDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) err return err } - if !seenPattern { - return fmt.Errorf("required property 'pattern' is missing") + if missing != 0 { + if missing&missingPattern != 0 { + return fmt.Errorf("required property 'pattern' is missing") + } } return nil @@ -17529,7 +18785,11 @@ type NotebookDocumentFilterNotebookType struct { var _ json.UnmarshalerFrom = (*NotebookDocumentFilterNotebookType)(nil) func (s *NotebookDocumentFilterNotebookType) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenNotebookType bool + const ( + missingNotebookType uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17545,7 +18805,7 @@ func (s *NotebookDocumentFilterNotebookType) UnmarshalJSONFrom(dec *jsontext.Dec } switch string(name) { case `"notebookType"`: - seenNotebookType = true + missing &^= missingNotebookType if err := json.UnmarshalDecode(dec, &s.NotebookType); err != nil { return err } @@ -17566,8 +18826,10 @@ func (s *NotebookDocumentFilterNotebookType) UnmarshalJSONFrom(dec *jsontext.Dec return err } - if !seenNotebookType { - return fmt.Errorf("required property 'notebookType' is missing") + if missing != 0 { + if missing&missingNotebookType != 0 { + return fmt.Errorf("required property 'notebookType' is missing") + } } return nil @@ -17590,7 +18852,11 @@ type NotebookDocumentFilterScheme struct { var _ json.UnmarshalerFrom = (*NotebookDocumentFilterScheme)(nil) func (s *NotebookDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenScheme bool + const ( + missingScheme uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17610,7 +18876,7 @@ func (s *NotebookDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } case `"scheme"`: - seenScheme = true + missing &^= missingScheme if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } @@ -17627,8 +18893,10 @@ func (s *NotebookDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenScheme { - return fmt.Errorf("required property 'scheme' is missing") + if missing != 0 { + if missing&missingScheme != 0 { + return fmt.Errorf("required property 'scheme' is missing") + } } return nil @@ -17651,7 +18919,11 @@ type NotebookDocumentFilterPattern struct { var _ json.UnmarshalerFrom = (*NotebookDocumentFilterPattern)(nil) func (s *NotebookDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenPattern bool + const ( + missingPattern uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17675,7 +18947,7 @@ func (s *NotebookDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } case `"pattern"`: - seenPattern = true + missing &^= missingPattern if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } @@ -17688,8 +18960,10 @@ func (s *NotebookDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenPattern { - return fmt.Errorf("required property 'pattern' is missing") + if missing != 0 { + if missing&missingPattern != 0 { + return fmt.Errorf("required property 'pattern' is missing") + } } return nil @@ -17713,10 +18987,12 @@ type NotebookCellArrayChange struct { var _ json.UnmarshalerFrom = (*NotebookCellArrayChange)(nil) func (s *NotebookCellArrayChange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenStart bool - seenDeleteCount bool + const ( + missingStart uint = 1 << iota + missingDeleteCount + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -17732,12 +19008,12 @@ func (s *NotebookCellArrayChange) UnmarshalJSONFrom(dec *jsontext.Decoder) error } switch string(name) { case `"start"`: - seenStart = true + missing &^= missingStart if err := json.UnmarshalDecode(dec, &s.Start); err != nil { return err } case `"deleteCount"`: - seenDeleteCount = true + missing &^= missingDeleteCount if err := json.UnmarshalDecode(dec, &s.DeleteCount); err != nil { return err } @@ -17754,11 +19030,13 @@ func (s *NotebookCellArrayChange) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenStart { - return fmt.Errorf("required property 'start' is missing") - } - if !seenDeleteCount { - return fmt.Errorf("required property 'deleteCount' is missing") + if missing != 0 { + if missing&missingStart != 0 { + return fmt.Errorf("required property 'start' is missing") + } + if missing&missingDeleteCount != 0 { + return fmt.Errorf("required property 'deleteCount' is missing") + } } return nil @@ -18417,12 +19695,14 @@ type SemanticTokensClientCapabilities struct { var _ json.UnmarshalerFrom = (*SemanticTokensClientCapabilities)(nil) func (s *SemanticTokensClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenRequests bool - seenTokenTypes bool - seenTokenModifiers bool - seenFormats bool + const ( + missingRequests uint = 1 << iota + missingTokenTypes + missingTokenModifiers + missingFormats + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -18442,22 +19722,22 @@ func (s *SemanticTokensClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decod return err } case `"requests"`: - seenRequests = true + missing &^= missingRequests if err := json.UnmarshalDecode(dec, &s.Requests); err != nil { return err } case `"tokenTypes"`: - seenTokenTypes = true + missing &^= missingTokenTypes if err := json.UnmarshalDecode(dec, &s.TokenTypes); err != nil { return err } case `"tokenModifiers"`: - seenTokenModifiers = true + missing &^= missingTokenModifiers if err := json.UnmarshalDecode(dec, &s.TokenModifiers); err != nil { return err } case `"formats"`: - seenFormats = true + missing &^= missingFormats if err := json.UnmarshalDecode(dec, &s.Formats); err != nil { return err } @@ -18486,17 +19766,19 @@ func (s *SemanticTokensClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decod return err } - if !seenRequests { - return fmt.Errorf("required property 'requests' is missing") - } - if !seenTokenTypes { - return fmt.Errorf("required property 'tokenTypes' is missing") - } - if !seenTokenModifiers { - return fmt.Errorf("required property 'tokenModifiers' is missing") - } - if !seenFormats { - return fmt.Errorf("required property 'formats' is missing") + if missing != 0 { + if missing&missingRequests != 0 { + return fmt.Errorf("required property 'requests' is missing") + } + if missing&missingTokenTypes != 0 { + return fmt.Errorf("required property 'tokenTypes' is missing") + } + if missing&missingTokenModifiers != 0 { + return fmt.Errorf("required property 'tokenModifiers' is missing") + } + if missing&missingFormats != 0 { + return fmt.Errorf("required property 'formats' is missing") + } } return nil @@ -18626,7 +19908,11 @@ type ShowDocumentClientCapabilities struct { var _ json.UnmarshalerFrom = (*ShowDocumentClientCapabilities)(nil) func (s *ShowDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenSupport bool + const ( + missingSupport uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -18642,7 +19928,7 @@ func (s *ShowDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder } switch string(name) { case `"support"`: - seenSupport = true + missing &^= missingSupport if err := json.UnmarshalDecode(dec, &s.Support); err != nil { return err } @@ -18655,8 +19941,10 @@ func (s *ShowDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenSupport { - return fmt.Errorf("required property 'support' is missing") + if missing != 0 { + if missing&missingSupport != 0 { + return fmt.Errorf("required property 'support' is missing") + } } return nil @@ -18676,10 +19964,12 @@ type StaleRequestSupportOptions struct { var _ json.UnmarshalerFrom = (*StaleRequestSupportOptions)(nil) func (s *StaleRequestSupportOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var ( - seenCancel bool - seenRetryOnContentModified bool + const ( + missingCancel uint = 1 << iota + missingRetryOnContentModified + _missingLast ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -18695,12 +19985,12 @@ func (s *StaleRequestSupportOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"cancel"`: - seenCancel = true + missing &^= missingCancel if err := json.UnmarshalDecode(dec, &s.Cancel); err != nil { return err } case `"retryOnContentModified"`: - seenRetryOnContentModified = true + missing &^= missingRetryOnContentModified if err := json.UnmarshalDecode(dec, &s.RetryOnContentModified); err != nil { return err } @@ -18713,11 +20003,13 @@ func (s *StaleRequestSupportOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenCancel { - return fmt.Errorf("required property 'cancel' is missing") - } - if !seenRetryOnContentModified { - return fmt.Errorf("required property 'retryOnContentModified' is missing") + if missing != 0 { + if missing&missingCancel != 0 { + return fmt.Errorf("required property 'cancel' is missing") + } + if missing&missingRetryOnContentModified != 0 { + return fmt.Errorf("required property 'retryOnContentModified' is missing") + } } return nil @@ -18737,7 +20029,11 @@ type RegularExpressionsClientCapabilities struct { var _ json.UnmarshalerFrom = (*RegularExpressionsClientCapabilities)(nil) func (s *RegularExpressionsClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenEngine bool + const ( + missingEngine uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -18753,7 +20049,7 @@ func (s *RegularExpressionsClientCapabilities) UnmarshalJSONFrom(dec *jsontext.D } switch string(name) { case `"engine"`: - seenEngine = true + missing &^= missingEngine if err := json.UnmarshalDecode(dec, &s.Engine); err != nil { return err } @@ -18770,8 +20066,10 @@ func (s *RegularExpressionsClientCapabilities) UnmarshalJSONFrom(dec *jsontext.D return err } - if !seenEngine { - return fmt.Errorf("required property 'engine' is missing") + if missing != 0 { + if missing&missingEngine != 0 { + return fmt.Errorf("required property 'engine' is missing") + } } return nil @@ -18797,7 +20095,11 @@ type MarkdownClientCapabilities struct { var _ json.UnmarshalerFrom = (*MarkdownClientCapabilities)(nil) func (s *MarkdownClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenParser bool + const ( + missingParser uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -18813,7 +20115,7 @@ func (s *MarkdownClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"parser"`: - seenParser = true + missing &^= missingParser if err := json.UnmarshalDecode(dec, &s.Parser); err != nil { return err } @@ -18834,8 +20136,10 @@ func (s *MarkdownClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenParser { - return fmt.Errorf("required property 'parser' is missing") + if missing != 0 { + if missing&missingParser != 0 { + return fmt.Errorf("required property 'parser' is missing") + } } return nil @@ -18871,7 +20175,11 @@ type ClientSymbolTagOptions struct { var _ json.UnmarshalerFrom = (*ClientSymbolTagOptions)(nil) func (s *ClientSymbolTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenValueSet bool + const ( + missingValueSet uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -18887,7 +20195,7 @@ func (s *ClientSymbolTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error } switch string(name) { case `"valueSet"`: - seenValueSet = true + missing &^= missingValueSet if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } @@ -18900,8 +20208,10 @@ func (s *ClientSymbolTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error return err } - if !seenValueSet { - return fmt.Errorf("required property 'valueSet' is missing") + if missing != 0 { + if missing&missingValueSet != 0 { + return fmt.Errorf("required property 'valueSet' is missing") + } } return nil @@ -18917,7 +20227,11 @@ type ClientSymbolResolveOptions struct { var _ json.UnmarshalerFrom = (*ClientSymbolResolveOptions)(nil) func (s *ClientSymbolResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenProperties bool + const ( + missingProperties uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -18933,7 +20247,7 @@ func (s *ClientSymbolResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er } switch string(name) { case `"properties"`: - seenProperties = true + missing &^= missingProperties if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } @@ -18946,8 +20260,10 @@ func (s *ClientSymbolResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er return err } - if !seenProperties { - return fmt.Errorf("required property 'properties' is missing") + if missing != 0 { + if missing&missingProperties != 0 { + return fmt.Errorf("required property 'properties' is missing") + } } return nil @@ -19088,7 +20404,11 @@ type ClientCodeActionLiteralOptions struct { var _ json.UnmarshalerFrom = (*ClientCodeActionLiteralOptions)(nil) func (s *ClientCodeActionLiteralOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenCodeActionKind bool + const ( + missingCodeActionKind uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19104,7 +20424,7 @@ func (s *ClientCodeActionLiteralOptions) UnmarshalJSONFrom(dec *jsontext.Decoder } switch string(name) { case `"codeActionKind"`: - seenCodeActionKind = true + missing &^= missingCodeActionKind if err := json.UnmarshalDecode(dec, &s.CodeActionKind); err != nil { return err } @@ -19117,8 +20437,10 @@ func (s *ClientCodeActionLiteralOptions) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenCodeActionKind { - return fmt.Errorf("required property 'codeActionKind' is missing") + if missing != 0 { + if missing&missingCodeActionKind != 0 { + return fmt.Errorf("required property 'codeActionKind' is missing") + } } return nil @@ -19133,7 +20455,11 @@ type ClientCodeActionResolveOptions struct { var _ json.UnmarshalerFrom = (*ClientCodeActionResolveOptions)(nil) func (s *ClientCodeActionResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenProperties bool + const ( + missingProperties uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19149,7 +20475,7 @@ func (s *ClientCodeActionResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder } switch string(name) { case `"properties"`: - seenProperties = true + missing &^= missingProperties if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } @@ -19162,8 +20488,10 @@ func (s *ClientCodeActionResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder return err } - if !seenProperties { - return fmt.Errorf("required property 'properties' is missing") + if missing != 0 { + if missing&missingProperties != 0 { + return fmt.Errorf("required property 'properties' is missing") + } } return nil @@ -19178,7 +20506,11 @@ type CodeActionTagOptions struct { var _ json.UnmarshalerFrom = (*CodeActionTagOptions)(nil) func (s *CodeActionTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenValueSet bool + const ( + missingValueSet uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19194,7 +20526,7 @@ func (s *CodeActionTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } switch string(name) { case `"valueSet"`: - seenValueSet = true + missing &^= missingValueSet if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } @@ -19207,8 +20539,10 @@ func (s *CodeActionTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return err } - if !seenValueSet { - return fmt.Errorf("required property 'valueSet' is missing") + if missing != 0 { + if missing&missingValueSet != 0 { + return fmt.Errorf("required property 'valueSet' is missing") + } } return nil @@ -19223,7 +20557,11 @@ type ClientCodeLensResolveOptions struct { var _ json.UnmarshalerFrom = (*ClientCodeLensResolveOptions)(nil) func (s *ClientCodeLensResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenProperties bool + const ( + missingProperties uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19239,7 +20577,7 @@ func (s *ClientCodeLensResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"properties"`: - seenProperties = true + missing &^= missingProperties if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } @@ -19252,8 +20590,10 @@ func (s *ClientCodeLensResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenProperties { - return fmt.Errorf("required property 'properties' is missing") + if missing != 0 { + if missing&missingProperties != 0 { + return fmt.Errorf("required property 'properties' is missing") + } } return nil @@ -19321,7 +20661,11 @@ type ClientInlayHintResolveOptions struct { var _ json.UnmarshalerFrom = (*ClientInlayHintResolveOptions)(nil) func (s *ClientInlayHintResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenProperties bool + const ( + missingProperties uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19337,7 +20681,7 @@ func (s *ClientInlayHintResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } switch string(name) { case `"properties"`: - seenProperties = true + missing &^= missingProperties if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } @@ -19350,8 +20694,10 @@ func (s *ClientInlayHintResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) return err } - if !seenProperties { - return fmt.Errorf("required property 'properties' is missing") + if missing != 0 { + if missing&missingProperties != 0 { + return fmt.Errorf("required property 'properties' is missing") + } } return nil @@ -19374,7 +20720,11 @@ type CompletionItemTagOptions struct { var _ json.UnmarshalerFrom = (*CompletionItemTagOptions)(nil) func (s *CompletionItemTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenValueSet bool + const ( + missingValueSet uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19390,7 +20740,7 @@ func (s *CompletionItemTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } switch string(name) { case `"valueSet"`: - seenValueSet = true + missing &^= missingValueSet if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } @@ -19403,8 +20753,10 @@ func (s *CompletionItemTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) erro return err } - if !seenValueSet { - return fmt.Errorf("required property 'valueSet' is missing") + if missing != 0 { + if missing&missingValueSet != 0 { + return fmt.Errorf("required property 'valueSet' is missing") + } } return nil @@ -19419,7 +20771,11 @@ type ClientCompletionItemResolveOptions struct { var _ json.UnmarshalerFrom = (*ClientCompletionItemResolveOptions)(nil) func (s *ClientCompletionItemResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenProperties bool + const ( + missingProperties uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19435,7 +20791,7 @@ func (s *ClientCompletionItemResolveOptions) UnmarshalJSONFrom(dec *jsontext.Dec } switch string(name) { case `"properties"`: - seenProperties = true + missing &^= missingProperties if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } @@ -19448,8 +20804,10 @@ func (s *ClientCompletionItemResolveOptions) UnmarshalJSONFrom(dec *jsontext.Dec return err } - if !seenProperties { - return fmt.Errorf("required property 'properties' is missing") + if missing != 0 { + if missing&missingProperties != 0 { + return fmt.Errorf("required property 'properties' is missing") + } } return nil @@ -19463,7 +20821,11 @@ type ClientCompletionItemInsertTextModeOptions struct { var _ json.UnmarshalerFrom = (*ClientCompletionItemInsertTextModeOptions)(nil) func (s *ClientCompletionItemInsertTextModeOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenValueSet bool + const ( + missingValueSet uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19479,7 +20841,7 @@ func (s *ClientCompletionItemInsertTextModeOptions) UnmarshalJSONFrom(dec *jsont } switch string(name) { case `"valueSet"`: - seenValueSet = true + missing &^= missingValueSet if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } @@ -19492,8 +20854,10 @@ func (s *ClientCompletionItemInsertTextModeOptions) UnmarshalJSONFrom(dec *jsont return err } - if !seenValueSet { - return fmt.Errorf("required property 'valueSet' is missing") + if missing != 0 { + if missing&missingValueSet != 0 { + return fmt.Errorf("required property 'valueSet' is missing") + } } return nil @@ -19520,7 +20884,11 @@ type ClientCodeActionKindOptions struct { var _ json.UnmarshalerFrom = (*ClientCodeActionKindOptions)(nil) func (s *ClientCodeActionKindOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenValueSet bool + const ( + missingValueSet uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19536,7 +20904,7 @@ func (s *ClientCodeActionKindOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"valueSet"`: - seenValueSet = true + missing &^= missingValueSet if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } @@ -19549,8 +20917,10 @@ func (s *ClientCodeActionKindOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenValueSet { - return fmt.Errorf("required property 'valueSet' is missing") + if missing != 0 { + if missing&missingValueSet != 0 { + return fmt.Errorf("required property 'valueSet' is missing") + } } return nil @@ -19565,7 +20935,11 @@ type ClientDiagnosticsTagOptions struct { var _ json.UnmarshalerFrom = (*ClientDiagnosticsTagOptions)(nil) func (s *ClientDiagnosticsTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenValueSet bool + const ( + missingValueSet uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19581,7 +20955,7 @@ func (s *ClientDiagnosticsTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e } switch string(name) { case `"valueSet"`: - seenValueSet = true + missing &^= missingValueSet if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } @@ -19594,8 +20968,10 @@ func (s *ClientDiagnosticsTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e return err } - if !seenValueSet { - return fmt.Errorf("required property 'valueSet' is missing") + if missing != 0 { + if missing&missingValueSet != 0 { + return fmt.Errorf("required property 'valueSet' is missing") + } } return nil @@ -19707,7 +21083,11 @@ type ColorPresentationRegistrationOptions struct { var _ json.UnmarshalerFrom = (*ColorPresentationRegistrationOptions)(nil) func (s *ColorPresentationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - var seenDocumentSelector bool + const ( + missingDocumentSelector uint = 1 << iota + _missingLast + ) + missing := _missingLast - 1 if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) @@ -19727,7 +21107,7 @@ func (s *ColorPresentationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.D return err } case `"documentSelector"`: - seenDocumentSelector = true + missing &^= missingDocumentSelector if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } @@ -19740,8 +21120,10 @@ func (s *ColorPresentationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.D return err } - if !seenDocumentSelector { - return fmt.Errorf("required property 'documentSelector' is missing") + if missing != 0 { + if missing&missingDocumentSelector != 0 { + return fmt.Errorf("required property 'documentSelector' is missing") + } } return nil From 43daeaa368dd425be4d37e18ee4ee9593e757e5d Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 21 Nov 2025 09:33:27 -0800 Subject: [PATCH 15/16] Build better error about missing props --- internal/lsp/lsproto/_generate/generate.mts | 5 +- internal/lsp/lsproto/lsp_generated.go | 1377 +++++++++++++------ 2 files changed, 961 insertions(+), 421 deletions(-) diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index 2c877f9f44..c705a1a0e6 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -861,6 +861,7 @@ function generateCode() { writeLine(""); writeLine(`import (`); writeLine(`\t"fmt"`); + writeLine(`\t"strings"`); writeLine(""); writeLine(`\t"github.com/go-json-experiment/json"`); writeLine(`\t"github.com/go-json-experiment/json/jsontext"`); @@ -974,11 +975,13 @@ function generateCode() { writeLine(""); writeLine(`\tif missing != 0 {`); + writeLine(`\t\tvar missingProps []string`); for (const prop of requiredProps) { writeLine(`\t\tif missing&missing${titleCase(prop.name)} != 0 {`); - writeLine(`\t\t\treturn fmt.Errorf("required property '${prop.name}' is missing")`); + writeLine(`\t\t\tmissingProps = append(missingProps, "${prop.name}")`); writeLine(`\t\t}`); } + writeLine(`\t\treturn fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", "))`); writeLine(`\t}`); writeLine(""); diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 5c6b0d7d53..4eabcaa191 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -4,6 +4,7 @@ package lsproto import ( "fmt" + "strings" "github.com/go-json-experiment/json" "github.com/go-json-experiment/json/jsontext" @@ -83,12 +84,14 @@ func (s *ImplementationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -145,12 +148,14 @@ func (s *Location) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -213,9 +218,11 @@ func (s *ImplementationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -291,12 +298,14 @@ func (s *TypeDefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -359,9 +368,11 @@ func (s *TypeDefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -420,12 +431,14 @@ func (s *WorkspaceFolder) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -474,9 +487,11 @@ func (s *DidChangeWorkspaceFoldersParams) UnmarshalJSONFrom(dec *jsontext.Decode } if missing != 0 { + var missingProps []string if missing&missingEvent != 0 { - return fmt.Errorf("required property 'event' is missing") + missingProps = append(missingProps, "event") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -524,9 +539,11 @@ func (s *ConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingItems != 0 { - return fmt.Errorf("required property 'items' is missing") + missingProps = append(missingProps, "items") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -594,9 +611,11 @@ func (s *DocumentColorParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -654,12 +673,14 @@ func (s *ColorInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingColor != 0 { - return fmt.Errorf("required property 'color' is missing") + missingProps = append(missingProps, "color") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -722,9 +743,11 @@ func (s *DocumentColorRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -810,15 +833,17 @@ func (s *ColorPresentationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingColor != 0 { - return fmt.Errorf("required property 'color' is missing") + missingProps = append(missingProps, "color") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -885,9 +910,11 @@ func (s *ColorPresentation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingLabel != 0 { - return fmt.Errorf("required property 'label' is missing") + missingProps = append(missingProps, "label") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -941,9 +968,11 @@ func (s *TextDocumentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1011,9 +1040,11 @@ func (s *FoldingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1108,12 +1139,14 @@ func (s *FoldingRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingStartLine != 0 { - return fmt.Errorf("required property 'startLine' is missing") + missingProps = append(missingProps, "startLine") } if missing&missingEndLine != 0 { - return fmt.Errorf("required property 'endLine' is missing") + missingProps = append(missingProps, "endLine") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1176,9 +1209,11 @@ func (s *FoldingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1254,12 +1289,14 @@ func (s *DeclarationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1322,9 +1359,11 @@ func (s *DeclarationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1401,12 +1440,14 @@ func (s *SelectionRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPositions != 0 { - return fmt.Errorf("required property 'positions' is missing") + missingProps = append(missingProps, "positions") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1463,9 +1504,11 @@ func (s *SelectionRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1528,9 +1571,11 @@ func (s *SelectionRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1578,9 +1623,11 @@ func (s *WorkDoneProgressCreateParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingToken != 0 { - return fmt.Errorf("required property 'token' is missing") + missingProps = append(missingProps, "token") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1628,9 +1675,11 @@ func (s *WorkDoneProgressCancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingToken != 0 { - return fmt.Errorf("required property 'token' is missing") + missingProps = append(missingProps, "token") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1701,12 +1750,14 @@ func (s *CallHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1817,21 +1868,23 @@ func (s *CallHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingSelectionRange != 0 { - return fmt.Errorf("required property 'selectionRange' is missing") + missingProps = append(missingProps, "selectionRange") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1897,9 +1950,11 @@ func (s *CallHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -1964,9 +2019,11 @@ func (s *CallHierarchyIncomingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingItem != 0 { - return fmt.Errorf("required property 'item' is missing") + missingProps = append(missingProps, "item") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2027,12 +2084,14 @@ func (s *CallHierarchyIncomingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingFrom != 0 { - return fmt.Errorf("required property 'from' is missing") + missingProps = append(missingProps, "from") } if missing&missingFromRanges != 0 { - return fmt.Errorf("required property 'fromRanges' is missing") + missingProps = append(missingProps, "fromRanges") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2097,9 +2156,11 @@ func (s *CallHierarchyOutgoingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingItem != 0 { - return fmt.Errorf("required property 'item' is missing") + missingProps = append(missingProps, "item") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2161,12 +2222,14 @@ func (s *CallHierarchyOutgoingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingTo != 0 { - return fmt.Errorf("required property 'to' is missing") + missingProps = append(missingProps, "to") } if missing&missingFromRanges != 0 { - return fmt.Errorf("required property 'fromRanges' is missing") + missingProps = append(missingProps, "fromRanges") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2234,9 +2297,11 @@ func (s *SemanticTokensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2295,9 +2360,11 @@ func (s *SemanticTokens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingData != 0 { - return fmt.Errorf("required property 'data' is missing") + missingProps = append(missingProps, "data") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2345,9 +2412,11 @@ func (s *SemanticTokensPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingData != 0 { - return fmt.Errorf("required property 'data' is missing") + missingProps = append(missingProps, "data") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2435,12 +2504,14 @@ func (s *SemanticTokensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } if missing&missingLegend != 0 { - return fmt.Errorf("required property 'legend' is missing") + missingProps = append(missingProps, "legend") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2518,12 +2589,14 @@ func (s *SemanticTokensDeltaParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPreviousResultId != 0 { - return fmt.Errorf("required property 'previousResultId' is missing") + missingProps = append(missingProps, "previousResultId") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2578,9 +2651,11 @@ func (s *SemanticTokensDelta) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingEdits != 0 { - return fmt.Errorf("required property 'edits' is missing") + missingProps = append(missingProps, "edits") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2628,9 +2703,11 @@ func (s *SemanticTokensDeltaPartialResult) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingEdits != 0 { - return fmt.Errorf("required property 'edits' is missing") + missingProps = append(missingProps, "edits") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2707,12 +2784,14 @@ func (s *SemanticTokensRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2792,9 +2871,11 @@ func (s *ShowDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2845,9 +2926,11 @@ func (s *ShowDocumentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingSuccess != 0 { - return fmt.Errorf("required property 'success' is missing") + missingProps = append(missingProps, "success") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2915,12 +2998,14 @@ func (s *LinkedEditingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -2981,9 +3066,11 @@ func (s *LinkedEditingRanges) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRanges != 0 { - return fmt.Errorf("required property 'ranges' is missing") + missingProps = append(missingProps, "ranges") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3046,9 +3133,11 @@ func (s *LinkedEditingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3100,9 +3189,11 @@ func (s *CreateFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingFiles != 0 { - return fmt.Errorf("required property 'files' is missing") + missingProps = append(missingProps, "files") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3190,9 +3281,11 @@ func (s *FileOperationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingFilters != 0 { - return fmt.Errorf("required property 'filters' is missing") + missingProps = append(missingProps, "filters") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3245,9 +3338,11 @@ func (s *RenameFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingFiles != 0 { - return fmt.Errorf("required property 'files' is missing") + missingProps = append(missingProps, "files") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3299,9 +3394,11 @@ func (s *DeleteFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingFiles != 0 { - return fmt.Errorf("required property 'files' is missing") + missingProps = append(missingProps, "files") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3377,12 +3474,14 @@ func (s *MonikerParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3459,15 +3558,17 @@ func (s *Moniker) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingScheme != 0 { - return fmt.Errorf("required property 'scheme' is missing") + missingProps = append(missingProps, "scheme") } if missing&missingIdentifier != 0 { - return fmt.Errorf("required property 'identifier' is missing") + missingProps = append(missingProps, "identifier") } if missing&missingUnique != 0 { - return fmt.Errorf("required property 'unique' is missing") + missingProps = append(missingProps, "unique") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3522,9 +3623,11 @@ func (s *MonikerRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3595,12 +3698,14 @@ func (s *TypeHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3712,21 +3817,23 @@ func (s *TypeHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingSelectionRange != 0 { - return fmt.Errorf("required property 'selectionRange' is missing") + missingProps = append(missingProps, "selectionRange") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3792,9 +3899,11 @@ func (s *TypeHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3859,9 +3968,11 @@ func (s *TypeHierarchySupertypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingItem != 0 { - return fmt.Errorf("required property 'item' is missing") + missingProps = append(missingProps, "item") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -3926,9 +4037,11 @@ func (s *TypeHierarchySubtypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingItem != 0 { - return fmt.Errorf("required property 'item' is missing") + missingProps = append(missingProps, "item") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4009,15 +4122,17 @@ func (s *InlineValueParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingContext != 0 { - return fmt.Errorf("required property 'context' is missing") + missingProps = append(missingProps, "context") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4083,9 +4198,11 @@ func (s *InlineValueRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4156,12 +4273,14 @@ func (s *InlayHintParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4283,12 +4402,14 @@ func (s *InlayHint) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } if missing&missingLabel != 0 { - return fmt.Errorf("required property 'label' is missing") + missingProps = append(missingProps, "label") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4362,9 +4483,11 @@ func (s *InlayHintRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4448,9 +4571,11 @@ func (s *DocumentDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4500,9 +4625,11 @@ func (s *DocumentDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext. } if missing != 0 { + var missingProps []string if missing&missingRelatedDocuments != 0 { - return fmt.Errorf("required property 'relatedDocuments' is missing") + missingProps = append(missingProps, "relatedDocuments") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4552,9 +4679,11 @@ func (s *DiagnosticServerCancellationData) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingRetriggerRequest != 0 { - return fmt.Errorf("required property 'retriggerRequest' is missing") + missingProps = append(missingProps, "retriggerRequest") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4649,15 +4778,17 @@ func (s *DiagnosticRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } if missing&missingInterFileDependencies != 0 { - return fmt.Errorf("required property 'interFileDependencies' is missing") + missingProps = append(missingProps, "interFileDependencies") } if missing&missingWorkspaceDiagnostics != 0 { - return fmt.Errorf("required property 'workspaceDiagnostics' is missing") + missingProps = append(missingProps, "workspaceDiagnostics") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4731,9 +4862,11 @@ func (s *WorkspaceDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingPreviousResultIds != 0 { - return fmt.Errorf("required property 'previousResultIds' is missing") + missingProps = append(missingProps, "previousResultIds") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4783,9 +4916,11 @@ func (s *WorkspaceDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingItems != 0 { - return fmt.Errorf("required property 'items' is missing") + missingProps = append(missingProps, "items") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4835,9 +4970,11 @@ func (s *WorkspaceDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext } if missing != 0 { + var missingProps []string if missing&missingItems != 0 { - return fmt.Errorf("required property 'items' is missing") + missingProps = append(missingProps, "items") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4898,12 +5035,14 @@ func (s *DidOpenNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingNotebookDocument != 0 { - return fmt.Errorf("required property 'notebookDocument' is missing") + missingProps = append(missingProps, "notebookDocument") } if missing&missingCellTextDocuments != 0 { - return fmt.Errorf("required property 'cellTextDocuments' is missing") + missingProps = append(missingProps, "cellTextDocuments") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -4970,9 +5109,11 @@ func (s *NotebookDocumentSyncRegistrationOptions) UnmarshalJSONFrom(dec *jsontex } if missing != 0 { + var missingProps []string if missing&missingNotebookSelector != 0 { - return fmt.Errorf("required property 'notebookSelector' is missing") + missingProps = append(missingProps, "notebookSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5047,12 +5188,14 @@ func (s *DidChangeNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decode } if missing != 0 { + var missingProps []string if missing&missingNotebookDocument != 0 { - return fmt.Errorf("required property 'notebookDocument' is missing") + missingProps = append(missingProps, "notebookDocument") } if missing&missingChange != 0 { - return fmt.Errorf("required property 'change' is missing") + missingProps = append(missingProps, "change") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5103,9 +5246,11 @@ func (s *DidSaveNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingNotebookDocument != 0 { - return fmt.Errorf("required property 'notebookDocument' is missing") + missingProps = append(missingProps, "notebookDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5166,12 +5311,14 @@ func (s *DidCloseNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingNotebookDocument != 0 { - return fmt.Errorf("required property 'notebookDocument' is missing") + missingProps = append(missingProps, "notebookDocument") } if missing&missingCellTextDocuments != 0 { - return fmt.Errorf("required property 'cellTextDocuments' is missing") + missingProps = append(missingProps, "cellTextDocuments") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5254,15 +5401,17 @@ func (s *InlineCompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } if missing&missingContext != 0 { - return fmt.Errorf("required property 'context' is missing") + missingProps = append(missingProps, "context") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5315,9 +5464,11 @@ func (s *InlineCompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingItems != 0 { - return fmt.Errorf("required property 'items' is missing") + missingProps = append(missingProps, "items") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5391,9 +5542,11 @@ func (s *InlineCompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingInsertText != 0 { - return fmt.Errorf("required property 'insertText' is missing") + missingProps = append(missingProps, "insertText") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5461,9 +5614,11 @@ func (s *InlineCompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.De } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5516,9 +5671,11 @@ func (s *TextDocumentContentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5574,9 +5731,11 @@ func (s *TextDocumentContentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingText != 0 { - return fmt.Errorf("required property 'text' is missing") + missingProps = append(missingProps, "text") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5637,9 +5796,11 @@ func (s *TextDocumentContentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext } if missing != 0 { + var missingProps []string if missing&missingSchemes != 0 { - return fmt.Errorf("required property 'schemes' is missing") + missingProps = append(missingProps, "schemes") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5692,9 +5853,11 @@ func (s *TextDocumentContentRefreshParams) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5741,9 +5904,11 @@ func (s *RegistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRegistrations != 0 { - return fmt.Errorf("required property 'registrations' is missing") + missingProps = append(missingProps, "registrations") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5790,9 +5955,11 @@ func (s *UnregistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUnregisterations != 0 { - return fmt.Errorf("required property 'unregisterations' is missing") + missingProps = append(missingProps, "unregisterations") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5933,15 +6100,17 @@ func (s *InitializeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingProcessId != 0 { - return fmt.Errorf("required property 'processId' is missing") + missingProps = append(missingProps, "processId") } if missing&missingRootUri != 0 { - return fmt.Errorf("required property 'rootUri' is missing") + missingProps = append(missingProps, "rootUri") } if missing&missingCapabilities != 0 { - return fmt.Errorf("required property 'capabilities' is missing") + missingProps = append(missingProps, "capabilities") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -5999,9 +6168,11 @@ func (s *InitializeResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingCapabilities != 0 { - return fmt.Errorf("required property 'capabilities' is missing") + missingProps = append(missingProps, "capabilities") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6054,9 +6225,11 @@ func (s *InitializeError) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRetry != 0 { - return fmt.Errorf("required property 'retry' is missing") + missingProps = append(missingProps, "retry") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6107,9 +6280,11 @@ func (s *DidChangeConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingSettings != 0 { - return fmt.Errorf("required property 'settings' is missing") + missingProps = append(missingProps, "settings") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6171,12 +6346,14 @@ func (s *ShowMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingType != 0 { - return fmt.Errorf("required property 'type' is missing") + missingProps = append(missingProps, "type") } if missing&missingMessage != 0 { - return fmt.Errorf("required property 'message' is missing") + missingProps = append(missingProps, "message") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6240,12 +6417,14 @@ func (s *ShowMessageRequestParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingType != 0 { - return fmt.Errorf("required property 'type' is missing") + missingProps = append(missingProps, "type") } if missing&missingMessage != 0 { - return fmt.Errorf("required property 'message' is missing") + missingProps = append(missingProps, "message") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6293,9 +6472,11 @@ func (s *MessageActionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTitle != 0 { - return fmt.Errorf("required property 'title' is missing") + missingProps = append(missingProps, "title") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6353,12 +6534,14 @@ func (s *LogMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingType != 0 { - return fmt.Errorf("required property 'type' is missing") + missingProps = append(missingProps, "type") } if missing&missingMessage != 0 { - return fmt.Errorf("required property 'message' is missing") + missingProps = append(missingProps, "message") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6407,9 +6590,11 @@ func (s *DidOpenTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6479,12 +6664,14 @@ func (s *DidChangeTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingContentChanges != 0 { - return fmt.Errorf("required property 'contentChanges' is missing") + missingProps = append(missingProps, "contentChanges") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6543,12 +6730,14 @@ func (s *TextDocumentChangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } if missing&missingSyncKind != 0 { - return fmt.Errorf("required property 'syncKind' is missing") + missingProps = append(missingProps, "syncKind") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6601,9 +6790,11 @@ func (s *DidCloseTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6664,9 +6855,11 @@ func (s *DidSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6723,9 +6916,11 @@ func (s *TextDocumentSaveRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.De } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6787,12 +6982,14 @@ func (s *WillSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingReason != 0 { - return fmt.Errorf("required property 'reason' is missing") + missingProps = append(missingProps, "reason") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6852,12 +7049,14 @@ func (s *TextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingNewText != 0 { - return fmt.Errorf("required property 'newText' is missing") + missingProps = append(missingProps, "newText") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6906,9 +7105,11 @@ func (s *DidChangeWatchedFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingChanges != 0 { - return fmt.Errorf("required property 'changes' is missing") + missingProps = append(missingProps, "changes") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -6957,9 +7158,11 @@ func (s *DidChangeWatchedFilesRegistrationOptions) UnmarshalJSONFrom(dec *jsonte } if missing != 0 { + var missingProps []string if missing&missingWatchers != 0 { - return fmt.Errorf("required property 'watchers' is missing") + missingProps = append(missingProps, "watchers") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7026,12 +7229,14 @@ func (s *PublishDiagnosticsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingDiagnostics != 0 { - return fmt.Errorf("required property 'diagnostics' is missing") + missingProps = append(missingProps, "diagnostics") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7116,12 +7321,14 @@ func (s *CompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7377,9 +7584,11 @@ func (s *CompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingLabel != 0 { - return fmt.Errorf("required property 'label' is missing") + missingProps = append(missingProps, "label") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7485,12 +7694,14 @@ func (s *CompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingIsIncomplete != 0 { - return fmt.Errorf("required property 'isIncomplete' is missing") + missingProps = append(missingProps, "isIncomplete") } if missing&missingItems != 0 { - return fmt.Errorf("required property 'items' is missing") + missingProps = append(missingProps, "items") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7592,9 +7803,11 @@ func (s *CompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7663,12 +7876,14 @@ func (s *HoverParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7725,9 +7940,11 @@ func (s *Hover) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingContents != 0 { - return fmt.Errorf("required property 'contents' is missing") + missingProps = append(missingProps, "contents") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7783,9 +8000,11 @@ func (s *HoverRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7864,12 +8083,14 @@ func (s *SignatureHelpParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -7957,9 +8178,11 @@ func (s *SignatureHelp) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingSignatures != 0 { - return fmt.Errorf("required property 'signatures' is missing") + missingProps = append(missingProps, "signatures") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8034,9 +8257,11 @@ func (s *SignatureHelpRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8113,12 +8338,14 @@ func (s *DefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8174,9 +8401,11 @@ func (s *DefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8261,15 +8490,17 @@ func (s *ReferenceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } if missing&missingContext != 0 { - return fmt.Errorf("required property 'context' is missing") + missingProps = append(missingProps, "context") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8325,9 +8556,11 @@ func (s *ReferenceRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8404,12 +8637,14 @@ func (s *DocumentHighlightParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8467,9 +8702,11 @@ func (s *DocumentHighlight) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8525,9 +8762,11 @@ func (s *DocumentHighlightRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.D } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8595,9 +8834,11 @@ func (s *DocumentSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8701,15 +8942,17 @@ func (s *SymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingLocation != 0 { - return fmt.Errorf("required property 'location' is missing") + missingProps = append(missingProps, "location") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8824,18 +9067,20 @@ func (s *DocumentSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingSelectionRange != 0 { - return fmt.Errorf("required property 'selectionRange' is missing") + missingProps = append(missingProps, "selectionRange") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8901,9 +9146,11 @@ func (s *DocumentSymbolRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -8989,15 +9236,17 @@ func (s *CodeActionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingContext != 0 { - return fmt.Errorf("required property 'context' is missing") + missingProps = append(missingProps, "context") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9077,12 +9326,14 @@ func (s *Command) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTitle != 0 { - return fmt.Errorf("required property 'title' is missing") + missingProps = append(missingProps, "title") } if missing&missingCommand != 0 { - return fmt.Errorf("required property 'command' is missing") + missingProps = append(missingProps, "command") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9219,9 +9470,11 @@ func (s *CodeAction) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTitle != 0 { - return fmt.Errorf("required property 'title' is missing") + missingProps = append(missingProps, "title") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9319,9 +9572,11 @@ func (s *CodeActionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9392,9 +9647,11 @@ func (s *WorkspaceSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingQuery != 0 { - return fmt.Errorf("required property 'query' is missing") + missingProps = append(missingProps, "query") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9496,15 +9753,17 @@ func (s *WorkspaceSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingLocation != 0 { - return fmt.Errorf("required property 'location' is missing") + missingProps = append(missingProps, "location") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9583,9 +9842,11 @@ func (s *CodeLensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9653,9 +9914,11 @@ func (s *CodeLens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9718,9 +9981,11 @@ func (s *CodeLensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9788,9 +10053,11 @@ func (s *DocumentLinkParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9868,9 +10135,11 @@ func (s *DocumentLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -9933,9 +10202,11 @@ func (s *DocumentLinkRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decode } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10004,12 +10275,14 @@ func (s *DocumentFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingOptions != 0 { - return fmt.Errorf("required property 'options' is missing") + missingProps = append(missingProps, "options") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10065,9 +10338,11 @@ func (s *DocumentFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext. } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10145,15 +10420,17 @@ func (s *DocumentRangeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingOptions != 0 { - return fmt.Errorf("required property 'options' is missing") + missingProps = append(missingProps, "options") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10220,9 +10497,11 @@ func (s *DocumentRangeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *json } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10304,15 +10583,17 @@ func (s *DocumentRangesFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingRanges != 0 { - return fmt.Errorf("required property 'ranges' is missing") + missingProps = append(missingProps, "ranges") } if missing&missingOptions != 0 { - return fmt.Errorf("required property 'options' is missing") + missingProps = append(missingProps, "options") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10397,18 +10678,20 @@ func (s *DocumentOnTypeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } if missing&missingCh != 0 { - return fmt.Errorf("required property 'ch' is missing") + missingProps = append(missingProps, "ch") } if missing&missingOptions != 0 { - return fmt.Errorf("required property 'options' is missing") + missingProps = append(missingProps, "options") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10474,12 +10757,14 @@ func (s *DocumentOnTypeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jso } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } if missing&missingFirstTriggerCharacter != 0 { - return fmt.Errorf("required property 'firstTriggerCharacter' is missing") + missingProps = append(missingProps, "firstTriggerCharacter") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10559,15 +10844,17 @@ func (s *RenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } if missing&missingNewName != 0 { - return fmt.Errorf("required property 'newName' is missing") + missingProps = append(missingProps, "newName") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10632,9 +10919,11 @@ func (s *RenameRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10702,12 +10991,14 @@ func (s *PrepareRenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10770,9 +11061,11 @@ func (s *ExecuteCommandParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingCommand != 0 { - return fmt.Errorf("required property 'command' is missing") + missingProps = append(missingProps, "command") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10827,9 +11120,11 @@ func (s *ExecuteCommandRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Deco } if missing != 0 { + var missingProps []string if missing&missingCommands != 0 { - return fmt.Errorf("required property 'commands' is missing") + missingProps = append(missingProps, "commands") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10898,9 +11193,11 @@ func (s *ApplyWorkspaceEditParams) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingEdit != 0 { - return fmt.Errorf("required property 'edit' is missing") + missingProps = append(missingProps, "edit") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -10969,9 +11266,11 @@ func (s *ApplyWorkspaceEditResult) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingApplied != 0 { - return fmt.Errorf("required property 'applied' is missing") + missingProps = append(missingProps, "applied") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11062,12 +11361,14 @@ func (s *WorkDoneProgressBegin) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingTitle != 0 { - return fmt.Errorf("required property 'title' is missing") + missingProps = append(missingProps, "title") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11147,9 +11448,11 @@ func (s *WorkDoneProgressReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11204,9 +11507,11 @@ func (s *WorkDoneProgressEnd) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11253,9 +11558,11 @@ func (s *SetTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingValue != 0 { - return fmt.Errorf("required property 'value' is missing") + missingProps = append(missingProps, "value") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11308,9 +11615,11 @@ func (s *LogTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingMessage != 0 { - return fmt.Errorf("required property 'message' is missing") + missingProps = append(missingProps, "message") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11358,9 +11667,11 @@ func (s *CancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingId != 0 { - return fmt.Errorf("required property 'id' is missing") + missingProps = append(missingProps, "id") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11417,12 +11728,14 @@ func (s *ProgressParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingToken != 0 { - return fmt.Errorf("required property 'token' is missing") + missingProps = append(missingProps, "token") } if missing&missingValue != 0 { - return fmt.Errorf("required property 'value' is missing") + missingProps = append(missingProps, "value") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11485,12 +11798,14 @@ func (s *TextDocumentPositionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingPosition != 0 { - return fmt.Errorf("required property 'position' is missing") + missingProps = append(missingProps, "position") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11582,15 +11897,17 @@ func (s *LocationLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTargetUri != 0 { - return fmt.Errorf("required property 'targetUri' is missing") + missingProps = append(missingProps, "targetUri") } if missing&missingTargetRange != 0 { - return fmt.Errorf("required property 'targetRange' is missing") + missingProps = append(missingProps, "targetRange") } if missing&missingTargetSelectionRange != 0 { - return fmt.Errorf("required property 'targetSelectionRange' is missing") + missingProps = append(missingProps, "targetSelectionRange") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11660,12 +11977,14 @@ func (s *Range) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingStart != 0 { - return fmt.Errorf("required property 'start' is missing") + missingProps = append(missingProps, "start") } if missing&missingEnd != 0 { - return fmt.Errorf("required property 'end' is missing") + missingProps = append(missingProps, "end") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11739,12 +12058,14 @@ func (s *WorkspaceFoldersChangeEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingAdded != 0 { - return fmt.Errorf("required property 'added' is missing") + missingProps = append(missingProps, "added") } if missing&missingRemoved != 0 { - return fmt.Errorf("required property 'removed' is missing") + missingProps = append(missingProps, "removed") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11801,9 +12122,11 @@ func (s *TextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11879,18 +12202,20 @@ func (s *Color) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRed != 0 { - return fmt.Errorf("required property 'red' is missing") + missingProps = append(missingProps, "red") } if missing&missingGreen != 0 { - return fmt.Errorf("required property 'green' is missing") + missingProps = append(missingProps, "green") } if missing&missingBlue != 0 { - return fmt.Errorf("required property 'blue' is missing") + missingProps = append(missingProps, "blue") } if missing&missingAlpha != 0 { - return fmt.Errorf("required property 'alpha' is missing") + missingProps = append(missingProps, "alpha") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -11989,12 +12314,14 @@ func (s *Position) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingLine != 0 { - return fmt.Errorf("required property 'line' is missing") + missingProps = append(missingProps, "line") } if missing&missingCharacter != 0 { - return fmt.Errorf("required property 'character' is missing") + missingProps = append(missingProps, "character") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12075,9 +12402,11 @@ func (s *SemanticTokensOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingLegend != 0 { - return fmt.Errorf("required property 'legend' is missing") + missingProps = append(missingProps, "legend") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12142,12 +12471,14 @@ func (s *SemanticTokensEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingStart != 0 { - return fmt.Errorf("required property 'start' is missing") + missingProps = append(missingProps, "start") } if missing&missingDeleteCount != 0 { - return fmt.Errorf("required property 'deleteCount' is missing") + missingProps = append(missingProps, "deleteCount") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12202,9 +12533,11 @@ func (s *FileCreate) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12271,12 +12604,14 @@ func (s *TextDocumentEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTextDocument != 0 { - return fmt.Errorf("required property 'textDocument' is missing") + missingProps = append(missingProps, "textDocument") } if missing&missingEdits != 0 { - return fmt.Errorf("required property 'edits' is missing") + missingProps = append(missingProps, "edits") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12350,12 +12685,14 @@ func (s *CreateFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12438,15 +12775,17 @@ func (s *RenameFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingOldUri != 0 { - return fmt.Errorf("required property 'oldUri' is missing") + missingProps = append(missingProps, "oldUri") } if missing&missingNewUri != 0 { - return fmt.Errorf("required property 'newUri' is missing") + missingProps = append(missingProps, "newUri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12520,12 +12859,14 @@ func (s *DeleteFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12593,9 +12934,11 @@ func (s *ChangeAnnotation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingLabel != 0 { - return fmt.Errorf("required property 'label' is missing") + missingProps = append(missingProps, "label") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12654,9 +12997,11 @@ func (s *FileOperationFilter) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingPattern != 0 { - return fmt.Errorf("required property 'pattern' is missing") + missingProps = append(missingProps, "pattern") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12716,12 +13061,14 @@ func (s *FileRename) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingOldUri != 0 { - return fmt.Errorf("required property 'oldUri' is missing") + missingProps = append(missingProps, "oldUri") } if missing&missingNewUri != 0 { - return fmt.Errorf("required property 'newUri' is missing") + missingProps = append(missingProps, "newUri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12772,9 +13119,11 @@ func (s *FileDelete) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12844,12 +13193,14 @@ func (s *InlineValueContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingFrameId != 0 { - return fmt.Errorf("required property 'frameId' is missing") + missingProps = append(missingProps, "frameId") } if missing&missingStoppedLocation != 0 { - return fmt.Errorf("required property 'stoppedLocation' is missing") + missingProps = append(missingProps, "stoppedLocation") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12909,12 +13260,14 @@ func (s *InlineValueText) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingText != 0 { - return fmt.Errorf("required property 'text' is missing") + missingProps = append(missingProps, "text") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -12984,12 +13337,14 @@ func (s *InlineValueVariableLookup) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingCaseSensitiveLookup != 0 { - return fmt.Errorf("required property 'caseSensitiveLookup' is missing") + missingProps = append(missingProps, "caseSensitiveLookup") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13050,9 +13405,11 @@ func (s *InlineValueEvaluatableExpression) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13147,9 +13504,11 @@ func (s *InlayHintLabelPart) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingValue != 0 { - return fmt.Errorf("required property 'value' is missing") + missingProps = append(missingProps, "value") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13230,12 +13589,14 @@ func (s *MarkupContent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingValue != 0 { - return fmt.Errorf("required property 'value' is missing") + missingProps = append(missingProps, "value") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13328,12 +13689,14 @@ func (s *RelatedFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.De } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingItems != 0 { - return fmt.Errorf("required property 'items' is missing") + missingProps = append(missingProps, "items") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13410,12 +13773,14 @@ func (s *RelatedUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsonte } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingResultId != 0 { - return fmt.Errorf("required property 'resultId' is missing") + missingProps = append(missingProps, "resultId") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13484,12 +13849,14 @@ func (s *FullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingItems != 0 { - return fmt.Errorf("required property 'items' is missing") + missingProps = append(missingProps, "items") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13554,12 +13921,14 @@ func (s *UnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Deco } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingResultId != 0 { - return fmt.Errorf("required property 'resultId' is missing") + missingProps = append(missingProps, "resultId") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13636,12 +14005,14 @@ func (s *DiagnosticOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingInterFileDependencies != 0 { - return fmt.Errorf("required property 'interFileDependencies' is missing") + missingProps = append(missingProps, "interFileDependencies") } if missing&missingWorkspaceDiagnostics != 0 { - return fmt.Errorf("required property 'workspaceDiagnostics' is missing") + missingProps = append(missingProps, "workspaceDiagnostics") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13702,12 +14073,14 @@ func (s *PreviousResultId) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingValue != 0 { - return fmt.Errorf("required property 'value' is missing") + missingProps = append(missingProps, "value") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13796,18 +14169,20 @@ func (s *NotebookDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingNotebookType != 0 { - return fmt.Errorf("required property 'notebookType' is missing") + missingProps = append(missingProps, "notebookType") } if missing&missingVersion != 0 { - return fmt.Errorf("required property 'version' is missing") + missingProps = append(missingProps, "version") } if missing&missingCells != 0 { - return fmt.Errorf("required property 'cells' is missing") + missingProps = append(missingProps, "cells") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13885,18 +14260,20 @@ func (s *TextDocumentItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingLanguageId != 0 { - return fmt.Errorf("required property 'languageId' is missing") + missingProps = append(missingProps, "languageId") } if missing&missingVersion != 0 { - return fmt.Errorf("required property 'version' is missing") + missingProps = append(missingProps, "version") } if missing&missingText != 0 { - return fmt.Errorf("required property 'text' is missing") + missingProps = append(missingProps, "text") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -13965,9 +14342,11 @@ func (s *NotebookDocumentSyncOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingNotebookSelector != 0 { - return fmt.Errorf("required property 'notebookSelector' is missing") + missingProps = append(missingProps, "notebookSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14027,12 +14406,14 @@ func (s *VersionedNotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.De } if missing != 0 { + var missingProps []string if missing&missingVersion != 0 { - return fmt.Errorf("required property 'version' is missing") + missingProps = append(missingProps, "version") } if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14096,9 +14477,11 @@ func (s *NotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14158,9 +14541,11 @@ func (s *InlineCompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingTriggerKind != 0 { - return fmt.Errorf("required property 'triggerKind' is missing") + missingProps = append(missingProps, "triggerKind") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14228,12 +14613,14 @@ func (s *StringValue) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingValue != 0 { - return fmt.Errorf("required property 'value' is missing") + missingProps = append(missingProps, "value") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14295,9 +14682,11 @@ func (s *TextDocumentContentOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingSchemes != 0 { - return fmt.Errorf("required property 'schemes' is missing") + missingProps = append(missingProps, "schemes") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14363,12 +14752,14 @@ func (s *Registration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingId != 0 { - return fmt.Errorf("required property 'id' is missing") + missingProps = append(missingProps, "id") } if missing&missingMethod != 0 { - return fmt.Errorf("required property 'method' is missing") + missingProps = append(missingProps, "method") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14427,12 +14818,14 @@ func (s *Unregistration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingId != 0 { - return fmt.Errorf("required property 'id' is missing") + missingProps = append(missingProps, "id") } if missing&missingMethod != 0 { - return fmt.Errorf("required property 'method' is missing") + missingProps = append(missingProps, "method") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14648,9 +15041,11 @@ func (s *ServerInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14708,12 +15103,14 @@ func (s *VersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decode } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingVersion != 0 { - return fmt.Errorf("required property 'version' is missing") + missingProps = append(missingProps, "version") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14777,12 +15174,14 @@ func (s *FileEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingType != 0 { - return fmt.Errorf("required property 'type' is missing") + missingProps = append(missingProps, "type") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14841,9 +15240,11 @@ func (s *FileSystemWatcher) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingGlobPattern != 0 { - return fmt.Errorf("required property 'globPattern' is missing") + missingProps = append(missingProps, "globPattern") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -14964,12 +15365,14 @@ func (s *Diagnostic) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingMessage != 0 { - return fmt.Errorf("required property 'message' is missing") + missingProps = append(missingProps, "message") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15026,9 +15429,11 @@ func (s *CompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTriggerKind != 0 { - return fmt.Errorf("required property 'triggerKind' is missing") + missingProps = append(missingProps, "triggerKind") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15110,15 +15515,17 @@ func (s *InsertReplaceEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingNewText != 0 { - return fmt.Errorf("required property 'newText' is missing") + missingProps = append(missingProps, "newText") } if missing&missingInsert != 0 { - return fmt.Errorf("required property 'insert' is missing") + missingProps = append(missingProps, "insert") } if missing&missingReplace != 0 { - return fmt.Errorf("required property 'replace' is missing") + missingProps = append(missingProps, "replace") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15342,12 +15749,14 @@ func (s *SignatureHelpContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTriggerKind != 0 { - return fmt.Errorf("required property 'triggerKind' is missing") + missingProps = append(missingProps, "triggerKind") } if missing&missingIsRetrigger != 0 { - return fmt.Errorf("required property 'isRetrigger' is missing") + missingProps = append(missingProps, "isRetrigger") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15431,9 +15840,11 @@ func (s *SignatureInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingLabel != 0 { - return fmt.Errorf("required property 'label' is missing") + missingProps = append(missingProps, "label") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15504,9 +15915,11 @@ func (s *ReferenceContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingIncludeDeclaration != 0 { - return fmt.Errorf("required property 'includeDeclaration' is missing") + missingProps = append(missingProps, "includeDeclaration") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15593,12 +16006,14 @@ func (s *BaseSymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15682,9 +16097,11 @@ func (s *CodeActionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingDiagnostics != 0 { - return fmt.Errorf("required property 'diagnostics' is missing") + missingProps = append(missingProps, "diagnostics") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15737,9 +16154,11 @@ func (s *CodeActionDisabled) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingReason != 0 { - return fmt.Errorf("required property 'reason' is missing") + missingProps = append(missingProps, "reason") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15824,9 +16243,11 @@ func (s *LocationUriOnly) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -15938,12 +16359,14 @@ func (s *FormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTabSize != 0 { - return fmt.Errorf("required property 'tabSize' is missing") + missingProps = append(missingProps, "tabSize") } if missing&missingInsertSpaces != 0 { - return fmt.Errorf("required property 'insertSpaces' is missing") + missingProps = append(missingProps, "insertSpaces") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16016,9 +16439,11 @@ func (s *DocumentOnTypeFormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decode } if missing != 0 { + var missingProps []string if missing&missingFirstTriggerCharacter != 0 { - return fmt.Errorf("required property 'firstTriggerCharacter' is missing") + missingProps = append(missingProps, "firstTriggerCharacter") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16084,12 +16509,14 @@ func (s *PrepareRenamePlaceholder) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingPlaceholder != 0 { - return fmt.Errorf("required property 'placeholder' is missing") + missingProps = append(missingProps, "placeholder") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16137,9 +16564,11 @@ func (s *PrepareRenameDefaultBehavior) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingDefaultBehavior != 0 { - return fmt.Errorf("required property 'defaultBehavior' is missing") + missingProps = append(missingProps, "defaultBehavior") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16194,9 +16623,11 @@ func (s *ExecuteCommandOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingCommands != 0 { - return fmt.Errorf("required property 'commands' is missing") + missingProps = append(missingProps, "commands") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16264,12 +16695,14 @@ func (s *SemanticTokensLegend) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingTokenTypes != 0 { - return fmt.Errorf("required property 'tokenTypes' is missing") + missingProps = append(missingProps, "tokenTypes") } if missing&missingTokenModifiers != 0 { - return fmt.Errorf("required property 'tokenModifiers' is missing") + missingProps = append(missingProps, "tokenModifiers") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16339,12 +16772,14 @@ func (s *OptionalVersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontex } if missing != 0 { + var missingProps []string if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingVersion != 0 { - return fmt.Errorf("required property 'version' is missing") + missingProps = append(missingProps, "version") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16415,15 +16850,17 @@ func (s *AnnotatedTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingNewText != 0 { - return fmt.Errorf("required property 'newText' is missing") + missingProps = append(missingProps, "newText") } if missing&missingAnnotationId != 0 { - return fmt.Errorf("required property 'annotationId' is missing") + missingProps = append(missingProps, "annotationId") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16492,12 +16929,14 @@ func (s *SnippetTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingSnippet != 0 { - return fmt.Errorf("required property 'snippet' is missing") + missingProps = append(missingProps, "snippet") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16555,9 +16994,11 @@ func (s *ResourceOperation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16658,9 +17099,11 @@ func (s *FileOperationPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingGlob != 0 { - return fmt.Errorf("required property 'glob' is missing") + missingProps = append(missingProps, "glob") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16748,18 +17191,20 @@ func (s *WorkspaceFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext. } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingItems != 0 { - return fmt.Errorf("required property 'items' is missing") + missingProps = append(missingProps, "items") } if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingVersion != 0 { - return fmt.Errorf("required property 'version' is missing") + missingProps = append(missingProps, "version") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16842,18 +17287,20 @@ func (s *WorkspaceUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *json } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingResultId != 0 { - return fmt.Errorf("required property 'resultId' is missing") + missingProps = append(missingProps, "resultId") } if missing&missingUri != 0 { - return fmt.Errorf("required property 'uri' is missing") + missingProps = append(missingProps, "uri") } if missing&missingVersion != 0 { - return fmt.Errorf("required property 'version' is missing") + missingProps = append(missingProps, "version") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16935,12 +17382,14 @@ func (s *NotebookCell) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingDocument != 0 { - return fmt.Errorf("required property 'document' is missing") + missingProps = append(missingProps, "document") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -16998,9 +17447,11 @@ func (s *NotebookDocumentFilterWithNotebook) UnmarshalJSONFrom(dec *jsontext.Dec } if missing != 0 { + var missingProps []string if missing&missingNotebook != 0 { - return fmt.Errorf("required property 'notebook' is missing") + missingProps = append(missingProps, "notebook") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17058,9 +17509,11 @@ func (s *NotebookDocumentFilterWithCells) UnmarshalJSONFrom(dec *jsontext.Decode } if missing != 0 { + var missingProps []string if missing&missingCells != 0 { - return fmt.Errorf("required property 'cells' is missing") + missingProps = append(missingProps, "cells") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17138,12 +17591,14 @@ func (s *SelectedCompletionInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingText != 0 { - return fmt.Errorf("required property 'text' is missing") + missingProps = append(missingProps, "text") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17203,9 +17658,11 @@ func (s *ClientInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingName != 0 { - return fmt.Errorf("required property 'name' is missing") + missingProps = append(missingProps, "name") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17338,12 +17795,14 @@ func (s *TextDocumentContentChangePartial) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingRange != 0 { - return fmt.Errorf("required property 'range' is missing") + missingProps = append(missingProps, "range") } if missing&missingText != 0 { - return fmt.Errorf("required property 'text' is missing") + missingProps = append(missingProps, "text") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17392,9 +17851,11 @@ func (s *TextDocumentContentChangeWholeDocument) UnmarshalJSONFrom(dec *jsontext } if missing != 0 { + var missingProps []string if missing&missingText != 0 { - return fmt.Errorf("required property 'text' is missing") + missingProps = append(missingProps, "text") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17445,9 +17906,11 @@ func (s *CodeDescription) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingHref != 0 { - return fmt.Errorf("required property 'href' is missing") + missingProps = append(missingProps, "href") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17507,12 +17970,14 @@ func (s *DiagnosticRelatedInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingLocation != 0 { - return fmt.Errorf("required property 'location' is missing") + missingProps = append(missingProps, "location") } if missing&missingMessage != 0 { - return fmt.Errorf("required property 'message' is missing") + missingProps = append(missingProps, "message") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17570,12 +18035,14 @@ func (s *EditRangeWithInsertReplace) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingInsert != 0 { - return fmt.Errorf("required property 'insert' is missing") + missingProps = append(missingProps, "insert") } if missing&missingReplace != 0 { - return fmt.Errorf("required property 'replace' is missing") + missingProps = append(missingProps, "replace") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17643,12 +18110,14 @@ func (s *MarkedStringWithLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingLanguage != 0 { - return fmt.Errorf("required property 'language' is missing") + missingProps = append(missingProps, "language") } if missing&missingValue != 0 { - return fmt.Errorf("required property 'value' is missing") + missingProps = append(missingProps, "value") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17717,9 +18186,11 @@ func (s *ParameterInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingLabel != 0 { - return fmt.Errorf("required property 'label' is missing") + missingProps = append(missingProps, "label") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17787,12 +18258,14 @@ func (s *CodeActionKindDocumentation) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingKind != 0 { - return fmt.Errorf("required property 'kind' is missing") + missingProps = append(missingProps, "kind") } if missing&missingCommand != 0 { - return fmt.Errorf("required property 'command' is missing") + missingProps = append(missingProps, "command") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17857,9 +18330,11 @@ func (s *NotebookCellTextDocumentFilter) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingNotebook != 0 { - return fmt.Errorf("required property 'notebook' is missing") + missingProps = append(missingProps, "notebook") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17925,9 +18400,11 @@ func (s *ExecutionSummary) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingExecutionOrder != 0 { - return fmt.Errorf("required property 'executionOrder' is missing") + missingProps = append(missingProps, "executionOrder") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -17975,9 +18452,11 @@ func (s *NotebookCellLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingLanguage != 0 { - return fmt.Errorf("required property 'language' is missing") + missingProps = append(missingProps, "language") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18042,9 +18521,11 @@ func (s *NotebookDocumentCellChangeStructure) UnmarshalJSONFrom(dec *jsontext.De } if missing != 0 { + var missingProps []string if missing&missingArray != 0 { - return fmt.Errorf("required property 'array' is missing") + missingProps = append(missingProps, "array") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18102,12 +18583,14 @@ func (s *NotebookDocumentCellContentChanges) UnmarshalJSONFrom(dec *jsontext.Dec } if missing != 0 { + var missingProps []string if missing&missingDocument != 0 { - return fmt.Errorf("required property 'document' is missing") + missingProps = append(missingProps, "document") } if missing&missingChanges != 0 { - return fmt.Errorf("required property 'changes' is missing") + missingProps = append(missingProps, "changes") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18376,9 +18859,11 @@ func (s *NotebookDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Dec } if missing != 0 { + var missingProps []string if missing&missingSynchronization != 0 { - return fmt.Errorf("required property 'synchronization' is missing") + missingProps = append(missingProps, "synchronization") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18544,12 +19029,14 @@ func (s *RelativePattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingBaseUri != 0 { - return fmt.Errorf("required property 'baseUri' is missing") + missingProps = append(missingProps, "baseUri") } if missing&missingPattern != 0 { - return fmt.Errorf("required property 'pattern' is missing") + missingProps = append(missingProps, "pattern") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18618,9 +19105,11 @@ func (s *TextDocumentFilterLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingLanguage != 0 { - return fmt.Errorf("required property 'language' is missing") + missingProps = append(missingProps, "language") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18689,9 +19178,11 @@ func (s *TextDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingScheme != 0 { - return fmt.Errorf("required property 'scheme' is missing") + missingProps = append(missingProps, "scheme") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18760,9 +19251,11 @@ func (s *TextDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) err } if missing != 0 { + var missingProps []string if missing&missingPattern != 0 { - return fmt.Errorf("required property 'pattern' is missing") + missingProps = append(missingProps, "pattern") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18827,9 +19320,11 @@ func (s *NotebookDocumentFilterNotebookType) UnmarshalJSONFrom(dec *jsontext.Dec } if missing != 0 { + var missingProps []string if missing&missingNotebookType != 0 { - return fmt.Errorf("required property 'notebookType' is missing") + missingProps = append(missingProps, "notebookType") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18894,9 +19389,11 @@ func (s *NotebookDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingScheme != 0 { - return fmt.Errorf("required property 'scheme' is missing") + missingProps = append(missingProps, "scheme") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -18961,9 +19458,11 @@ func (s *NotebookDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingPattern != 0 { - return fmt.Errorf("required property 'pattern' is missing") + missingProps = append(missingProps, "pattern") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -19031,12 +19530,14 @@ func (s *NotebookCellArrayChange) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingStart != 0 { - return fmt.Errorf("required property 'start' is missing") + missingProps = append(missingProps, "start") } if missing&missingDeleteCount != 0 { - return fmt.Errorf("required property 'deleteCount' is missing") + missingProps = append(missingProps, "deleteCount") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -19767,18 +20268,20 @@ func (s *SemanticTokensClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decod } if missing != 0 { + var missingProps []string if missing&missingRequests != 0 { - return fmt.Errorf("required property 'requests' is missing") + missingProps = append(missingProps, "requests") } if missing&missingTokenTypes != 0 { - return fmt.Errorf("required property 'tokenTypes' is missing") + missingProps = append(missingProps, "tokenTypes") } if missing&missingTokenModifiers != 0 { - return fmt.Errorf("required property 'tokenModifiers' is missing") + missingProps = append(missingProps, "tokenModifiers") } if missing&missingFormats != 0 { - return fmt.Errorf("required property 'formats' is missing") + missingProps = append(missingProps, "formats") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -19942,9 +20445,11 @@ func (s *ShowDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingSupport != 0 { - return fmt.Errorf("required property 'support' is missing") + missingProps = append(missingProps, "support") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20004,12 +20509,14 @@ func (s *StaleRequestSupportOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingCancel != 0 { - return fmt.Errorf("required property 'cancel' is missing") + missingProps = append(missingProps, "cancel") } if missing&missingRetryOnContentModified != 0 { - return fmt.Errorf("required property 'retryOnContentModified' is missing") + missingProps = append(missingProps, "retryOnContentModified") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20067,9 +20574,11 @@ func (s *RegularExpressionsClientCapabilities) UnmarshalJSONFrom(dec *jsontext.D } if missing != 0 { + var missingProps []string if missing&missingEngine != 0 { - return fmt.Errorf("required property 'engine' is missing") + missingProps = append(missingProps, "engine") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20137,9 +20646,11 @@ func (s *MarkdownClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingParser != 0 { - return fmt.Errorf("required property 'parser' is missing") + missingProps = append(missingProps, "parser") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20209,9 +20720,11 @@ func (s *ClientSymbolTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error } if missing != 0 { + var missingProps []string if missing&missingValueSet != 0 { - return fmt.Errorf("required property 'valueSet' is missing") + missingProps = append(missingProps, "valueSet") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20261,9 +20774,11 @@ func (s *ClientSymbolResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) er } if missing != 0 { + var missingProps []string if missing&missingProperties != 0 { - return fmt.Errorf("required property 'properties' is missing") + missingProps = append(missingProps, "properties") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20438,9 +20953,11 @@ func (s *ClientCodeActionLiteralOptions) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingCodeActionKind != 0 { - return fmt.Errorf("required property 'codeActionKind' is missing") + missingProps = append(missingProps, "codeActionKind") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20489,9 +21006,11 @@ func (s *ClientCodeActionResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder } if missing != 0 { + var missingProps []string if missing&missingProperties != 0 { - return fmt.Errorf("required property 'properties' is missing") + missingProps = append(missingProps, "properties") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20540,9 +21059,11 @@ func (s *CodeActionTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } if missing != 0 { + var missingProps []string if missing&missingValueSet != 0 { - return fmt.Errorf("required property 'valueSet' is missing") + missingProps = append(missingProps, "valueSet") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20591,9 +21112,11 @@ func (s *ClientCodeLensResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingProperties != 0 { - return fmt.Errorf("required property 'properties' is missing") + missingProps = append(missingProps, "properties") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20695,9 +21218,11 @@ func (s *ClientInlayHintResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) } if missing != 0 { + var missingProps []string if missing&missingProperties != 0 { - return fmt.Errorf("required property 'properties' is missing") + missingProps = append(missingProps, "properties") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20754,9 +21279,11 @@ func (s *CompletionItemTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) erro } if missing != 0 { + var missingProps []string if missing&missingValueSet != 0 { - return fmt.Errorf("required property 'valueSet' is missing") + missingProps = append(missingProps, "valueSet") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20805,9 +21332,11 @@ func (s *ClientCompletionItemResolveOptions) UnmarshalJSONFrom(dec *jsontext.Dec } if missing != 0 { + var missingProps []string if missing&missingProperties != 0 { - return fmt.Errorf("required property 'properties' is missing") + missingProps = append(missingProps, "properties") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20855,9 +21384,11 @@ func (s *ClientCompletionItemInsertTextModeOptions) UnmarshalJSONFrom(dec *jsont } if missing != 0 { + var missingProps []string if missing&missingValueSet != 0 { - return fmt.Errorf("required property 'valueSet' is missing") + missingProps = append(missingProps, "valueSet") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20918,9 +21449,11 @@ func (s *ClientCodeActionKindOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingValueSet != 0 { - return fmt.Errorf("required property 'valueSet' is missing") + missingProps = append(missingProps, "valueSet") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -20969,9 +21502,11 @@ func (s *ClientDiagnosticsTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) e } if missing != 0 { + var missingProps []string if missing&missingValueSet != 0 { - return fmt.Errorf("required property 'valueSet' is missing") + missingProps = append(missingProps, "valueSet") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil @@ -21121,9 +21656,11 @@ func (s *ColorPresentationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.D } if missing != 0 { + var missingProps []string if missing&missingDocumentSelector != 0 { - return fmt.Errorf("required property 'documentSelector' is missing") + missingProps = append(missingProps, "documentSelector") } + return fmt.Errorf("missing required properties: %s", strings.Join(missingProps, ", ")) } return nil From 60c8fbe9d059075561e6211469b09f58be01a92e Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 21 Nov 2025 10:06:02 -0800 Subject: [PATCH 16/16] CodeLenss --- internal/lsp/lsproto/_generate/generate.mts | 16 ++++++++++- internal/lsp/lsproto/lsp_generated.go | 30 ++++++++++----------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/internal/lsp/lsproto/_generate/generate.mts b/internal/lsp/lsproto/_generate/generate.mts index c705a1a0e6..a8dbf32115 100644 --- a/internal/lsp/lsproto/_generate/generate.mts +++ b/internal/lsp/lsproto/_generate/generate.mts @@ -471,6 +471,20 @@ function flattenOrTypes(types: Type[]): Type[] { return Array.from(flattened); } +function pluralize(name: string): string { + // Handle common irregular plurals and special cases + if ( + name.endsWith("s") || name.endsWith("x") || name.endsWith("z") || + name.endsWith("ch") || name.endsWith("sh") + ) { + return name + "es"; + } + if (name.endsWith("y") && name.length > 1 && !"aeiou".includes(name[name.length - 2])) { + return name.slice(0, -1) + "ies"; + } + return name + "s"; +} + function handleOrType(orType: OrType): GoType { // First, flatten any nested OR types const types = flattenOrTypes(orType.items); @@ -504,7 +518,7 @@ function handleOrType(orType: OrType): GoType { type.kind === "array" && (type.element.kind === "reference" || type.element.kind === "base") ) { - return `${titleCase(type.element.name)}s`; + return pluralize(titleCase(type.element.name)); } else if (type.kind === "array") { // Handle more complex array types diff --git a/internal/lsp/lsproto/lsp_generated.go b/internal/lsp/lsproto/lsp_generated.go index 4eabcaa191..3c43d47da3 100644 --- a/internal/lsp/lsproto/lsp_generated.go +++ b/internal/lsp/lsproto/lsp_generated.go @@ -23503,7 +23503,7 @@ type WorkspaceSymbolResolveResponse = *WorkspaceSymbol var WorkspaceSymbolResolveInfo = RequestInfo[*WorkspaceSymbol, WorkspaceSymbolResolveResponse]{Method: MethodWorkspaceSymbolResolve} // Response type for `textDocument/codeLens` -type CodeLensResponse = CodeLenssOrNull +type CodeLensResponse = CodeLensesOrNull // Type mapping info for `textDocument/codeLens` var TextDocumentCodeLensInfo = RequestInfo[*CodeLensParams, CodeLensResponse]{Method: MethodTextDocumentCodeLens} @@ -27661,25 +27661,25 @@ func (o *SymbolInformationsOrWorkspaceSymbolsOrNull) UnmarshalJSONFrom(dec *json return fmt.Errorf("invalid SymbolInformationsOrWorkspaceSymbolsOrNull: %s", data) } -type CodeLenssOrNull struct { - CodeLenss *[]*CodeLens +type CodeLensesOrNull struct { + CodeLenses *[]*CodeLens } -var _ json.MarshalerTo = (*CodeLenssOrNull)(nil) +var _ json.MarshalerTo = (*CodeLensesOrNull)(nil) -func (o *CodeLenssOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { - assertAtMostOne("more than one element of CodeLenssOrNull is set", o.CodeLenss != nil) +func (o *CodeLensesOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { + assertAtMostOne("more than one element of CodeLensesOrNull is set", o.CodeLenses != nil) - if o.CodeLenss != nil { - return json.MarshalEncode(enc, o.CodeLenss) + if o.CodeLenses != nil { + return json.MarshalEncode(enc, o.CodeLenses) } return enc.WriteToken(jsontext.Null) } -var _ json.UnmarshalerFrom = (*CodeLenssOrNull)(nil) +var _ json.UnmarshalerFrom = (*CodeLensesOrNull)(nil) -func (o *CodeLenssOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { - *o = CodeLenssOrNull{} +func (o *CodeLensesOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + *o = CodeLensesOrNull{} data, err := dec.ReadValue() if err != nil { @@ -27689,12 +27689,12 @@ func (o *CodeLenssOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { return nil } - var vCodeLenss []*CodeLens - if err := json.Unmarshal(data, &vCodeLenss); err == nil { - o.CodeLenss = &vCodeLenss + var vCodeLenses []*CodeLens + if err := json.Unmarshal(data, &vCodeLenses); err == nil { + o.CodeLenses = &vCodeLenses return nil } - return fmt.Errorf("invalid CodeLenssOrNull: %s", data) + return fmt.Errorf("invalid CodeLensesOrNull: %s", data) } type DocumentLinksOrNull struct {