From eeeb64c2528d7c22bd51a1c946bad06f49002925 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 25 Nov 2025 09:23:35 -0800 Subject: [PATCH 01/10] WIP: strada document symbol --- .../fourslash/_scripts/convertFourslash.mts | 117 +++++++++++- internal/fourslash/fourslash.go | 51 ++++-- .../tests/gen/getNavigationBarItems_test.go | 39 ++++ .../gen/jsdocTypedefTagNavigateTo_test.go | 48 +++++ internal/fourslash/tests/gen/navbar01_test.go | 171 ++++++++++++++++++ .../gen/navbarNestedCommonJsExports_test.go | 39 ++++ .../fourslash/tests/gen/navbar_const_test.go | 24 +++ .../gen/navbar_contains-no-duplicates_test.go | 112 ++++++++++++ .../tests/gen/navbar_exportDefault_test.go | 56 ++++++ .../fourslash/tests/gen/navbar_let_test.go | 24 +++ ...nymousClassAndFunctionExpressions2_test.go | 52 ++++++ ...nymousClassAndFunctionExpressions3_test.go | 60 ++++++ ...onymousClassAndFunctionExpressions_test.go | 137 ++++++++++++++ .../gen/navigationBarAssignmentTypes_test.go | 46 +++++ .../gen/navigationBarClassStaticBlock_test.go | 35 ++++ .../navigationBarComputedPropertyName_test.go | 41 +++++ ...ionIndirectlyInVariableDeclaration_test.go | 64 +++++++ ...BarFunctionLikePropertyAssignments_test.go | 63 +++++++ .../navigationBarFunctionPrototype2_test.go | 44 +++++ .../navigationBarFunctionPrototype3_test.go | 44 +++++ ...vigationBarFunctionPrototypeBroken_test.go | 64 +++++++ ...tionBarFunctionPrototypeInterlaced_test.go | 70 +++++++ ...vigationBarFunctionPrototypeNested_test.go | 82 +++++++++ .../navigationBarFunctionPrototype_test.go | 92 ++++++++++ .../gen/navigationBarGetterAndSetter_test.go | 48 +++++ .../tests/gen/navigationBarImports_test.go | 41 +++++ .../gen/navigationBarInitializerSpans_test.go | 62 +++++++ ...rItemsBindingPatternsInConstructor_test.go | 61 +++++++ .../navigationBarItemsBindingPatterns_test.go | 85 +++++++++ .../gen/navigationBarItemsClass1_test.go | 30 +++ .../gen/navigationBarItemsClass2_test.go | 30 +++ .../gen/navigationBarItemsClass3_test.go | 32 ++++ .../gen/navigationBarItemsClass4_test.go | 32 ++++ .../gen/navigationBarItemsClass5_test.go | 30 +++ .../gen/navigationBarItemsClass6_test.go | 45 +++++ .../navigationBarItemsComputedNames_test.go | 83 +++++++++ ...avigationBarItemsEmptyConstructors_test.go | 34 ++++ .../gen/navigationBarItemsExports_test.go | 40 ++++ ...vigationBarItemsFunctionProperties_test.go | 40 ++++ ...navigationBarItemsFunctionsBroken2_test.go | 39 ++++ .../navigationBarItemsFunctionsBroken_test.go | 33 ++++ .../gen/navigationBarItemsFunctions_test.go | 84 +++++++++ .../gen/navigationBarItemsImports_test.go | 69 +++++++ ...rItemsInsideMethodsAndConstructors_test.go | 107 +++++++++++ .../gen/navigationBarItemsItems2_test.go | 32 ++++ ...ationBarItemsItemsExternalModules2_test.go | 40 ++++ ...ationBarItemsItemsExternalModules3_test.go | 40 ++++ ...gationBarItemsItemsExternalModules_test.go | 33 ++++ ...gationBarItemsItemsModuleVariables_test.go | 60 ++++++ .../tests/gen/navigationBarItemsItems_test.go | 171 ++++++++++++++++++ .../navigationBarItemsMissingName1_test.go | 39 ++++ .../navigationBarItemsMissingName2_test.go | 36 ++++ .../gen/navigationBarItemsModules1_test.go | 109 +++++++++++ .../gen/navigationBarItemsModules2_test.go | 40 ++++ ...arItemsMultilineStringIdentifiers1_test.go | 94 ++++++++++ ...arItemsMultilineStringIdentifiers2_test.go | 63 +++++++ ...arItemsMultilineStringIdentifiers3_test.go | 30 +++ ...igationBarItemsNamedArrowFunctions_test.go | 42 +++++ ...emsPropertiesDefinedInConstructors_test.go | 56 ++++++ ...nBarItemsStaticAndNonStaticNoMerge_test.go | 39 ++++ .../gen/navigationBarItemsSymbols1_test.go | 45 +++++ .../gen/navigationBarItemsSymbols2_test.go | 39 ++++ .../gen/navigationBarItemsSymbols3_test.go | 27 +++ .../gen/navigationBarItemsSymbols4_test.go | 64 +++++++ .../gen/navigationBarItemsTypeAlias_test.go | 24 +++ ...avigationBarJsDocCommentWithNoTags_test.go | 25 +++ .../tests/gen/navigationBarJsDoc_test.go | 37 ++++ ...navigationBarMerging_grandchildren_test.go | 56 ++++++ .../tests/gen/navigationBarMerging_test.go | 136 ++++++++++++++ ...gationBarNamespaceImportWithNoName_test.go | 24 +++ .../navigationBarNestedObjectLiterals_test.go | 81 +++++++++ .../navigationBarPrivateNameMethod_test.go | 58 ++++++ .../gen/navigationBarPrivateName_test.go | 56 ++++++ .../navigationBarPropertyDeclarations_test.go | 161 +++++++++++++++++ .../tests/gen/navigationBarVariables_test.go | 58 ++++++ ...avigationBarWellKnownSymbolExpando_test.go | 37 ++++ .../navigationBarWithLocalVariables_test.go | 34 ++++ ...gationItemsExportDefaultExpression_test.go | 161 +++++++++++++++++ ...igationItemsExportEqualsExpression_test.go | 137 ++++++++++++++ 79 files changed, 4770 insertions(+), 14 deletions(-) create mode 100644 internal/fourslash/tests/gen/getNavigationBarItems_test.go create mode 100644 internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go create mode 100644 internal/fourslash/tests/gen/navbar01_test.go create mode 100644 internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go create mode 100644 internal/fourslash/tests/gen/navbar_const_test.go create mode 100644 internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go create mode 100644 internal/fourslash/tests/gen/navbar_exportDefault_test.go create mode 100644 internal/fourslash/tests/gen/navbar_let_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototype2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototype3_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototypeBroken_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototypeInterlaced_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototypeNested_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototype_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarImports_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsClass1_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsClass2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsClass3_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsClass4_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsClass5_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsClass6_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsExports_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsImports_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsItems2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsItems_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsModules1_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsModules2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarJsDoc_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarMerging_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarPrivateName_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarVariables_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go create mode 100644 internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go create mode 100644 internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go create mode 100644 internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts index c8e1d679bf..21d3908996 100644 --- a/internal/fourslash/_scripts/convertFourslash.mts +++ b/internal/fourslash/_scripts/convertFourslash.mts @@ -94,6 +94,11 @@ function parseFileContent(filename: string, content: string): GoTest | undefined goTest.commands.push(...result); } } + if (goTest.commands.length === 0) { + console.error(`No commands parsed in file: ${filename}`); + unparsedFiles.push(filename); + return undefined; + } return goTest; } @@ -237,6 +242,10 @@ function parseFourslashStatement(statement: ts.Statement): Cmd[] | undefined { case "outliningSpansInCurrentFile": case "outliningHintSpansInCurrentFile": return parseOutliningSpansArgs(callExpression.arguments); + case "navigationTree": + return parseVerifyNavTree(callExpression.arguments); + case "navigationBar": + return []; // Deprecated. } } // `goTo....` @@ -2273,6 +2282,100 @@ function parseVerifyNavigateToArg(arg: ts.Expression): string | undefined { }`; } +function parseVerifyNavTree(args: readonly ts.Expression[]): [VerifyNavTreeCmd] | undefined { + // Ignore `{ checkSpans: true }`. + if (!ts.isObjectLiteralExpression(args[0])) { + console.error(`Expected object literal expression for verify.navigationTree argument, got ${args[0].getText()}`); + return undefined; + } + let expectedItems: string[] = []; + for (const prop of args[0].properties) { + if (!ts.isPropertyAssignment(prop) || !(ts.isIdentifier(prop.name) || ts.isStringLiteralLike(prop.name))) { + console.error(`Expected property assignment with identifier or string literal name for verify.navigationTree argument, got ${prop.getText()}`); + return undefined; + } + if (prop.name.text === "childItems") { + const init = prop.initializer; + if (!ts.isArrayLiteralExpression(init)) { + console.error(`Expected array literal expression for childItems in verify.navigationTree argument, got ${init.getText()}`); + return undefined; + } + for (const elem of init.elements) { + if (!ts.isObjectLiteralExpression(elem)) { + console.error(`Expected object literal expression for navigation tree item, got ${elem.getText()}`); + return undefined; + } + const item = parseNavTreeItem(elem); + if (!item) { + return undefined; + } + expectedItems.push(item); + } + } + } + return [{ + kind: "verifyNavigationTree", + arg: expectedItems.length ? `[]*lsproto.DocumentSymbol{\n${expectedItems.join(",\n")},\n}` : "nil", + }]; +} + +function parseNavTreeItem(item: ts.ObjectLiteralExpression): string | undefined { + let children: string | undefined; + let name: string; + let kind: string | undefined; + for (const prop of item.properties) { + if (!ts.isPropertyAssignment(prop) || !(ts.isIdentifier(prop.name) || ts.isStringLiteralLike(prop.name))) { + console.error(`Expected property assignment with identifier or string name for navigation tree item, got ${prop.getText()}`); + return undefined; + } + switch (prop.name.text) { + case "text": { + if (!ts.isStringLiteralLike(prop.initializer)) { + console.error(`Expected string literal for text in navigation tree item, got ${prop.initializer.getText()}`); + return undefined; + } + name = getGoStringLiteral(prop.initializer.text); + break; + } + case "kind": { + const goKind = getSymbolKind(prop.initializer); + if (!goKind) { + return undefined; + } + kind = goKind; + break; + } + case "childItems": { + const init = prop.initializer; + if (!ts.isArrayLiteralExpression(init)) { + console.error(`Expected array literal expression for childItems in navigation tree item, got ${init.getText()}`); + return undefined; + } + const childItems: string[] = []; + for (const elem of init.elements) { + if (!ts.isObjectLiteralExpression(elem)) { + console.error(`Expected object literal expression for navigation tree child item, got ${elem.getText()}`); + return undefined; + } + const childItem = parseNavTreeItem(elem); + if (!childItem) { + return undefined; + } + childItems.push(childItem); + } + if (childItems.length > 0) { + children = `PtrTo([]*lsproto.DocumentSymbol{\n${childItems.join(",\n")},\n})`; + } + } + } + } + return `&lsproto.DocumentSymbol{ + Name: ${name!}, + Kind: lsproto.${kind || "SymbolKindProperty"}, + Children: ${children ? children : "nil"}, + }` +} + function parseNavToItem(arg: ts.Expression): string | undefined { let item = getNodeOfKind(arg, ts.isObjectLiteralExpression); if (!item) { @@ -2348,7 +2451,11 @@ function getSymbolKind(kind: ts.Expression): string | undefined { console.error(`Expected string literal for symbol kind, got ${kind.getText()}`); return undefined; } - switch (result.text) { + return getSymbolKindWorker(result.text); +} + +function getSymbolKindWorker(kind: string): string { + switch (kind) { case "script": return "SymbolKindFile"; case "module": @@ -2567,6 +2674,11 @@ interface VerifyOutliningSpansCmd { foldingRangeKind?: string; } +interface VerifyNavTreeCmd { + kind: "verifyNavigationTree"; + arg: string; +} + type Cmd = | VerifyCompletionsCmd | VerifyApplyCodeActionFromCompletionCmd @@ -2587,6 +2699,7 @@ type Cmd = | VerifyBaselineRenameCmd | VerifyRenameInfoCmd | VerifyNavToCmd + | VerifyNavTreeCmd | VerifyBaselineInlayHintsCmd | VerifyImportFixAtPositionCmd | VerifyDiagnosticsCmd @@ -2894,6 +3007,8 @@ function generateCmd(cmd: Cmd): string { return generateNoSignatureHelpForTriggerReason(cmd); case "verifyOutliningSpans": return generateVerifyOutliningSpans(cmd); + case "verifyNavigationTree": + return `f.VerifyStradaDocumentSymbol(t, ${cmd.arg})`; default: let neverCommand: never = cmd; throw new Error(`Unknown command kind: ${neverCommand as Cmd["kind"]}`); diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index b9e223b88d..9e9e170ca7 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -479,6 +479,19 @@ var ( defaultHoverCapabilities = &lsproto.HoverClientCapabilities{ ContentFormat: &[]lsproto.MarkupKind{lsproto.MarkupKindMarkdown, lsproto.MarkupKindPlainText}, } + defaultSignatureHelpCapabilities = &lsproto.SignatureHelpClientCapabilities{ + SignatureInformation: &lsproto.ClientSignatureInformationOptions{ + DocumentationFormat: &[]lsproto.MarkupKind{lsproto.MarkupKindMarkdown, lsproto.MarkupKindPlainText}, + ParameterInformation: &lsproto.ClientSignatureParameterInformationOptions{ + LabelOffsetSupport: ptrTrue, + }, + ActiveParameterSupport: ptrTrue, + }, + ContextSupport: ptrTrue, + } + defaultDocumentSymbolCapabilities = &lsproto.DocumentSymbolClientCapabilities{ + HierarchicalDocumentSymbolSupport: ptrTrue, + } ) func getCapabilitiesWithDefaults(capabilities *lsproto.ClientCapabilities) *lsproto.ClientCapabilities { @@ -536,16 +549,10 @@ func getCapabilitiesWithDefaults(capabilities *lsproto.ClientCapabilities) *lspr capabilitiesWithDefaults.TextDocument.Hover = defaultHoverCapabilities } if capabilitiesWithDefaults.TextDocument.SignatureHelp == nil { - capabilitiesWithDefaults.TextDocument.SignatureHelp = &lsproto.SignatureHelpClientCapabilities{ - SignatureInformation: &lsproto.ClientSignatureInformationOptions{ - DocumentationFormat: &[]lsproto.MarkupKind{lsproto.MarkupKindMarkdown, lsproto.MarkupKindPlainText}, - ParameterInformation: &lsproto.ClientSignatureParameterInformationOptions{ - LabelOffsetSupport: ptrTrue, - }, - ActiveParameterSupport: ptrTrue, - }, - ContextSupport: ptrTrue, - } + capabilitiesWithDefaults.TextDocument.SignatureHelp = defaultSignatureHelpCapabilities + } + if capabilitiesWithDefaults.TextDocument.DocumentSymbol == nil { + capabilitiesWithDefaults.TextDocument.DocumentSymbol = defaultDocumentSymbolCapabilities } return &capabilitiesWithDefaults } @@ -1173,9 +1180,10 @@ func ignorePaths(paths ...string) cmp.Option { } var ( - completionIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data") - autoImportIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data", ".LabelDetails", ".Detail", ".AdditionalTextEdits") - diagnosticsIgnoreOpts = ignorePaths(".Severity", ".Source", ".RelatedInformation") + completionIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data") + autoImportIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data", ".LabelDetails", ".Detail", ".AdditionalTextEdits") + diagnosticsIgnoreOpts = ignorePaths(".Severity", ".Source", ".RelatedInformation") + stradaDocumentSymbolIgnoreOpts = ignorePaths(".Detail", ".Tags", ".Deprecated", ".Range", ".SelectionRange") ) func (f *FourslashTest) verifyCompletionItem(t *testing.T, prefix string, actual *lsproto.CompletionItem, expected *lsproto.CompletionItem) { @@ -3665,3 +3673,20 @@ func verifyIncludesSymbols( assertDeepEqual(t, actualSym, sym, fmt.Sprintf("%s: Symbol '%s' at location '%v' mismatch", prefix, sym.Name, sym.Location)) } } + +// `verify.navigationTree` in Strada. +func (f *FourslashTest) VerifyStradaDocumentSymbol(t *testing.T, expected []*lsproto.DocumentSymbol) { + params := &lsproto.DocumentSymbolParams{ + TextDocument: lsproto.TextDocumentIdentifier{ + Uri: lsconv.FileNameToDocumentURI(f.activeFilename), + }, + } + result := sendRequest(t, f, lsproto.TextDocumentDocumentSymbolInfo, params) + if result.DocumentSymbols == nil { + if len(expected) != 0 { + t.Fatalf("Expected non-nil document symbols array from document symbol request") + } + return + } + assertDeepEqual(t, *result.DocumentSymbols, expected, "Document symbols mismatch", stradaDocumentSymbolIgnoreOpts) +} diff --git a/internal/fourslash/tests/gen/getNavigationBarItems_test.go b/internal/fourslash/tests/gen/getNavigationBarItems_test.go new file mode 100644 index 0000000000..756ed1619e --- /dev/null +++ b/internal/fourslash/tests/gen/getNavigationBarItems_test.go @@ -0,0 +1,39 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGetNavigationBarItems(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class C { + foo; + ["bar"]: string; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "C", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "[\"bar\"]", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "foo", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go b/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go new file mode 100644 index 0000000000..d6fffc98b0 --- /dev/null +++ b/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go @@ -0,0 +1,48 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestJsdocTypedefTagNavigateTo(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowNonTsExtensions: true +// @Filename: jsDocTypedef_form2.js + +/** @typedef {(string | number)} NumberLike */ +/** @typedef {(string | number | string[])} */ +var NumberLike2; + +/** @type {/*1*/NumberLike} */ +var numberLike;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.MarkTestAsStradaServer() + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "numberLike", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "NumberLike", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "NumberLike2", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "NumberLike2", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navbar01_test.go b/internal/fourslash/tests/gen/navbar01_test.go new file mode 100644 index 0000000000..20300a8d7c --- /dev/null +++ b/internal/fourslash/tests/gen/navbar01_test.go @@ -0,0 +1,171 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavbar01(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// Interface +interface IPoint { + getDist(): number; + new(): IPoint; + (): any; + [x:string]: number; + prop: string; +} + +/// Module +module Shapes { + // Class + export class Point implements IPoint { + constructor (public x: number, public y: number) { } + + // Instance member + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } + + // Getter + get value(): number { return 0; } + + // Setter + set value(newValue: number) { return; } + + // Static member + static origin = new Point(0, 0); + + // Static method + private static getOrigin() { return Point.origin;} + } + + enum Values { value1, value2, value3 } +} + +// Local variables +var p: IPoint = new Shapes.Point(3, 4); +var dist = p.getDist();` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.MarkTestAsStradaServer() + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "dist", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "IPoint", + Kind: lsproto.SymbolKindInterface, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "()", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "new()", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "[]", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "getDist", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "prop", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "p", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "Shapes", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Point", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "getDist", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "getOrigin", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "origin", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "value", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "value", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "Values", + Kind: lsproto.SymbolKindEnum, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "value1", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + { + Name: "value2", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + { + Name: "value3", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go b/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go new file mode 100644 index 0000000000..1a2b6384ff --- /dev/null +++ b/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go @@ -0,0 +1,39 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavbarNestedCommonJsExports(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: /a.js +exports.a = exports.b = exports.c = 0;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navbar_const_test.go b/internal/fourslash/tests/gen/navbar_const_test.go new file mode 100644 index 0000000000..9370f12bda --- /dev/null +++ b/internal/fourslash/tests/gen/navbar_const_test.go @@ -0,0 +1,24 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavbar_const(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `const c = 0;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go b/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go new file mode 100644 index 0000000000..607f234f3b --- /dev/null +++ b/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go @@ -0,0 +1,112 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavbar_contains_no_duplicates(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `declare module Windows { + export module Foundation { + export var A; + export class Test { + public wow(); + } + } +} + +declare module Windows { + export module Foundation { + export var B; + export module Test { + export function Boom(): number; + } + } +} + +class ABC { + public foo() { + return 3; + } +} + +module ABC { + export var x = 3; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "ABC", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "foo", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "ABC", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "Windows", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Foundation", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "B", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "Test", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "wow", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "Test", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Boom", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navbar_exportDefault_test.go b/internal/fourslash/tests/gen/navbar_exportDefault_test.go new file mode 100644 index 0000000000..4669c5f8cf --- /dev/null +++ b/internal/fourslash/tests/gen/navbar_exportDefault_test.go @@ -0,0 +1,56 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavbar_exportDefault(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: a.ts +export default class { } +// @Filename: b.ts +export default class C { } +// @Filename: c.ts +export default function { } +// @Filename: d.ts +export default function Func { }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "a.ts") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "default", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) + f.GoToFile(t, "b.ts") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "C", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) + f.GoToFile(t, "c.ts") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "default", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }) + f.GoToFile(t, "d.ts") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Func", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navbar_let_test.go b/internal/fourslash/tests/gen/navbar_let_test.go new file mode 100644 index 0000000000..e8bed9a1f2 --- /dev/null +++ b/internal/fourslash/tests/gen/navbar_let_test.go @@ -0,0 +1,24 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavbar_let(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `let c = 0;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go new file mode 100644 index 0000000000..6bd6fbd3c4 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go @@ -0,0 +1,52 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarAnonymousClassAndFunctionExpressions2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `console.log(console.log(class Y {}, class X {}), console.log(class B {}, class A {})); +console.log(class Cls { meth() {} });` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "B", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "Cls", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "meth", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "X", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "Y", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go new file mode 100644 index 0000000000..6a2428adaf --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go @@ -0,0 +1,60 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarAnonymousClassAndFunctionExpressions3(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `describe('foo', () => { + test(` + "`" + `a ${1} b ${2}` + "`" + `, () => {}) +}) + +const a = 1; +const b = 2; +describe('foo', () => { + test(` + "`" + `a ${a} b {b}` + "`" + `, () => {}) +})` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "describe('foo') callback", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "test(`a ${1} b ${2}`) callback", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + { + Name: "describe('foo') callback", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "test(`a ${a} b {b}`) callback", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go new file mode 100644 index 0000000000..a48be8768e --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go @@ -0,0 +1,137 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarAnonymousClassAndFunctionExpressions(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `global.cls = class { }; +(function() { + const x = () => { + // Presence of inner function causes x to be a top-level function. + function xx() {} + }; + const y = { + // This is not a top-level function (contains nothing, but shows up in childItems of its parent.) + foo: function() {} + }; + (function nest() { + function moreNest() {} + })(); +})(); +(function() { // Different anonymous functions are not merged + // These will only show up as childItems. + function z() {} + console.log(function() {}) + describe("this", 'function', ` + "`" + `is a function` + "`" + `, ` + "`" + `with template literal ${"a"}` + "`" + `, () => {}); + [].map(() => {}); +}) +(function classes() { + // Classes show up in top-level regardless of whether they have names or inner declarations. + const cls2 = class { }; + console.log(class cls3 {}); + (class { }); +})` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "nest", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "moreNest", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "xx", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + { + Name: "y", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "foo", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }), + }, + { + Name: "", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "console.log() callback", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "describe(\"this\", 'function', `is a function`, `with template literal ${\"a\"}`) callback", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "map() callback", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "z", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + { + Name: "classes", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "cls2", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "cls3", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }), + }, + { + Name: "cls", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go b/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go new file mode 100644 index 0000000000..c4a324c947 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go @@ -0,0 +1,46 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarAssignmentTypes(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `'use strict' +const a = { + ...b, + c, + d: 0 +};` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "b", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "d", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go b/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go new file mode 100644 index 0000000000..796943780b --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go @@ -0,0 +1,35 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarClassStaticBlock(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class C { + static { + let x; + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "C", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go b/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go new file mode 100644 index 0000000000..4cd9979185 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go @@ -0,0 +1,41 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarComputedPropertyName(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function F(key, value) { + return { + [key]: value, + "prop": true + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "F", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "[key]", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "\"prop\"", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go b/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go new file mode 100644 index 0000000000..a0ef075c9b --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go @@ -0,0 +1,64 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionIndirectlyInVariableDeclaration(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `var a = { + propA: function() { + var c; + } +}; +var b; +b = { + propB: function() { + // function must not have an empty body to appear top level + var d; + } +};` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "propA", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }), + }, + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "propB", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "d", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go b/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go new file mode 100644 index 0000000000..88b4b4e912 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go @@ -0,0 +1,63 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionLikePropertyAssignments(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `var functions = { + a: 0, + b: function () { }, + c: function x() { }, + d: () => { }, + e: y(), + f() { } +};` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "functions", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "d", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "e", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "f", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototype2_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototype2_test.go new file mode 100644 index 0000000000..1d640cc95d --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarFunctionPrototype2_test.go @@ -0,0 +1,44 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototype2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.js +A.prototype.a = function() { }; +A.prototype.b = function() { }; +function A() {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototype3_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototype3_test.go new file mode 100644 index 0000000000..9d2568cafd --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarFunctionPrototype3_test.go @@ -0,0 +1,44 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototype3(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.js +var A; +A.prototype.a = function() { }; +A.b = function() { };` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "a", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeBroken_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeBroken_test.go new file mode 100644 index 0000000000..8139e28d9b --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeBroken_test.go @@ -0,0 +1,64 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototypeBroken(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.js +function A() {} +A. // Started typing something here +A.prototype.a = function() { }; +G. // Started typing something here +A.prototype.a = function() { };` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "G", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }), + }, + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "A", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeInterlaced_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeInterlaced_test.go new file mode 100644 index 0000000000..ebed818319 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeInterlaced_test.go @@ -0,0 +1,70 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototypeInterlaced(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.js +var b = 1; +function A() {}; +A.prototype.a = function() { }; +A.b = function() { }; +b = 2 +/* Comment */ +A.prototype.c = function() { } +var b = 2 +A.prototype.d = function() { }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "a", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "d", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeNested_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeNested_test.go new file mode 100644 index 0000000000..c9313c26c0 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeNested_test.go @@ -0,0 +1,82 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototypeNested(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.js +function A() {} +A.B = function () { } +A.B.prototype.d = function () { } +Object.defineProperty(A.B.prototype, "x", { + get() {} +}) +A.prototype.D = function () { } +A.prototype.D.prototype.d = function () { } ` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "B", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "d", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "get", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }), + }, + { + Name: "D", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "d", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototype_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototype_test.go new file mode 100644 index 0000000000..e5e5a5d6ed --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarFunctionPrototype_test.go @@ -0,0 +1,92 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototype(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.js +function f() {} +f.prototype.x = 0; +f.y = 0; +f.prototype.method = function () {}; +Object.defineProperty(f, 'staticProp', { + set: function() {}, + get: function(){ + } +}); +Object.defineProperty(f.prototype, 'name', { + set: function() {}, + get: function(){ + } +}); ` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "f", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "method", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "staticProp", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "get", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "set", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "name", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "get", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "set", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go b/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go new file mode 100644 index 0000000000..8220b3cd35 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go @@ -0,0 +1,48 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarGetterAndSetter(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class X { + get x() {} + set x(value) { + // Inner declaration should make the setter top-level. + function f() {} + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "X", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "f", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarImports_test.go b/internal/fourslash/tests/gen/navigationBarImports_test.go new file mode 100644 index 0000000000..a4886c845f --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarImports_test.go @@ -0,0 +1,41 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarImports(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `import a, {b} from "m"; +import c = require("m"); +import * as d from "m";` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "d", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go b/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go new file mode 100644 index 0000000000..ed9c45effd --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go @@ -0,0 +1,62 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarInitializerSpans(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// get the name for the navbar from the variable name rather than the function name +const [|[|x|] = () => { var [|a|]; }|]; +const [|[|f|] = function f() { var [|b|]; }|]; +const [|[|y|] = { [|[|z|]: function z() { var [|c|]; }|] }|];` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "f", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "y", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "z", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go b/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go new file mode 100644 index 0000000000..6dbbba5bf9 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go @@ -0,0 +1,61 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsBindingPatternsInConstructor(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class A { + x: any + constructor([a]: any) { + } +} +class B { + x: any; + constructor( {a} = { a: 1 }) { + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "B", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go b/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go new file mode 100644 index 0000000000..0a41f38895 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go @@ -0,0 +1,85 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsBindingPatterns(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `'use strict' +var foo, {} +var bar, [] +let foo1, {a, b} +const bar1, [c, d] +var {e, x: [f, g]} = {a:1, x:[]}; +var { h: i = function j() {} } = obj;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "bar", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "bar1", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "d", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "e", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "f", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "foo", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "foo1", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "g", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "i", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go new file mode 100644 index 0000000000..dd414cd28e --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go @@ -0,0 +1,30 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsClass1(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function Foo() {} +class Foo {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go new file mode 100644 index 0000000000..35e3fbe08a --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go @@ -0,0 +1,30 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsClass2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class Foo {} +function Foo() {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go new file mode 100644 index 0000000000..7a89d26b66 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go @@ -0,0 +1,32 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsClass3(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @filename: /foo.js +function Foo() {} +class Foo {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go new file mode 100644 index 0000000000..88e5b74ea5 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go @@ -0,0 +1,32 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsClass4(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @filename: /foo.js +class Foo {} +function Foo() {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go new file mode 100644 index 0000000000..4748c94de4 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go @@ -0,0 +1,30 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsClass5(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class Foo {} +let Foo = 1;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go new file mode 100644 index 0000000000..fb8c2d9702 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go @@ -0,0 +1,45 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsClass6(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function Z() { } + +Z.foo = 42 + +class Z { }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Z", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "foo", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "Z", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go b/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go new file mode 100644 index 0000000000..e3b00858c8 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go @@ -0,0 +1,83 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsComputedNames(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `const enum E { + A = 'A', +} +const a = ''; + +class C { + [a]() { + return 1; + } + + [E.A]() { + return 1; + } + + [1]() { + return 1; + }, + + ["foo"]() { + return 1; + }, +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "C", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "[a]", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "[E.A]", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "[1]", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "[\"foo\"]", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "E", + Kind: lsproto.SymbolKindEnum, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go new file mode 100644 index 0000000000..dfe2d08b6e --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go @@ -0,0 +1,34 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsEmptyConstructors(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class Test { + constructor() { + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Test", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsExports_test.go b/internal/fourslash/tests/gen/navigationBarItemsExports_test.go new file mode 100644 index 0000000000..6211bed92e --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsExports_test.go @@ -0,0 +1,40 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsExports(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `export { a } from "a"; + +export { b as B } from "a" + +export import e = require("a"); + +export * from "a"; // no bindings here` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "B", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "e", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go new file mode 100644 index 0000000000..1fdb3d8b95 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go @@ -0,0 +1,40 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsFunctionProperties(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `(function(){ +var A; +A/*1*/ +.a = function() { }; +})();` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "A", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go new file mode 100644 index 0000000000..f5f042e62e --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go @@ -0,0 +1,39 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsFunctionsBroken2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function; +function f() { + function; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "f", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go new file mode 100644 index 0000000000..15f54d097d --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go @@ -0,0 +1,33 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsFunctionsBroken(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function f() { + function; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "f", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go new file mode 100644 index 0000000000..5b63cfbb26 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go @@ -0,0 +1,84 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsFunctions(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function foo() { + var x = 10; + function bar() { + var y = 10; + function biz() { + var z = 10; + } + function qux() { + // A function with an empty body should not be top level + } + } +} + +function baz() { + var v = 10; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "baz", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "v", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "foo", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "bar", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "biz", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "z", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "qux", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsImports_test.go b/internal/fourslash/tests/gen/navigationBarItemsImports_test.go new file mode 100644 index 0000000000..b607dc06ee --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsImports_test.go @@ -0,0 +1,69 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsImports(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `import d1 from "a"; + +import { a } from "a"; + +import { b as B } from "a" + +import d2, { c, d as D } from "a" + +import e = require("a"); + +import * as ns from "a";` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "B", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "D", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "d1", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "d2", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "e", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "ns", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go new file mode 100644 index 0000000000..daa93e9829 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go @@ -0,0 +1,107 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsInsideMethodsAndConstructors(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class Class { + constructor() { + function LocalFunctionInConstructor() {} + interface LocalInterfaceInConstrcutor {} + enum LocalEnumInConstructor { LocalEnumMemberInConstructor } + } + + method() { + function LocalFunctionInMethod() { + function LocalFunctionInLocalFunctionInMethod() {} + } + interface LocalInterfaceInMethod {} + enum LocalEnumInMethod { LocalEnumMemberInMethod } + } + + emptyMethod() { } // Non child functions method should not be duplicated +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Class", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "LocalEnumInConstructor", + Kind: lsproto.SymbolKindEnum, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "LocalEnumMemberInConstructor", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + }), + }, + { + Name: "LocalFunctionInConstructor", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "LocalInterfaceInConstrcutor", + Kind: lsproto.SymbolKindInterface, + Children: nil, + }, + }), + }, + { + Name: "emptyMethod", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "method", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "LocalEnumInMethod", + Kind: lsproto.SymbolKindEnum, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "LocalEnumMemberInMethod", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + }), + }, + { + Name: "LocalFunctionInMethod", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "LocalFunctionInLocalFunctionInMethod", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + { + Name: "LocalInterfaceInMethod", + Kind: lsproto.SymbolKindInterface, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go b/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go new file mode 100644 index 0000000000..05d7607926 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go @@ -0,0 +1,32 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsItems2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.InsertLine(t, "module A") + f.Insert(t, "export class ") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "A", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go new file mode 100644 index 0000000000..24068af808 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go @@ -0,0 +1,40 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsItemsExternalModules2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: test/file.ts +export class Bar { + public s: string; +} +export var x: number;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Bar", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "s", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go new file mode 100644 index 0000000000..f1502a3e96 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go @@ -0,0 +1,40 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsItemsExternalModules3(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: test/my fil e.ts +export class Bar { + public s: string; +} +export var x: number;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Bar", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "s", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go new file mode 100644 index 0000000000..544f7f6e75 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go @@ -0,0 +1,33 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsItemsExternalModules(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `export class Bar { + public s: string; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Bar", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "s", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go new file mode 100644 index 0000000000..4b47d7bd87 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go @@ -0,0 +1,60 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsItemsModuleVariables(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: navigationItemsModuleVariables_0.ts + /*file1*/ +module Module1 { + export var x = 0; +} +// @Filename: navigationItemsModuleVariables_1.ts + /*file2*/ +module Module1.SubModule { + export var y = 0; +} +// @Filename: navigationItemsModuleVariables_2.ts + /*file3*/ +module Module1 { + export var z = 0; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "file1") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Module1", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) + f.GoToMarker(t, "file2") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Module1.SubModule", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "y", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsItems_test.go b/internal/fourslash/tests/gen/navigationBarItemsItems_test.go new file mode 100644 index 0000000000..1c7eb2ac3c --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsItems_test.go @@ -0,0 +1,171 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsItems(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// Interface +interface IPoint { + getDist(): number; + new(): IPoint; + (): any; + [x:string]: number; + prop: string; +} + +/// Module +module Shapes { + + // Class + export class Point implements IPoint { + constructor (public x: number, public y: number) { } + + // Instance member + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } + + // Getter + get value(): number { return 0; } + + // Setter + set value(newValue: number) { return; } + + // Static member + static origin = new Point(0, 0); + + // Static method + private static getOrigin() { return Point.origin; } + } + + enum Values { value1, value2, value3 } +} + +// Local variables +var p: IPoint = new Shapes.Point(3, 4); +var dist = p.getDist();` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "dist", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "IPoint", + Kind: lsproto.SymbolKindInterface, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "()", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "new()", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "[]", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "getDist", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "prop", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "p", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "Shapes", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Point", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "getDist", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "getOrigin", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "origin", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "value", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "value", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "Values", + Kind: lsproto.SymbolKindEnum, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "value1", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + { + Name: "value2", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + { + Name: "value3", + Kind: lsproto.SymbolKindEnumMember, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go b/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go new file mode 100644 index 0000000000..c1f79ed979 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go @@ -0,0 +1,39 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsMissingName1(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `export function +class C { + foo() {} +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "C", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "foo", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go b/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go new file mode 100644 index 0000000000..f58a29f2c3 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go @@ -0,0 +1,36 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsMissingName2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `/** + * This is a class. + */ +class /* But it has no name! */ { + foo() {} +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "foo", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go b/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go new file mode 100644 index 0000000000..7671274926 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go @@ -0,0 +1,109 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsModules1(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `declare module "X.Y.Z" {} + +declare module 'X2.Y2.Z2' {} + +declare module "foo"; + +module A.B.C { + export var x; +} + +module A.B { + export var y; +} + +module A { + export var z; +} + +module A { + module B { + module C { + declare var x; + } + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "'X2.Y2.Z2'", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + { + Name: "\"foo\"", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + { + Name: "\"X.Y.Z\"", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + { + Name: "A", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "B", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "C", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }), + }, + { + Name: "z", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "A.B", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "y", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "A.B.C", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go b/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go new file mode 100644 index 0000000000..3469a02b13 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go @@ -0,0 +1,40 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsModules2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `namespace Test.A { } + +namespace Test.B { + class Foo { } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Test.A", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + { + Name: "Test.B", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go new file mode 100644 index 0000000000..49fc439842 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go @@ -0,0 +1,94 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsMultilineStringIdentifiers1(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `declare module "Multiline\r\nMadness" { +} + +declare module "Multiline\ +Madness" { +} +declare module "MultilineMadness" {} + +declare module "Multiline\ +Madness2" { +} + +interface Foo { + "a1\\\r\nb"; + "a2\ + \ + b"(): Foo; +} + +class Bar implements Foo { + 'a1\\\r\nb': Foo; + + 'a2\ + \ + b'(): Foo { + return this; + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "\"MultilineMadness\"", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + { + Name: "\"MultilineMadness2\"", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + { + Name: "\"Multiline\\r\\nMadness\"", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + { + Name: "Bar", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "'a1\\\\\\r\\nb'", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "'a2 b'", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "Foo", + Kind: lsproto.SymbolKindInterface, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "\"a1\\\\\\r\\nb\"", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "\"a2 b\"", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go new file mode 100644 index 0000000000..fdb369a9eb --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go @@ -0,0 +1,63 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsMultilineStringIdentifiers2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function f(p1: () => any, p2: string) { } +f(() => { }, ` + "`" + `line1\ +line2\ +line3` + "`" + `); + +class c1 { + const a = ' ''line1\ + line2'; +} + +f(() => { }, ` + "`" + `unterminated backtick 1 +unterminated backtick 2 +unterminated backtick 3` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "c1", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "'line1 line2'", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "f", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "f(`line1line2line3`) callback", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "f(`unterminated backtick 1unterminated backtick 2unterminated backtick 3) callback", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go new file mode 100644 index 0000000000..e53a85322b --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go @@ -0,0 +1,30 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsMultilineStringIdentifiers3(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `declare module 'MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters' { }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "'MoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharacter...", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go b/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go new file mode 100644 index 0000000000..0988927130 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go @@ -0,0 +1,42 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsNamedArrowFunctions(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `export const value = 2; +export const func = () => 2; +export const func2 = function() { }; +export function exportedFunction() { }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "exportedFunction", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "func", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "func2", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "value", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go new file mode 100644 index 0000000000..0a3020e912 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go @@ -0,0 +1,56 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsPropertiesDefinedInConstructors(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class List { + constructor(public a: boolean, private b: T, readonly c: string, d: number) { + var local = 0; + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "List", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "local", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "a", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go b/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go new file mode 100644 index 0000000000..3c8d94ea48 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go @@ -0,0 +1,39 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsStaticAndNonStaticNoMerge(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class C { + static x; + x; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "C", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go new file mode 100644 index 0000000000..44c280a00b --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go @@ -0,0 +1,45 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsSymbols1(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class C { + [Symbol.isRegExp] = 0; + [Symbol.iterator]() { } + get [Symbol.isConcatSpreadable]() { } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "C", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "[Symbol.isRegExp]", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "[Symbol.iterator]", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "[Symbol.isConcatSpreadable]", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go new file mode 100644 index 0000000000..ce8a66af37 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go @@ -0,0 +1,39 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsSymbols2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `interface I { + [Symbol.isRegExp]: string; + [Symbol.iterator](): string; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "I", + Kind: lsproto.SymbolKindInterface, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "[Symbol.isRegExp]", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "[Symbol.iterator]", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go new file mode 100644 index 0000000000..ff0f246891 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go @@ -0,0 +1,27 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsSymbols3(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `enum E { + // No nav bar entry for this + [Symbol.isRegExp] = 0 +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "E", + Kind: lsproto.SymbolKindEnum, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go new file mode 100644 index 0000000000..43178def91 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go @@ -0,0 +1,64 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsSymbols4(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @checkJs: true +// @allowJs: true +// @target: es6 +// @Filename: file.js +const _sym = Symbol("_sym"); +class MyClass { + constructor() { + // Dynamic assignment properties can't show up in navigation, + // as they're not syntactic members + // Additonally, late bound members are always filtered out, besides + this[_sym] = "ok"; + } + + method() { + this[_sym] = "yep"; + const x = this[_sym]; + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "_sym", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "MyClass", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "method", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go b/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go new file mode 100644 index 0000000000..d19b289877 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go @@ -0,0 +1,24 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarItemsTypeAlias(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `type T = number | string;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "T", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go b/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go new file mode 100644 index 0000000000..daa2a5be33 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go @@ -0,0 +1,25 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarJsDocCommentWithNoTags(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `/** Test */ +export const Test = {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "Test", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarJsDoc_test.go b/internal/fourslash/tests/gen/navigationBarJsDoc_test.go new file mode 100644 index 0000000000..6d0fa83b95 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarJsDoc_test.go @@ -0,0 +1,37 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarJsDoc(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.js +/** @typedef {(number|string)} NumberLike */ +/** @typedef {(string|number)} */ +const x = 0;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "NumberLike", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "x", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go b/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go new file mode 100644 index 0000000000..f57f90f6fe --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go @@ -0,0 +1,56 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarMerging_grandchildren(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// Should not merge grandchildren with property assignments +const o = { + a: { + m() {}, + }, + b: { + m() {}, + }, +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "o", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "m", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "b", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "m", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarMerging_test.go b/internal/fourslash/tests/gen/navigationBarMerging_test.go new file mode 100644 index 0000000000..179c4880b2 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarMerging_test.go @@ -0,0 +1,136 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarMerging(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: file1.ts +module a { + function foo() {} +} +module b { + function foo() {} +} +module a { + function bar() {} +} +// @Filename: file2.ts +module a {} +function a() {} +// @Filename: file3.ts +module a { + interface A { + foo: number; + } +} +module a { + interface A { + bar: number; + } +} +// @Filename: file4.ts +module A { export var x; } +module A.B { export var y; }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "bar", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "foo", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + { + Name: "b", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "foo", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }) + f.GoToFile(t, "file2.ts") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "a", + Kind: lsproto.SymbolKindModule, + Children: nil, + }, + }) + f.GoToFile(t, "file3.ts") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindInterface, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "bar", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "foo", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }), + }, + }) + f.GoToFile(t, "file4.ts") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + { + Name: "A.B", + Kind: lsproto.SymbolKindModule, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "y", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go b/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go new file mode 100644 index 0000000000..5bfdf1b03b --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go @@ -0,0 +1,24 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarNamespaceImportWithNoName(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `import *{} from 'foo';` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go b/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go new file mode 100644 index 0000000000..9df0e23f07 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go @@ -0,0 +1,81 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarNestedObjectLiterals(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `var a = { + b: 0, + c: {}, + d: { + e: 1, + }, + f: { + g: 2, + h: { + i: 3, + }, + }, +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "b", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "d", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "e", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "f", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "g", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "h", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "i", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go b/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go new file mode 100644 index 0000000000..3a4a4b7591 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go @@ -0,0 +1,58 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarPrivateNameMethod(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class A { + #foo() { + class B { + #bar() { + function baz () { + } + } + } + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "#foo", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "B", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "#bar", + Kind: lsproto.SymbolKindMethod, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "baz", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }), + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarPrivateName_test.go b/internal/fourslash/tests/gen/navigationBarPrivateName_test.go new file mode 100644 index 0000000000..7481540865 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarPrivateName_test.go @@ -0,0 +1,56 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarPrivateName(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class A { + #foo: () => { + class B { + #bar: () => { + function baz () { + } + } + } + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "#foo", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "B", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "#bar", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "baz", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go b/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go new file mode 100644 index 0000000000..d911777065 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go @@ -0,0 +1,161 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarPropertyDeclarations(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class A { + public A1 = class { + public x = 1; + private y() {} + protected z() {} + } + + public A2 = { + x: 1, + y() {}, + z() {} + } + + public A3 = function () {} + public A4 = () => {} + public A5 = 1; + public A6 = "A6"; + + public ["A7"] = class { + public x = 1; + private y() {} + protected z() {} + } + + public [1] = { + x: 1, + y() {}, + z() {} + } + + public [1 + 1] = 1; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "A", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "[1]", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "z", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "A1", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "z", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "A2", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "z", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + { + Name: "A3", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "A4", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "A5", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "A6", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "[\"A7\"]", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + { + Name: "z", + Kind: lsproto.SymbolKindMethod, + Children: nil, + }, + }), + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarVariables_test.go b/internal/fourslash/tests/gen/navigationBarVariables_test.go new file mode 100644 index 0000000000..a006310e95 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarVariables_test.go @@ -0,0 +1,58 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarVariables(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `var x = 0; +let y = 1; +const z = 2; +// @Filename: file2.ts +var {a} = 0; +let {a: b} = 0; +const [c] = 0;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "z", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) + f.GoToFile(t, "file2.ts") + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go b/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go new file mode 100644 index 0000000000..e7df5d2d9c --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go @@ -0,0 +1,37 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarWellKnownSymbolExpando(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function f() {} +f[Symbol.iterator] = function() {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "f", + Kind: lsproto.SymbolKindClass, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "constructor", + Kind: lsproto.SymbolKindConstructor, + Children: nil, + }, + { + Name: "[Symbol.iterator]", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go b/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go new file mode 100644 index 0000000000..8ac264d7b0 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go @@ -0,0 +1,34 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarWithLocalVariables(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `function x(){ + const x = Object() + x.foo = "" +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }), + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go b/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go new file mode 100644 index 0000000000..b14a91ea90 --- /dev/null +++ b/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go @@ -0,0 +1,161 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationItemsExportDefaultExpression(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `export default function () {} +export default function () { + return class Foo { + } +} + +export default () => "" +export default () => { + return class Foo { + } +} + +export default function f1() {} +export default function f2() { + return class Foo { + } +} + +const abc = 12; +export default abc; +export default class AB {} +export default { + a: 1, + b: 1, + c: { + d: 1 + } +} + +function foo(props: { x: number; y: number }) {} +export default foo({ x: 1, y: 1 });` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "default", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "default", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }), + }, + { + Name: "default", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "default", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }), + }, + { + Name: "default", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "d", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }), + }, + { + Name: "default", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "x", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "y", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + { + Name: "AB", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "abc", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "default", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "f1", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "f2", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }), + }, + { + Name: "foo", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + }) +} diff --git a/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go b/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go new file mode 100644 index 0000000000..f138c9a9ff --- /dev/null +++ b/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go @@ -0,0 +1,137 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationItemsExportEqualsExpression(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `export = function () {} +export = function () { + return class Foo { + } +} + +export = () => "" +export = () => { + return class Foo { + } +} + +export = function f1() {} +export = function f2() { + return class Foo { + } +} + +const abc = 12; +export = abc; +export = class AB {} +export = { + a: 1, + b: 1, + c: { + d: 1 + } +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ + { + Name: "export=", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "export=", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }), + }, + { + Name: "export=", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "export=", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }), + }, + { + Name: "export=", + Kind: lsproto.SymbolKindFunction, + Children: nil, + }, + { + Name: "export=", + Kind: lsproto.SymbolKindFunction, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "Foo", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + }), + }, + { + Name: "export=", + Kind: lsproto.SymbolKindClass, + Children: nil, + }, + { + Name: "export=", + Kind: lsproto.SymbolKindVariable, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "a", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "b", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + { + Name: "c", + Kind: lsproto.SymbolKindProperty, + Children: PtrTo([]*lsproto.DocumentSymbol{ + { + Name: "d", + Kind: lsproto.SymbolKindProperty, + Children: nil, + }, + }), + }, + }), + }, + { + Name: "abc", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + { + Name: "export=", + Kind: lsproto.SymbolKindVariable, + Children: nil, + }, + }) +} From dba5ecd44fed17991637ca8071cb538c5ecac85c Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 3 Dec 2025 10:29:29 -0800 Subject: [PATCH 02/10] bunch of doc symbol fixes --- .../fourslash/_scripts/convertFourslash.mts | 4 +- internal/fourslash/fourslash.go | 75 ++++- internal/fourslash/tests/gen/navbar01_test.go | 2 +- .../gen/navbar_contains-no-duplicates_test.go | 8 +- .../gen/navigationBarItemsItems2_test.go | 2 +- ...gationBarItemsItemsModuleVariables_test.go | 4 +- .../tests/gen/navigationBarItemsItems_test.go | 2 +- .../gen/navigationBarItemsModules1_test.go | 16 +- .../gen/navigationBarItemsModules2_test.go | 4 +- ...arItemsMultilineStringIdentifiers1_test.go | 6 +- ...arItemsMultilineStringIdentifiers3_test.go | 2 +- .../tests/gen/navigationBarMerging_test.go | 12 +- internal/ls/symbols.go | 277 +++++++++++++++++- internal/stringutil/util.go | 17 ++ 14 files changed, 384 insertions(+), 47 deletions(-) diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts index 21d3908996..f5f3eda259 100644 --- a/internal/fourslash/_scripts/convertFourslash.mts +++ b/internal/fourslash/_scripts/convertFourslash.mts @@ -2459,7 +2459,7 @@ function getSymbolKindWorker(kind: string): string { case "script": return "SymbolKindFile"; case "module": - return "SymbolKindModule"; + return "SymbolKindNamespace"; case "class": case "local class": return "SymbolKindClass"; @@ -2507,6 +2507,8 @@ function getSymbolKindWorker(kind: string): string { return "SymbolKindModule"; case "string": return "SymbolKindString"; + case "type": + return "SymbolKindInterface"; default: return "SymbolKindVariable"; } diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 9e9e170ca7..b8936a11c9 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -167,6 +167,7 @@ func NewFourslash(t *testing.T, capabilities *lsproto.ClientCapabilities, conten testfs[filePath] = vfstest.Symlink(tspath.GetNormalizedAbsolutePath(target, rootDir)) } + // !!! use default compiler options for inferred project as base compilerOptions := &core.CompilerOptions{ SkipDefaultLibCheck: core.TSTrue, } @@ -1183,7 +1184,7 @@ var ( completionIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data") autoImportIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data", ".LabelDetails", ".Detail", ".AdditionalTextEdits") diagnosticsIgnoreOpts = ignorePaths(".Severity", ".Source", ".RelatedInformation") - stradaDocumentSymbolIgnoreOpts = ignorePaths(".Detail", ".Tags", ".Deprecated", ".Range", ".SelectionRange") + stradaDocumentSymbolIgnoreOpts = ignorePaths(".Detail", ".Tags", ".Deprecated", ".Range", ".SelectionRange", ".Children") ) func (f *FourslashTest) verifyCompletionItem(t *testing.T, prefix string, actual *lsproto.CompletionItem, expected *lsproto.CompletionItem) { @@ -2997,7 +2998,7 @@ func (f *FourslashTest) getCurrentPositionPrefix() string { if f.lastKnownMarkerName != nil { return fmt.Sprintf("At marker '%s': ", *f.lastKnownMarkerName) } - return fmt.Sprintf("At position (Ln %d, Col %d): ", f.currentCaretPosition.Line, f.currentCaretPosition.Character) + return fmt.Sprintf("At position %s(Ln %d, Col %d): ", f.activeFilename, f.currentCaretPosition.Line, f.currentCaretPosition.Character) } func (f *FourslashTest) BaselineAutoImportsCompletions(t *testing.T, markerNames []string) { @@ -3688,5 +3689,73 @@ func (f *FourslashTest) VerifyStradaDocumentSymbol(t *testing.T, expected []*lsp } return } - assertDeepEqual(t, *result.DocumentSymbols, expected, "Document symbols mismatch", stradaDocumentSymbolIgnoreOpts) + assertDocumentSymbolsAreEqual( + t, + *result.DocumentSymbols, + expected, + fmt.Sprintf("At file %s: Document symbols mismatch", f.activeFilename), + ) +} + +func assertDocumentSymbolsAreEqual( + t *testing.T, + actual []*lsproto.DocumentSymbol, + expected []*lsproto.DocumentSymbol, + prefix string, +) { + slices.SortFunc(actual, compareDocumentSymbols) + slices.SortFunc(expected, compareDocumentSymbols) + if len(actual) != len(expected) { + t.Fatalf( + "%s: Expected %d document symbols, but got %d:\n%s", + prefix, + len(expected), + len(actual), + cmp.Diff( + core.Map(actual, func(d *lsproto.DocumentSymbol) string { return d.Name }), + core.Map(expected, func(d *lsproto.DocumentSymbol) string { return d.Name }), + ), + ) + } + for i := range actual { + assertDocumentSymbolIsEqual(t, actual[i], expected[i], prefix) + } +} + +func compareDocumentSymbols(d1, d2 *lsproto.DocumentSymbol) int { + c := stringutil.CompareStringsCaseInsensitive(d1.Name, d2.Name) + if c != 0 { + return c + } + c = strings.Compare(d2.Name, d1.Name) + if c != 0 { + return c + } + c = lsproto.CompareRanges(&d1.Range, &d2.Range) + return c +} + +func assertDocumentSymbolIsEqual( + t *testing.T, + actual *lsproto.DocumentSymbol, + expected *lsproto.DocumentSymbol, + prefix string, +) { + assertDeepEqual(t, actual, expected, prefix, stradaDocumentSymbolIgnoreOpts) + if actual.Children != nil && len(*actual.Children) > 0 || expected.Children != nil && len(*expected.Children) > 0 { + var actualChildren []*lsproto.DocumentSymbol + var expectedChildren []*lsproto.DocumentSymbol + if actual.Children != nil { + actualChildren = *actual.Children + } + if expected.Children != nil { + expectedChildren = *expected.Children + } + assertDocumentSymbolsAreEqual( + t, + actualChildren, + expectedChildren, + prefix+" (in children of symbol "+actual.Name+")", + ) + } } diff --git a/internal/fourslash/tests/gen/navbar01_test.go b/internal/fourslash/tests/gen/navbar01_test.go index 20300a8d7c..67b1f19811 100644 --- a/internal/fourslash/tests/gen/navbar01_test.go +++ b/internal/fourslash/tests/gen/navbar01_test.go @@ -96,7 +96,7 @@ var dist = p.getDist();` }, { Name: "Shapes", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "Point", diff --git a/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go b/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go index 607f234f3b..1abc6fb8a2 100644 --- a/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go +++ b/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go @@ -55,7 +55,7 @@ module ABC { }, { Name: "ABC", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "x", @@ -66,11 +66,11 @@ module ABC { }, { Name: "Windows", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "Foundation", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "A", @@ -95,7 +95,7 @@ module ABC { }, { Name: "Test", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "Boom", diff --git a/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go b/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go index 05d7607926..e50375dee3 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go @@ -25,7 +25,7 @@ func TestNavigationBarItemsItems2(t *testing.T) { }, { Name: "A", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, }) diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go index 4b47d7bd87..2eb4030393 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go @@ -33,7 +33,7 @@ module Module1 { f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "Module1", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "x", @@ -47,7 +47,7 @@ module Module1 { f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "Module1.SubModule", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "y", diff --git a/internal/fourslash/tests/gen/navigationBarItemsItems_test.go b/internal/fourslash/tests/gen/navigationBarItemsItems_test.go index 1c7eb2ac3c..27c7fd586f 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItems_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItems_test.go @@ -96,7 +96,7 @@ var dist = p.getDist();` }, { Name: "Shapes", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "Point", diff --git a/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go b/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go index 7671274926..8eb14d35d5 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go @@ -42,30 +42,30 @@ module A { f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "'X2.Y2.Z2'", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, { Name: "\"foo\"", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, { Name: "\"X.Y.Z\"", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, { Name: "A", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "B", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "C", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "x", @@ -85,7 +85,7 @@ module A { }, { Name: "A.B", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "y", @@ -96,7 +96,7 @@ module A { }, { Name: "A.B.C", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "x", diff --git a/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go b/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go index 3469a02b13..7d03600293 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go @@ -22,12 +22,12 @@ namespace Test.B { f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "Test.A", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, { Name: "Test.B", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "Foo", diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go index 49fc439842..273957b9cd 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go @@ -45,17 +45,17 @@ class Bar implements Foo { f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "\"MultilineMadness\"", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, { Name: "\"MultilineMadness2\"", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, { Name: "\"Multiline\\r\\nMadness\"", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, { diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go index e53a85322b..6f6d39d334 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go @@ -23,7 +23,7 @@ MoreThanOneHundredAndFiftyCharacters' { }` f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "'MoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharacter...", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, }) diff --git a/internal/fourslash/tests/gen/navigationBarMerging_test.go b/internal/fourslash/tests/gen/navigationBarMerging_test.go index 179c4880b2..9039416e33 100644 --- a/internal/fourslash/tests/gen/navigationBarMerging_test.go +++ b/internal/fourslash/tests/gen/navigationBarMerging_test.go @@ -44,7 +44,7 @@ module A.B { export var y; }` f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "a", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "bar", @@ -60,7 +60,7 @@ module A.B { export var y; }` }, { Name: "b", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "foo", @@ -79,7 +79,7 @@ module A.B { export var y; }` }, { Name: "a", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: nil, }, }) @@ -87,7 +87,7 @@ module A.B { export var y; }` f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "a", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "A", @@ -112,7 +112,7 @@ module A.B { export var y; }` f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ { Name: "A", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "x", @@ -123,7 +123,7 @@ module A.B { export var y; }` }, { Name: "A.B", - Kind: lsproto.SymbolKindModule, + Kind: lsproto.SymbolKindNamespace, Children: PtrTo([]*lsproto.DocumentSymbol{ { Name: "y", diff --git a/internal/ls/symbols.go b/internal/ls/symbols.go index 5ca7d20d5c..61c55730c1 100644 --- a/internal/ls/symbols.go +++ b/internal/ls/symbols.go @@ -9,6 +9,7 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/astnav" + "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/compiler" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/ls/lsconv" @@ -23,7 +24,7 @@ import ( func (l *LanguageService) ProvideDocumentSymbols(ctx context.Context, documentURI lsproto.DocumentUri) (lsproto.DocumentSymbolResponse, error) { _, file := l.getProgramAndFile(documentURI) if lsproto.GetClientCapabilities(ctx).TextDocument.DocumentSymbol.HierarchicalDocumentSymbolSupport { - symbols := l.getDocumentSymbolsForChildren(ctx, file.AsNode()) + symbols := l.getDocumentSymbolsForChildren(ctx, file.AsNode(), file) return lsproto.SymbolInformationsOrDocumentSymbolsOrNull{DocumentSymbols: &symbols}, nil } // Client doesn't support hierarchical document symbols, return flat SymbolInformation array @@ -38,7 +39,7 @@ func (l *LanguageService) ProvideDocumentSymbols(ctx context.Context, documentUR // getDocumentSymbolInformations converts hierarchical DocumentSymbols to a flat SymbolInformation array func (l *LanguageService) getDocumentSymbolInformations(ctx context.Context, file *ast.SourceFile, documentURI lsproto.DocumentUri) []lsproto.SymbolInformation { // First get hierarchical symbols - docSymbols := l.getDocumentSymbolsForChildren(ctx, file.AsNode()) + docSymbols := l.getDocumentSymbolsForChildren(ctx, file.AsNode(), file) // Flatten the hierarchy var result []lsproto.SymbolInformation @@ -68,10 +69,11 @@ func (l *LanguageService) getDocumentSymbolInformations(ctx context.Context, fil return result } -func (l *LanguageService) getDocumentSymbolsForChildren(ctx context.Context, node *ast.Node) []*lsproto.DocumentSymbol { +func (l *LanguageService) getDocumentSymbolsForChildren(ctx context.Context, node *ast.Node, file *ast.SourceFile) []*lsproto.DocumentSymbol { var symbols []*lsproto.DocumentSymbol + expandoTargets := collections.Set[string]{} addSymbolForNode := func(node *ast.Node, children []*lsproto.DocumentSymbol) { - if node.Flags&ast.NodeFlagsReparsed == 0 { + if node.Flags&ast.NodeFlagsReparsed == 0 || node.Kind == ast.KindJSExportAssignment { symbol := l.newDocumentSymbol(node, children) if symbol != nil { symbols = append(symbols, symbol) @@ -82,11 +84,40 @@ func (l *LanguageService) getDocumentSymbolsForChildren(ctx context.Context, nod getSymbolsForChildren := func(node *ast.Node) []*lsproto.DocumentSymbol { var result []*lsproto.DocumentSymbol if node != nil { + saveExpandoTargets := expandoTargets + expandoTargets = collections.Set[string]{} saveSymbols := symbols symbols = nil node.ForEachChild(visit) result = symbols symbols = saveSymbols + expandoTargets = saveExpandoTargets + } + return result + } + startNode := func(node *ast.Node) func() { + if node == nil { + return func() {} + } + saveExpandoTargets := expandoTargets + expandoTargets = collections.Set[string]{} + saveSymbols := symbols + symbols = nil + return func() { + result := symbols + symbols = saveSymbols + expandoTargets = saveExpandoTargets + addSymbolForNode(node, result) + } + } + getSymbolsForNode := func(node *ast.Node) []*lsproto.DocumentSymbol { + var result []*lsproto.DocumentSymbol + if node != nil { + saveSymbols := symbols + symbols = nil + visit(node) + result = symbols + symbols = saveSymbols } return result } @@ -94,13 +125,38 @@ func (l *LanguageService) getDocumentSymbolsForChildren(ctx context.Context, nod if ctx.Err() != nil { return true } + if jsdocs := node.JSDoc(file); len(jsdocs) > 0 { + for _, jsdoc := range jsdocs { + if tagList := jsdoc.AsJSDoc().Tags; tagList != nil { + for _, tag := range tagList.Nodes { + if ast.IsJSDocTypedefTag(tag) || ast.IsJSDocCallbackTag(tag) { + addSymbolForNode(tag, nil /*children*/) + } + } + } + } + } switch node.Kind { case ast.KindClassDeclaration, ast.KindClassExpression, ast.KindInterfaceDeclaration, ast.KindEnumDeclaration: + if ast.IsClassLike(node) && ast.GetDeclarationName(node) != "" { + expandoTargets.Add(ast.GetDeclarationName(node)) + } addSymbolForNode(node, getSymbolsForChildren(node)) case ast.KindModuleDeclaration: addSymbolForNode(node, getSymbolsForChildren(getInteriorModule(node))) + case ast.KindConstructor: + addSymbolForNode(node, getSymbolsForChildren(node.Body())) + for _, param := range node.Parameters() { + if ast.IsParameterPropertyDeclaration(param, node) { + addSymbolForNode(param, nil /*children*/) + } + } case ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction, ast.KindMethodDeclaration, ast.KindGetAccessor, - ast.KindSetAccessor, ast.KindConstructor: + ast.KindSetAccessor: + name := ast.GetDeclarationName(node) + if name != "" { + expandoTargets.Add(name) + } addSymbolForNode(node, getSymbolsForChildren(node.Body())) case ast.KindVariableDeclaration, ast.KindBindingElement, ast.KindPropertyAssignment, ast.KindPropertyDeclaration: name := node.Name() @@ -111,29 +167,125 @@ func (l *LanguageService) getDocumentSymbolsForChildren(ctx context.Context, nod addSymbolForNode(node, getSymbolsForChildren(node.Initializer())) } } + case ast.KindSpreadAssignment: + addSymbolForNode(node, nil /*children*/) case ast.KindMethodSignature, ast.KindPropertySignature, ast.KindCallSignature, ast.KindConstructSignature, ast.KindIndexSignature, - ast.KindEnumMember, ast.KindShorthandPropertyAssignment, ast.KindTypeAliasDeclaration: + ast.KindEnumMember, ast.KindShorthandPropertyAssignment, ast.KindTypeAliasDeclaration, ast.KindImportEqualsDeclaration, ast.KindExportSpecifier: addSymbolForNode(node, nil) + case ast.KindImportClause: + // Handle default import case e.g.: + // import d from "mod"; + if node.Name() != nil { + addSymbolForNode(node.Name(), nil /*children*/) + } + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + if namedBindings := node.AsImportClause().NamedBindings; namedBindings != nil { + if namedBindings.Kind == ast.KindNamespaceImport { + addSymbolForNode(namedBindings, nil /*children*/) + } else { + for _, element := range namedBindings.Elements() { + addSymbolForNode(element, nil /*children*/) + } + } + } + case ast.KindBinaryExpression: + binaryExpr := node.AsBinaryExpression() + assignmentKind := ast.GetAssignmentDeclarationKind(binaryExpr) + switch assignmentKind { + // `module.exports = ...`` should be reparsed into a JSExportAssignment, + // and `exports.a = ...`` into a CommonJSExport. + case ast.JSDeclarationKindNone, ast.JSDeclarationKindThisProperty, + ast.JSDeclarationKindModuleExports, ast.JSDeclarationKindExportsProperty: + node.ForEachChild(visit) + case ast.JSDeclarationKindProperty: + // `A.b = ... ` or `A.prototype.b = ...` + target := binaryExpr.Left + targetFunction := target.Expression() + if isPrototypeExpando(binaryExpr) { + targetFunction = targetFunction.Expression() + // If we see a prototype assignment, start tracking the target as an expando target. + if ast.IsIdentifier(targetFunction) { + expandoTargets.Add(targetFunction.Text()) + } + } + if ast.IsIdentifier(targetFunction) && + expandoTargets.Has(targetFunction.Text()) { + endNode := startNode(node) + addSymbolForNode(target, getSymbolsForNode(binaryExpr.Right)) + endNode() + } else { + node.ForEachChild(visit) + } + } + case ast.KindExportAssignment, ast.KindJSExportAssignment: + if node.AsExportAssignment().IsExportEquals { + addSymbolForNode(node, getSymbolsForNode(node.Expression())) + } else { + node.ForEachChild(visit) + } default: node.ForEachChild(visit) } return false } node.ForEachChild(visit) - return symbols + return mergeExpandos(symbols) } +// Binary expression is `f.prototype.prop`. +func isPrototypeExpando(binaryExpr *ast.BinaryExpression) bool { + target := binaryExpr.Left.Expression() + if ast.IsAccessExpression(target) { + accessName := ast.GetElementOrPropertyAccessName(target) + return accessName != nil && accessName.Text() == "prototype" + } + return false +} + +const maxLength = 150 + func (l *LanguageService) newDocumentSymbol(node *ast.Node, children []*lsproto.DocumentSymbol) *lsproto.DocumentSymbol { result := new(lsproto.DocumentSymbol) file := ast.GetSourceFileOfNode(node) nodeStartPos := scanner.SkipTrivia(file.Text(), node.Pos()) - name := ast.GetNameOfDeclaration(node) + var name *ast.Node + // Expando properties + if ast.IsBinaryExpression(node) { + if isPrototypeExpando(node.AsBinaryExpression()) { // `f.prototype.prop = ...` + name = node.AsBinaryExpression().Left.Expression().Expression() + } else { // `f[prop] = ...` + name = node.AsBinaryExpression().Left.Expression() + } + } else if ast.IsAccessExpression(node) { + if ast.IsPropertyAccessExpression(node) { + name = node.AsPropertyAccessExpression().Name() + } else if ast.IsElementAccessExpression(node) { + name = node.AsElementAccessExpression().ArgumentExpression + } + } else if ast.IsIdentifier(node) || ast.IsPrivateIdentifier(node) { + name = node + } else if ast.IsSpreadAssignment(node) && ast.IsIdentifier(node.Expression()) { + name = node.Expression() + } else { + name = ast.GetNameOfDeclaration(node) + } var text string var nameStartPos, nameEndPos int if ast.IsModuleDeclaration(node) && !ast.IsAmbientModule(node) { text = getModuleName(node) nameStartPos = scanner.SkipTrivia(file.Text(), name.Pos()) nameEndPos = getInteriorModule(node).Name().End() + } else if ast.IsAnyExportAssignment(node) && node.AsExportAssignment().IsExportEquals { + text = "export=" + if name != nil { + nameStartPos = scanner.SkipTrivia(file.Text(), name.Pos()) + nameEndPos = name.End() + } else { + nameStartPos = nodeStartPos + nameEndPos = node.End() + } } else if name != nil { text = getTextOfName(name) nameStartPos = max(scanner.SkipTrivia(file.Text(), name.Pos()), nodeStartPos) @@ -146,6 +298,10 @@ func (l *LanguageService) newDocumentSymbol(node *ast.Node, children []*lsproto. if text == "" { return nil } + truncatedText := stringutil.TruncateByRunes(text, maxLength) + if len(truncatedText) < len(text) { + text = truncatedText + "..." + } result.Name = text result.Kind = getSymbolKindFromNode(node) result.Range = lsproto.Range{ @@ -163,6 +319,86 @@ func (l *LanguageService) newDocumentSymbol(node *ast.Node, children []*lsproto. return result } +// Merges expando symbols into their target symbols, and namespaces of same name. +// Modifies the input slice. +func mergeExpandos(symbols []*lsproto.DocumentSymbol) []*lsproto.DocumentSymbol { + mergedSymbols := make([]*lsproto.DocumentSymbol, 0, len(symbols)) + // Collect symbols that can be an expando target. + nameToExpandoTargetIndex := collections.MultiMap[string, int]{} + // Collect namespaces. + nameToNamespaceIndex := map[string]int{} + for i, symbol := range symbols { + if isAnonymousName(symbol.Name) { + continue + } + if symbol.Kind == lsproto.SymbolKindClass || symbol.Kind == lsproto.SymbolKindFunction || symbol.Kind == lsproto.SymbolKindVariable { + nameToExpandoTargetIndex.Add(symbol.Name, i) + } + if symbol.Kind == lsproto.SymbolKindNamespace { + if _, ok := nameToNamespaceIndex[symbol.Name]; !ok { + nameToNamespaceIndex[symbol.Name] = i + } + } + } + for i, symbol := range symbols { + if symbol.Children != nil { + children := mergeExpandos(*symbol.Children) + symbol.Children = &children + } + + // Anonymous symbols never merge. + if isAnonymousName(symbol.Name) { + continue + } + + // Merge expandos. + if symbol.Kind == lsproto.SymbolKindProperty { + symbolsWithSameName := nameToExpandoTargetIndex.Get(symbol.Name) + for j := len(symbolsWithSameName) - 1; j >= 0; j-- { + targetIndex := symbolsWithSameName[j] + targetSymbol := symbols[targetIndex] + mergeChildren(targetSymbol, symbol) + // Mark this symbol as merged. + symbols[i] = nil + } + } + // Merge namespaces. + if symbol.Kind == lsproto.SymbolKindNamespace { + if targetIndex, ok := nameToNamespaceIndex[symbol.Name]; ok && targetIndex != i { + targetSymbol := symbols[targetIndex] + mergeChildren(targetSymbol, symbol) + // Mark this symbol as merged. + symbols[i] = nil + } + } + } + for _, symbol := range symbols { + if symbol != nil { + mergedSymbols = append(mergedSymbols, symbol) + } + } + return mergedSymbols +} + +func mergeChildren(target *lsproto.DocumentSymbol, source *lsproto.DocumentSymbol) { + if source.Children != nil { + if target.Children == nil { + target.Children = source.Children + } else { + *target.Children = mergeExpandos(append(*target.Children, *source.Children...)) + slices.SortFunc(*target.Children, func(a, b *lsproto.DocumentSymbol) int { + return lsproto.CompareRanges(&a.Range, &b.Range) + }) + } + } +} + +// See `getUnnamedNodeLabel`. +func isAnonymousName(name string) bool { + return name == "" || name == "" || name == "export=" || name == "default" || + name == "constructor" || name == "()" || name == "new()" || name == "[]" || strings.HasSuffix(name, "() callback") +} + func getTextOfName(node *ast.Node) string { switch node.Kind { case ast.KindIdentifier, ast.KindPrivateIdentifier, ast.KindNumericLiteral: @@ -180,8 +416,17 @@ func getTextOfName(node *ast.Node) string { } func getUnnamedNodeLabel(node *ast.Node) string { + if parent := ast.WalkUpParenthesizedExpressions(node.Parent); parent != nil && ast.IsExportAssignment(parent) { + if parent.AsExportAssignment().IsExportEquals { + return "export=" + } + return "default" + } switch node.Kind { - case ast.KindFunctionExpression, ast.KindArrowFunction: + case ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction: + if node.ModifierFlags()&ast.ModifierFlagsDefault != 0 { + return "default" + } if ast.IsCallExpression(node.Parent) { name := getCallExpressionName(node.Parent.Expression()) if name != "" { @@ -189,7 +434,10 @@ func getUnnamedNodeLabel(node *ast.Node) string { } } return "" - case ast.KindClassExpression: + case ast.KindClassDeclaration, ast.KindClassExpression: + if node.ModifierFlags()&ast.ModifierFlagsDefault != 0 { + return "default" + } return "" case ast.KindConstructor: return "constructor" @@ -360,12 +608,12 @@ func getSymbolKindFromNode(node *ast.Node) lsproto.SymbolKind { } return lsproto.SymbolKindFile case ast.KindModuleDeclaration: - return lsproto.SymbolKindModule + return lsproto.SymbolKindNamespace case ast.KindClassDeclaration, ast.KindClassExpression: return lsproto.SymbolKindClass case ast.KindInterfaceDeclaration: return lsproto.SymbolKindInterface - case ast.KindTypeAliasDeclaration: + case ast.KindTypeAliasDeclaration, ast.KindJSDocTypedefTag, ast.KindJSDocCallbackTag: return lsproto.SymbolKindClass case ast.KindEnumDeclaration: return lsproto.SymbolKindEnum @@ -377,9 +625,10 @@ func getSymbolKindFromNode(node *ast.Node) lsproto.SymbolKind { return lsproto.SymbolKindProperty case ast.KindMethodDeclaration, ast.KindMethodSignature: return lsproto.SymbolKindMethod - case ast.KindPropertyDeclaration, ast.KindPropertySignature: + case ast.KindPropertyDeclaration, ast.KindPropertySignature, ast.KindPropertyAssignment, + ast.KindShorthandPropertyAssignment, ast.KindSpreadAssignment, ast.KindIndexSignature: return lsproto.SymbolKindProperty - case ast.KindIndexSignature, ast.KindCallSignature: + case ast.KindCallSignature: return lsproto.SymbolKindMethod case ast.KindConstructSignature: return lsproto.SymbolKindConstructor diff --git a/internal/stringutil/util.go b/internal/stringutil/util.go index 629846abae..4b4ba7e9d6 100644 --- a/internal/stringutil/util.go +++ b/internal/stringutil/util.go @@ -238,3 +238,20 @@ func LowerFirstChar(str string) string { } return str } + +func TruncateByRunes(str string, maxLength int) string { + if len(str) < maxLength { + return str + } + if maxLength <= 0 { + return "" + } + var runeCount int + for i := range str { + runeCount++ + if runeCount >= maxLength { + return str[:i] + } + } + return str +} From 2aaa13d892b1053723e088cbbf2943077c99ae3e Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 3 Dec 2025 13:50:46 -0800 Subject: [PATCH 03/10] add document symbol baseline test --- internal/fourslash/baselineutil.go | 3 +- internal/fourslash/fourslash.go | 31 +++++++++++++++++ .../tests/documentSymbolPrivateName_test.go | 34 +++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 internal/fourslash/tests/documentSymbolPrivateName_test.go diff --git a/internal/fourslash/baselineutil.go b/internal/fourslash/baselineutil.go index f013bb4752..2439749502 100644 --- a/internal/fourslash/baselineutil.go +++ b/internal/fourslash/baselineutil.go @@ -35,6 +35,7 @@ const ( signatureHelpCmd baselineCommand = "SignatureHelp" smartSelectionCmd baselineCommand = "Smart Selection" codeLensesCmd baselineCommand = "Code Lenses" + documentSymbolsCmd baselineCommand = "Document Symbols" ) type baselineCommand string @@ -75,7 +76,7 @@ func getBaselineExtension(command baselineCommand) string { return "baseline" case callHierarchyCmd: return "callHierarchy.txt" - case autoImportsCmd: + case autoImportsCmd, documentSymbolsCmd: return "baseline.md" default: return "baseline.jsonc" diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index b8936a11c9..c3de57fbc8 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -15,6 +15,7 @@ import ( "unicode/utf8" "github.com/go-json-experiment/json" + "github.com/go-json-experiment/json/jsontext" "github.com/google/go-cmp/cmp" "github.com/microsoft/typescript-go/internal/bundled" "github.com/microsoft/typescript-go/internal/collections" @@ -3759,3 +3760,33 @@ func assertDocumentSymbolIsEqual( ) } } + +var marshalSymbolKind = func(v lsproto.SymbolKind) ([]byte, error) { + return []byte(`"` + v.String() + `"`), nil +} + +func (f *FourslashTest) VerifyBaselineDocumentSymbols(t *testing.T) { + params := &lsproto.DocumentSymbolParams{ + TextDocument: lsproto.TextDocumentIdentifier{ + Uri: lsconv.FileNameToDocumentURI(f.activeFilename), + }, + } + result := sendRequest(t, f, lsproto.TextDocumentDocumentSymbolInfo, params) + var content strings.Builder + ext := strings.TrimPrefix(tspath.GetAnyExtensionFromPath(f.activeFilename, nil, true), ".") + lang := core.IfElse(ext == "mts" || ext == "cts", "ts", ext) + content.WriteString(codeFence(lang, "// @FileName: "+f.activeFilename+"\n"+f.scriptInfos[f.activeFilename].content)) + content.WriteString("\n\n# Symbols\n\n") + content.WriteString("```json\n") + err := json.MarshalWrite( + &content, + result.DocumentSymbols, + jsontext.Multiline(true), + json.WithMarshalers(json.MarshalFunc(marshalSymbolKind)), + ) + if err != nil { + t.Fatalf("Failed to marshal document symbols for baseline: %v", err) + } + content.WriteString("\n```") + f.addResultToBaseline(t, documentSymbolsCmd, content.String()) +} diff --git a/internal/fourslash/tests/documentSymbolPrivateName_test.go b/internal/fourslash/tests/documentSymbolPrivateName_test.go new file mode 100644 index 0000000000..a95f32a837 --- /dev/null +++ b/internal/fourslash/tests/documentSymbolPrivateName_test.go @@ -0,0 +1,34 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestDocumentSymbolPrivateName(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: first.ts +class A { + #foo: () => { + class B { + #bar: () => { + function baz () { + } + } + } + } +} +// @Filename: second.ts +class Foo { + #privateMethod() {} +} +` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentSymbols(t) + f.GoToFile(t, "second.ts") + f.VerifyBaselineDocumentSymbols(t) +} From 4c53d7533d7fadb19a4ee837e6f01dbbad358a31 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 3 Dec 2025 14:26:56 -0800 Subject: [PATCH 04/10] switch tests to baseline ones --- .../fourslash/_scripts/convertFourslash.mts | 92 +-- internal/fourslash/_scripts/manualTests.txt | 8 + internal/fourslash/fourslash.go | 94 +-- .../tests/documentSymbolPrivateName_test.go | 4 +- .../tests/gen/getNavigationBarItems_test.go | 21 +- .../gen/jsdocTypedefTagNavigateTo_test.go | 24 +- internal/fourslash/tests/gen/navbar01_test.go | 119 +--- .../gen/navbarNestedCommonJsExports_test.go | 22 +- .../fourslash/tests/gen/navbar_const_test.go | 9 +- .../gen/navbar_contains-no-duplicates_test.go | 71 +- .../tests/gen/navbar_exportDefault_test.go | 33 +- .../fourslash/tests/gen/navbar_let_test.go | 9 +- ...nymousClassAndFunctionExpressions2_test.go | 36 +- ...nymousClassAndFunctionExpressions3_test.go | 37 +- ...onymousClassAndFunctionExpressions_test.go | 96 +-- .../gen/navigationBarAssignmentTypes_test.go | 26 +- .../gen/navigationBarClassStaticBlock_test.go | 16 +- .../navigationBarComputedPropertyName_test.go | 21 +- ...ionIndirectlyInVariableDeclaration_test.go | 38 +- ...BarFunctionLikePropertyAssignments_test.go | 41 +- .../navigationBarFunctionPrototype2_test.go | 44 -- .../navigationBarFunctionPrototype3_test.go | 44 -- ...vigationBarFunctionPrototypeBroken_test.go | 64 -- ...tionBarFunctionPrototypeInterlaced_test.go | 70 -- ...vigationBarFunctionPrototypeNested_test.go | 82 --- .../navigationBarFunctionPrototype_test.go | 92 --- .../gen/navigationBarGetterAndSetter_test.go | 27 +- .../tests/gen/navigationBarImports_test.go | 24 +- .../gen/navigationBarInitializerSpans_test.go | 44 +- ...rItemsBindingPatternsInConstructor_test.go | 37 +- .../navigationBarItemsBindingPatterns_test.go | 64 +- .../gen/navigationBarItemsClass1_test.go | 14 +- .../gen/navigationBarItemsClass2_test.go | 14 +- .../gen/navigationBarItemsClass3_test.go | 14 +- .../gen/navigationBarItemsClass4_test.go | 14 +- .../gen/navigationBarItemsClass5_test.go | 14 +- .../gen/navigationBarItemsClass6_test.go | 26 +- .../navigationBarItemsComputedNames_test.go | 47 +- ...avigationBarItemsEmptyConstructors_test.go | 16 +- .../gen/navigationBarItemsExports_test.go | 19 +- ...vigationBarItemsFunctionProperties_test.go | 21 +- ...navigationBarItemsFunctionsBroken2_test.go | 21 +- .../navigationBarItemsFunctionsBroken_test.go | 16 +- .../gen/navigationBarItemsFunctions_test.go | 54 +- .../gen/navigationBarItemsImports_test.go | 44 +- ...rItemsInsideMethodsAndConstructors_test.go | 76 +- .../gen/navigationBarItemsItems2_test.go | 14 +- ...ationBarItemsItemsExternalModules2_test.go | 21 +- ...ationBarItemsItemsExternalModules3_test.go | 21 +- ...gationBarItemsItemsExternalModules_test.go | 16 +- ...gationBarItemsItemsModuleVariables_test.go | 30 +- .../tests/gen/navigationBarItemsItems_test.go | 119 +--- .../navigationBarItemsMissingName1_test.go | 21 +- .../navigationBarItemsMissingName2_test.go | 16 +- .../gen/navigationBarItemsModules1_test.go | 70 +- .../gen/navigationBarItemsModules2_test.go | 21 +- ...arItemsMultilineStringIdentifiers1_test.go | 52 +- ...arItemsMultilineStringIdentifiers2_test.go | 36 +- ...arItemsMultilineStringIdentifiers3_test.go | 9 +- ...igationBarItemsNamedArrowFunctions_test.go | 24 +- ...emsPropertiesDefinedInConstructors_test.go | 37 +- ...nBarItemsStaticAndNonStaticNoMerge_test.go | 21 +- .../gen/navigationBarItemsSymbols1_test.go | 26 +- .../gen/navigationBarItemsSymbols2_test.go | 21 +- .../gen/navigationBarItemsSymbols3_test.go | 9 +- .../gen/navigationBarItemsSymbols4_test.go | 32 +- .../gen/navigationBarItemsTypeAlias_test.go | 9 +- ...avigationBarJsDocCommentWithNoTags_test.go | 9 +- ...navigationBarMerging_grandchildren_test.go | 33 +- .../tests/gen/navigationBarMerging_test.go | 95 +-- ...gationBarNamespaceImportWithNoName_test.go | 9 +- .../navigationBarNestedObjectLiterals_test.go | 54 +- .../navigationBarPrivateNameMethod_test.go | 34 +- .../gen/navigationBarPrivateName_test.go | 32 +- .../navigationBarPropertyDeclarations_test.go | 115 +--- .../tests/gen/navigationBarVariables_test.go | 37 +- ...avigationBarWellKnownSymbolExpando_test.go | 21 +- .../navigationBarWithLocalVariables_test.go | 16 +- ...gationItemsExportDefaultExpression_test.go | 116 +--- ...igationItemsExportEqualsExpression_test.go | 95 +-- .../NavigationBarJsDoc_test.go} | 22 +- .../navigationBarFunctionPrototype2_test.go | 21 + .../navigationBarFunctionPrototype3_test.go | 21 + .../navigationBarFunctionPrototype4_test.go | 29 + ...vigationBarFunctionPrototypeBroken_test.go | 23 + ...tionBarFunctionPrototypeInterlaced_test.go | 27 + ...vigationBarFunctionPrototypeNested_test.go | 26 + .../navigationBarFunctionPrototype_test.go | 32 + .../documentSymbolPrivateName.baseline.md | 217 ++++++ .../getNavigationBarItems.baseline.md | 91 +++ .../jsdocTypedefTagNavigateTo.baseline.md | 92 +++ .../documentSymbols/navbar01.baseline.md | 602 ++++++++++++++++ .../navbarNestedCommonJsExports.baseline.md | 11 + .../documentSymbols/navbar_const.baseline.md | 37 + .../navbar_contains_no_duplicates.baseline.md | 344 +++++++++ .../navbar_exportDefault.baseline.md | 157 +++++ .../documentSymbols/navbar_let.baseline.md | 37 + ...ousClassAndFunctionExpressions.baseline.md | 469 +++++++++++++ ...usClassAndFunctionExpressions2.baseline.md | 164 +++++ ...usClassAndFunctionExpressions3.baseline.md | 172 +++++ .../navigationBarAssignmentTypes.baseline.md | 118 ++++ .../navigationBarClassStaticBlock.baseline.md | 67 ++ ...igationBarComputedPropertyName.baseline.md | 93 +++ ...ndirectlyInVariableDeclaration.baseline.md | 176 +++++ ...unctionLikePropertyAssignments.baseline.md | 195 ++++++ ...navigationBarFunctionPrototype.baseline.md | 252 +++++++ ...avigationBarFunctionPrototype2.baseline.md | 142 ++++ ...avigationBarFunctionPrototype3.baseline.md | 142 ++++ ...avigationBarFunctionPrototype4.baseline.md | 328 +++++++++ ...tionBarFunctionPrototypeBroken.baseline.md | 91 +++ ...BarFunctionPrototypeInterlaced.baseline.md | 300 ++++++++ ...tionBarFunctionPrototypeNested.baseline.md | 222 ++++++ .../navigationBarGetterAndSetter.baseline.md | 120 ++++ .../navigationBarImports.baseline.md | 114 +++ .../navigationBarInitializerSpans.baseline.md | 194 ++++++ ...igationBarItemsBindingPatterns.baseline.md | 318 +++++++++ ...msBindingPatternsInConstructor.baseline.md | 173 +++++ .../navigationBarItemsClass1.baseline.md | 63 ++ .../navigationBarItemsClass2.baseline.md | 63 ++ .../navigationBarItemsClass3.baseline.md | 63 ++ .../navigationBarItemsClass4.baseline.md | 63 ++ .../navigationBarItemsClass5.baseline.md | 63 ++ .../navigationBarItemsClass6.baseline.md | 118 ++++ ...avigationBarItemsComputedNames.baseline.md | 235 +++++++ ...ationBarItemsEmptyConstructors.baseline.md | 66 ++ .../navigationBarItemsExports.baseline.md | 93 +++ ...tionBarItemsFunctionProperties.baseline.md | 92 +++ .../navigationBarItemsFunctions.baseline.md | 256 +++++++ ...igationBarItemsFunctionsBroken.baseline.md | 39 ++ ...gationBarItemsFunctionsBroken2.baseline.md | 40 ++ .../navigationBarItemsImports.baseline.md | 222 ++++++ ...msInsideMethodsAndConstructors.baseline.md | 359 ++++++++++ .../navigationBarItemsItems.baseline.md | 603 ++++++++++++++++ .../navigationBarItemsItems2.baseline.md | 63 ++ ...onBarItemsItemsExternalModules.baseline.md | 65 ++ ...nBarItemsItemsExternalModules2.baseline.md | 91 +++ ...nBarItemsItemsExternalModules3.baseline.md | 91 +++ ...onBarItemsItemsModuleVariables.baseline.md | 135 ++++ ...navigationBarItemsMissingName1.baseline.md | 66 ++ ...navigationBarItemsMissingName2.baseline.md | 68 ++ .../navigationBarItemsModules1.baseline.md | 341 +++++++++ .../navigationBarItemsModules2.baseline.md | 92 +++ ...emsMultilineStringIdentifiers1.baseline.md | 266 +++++++ ...emsMultilineStringIdentifiers2.baseline.md | 175 +++++ ...emsMultilineStringIdentifiers3.baseline.md | 43 ++ ...ionBarItemsNamedArrowFunctions.baseline.md | 115 ++++ ...ropertiesDefinedInConstructors.baseline.md | 168 +++++ ...ItemsStaticAndNonStaticNoMerge.baseline.md | 91 +++ .../navigationBarItemsSymbols1.baseline.md | 117 ++++ .../navigationBarItemsSymbols2.baseline.md | 91 +++ .../navigationBarItemsSymbols3.baseline.md | 66 ++ .../navigationBarItemsSymbols4.baseline.md | 152 ++++ .../navigationBarItemsTypeAlias.baseline.md | 37 + .../navigationBarJsDoc.baseline.md | 64 ++ ...ationBarJsDocCommentWithNoTags.baseline.md | 38 + .../navigationBarMerging.baseline.md | 483 +++++++++++++ ...gationBarMerging_grandchildren.baseline.md | 148 ++++ ...onBarNamespaceImportWithNoName.baseline.md | 11 + ...igationBarNestedObjectLiterals.baseline.md | 253 +++++++ .../navigationBarPrivateName.baseline.md | 148 ++++ ...navigationBarPrivateNameMethod.baseline.md | 150 ++++ ...igationBarPropertyDeclarations.baseline.md | 598 ++++++++++++++++ .../navigationBarVariables.baseline.md | 181 +++++ ...ationBarWellKnownSymbolExpando.baseline.md | 90 +++ ...avigationBarWithLocalVariables.baseline.md | 66 ++ ...onItemsExportDefaultExpression.baseline.md | 496 +++++++++++++ ...ionItemsExportEqualsExpression.baseline.md | 651 ++++++++++++++++++ 167 files changed, 13862 insertions(+), 3035 deletions(-) delete mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototype2_test.go delete mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototype3_test.go delete mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototypeBroken_test.go delete mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototypeInterlaced_test.go delete mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototypeNested_test.go delete mode 100644 internal/fourslash/tests/gen/navigationBarFunctionPrototype_test.go rename internal/fourslash/tests/{gen/navigationBarJsDoc_test.go => manual/NavigationBarJsDoc_test.go} (50%) create mode 100644 internal/fourslash/tests/manual/navigationBarFunctionPrototype2_test.go create mode 100644 internal/fourslash/tests/manual/navigationBarFunctionPrototype3_test.go create mode 100644 internal/fourslash/tests/manual/navigationBarFunctionPrototype4_test.go create mode 100644 internal/fourslash/tests/manual/navigationBarFunctionPrototypeBroken_test.go create mode 100644 internal/fourslash/tests/manual/navigationBarFunctionPrototypeInterlaced_test.go create mode 100644 internal/fourslash/tests/manual/navigationBarFunctionPrototypeNested_test.go create mode 100644 internal/fourslash/tests/manual/navigationBarFunctionPrototype_test.go create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline.md diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts index f5f3eda259..0828202f72 100644 --- a/internal/fourslash/_scripts/convertFourslash.mts +++ b/internal/fourslash/_scripts/convertFourslash.mts @@ -2283,99 +2283,12 @@ function parseVerifyNavigateToArg(arg: ts.Expression): string | undefined { } function parseVerifyNavTree(args: readonly ts.Expression[]): [VerifyNavTreeCmd] | undefined { - // Ignore `{ checkSpans: true }`. - if (!ts.isObjectLiteralExpression(args[0])) { - console.error(`Expected object literal expression for verify.navigationTree argument, got ${args[0].getText()}`); - return undefined; - } - let expectedItems: string[] = []; - for (const prop of args[0].properties) { - if (!ts.isPropertyAssignment(prop) || !(ts.isIdentifier(prop.name) || ts.isStringLiteralLike(prop.name))) { - console.error(`Expected property assignment with identifier or string literal name for verify.navigationTree argument, got ${prop.getText()}`); - return undefined; - } - if (prop.name.text === "childItems") { - const init = prop.initializer; - if (!ts.isArrayLiteralExpression(init)) { - console.error(`Expected array literal expression for childItems in verify.navigationTree argument, got ${init.getText()}`); - return undefined; - } - for (const elem of init.elements) { - if (!ts.isObjectLiteralExpression(elem)) { - console.error(`Expected object literal expression for navigation tree item, got ${elem.getText()}`); - return undefined; - } - const item = parseNavTreeItem(elem); - if (!item) { - return undefined; - } - expectedItems.push(item); - } - } - } + // Ignore arguments and use baseline tests intead. return [{ kind: "verifyNavigationTree", - arg: expectedItems.length ? `[]*lsproto.DocumentSymbol{\n${expectedItems.join(",\n")},\n}` : "nil", }]; } -function parseNavTreeItem(item: ts.ObjectLiteralExpression): string | undefined { - let children: string | undefined; - let name: string; - let kind: string | undefined; - for (const prop of item.properties) { - if (!ts.isPropertyAssignment(prop) || !(ts.isIdentifier(prop.name) || ts.isStringLiteralLike(prop.name))) { - console.error(`Expected property assignment with identifier or string name for navigation tree item, got ${prop.getText()}`); - return undefined; - } - switch (prop.name.text) { - case "text": { - if (!ts.isStringLiteralLike(prop.initializer)) { - console.error(`Expected string literal for text in navigation tree item, got ${prop.initializer.getText()}`); - return undefined; - } - name = getGoStringLiteral(prop.initializer.text); - break; - } - case "kind": { - const goKind = getSymbolKind(prop.initializer); - if (!goKind) { - return undefined; - } - kind = goKind; - break; - } - case "childItems": { - const init = prop.initializer; - if (!ts.isArrayLiteralExpression(init)) { - console.error(`Expected array literal expression for childItems in navigation tree item, got ${init.getText()}`); - return undefined; - } - const childItems: string[] = []; - for (const elem of init.elements) { - if (!ts.isObjectLiteralExpression(elem)) { - console.error(`Expected object literal expression for navigation tree child item, got ${elem.getText()}`); - return undefined; - } - const childItem = parseNavTreeItem(elem); - if (!childItem) { - return undefined; - } - childItems.push(childItem); - } - if (childItems.length > 0) { - children = `PtrTo([]*lsproto.DocumentSymbol{\n${childItems.join(",\n")},\n})`; - } - } - } - } - return `&lsproto.DocumentSymbol{ - Name: ${name!}, - Kind: lsproto.${kind || "SymbolKindProperty"}, - Children: ${children ? children : "nil"}, - }` -} - function parseNavToItem(arg: ts.Expression): string | undefined { let item = getNodeOfKind(arg, ts.isObjectLiteralExpression); if (!item) { @@ -2678,7 +2591,6 @@ interface VerifyOutliningSpansCmd { interface VerifyNavTreeCmd { kind: "verifyNavigationTree"; - arg: string; } type Cmd = @@ -3010,7 +2922,7 @@ function generateCmd(cmd: Cmd): string { case "verifyOutliningSpans": return generateVerifyOutliningSpans(cmd); case "verifyNavigationTree": - return `f.VerifyStradaDocumentSymbol(t, ${cmd.arg})`; + return `f.VerifyBaselineDocumentSymbol(t)`; default: let neverCommand: never = cmd; throw new Error(`Unknown command kind: ${neverCommand as Cmd["kind"]}`); diff --git a/internal/fourslash/_scripts/manualTests.txt b/internal/fourslash/_scripts/manualTests.txt index c86bec5d29..5373890ae0 100644 --- a/internal/fourslash/_scripts/manualTests.txt +++ b/internal/fourslash/_scripts/manualTests.txt @@ -2,6 +2,14 @@ completionListInClosedFunction05 completionsAtIncompleteObjectLiteralProperty completionsSelfDeclaring1 completionsWithDeprecatedTag4 +navigationBarFunctionPrototype +navigationBarFunctionPrototype2 +navigationBarFunctionPrototype3 +navigationBarFunctionPrototype4 +navigationBarFunctionPrototypeBroken +navigationBarFunctionPrototypeInterlaced +navigationBarFunctionPrototypeNested +navigationBarJsDoc navigationItemsExactMatch2 navigationItemsSpecialPropertyAssignment navto_excludeLib1 diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index c3de57fbc8..8757d24161 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -1182,10 +1182,9 @@ func ignorePaths(paths ...string) cmp.Option { } var ( - completionIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data") - autoImportIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data", ".LabelDetails", ".Detail", ".AdditionalTextEdits") - diagnosticsIgnoreOpts = ignorePaths(".Severity", ".Source", ".RelatedInformation") - stradaDocumentSymbolIgnoreOpts = ignorePaths(".Detail", ".Tags", ".Deprecated", ".Range", ".SelectionRange", ".Children") + completionIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data") + autoImportIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data", ".LabelDetails", ".Detail", ".AdditionalTextEdits") + diagnosticsIgnoreOpts = ignorePaths(".Severity", ".Source", ".RelatedInformation") ) func (f *FourslashTest) verifyCompletionItem(t *testing.T, prefix string, actual *lsproto.CompletionItem, expected *lsproto.CompletionItem) { @@ -3676,96 +3675,11 @@ func verifyIncludesSymbols( } } -// `verify.navigationTree` in Strada. -func (f *FourslashTest) VerifyStradaDocumentSymbol(t *testing.T, expected []*lsproto.DocumentSymbol) { - params := &lsproto.DocumentSymbolParams{ - TextDocument: lsproto.TextDocumentIdentifier{ - Uri: lsconv.FileNameToDocumentURI(f.activeFilename), - }, - } - result := sendRequest(t, f, lsproto.TextDocumentDocumentSymbolInfo, params) - if result.DocumentSymbols == nil { - if len(expected) != 0 { - t.Fatalf("Expected non-nil document symbols array from document symbol request") - } - return - } - assertDocumentSymbolsAreEqual( - t, - *result.DocumentSymbols, - expected, - fmt.Sprintf("At file %s: Document symbols mismatch", f.activeFilename), - ) -} - -func assertDocumentSymbolsAreEqual( - t *testing.T, - actual []*lsproto.DocumentSymbol, - expected []*lsproto.DocumentSymbol, - prefix string, -) { - slices.SortFunc(actual, compareDocumentSymbols) - slices.SortFunc(expected, compareDocumentSymbols) - if len(actual) != len(expected) { - t.Fatalf( - "%s: Expected %d document symbols, but got %d:\n%s", - prefix, - len(expected), - len(actual), - cmp.Diff( - core.Map(actual, func(d *lsproto.DocumentSymbol) string { return d.Name }), - core.Map(expected, func(d *lsproto.DocumentSymbol) string { return d.Name }), - ), - ) - } - for i := range actual { - assertDocumentSymbolIsEqual(t, actual[i], expected[i], prefix) - } -} - -func compareDocumentSymbols(d1, d2 *lsproto.DocumentSymbol) int { - c := stringutil.CompareStringsCaseInsensitive(d1.Name, d2.Name) - if c != 0 { - return c - } - c = strings.Compare(d2.Name, d1.Name) - if c != 0 { - return c - } - c = lsproto.CompareRanges(&d1.Range, &d2.Range) - return c -} - -func assertDocumentSymbolIsEqual( - t *testing.T, - actual *lsproto.DocumentSymbol, - expected *lsproto.DocumentSymbol, - prefix string, -) { - assertDeepEqual(t, actual, expected, prefix, stradaDocumentSymbolIgnoreOpts) - if actual.Children != nil && len(*actual.Children) > 0 || expected.Children != nil && len(*expected.Children) > 0 { - var actualChildren []*lsproto.DocumentSymbol - var expectedChildren []*lsproto.DocumentSymbol - if actual.Children != nil { - actualChildren = *actual.Children - } - if expected.Children != nil { - expectedChildren = *expected.Children - } - assertDocumentSymbolsAreEqual( - t, - actualChildren, - expectedChildren, - prefix+" (in children of symbol "+actual.Name+")", - ) - } -} - var marshalSymbolKind = func(v lsproto.SymbolKind) ([]byte, error) { return []byte(`"` + v.String() + `"`), nil } -func (f *FourslashTest) VerifyBaselineDocumentSymbols(t *testing.T) { +func (f *FourslashTest) VerifyBaselineDocumentSymbol(t *testing.T) { params := &lsproto.DocumentSymbolParams{ TextDocument: lsproto.TextDocumentIdentifier{ Uri: lsconv.FileNameToDocumentURI(f.activeFilename), diff --git a/internal/fourslash/tests/documentSymbolPrivateName_test.go b/internal/fourslash/tests/documentSymbolPrivateName_test.go index a95f32a837..dd771e13fa 100644 --- a/internal/fourslash/tests/documentSymbolPrivateName_test.go +++ b/internal/fourslash/tests/documentSymbolPrivateName_test.go @@ -28,7 +28,7 @@ class Foo { } ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineDocumentSymbols(t) + f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "second.ts") - f.VerifyBaselineDocumentSymbols(t) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/getNavigationBarItems_test.go b/internal/fourslash/tests/gen/getNavigationBarItems_test.go index 756ed1619e..b52eb5581d 100644 --- a/internal/fourslash/tests/gen/getNavigationBarItems_test.go +++ b/internal/fourslash/tests/gen/getNavigationBarItems_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -18,22 +16,5 @@ func TestGetNavigationBarItems(t *testing.T) { ["bar"]: string; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "C", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "[\"bar\"]", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "foo", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go b/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go index d6fffc98b0..e13db5c96d 100644 --- a/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go +++ b/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -23,26 +22,5 @@ var NumberLike2; var numberLike;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.MarkTestAsStradaServer() - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "numberLike", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "NumberLike", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "NumberLike2", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "NumberLike2", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar01_test.go b/internal/fourslash/tests/gen/navbar01_test.go index 67b1f19811..51e356a139 100644 --- a/internal/fourslash/tests/gen/navbar01_test.go +++ b/internal/fourslash/tests/gen/navbar01_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -52,120 +50,5 @@ var p: IPoint = new Shapes.Point(3, 4); var dist = p.getDist();` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.MarkTestAsStradaServer() - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "dist", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "IPoint", - Kind: lsproto.SymbolKindInterface, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "()", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "new()", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "[]", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "getDist", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "prop", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "p", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "Shapes", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Point", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "getDist", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "getOrigin", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "origin", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "value", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "value", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "Values", - Kind: lsproto.SymbolKindEnum, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "value1", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - { - Name: "value2", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - { - Name: "value3", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go b/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go index 1a2b6384ff..529bc3164a 100644 --- a/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go +++ b/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -17,23 +15,5 @@ func TestNavbarNestedCommonJsExports(t *testing.T) { // @Filename: /a.js exports.a = exports.b = exports.c = 0;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar_const_test.go b/internal/fourslash/tests/gen/navbar_const_test.go index 9370f12bda..6c0489a348 100644 --- a/internal/fourslash/tests/gen/navbar_const_test.go +++ b/internal/fourslash/tests/gen/navbar_const_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -14,11 +13,5 @@ func TestNavbar_const(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `const c = 0;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go b/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go index 1abc6fb8a2..88ec4218d8 100644 --- a/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go +++ b/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -41,72 +39,5 @@ module ABC { export var x = 3; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "ABC", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "foo", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "ABC", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "Windows", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Foundation", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "B", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "Test", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "wow", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "Test", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Boom", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar_exportDefault_test.go b/internal/fourslash/tests/gen/navbar_exportDefault_test.go index 4669c5f8cf..ebba5d36d9 100644 --- a/internal/fourslash/tests/gen/navbar_exportDefault_test.go +++ b/internal/fourslash/tests/gen/navbar_exportDefault_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -22,35 +21,11 @@ export default function { } export default function Func { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "a.ts") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "default", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "b.ts") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "C", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "c.ts") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "default", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "d.ts") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Func", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar_let_test.go b/internal/fourslash/tests/gen/navbar_let_test.go index e8bed9a1f2..5d3fe1c922 100644 --- a/internal/fourslash/tests/gen/navbar_let_test.go +++ b/internal/fourslash/tests/gen/navbar_let_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -14,11 +13,5 @@ func TestNavbar_let(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `let c = 0;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go index 6bd6fbd3c4..6be83c9ed6 100644 --- a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -16,37 +14,5 @@ func TestNavigationBarAnonymousClassAndFunctionExpressions2(t *testing.T) { const content = `console.log(console.log(class Y {}, class X {}), console.log(class B {}, class A {})); console.log(class Cls { meth() {} });` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "B", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "Cls", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "meth", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "X", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "Y", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go index 6a2428adaf..3e6315a74f 100644 --- a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -23,38 +21,5 @@ describe('foo', () => { test(` + "`" + `a ${a} b {b}` + "`" + `, () => {}) })` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "describe('foo') callback", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "test(`a ${1} b ${2}`) callback", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - { - Name: "describe('foo') callback", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "test(`a ${a} b {b}`) callback", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go index a48be8768e..4c3f1e20e4 100644 --- a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -41,97 +39,5 @@ func TestNavigationBarAnonymousClassAndFunctionExpressions(t *testing.T) { (class { }); })` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "nest", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "moreNest", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "xx", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - { - Name: "y", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "foo", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }), - }, - { - Name: "", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "console.log() callback", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "describe(\"this\", 'function', `is a function`, `with template literal ${\"a\"}`) callback", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "map() callback", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "z", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - { - Name: "classes", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "cls2", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "cls3", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }), - }, - { - Name: "cls", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go b/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go index c4a324c947..2034931ef7 100644 --- a/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go +++ b/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -20,27 +18,5 @@ const a = { d: 0 };` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "b", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "d", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go b/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go index 796943780b..3e2e9047e4 100644 --- a/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go +++ b/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -19,17 +17,5 @@ func TestNavigationBarClassStaticBlock(t *testing.T) { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "C", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go b/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go index 4cd9979185..3018f664c5 100644 --- a/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go +++ b/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -20,22 +18,5 @@ func TestNavigationBarComputedPropertyName(t *testing.T) { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "F", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "[key]", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "\"prop\"", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go b/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go index a0ef075c9b..596c77a19e 100644 --- a/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go +++ b/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -26,39 +24,5 @@ b = { } };` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "propA", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }), - }, - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "propB", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "d", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go b/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go index 88b4b4e912..c2dfe76137 100644 --- a/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go +++ b/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -22,42 +20,5 @@ func TestNavigationBarFunctionLikePropertyAssignments(t *testing.T) { f() { } };` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "functions", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "d", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "e", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "f", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototype2_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototype2_test.go deleted file mode 100644 index 1d640cc95d..0000000000 --- a/internal/fourslash/tests/gen/navigationBarFunctionPrototype2_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package fourslash_test - -import ( - "testing" - - "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" - "github.com/microsoft/typescript-go/internal/testutil" -) - -func TestNavigationBarFunctionPrototype2(t *testing.T) { - t.Parallel() - - defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @Filename: foo.js -A.prototype.a = function() { }; -A.prototype.b = function() { }; -function A() {}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - }), - }, - }) -} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototype3_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototype3_test.go deleted file mode 100644 index 9d2568cafd..0000000000 --- a/internal/fourslash/tests/gen/navigationBarFunctionPrototype3_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package fourslash_test - -import ( - "testing" - - "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" - "github.com/microsoft/typescript-go/internal/testutil" -) - -func TestNavigationBarFunctionPrototype3(t *testing.T) { - t.Parallel() - - defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @Filename: foo.js -var A; -A.prototype.a = function() { }; -A.b = function() { };` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "a", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }) -} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeBroken_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeBroken_test.go deleted file mode 100644 index 8139e28d9b..0000000000 --- a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeBroken_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package fourslash_test - -import ( - "testing" - - "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" - "github.com/microsoft/typescript-go/internal/testutil" -) - -func TestNavigationBarFunctionPrototypeBroken(t *testing.T) { - t.Parallel() - - defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @Filename: foo.js -function A() {} -A. // Started typing something here -A.prototype.a = function() { }; -G. // Started typing something here -A.prototype.a = function() { };` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "G", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }), - }, - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "A", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }), - }, - }) -} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeInterlaced_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeInterlaced_test.go deleted file mode 100644 index ebed818319..0000000000 --- a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeInterlaced_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package fourslash_test - -import ( - "testing" - - "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" - "github.com/microsoft/typescript-go/internal/testutil" -) - -func TestNavigationBarFunctionPrototypeInterlaced(t *testing.T) { - t.Parallel() - - defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @Filename: foo.js -var b = 1; -function A() {}; -A.prototype.a = function() { }; -A.b = function() { }; -b = 2 -/* Comment */ -A.prototype.c = function() { } -var b = 2 -A.prototype.d = function() { }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "a", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "d", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) -} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeNested_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototypeNested_test.go deleted file mode 100644 index c9313c26c0..0000000000 --- a/internal/fourslash/tests/gen/navigationBarFunctionPrototypeNested_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package fourslash_test - -import ( - "testing" - - "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" - "github.com/microsoft/typescript-go/internal/testutil" -) - -func TestNavigationBarFunctionPrototypeNested(t *testing.T) { - t.Parallel() - - defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @Filename: foo.js -function A() {} -A.B = function () { } -A.B.prototype.d = function () { } -Object.defineProperty(A.B.prototype, "x", { - get() {} -}) -A.prototype.D = function () { } -A.prototype.D.prototype.d = function () { } ` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "B", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "d", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "get", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }), - }, - { - Name: "D", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "d", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }), - }, - }) -} diff --git a/internal/fourslash/tests/gen/navigationBarFunctionPrototype_test.go b/internal/fourslash/tests/gen/navigationBarFunctionPrototype_test.go deleted file mode 100644 index e5e5a5d6ed..0000000000 --- a/internal/fourslash/tests/gen/navigationBarFunctionPrototype_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package fourslash_test - -import ( - "testing" - - "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" - "github.com/microsoft/typescript-go/internal/testutil" -) - -func TestNavigationBarFunctionPrototype(t *testing.T) { - t.Parallel() - - defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @Filename: foo.js -function f() {} -f.prototype.x = 0; -f.y = 0; -f.prototype.method = function () {}; -Object.defineProperty(f, 'staticProp', { - set: function() {}, - get: function(){ - } -}); -Object.defineProperty(f.prototype, 'name', { - set: function() {}, - get: function(){ - } -}); ` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "f", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "method", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "staticProp", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "get", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "set", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "name", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "get", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "set", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }), - }, - }) -} diff --git a/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go b/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go index 8220b3cd35..87e2b61912 100644 --- a/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go +++ b/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -21,28 +19,5 @@ func TestNavigationBarGetterAndSetter(t *testing.T) { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "X", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "f", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarImports_test.go b/internal/fourslash/tests/gen/navigationBarImports_test.go index a4886c845f..42daf22049 100644 --- a/internal/fourslash/tests/gen/navigationBarImports_test.go +++ b/internal/fourslash/tests/gen/navigationBarImports_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -16,26 +15,5 @@ func TestNavigationBarImports(t *testing.T) { import c = require("m"); import * as d from "m";` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "d", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go b/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go index ed9c45effd..43601d3f1b 100644 --- a/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go +++ b/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -18,45 +16,5 @@ const [|[|x|] = () => { var [|a|]; }|]; const [|[|f|] = function f() { var [|b|]; }|]; const [|[|y|] = { [|[|z|]: function z() { var [|c|]; }|] }|];` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "f", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "y", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "z", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go b/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go index 6dbbba5bf9..dfc1b5c25d 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -24,38 +22,5 @@ class B { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "B", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go b/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go index 0a41f38895..6021acab20 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -20,66 +19,5 @@ const bar1, [c, d] var {e, x: [f, g]} = {a:1, x:[]}; var { h: i = function j() {} } = obj;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "bar", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "bar1", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "d", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "e", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "f", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "foo", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "foo1", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "g", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "i", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go index dd414cd28e..06170b235f 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -15,16 +14,5 @@ func TestNavigationBarItemsClass1(t *testing.T) { const content = `function Foo() {} class Foo {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go index 35e3fbe08a..9cb5aa9e5a 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -15,16 +14,5 @@ func TestNavigationBarItemsClass2(t *testing.T) { const content = `class Foo {} function Foo() {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go index 7a89d26b66..85db7b11ec 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -17,16 +16,5 @@ func TestNavigationBarItemsClass3(t *testing.T) { function Foo() {} class Foo {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go index 88e5b74ea5..17261e51e8 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -17,16 +16,5 @@ func TestNavigationBarItemsClass4(t *testing.T) { class Foo {} function Foo() {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go index 4748c94de4..676385b054 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -15,16 +14,5 @@ func TestNavigationBarItemsClass5(t *testing.T) { const content = `class Foo {} let Foo = 1;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go index fb8c2d9702..411043628c 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -19,27 +17,5 @@ Z.foo = 42 class Z { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Z", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "foo", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "Z", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go b/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go index e3b00858c8..3ed622586d 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -36,48 +34,5 @@ class C { }, }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "C", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "[a]", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "[E.A]", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "[1]", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "[\"foo\"]", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "E", - Kind: lsproto.SymbolKindEnum, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go index dfe2d08b6e..01303931fd 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -18,17 +16,5 @@ func TestNavigationBarItemsEmptyConstructors(t *testing.T) { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Test", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsExports_test.go b/internal/fourslash/tests/gen/navigationBarItemsExports_test.go index 6211bed92e..0bbc289f2e 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsExports_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsExports_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -20,21 +19,5 @@ export import e = require("a"); export * from "a"; // no bindings here` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "B", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "e", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go index 1fdb3d8b95..88adbe8ad6 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -19,22 +17,5 @@ A/*1*/ .a = function() { }; })();` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "A", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go index f5f042e62e..050a29e602 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -18,22 +16,5 @@ function f() { function; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "f", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go index 15f54d097d..1836d386fb 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -17,17 +15,5 @@ func TestNavigationBarItemsFunctionsBroken(t *testing.T) { function; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "f", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go index 5b63cfbb26..bacced2afa 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -30,55 +28,5 @@ function baz() { var v = 10; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "baz", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "v", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "foo", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "bar", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "biz", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "z", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "qux", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsImports_test.go b/internal/fourslash/tests/gen/navigationBarItemsImports_test.go index b607dc06ee..b558e58be1 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsImports_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsImports_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -24,46 +23,5 @@ import e = require("a"); import * as ns from "a";` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "B", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "D", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "d1", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "d2", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "e", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "ns", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go index daa93e9829..bfa7a66225 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -31,77 +29,5 @@ func TestNavigationBarItemsInsideMethodsAndConstructors(t *testing.T) { emptyMethod() { } // Non child functions method should not be duplicated }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Class", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "LocalEnumInConstructor", - Kind: lsproto.SymbolKindEnum, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "LocalEnumMemberInConstructor", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - }), - }, - { - Name: "LocalFunctionInConstructor", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "LocalInterfaceInConstrcutor", - Kind: lsproto.SymbolKindInterface, - Children: nil, - }, - }), - }, - { - Name: "emptyMethod", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "method", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "LocalEnumInMethod", - Kind: lsproto.SymbolKindEnum, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "LocalEnumMemberInMethod", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - }), - }, - { - Name: "LocalFunctionInMethod", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "LocalFunctionInLocalFunctionInMethod", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - { - Name: "LocalInterfaceInMethod", - Kind: lsproto.SymbolKindInterface, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go b/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go index e50375dee3..49db825c7b 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -17,16 +16,5 @@ func TestNavigationBarItemsItems2(t *testing.T) { f.GoToMarker(t, "") f.InsertLine(t, "module A") f.Insert(t, "export class ") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "A", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go index 24068af808..c80e1cdb53 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -19,22 +17,5 @@ export class Bar { } export var x: number;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Bar", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "s", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go index f1502a3e96..4b8ac090e5 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -19,22 +17,5 @@ export class Bar { } export var x: number;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Bar", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "s", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go index 544f7f6e75..2ca612e67b 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -17,17 +15,5 @@ func TestNavigationBarItemsItemsExternalModules(t *testing.T) { public s: string; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Bar", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "s", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go index 2eb4030393..8ebf5cef76 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -30,31 +28,7 @@ module Module1 { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToMarker(t, "file1") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Module1", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) f.GoToMarker(t, "file2") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Module1.SubModule", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "y", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItems_test.go b/internal/fourslash/tests/gen/navigationBarItemsItems_test.go index 27c7fd586f..290874ced6 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItems_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItems_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -52,120 +50,5 @@ module Shapes { var p: IPoint = new Shapes.Point(3, 4); var dist = p.getDist();` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "dist", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "IPoint", - Kind: lsproto.SymbolKindInterface, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "()", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "new()", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "[]", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "getDist", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "prop", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "p", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "Shapes", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Point", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "getDist", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "getOrigin", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "origin", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "value", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "value", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "Values", - Kind: lsproto.SymbolKindEnum, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "value1", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - { - Name: "value2", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - { - Name: "value3", - Kind: lsproto.SymbolKindEnumMember, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go b/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go index c1f79ed979..9c4691c92b 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -18,22 +16,5 @@ class C { foo() {} }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "C", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "foo", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go b/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go index f58a29f2c3..e26ba91734 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -20,17 +18,5 @@ class /* But it has no name! */ { foo() {} }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "foo", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go b/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go index 8eb14d35d5..c4f757141b 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -39,71 +37,5 @@ module A { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "'X2.Y2.Z2'", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - { - Name: "\"foo\"", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - { - Name: "\"X.Y.Z\"", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - { - Name: "A", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "B", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "C", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }), - }, - { - Name: "z", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "A.B", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "y", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "A.B.C", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go b/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go index 7d03600293..bd5bf6ca16 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -19,22 +17,5 @@ namespace Test.B { class Foo { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Test.A", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - { - Name: "Test.B", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go index 273957b9cd..b344f04b09 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -42,53 +40,5 @@ class Bar implements Foo { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "\"MultilineMadness\"", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - { - Name: "\"MultilineMadness2\"", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - { - Name: "\"Multiline\\r\\nMadness\"", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - { - Name: "Bar", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "'a1\\\\\\r\\nb'", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "'a2 b'", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "Foo", - Kind: lsproto.SymbolKindInterface, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "\"a1\\\\\\r\\nb\"", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "\"a2 b\"", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go index fdb369a9eb..80bfbe5b48 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -27,37 +25,5 @@ f(() => { }, ` + "`" + `unterminated backtick 1 unterminated backtick 2 unterminated backtick 3` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "c1", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "'line1 line2'", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "f", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "f(`line1line2line3`) callback", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "f(`unterminated backtick 1unterminated backtick 2unterminated backtick 3) callback", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go index 6f6d39d334..49c737112e 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -20,11 +19,5 @@ MoreThanOneHundredAndFiftyCharacters\ MoreThanOneHundredAndFiftyCharacters\ MoreThanOneHundredAndFiftyCharacters' { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "'MoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharacter...", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go b/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go index 0988927130..1c32997418 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -17,26 +16,5 @@ export const func = () => 2; export const func2 = function() { }; export function exportedFunction() { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "exportedFunction", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "func", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "func2", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "value", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go index 0a3020e912..66c46bddd2 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -19,38 +17,5 @@ func TestNavigationBarItemsPropertiesDefinedInConstructors(t *testing.T) { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "List", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "local", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "a", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go b/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go index 3c8d94ea48..59b1c4acea 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -18,22 +16,5 @@ func TestNavigationBarItemsStaticAndNonStaticNoMerge(t *testing.T) { x; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "C", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go index 44c280a00b..5626f58a98 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -19,27 +17,5 @@ func TestNavigationBarItemsSymbols1(t *testing.T) { get [Symbol.isConcatSpreadable]() { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "C", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "[Symbol.isRegExp]", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "[Symbol.iterator]", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "[Symbol.isConcatSpreadable]", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go index ce8a66af37..15dfd24e66 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -18,22 +16,5 @@ func TestNavigationBarItemsSymbols2(t *testing.T) { [Symbol.iterator](): string; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "I", - Kind: lsproto.SymbolKindInterface, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "[Symbol.isRegExp]", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "[Symbol.iterator]", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go index ff0f246891..6cb36bbbce 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -17,11 +16,5 @@ func TestNavigationBarItemsSymbols3(t *testing.T) { [Symbol.isRegExp] = 0 }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "E", - Kind: lsproto.SymbolKindEnum, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go index 43178def91..c343e4eaaa 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -32,33 +30,5 @@ class MyClass { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "_sym", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "MyClass", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "method", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go b/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go index d19b289877..1a32cfb5d7 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -14,11 +13,5 @@ func TestNavigationBarItemsTypeAlias(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `type T = number | string;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "T", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go b/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go index daa2a5be33..4f4ded877a 100644 --- a/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go +++ b/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -15,11 +14,5 @@ func TestNavigationBarJsDocCommentWithNoTags(t *testing.T) { const content = `/** Test */ export const Test = {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "Test", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go b/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go index f57f90f6fe..e22ec72d34 100644 --- a/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go +++ b/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -23,34 +21,5 @@ const o = { }, }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "o", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "m", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "b", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "m", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarMerging_test.go b/internal/fourslash/tests/gen/navigationBarMerging_test.go index 9039416e33..d1418aa249 100644 --- a/internal/fourslash/tests/gen/navigationBarMerging_test.go +++ b/internal/fourslash/tests/gen/navigationBarMerging_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -41,96 +39,11 @@ module a { module A { export var x; } module A.B { export var y; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "bar", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "foo", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - { - Name: "b", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "foo", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "file2.ts") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "a", - Kind: lsproto.SymbolKindNamespace, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "file3.ts") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindInterface, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "bar", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "foo", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "file4.ts") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - { - Name: "A.B", - Kind: lsproto.SymbolKindNamespace, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "y", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go b/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go index 5bfdf1b03b..7d14d0b20e 100644 --- a/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go +++ b/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -14,11 +13,5 @@ func TestNavigationBarNamespaceImportWithNoName(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `import *{} from 'foo';` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go b/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go index 9df0e23f07..418b24ced0 100644 --- a/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go +++ b/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -27,55 +25,5 @@ func TestNavigationBarNestedObjectLiterals(t *testing.T) { }, }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "b", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "d", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "e", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "f", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "g", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "h", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "i", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go b/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go index 3a4a4b7591..d2d1c99105 100644 --- a/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go +++ b/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -24,35 +22,5 @@ func TestNavigationBarPrivateNameMethod(t *testing.T) { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "#foo", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "B", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "#bar", - Kind: lsproto.SymbolKindMethod, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "baz", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }), - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarPrivateName_test.go b/internal/fourslash/tests/gen/navigationBarPrivateName_test.go index 7481540865..b4ace062c2 100644 --- a/internal/fourslash/tests/gen/navigationBarPrivateName_test.go +++ b/internal/fourslash/tests/gen/navigationBarPrivateName_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -24,33 +22,5 @@ func TestNavigationBarPrivateName(t *testing.T) { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "#foo", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "B", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "#bar", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "baz", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go b/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go index d911777065..c28a7b972e 100644 --- a/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go +++ b/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -46,116 +44,5 @@ func TestNavigationBarPropertyDeclarations(t *testing.T) { public [1 + 1] = 1; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "A", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "[1]", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "z", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "A1", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "z", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "A2", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "z", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - { - Name: "A3", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "A4", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "A5", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "A6", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "[\"A7\"]", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - { - Name: "z", - Kind: lsproto.SymbolKindMethod, - Children: nil, - }, - }), - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarVariables_test.go b/internal/fourslash/tests/gen/navigationBarVariables_test.go index a006310e95..9591b15034 100644 --- a/internal/fourslash/tests/gen/navigationBarVariables_test.go +++ b/internal/fourslash/tests/gen/navigationBarVariables_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -20,39 +19,7 @@ var {a} = 0; let {a: b} = 0; const [c] = 0;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "z", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "file2.ts") - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go b/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go index e7df5d2d9c..9f0b4a8404 100644 --- a/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go +++ b/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -16,22 +14,5 @@ func TestNavigationBarWellKnownSymbolExpando(t *testing.T) { const content = `function f() {} f[Symbol.iterator] = function() {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "f", - Kind: lsproto.SymbolKindClass, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "constructor", - Kind: lsproto.SymbolKindConstructor, - Children: nil, - }, - { - Name: "[Symbol.iterator]", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go b/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go index 8ac264d7b0..851399bc19 100644 --- a/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go +++ b/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -18,17 +16,5 @@ func TestNavigationBarWithLocalVariables(t *testing.T) { x.foo = "" }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }), - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go b/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go index b14a91ea90..6311e18332 100644 --- a/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go +++ b/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -45,117 +43,5 @@ export default { function foo(props: { x: number; y: number }) {} export default foo({ x: 1, y: 1 });` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "default", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "default", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }), - }, - { - Name: "default", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "default", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }), - }, - { - Name: "default", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "d", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }), - }, - { - Name: "default", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "x", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "y", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - { - Name: "AB", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "abc", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "default", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "f1", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "f2", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }), - }, - { - Name: "foo", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go b/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go index f138c9a9ff..db93131fa9 100644 --- a/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go +++ b/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -42,96 +40,5 @@ export = { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "export=", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "export=", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }), - }, - { - Name: "export=", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "export=", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }), - }, - { - Name: "export=", - Kind: lsproto.SymbolKindFunction, - Children: nil, - }, - { - Name: "export=", - Kind: lsproto.SymbolKindFunction, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "Foo", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }), - }, - { - Name: "export=", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "export=", - Kind: lsproto.SymbolKindVariable, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "a", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "b", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - { - Name: "c", - Kind: lsproto.SymbolKindProperty, - Children: PtrTo([]*lsproto.DocumentSymbol{ - { - Name: "d", - Kind: lsproto.SymbolKindProperty, - Children: nil, - }, - }), - }, - }), - }, - { - Name: "abc", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "export=", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarJsDoc_test.go b/internal/fourslash/tests/manual/NavigationBarJsDoc_test.go similarity index 50% rename from internal/fourslash/tests/gen/navigationBarJsDoc_test.go rename to internal/fourslash/tests/manual/NavigationBarJsDoc_test.go index 6d0fa83b95..567d82fa03 100644 --- a/internal/fourslash/tests/gen/navigationBarJsDoc_test.go +++ b/internal/fourslash/tests/manual/NavigationBarJsDoc_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/testutil" ) @@ -12,26 +11,11 @@ func TestNavigationBarJsDoc(t *testing.T) { t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @Filename: foo.js + const content = `// @allowJs: true +// @Filename: foo.js /** @typedef {(number|string)} NumberLike */ /** @typedef {(string|number)} */ const x = 0;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyStradaDocumentSymbol(t, []*lsproto.DocumentSymbol{ - { - Name: "NumberLike", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindVariable, - Children: nil, - }, - { - Name: "x", - Kind: lsproto.SymbolKindClass, - Children: nil, - }, - }) + f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototype2_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototype2_test.go new file mode 100644 index 0000000000..ef69c1be93 --- /dev/null +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototype2_test.go @@ -0,0 +1,21 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototype2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: foo.js +A.prototype.a = function() { }; +A.prototype.b = function() { }; +function A() {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentSymbol(t) +} diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototype3_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototype3_test.go new file mode 100644 index 0000000000..459d91a959 --- /dev/null +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototype3_test.go @@ -0,0 +1,21 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototype3(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: foo.js +var A; +A.prototype.a = function() { }; +A.b = function() { };` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentSymbol(t) +} diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototype4_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototype4_test.go new file mode 100644 index 0000000000..a086bd9d61 --- /dev/null +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototype4_test.go @@ -0,0 +1,29 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototype4(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: foo.js +var A; +A.prototype = { }; +A.prototype = { m() {} }; +A.prototype.a = function() { }; +A.b = function() { }; + +var B; +B["prototype"] = { }; +B["prototype"] = { m() {} }; +B["prototype"]["a"] = function() { }; +B["b"] = function() { };` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentSymbol(t) +} diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeBroken_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeBroken_test.go new file mode 100644 index 0000000000..b7f6a88ea2 --- /dev/null +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeBroken_test.go @@ -0,0 +1,23 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototypeBroken(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: foo.js +function A() {} +A. // Started typing something here +A.prototype.a = function() { }; +G. // Started typing something here +A.prototype.a = function() { };` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentSymbol(t) +} diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeInterlaced_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeInterlaced_test.go new file mode 100644 index 0000000000..23de790666 --- /dev/null +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeInterlaced_test.go @@ -0,0 +1,27 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototypeInterlaced(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: foo.js +var b = 1; +function A() {}; +A.prototype.a = function() { }; +A.b = function() { }; +b = 2 +/* Comment */ +A.prototype.c = function() { } +var b = 2 +A.prototype.d = function() { }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentSymbol(t) +} diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeNested_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeNested_test.go new file mode 100644 index 0000000000..f876b19f79 --- /dev/null +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeNested_test.go @@ -0,0 +1,26 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototypeNested(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: foo.js +function A() {} +A.B = function () { } +A.B.prototype.d = function () { } +Object.defineProperty(A.B.prototype, "x", { + get() {} +}) +A.prototype.D = function () { } +A.prototype.D.prototype.d = function () { } ` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentSymbol(t) +} diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototype_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototype_test.go new file mode 100644 index 0000000000..cb46468929 --- /dev/null +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototype_test.go @@ -0,0 +1,32 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestNavigationBarFunctionPrototype(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: foo.js +function f() {} +f.prototype.x = 0; +f.y = 0; +f.prototype.method = function () {}; +Object.defineProperty(f, 'staticProp', { + set: function() {}, + get: function(){ + } +}); +Object.defineProperty(f.prototype, 'name', { + set: function() {}, + get: function(){ + } +}); ` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentSymbol(t) +} diff --git a/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline.md new file mode 100644 index 0000000000..5948d22531 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline.md @@ -0,0 +1,217 @@ +// === Document Symbols === +```ts +// @FileName: /first.ts +class A { + #foo: () => { + class B { + #bar: () => { + function baz () { + } + } + } + } +} +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "#foo", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 6 + } + }, + "children": [] + } + ] + }, + { + "name": "B", + "kind": "Class", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "children": [ + { + "name": "#bar", + "kind": "Property", + "range": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 10 + } + }, + "children": [] + } + ] + }, + { + "name": "baz", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 9 + }, + "end": { + "line": 5, + "character": 10 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 18 + }, + "end": { + "line": 4, + "character": 21 + } + }, + "children": [] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /second.ts +class Foo { + #privateMethod() {} +} + +``` + +# Symbols + +```json +[ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "children": [ + { + "name": "#privateMethod", + "kind": "Method", + "range": { + "start": { + "line": 1, + "character": 1 + }, + "end": { + "line": 1, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 1 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline.md new file mode 100644 index 0000000000..4769b06389 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline.md @@ -0,0 +1,91 @@ +// === Document Symbols === +```ts +// @FileName: /getNavigationBarItems.ts +class C { + foo; + ["bar"]: string; +} +``` + +# Symbols + +```json +[ + { + "name": "C", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "foo", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "children": [] + }, + { + "name": "\"bar\"", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline.md new file mode 100644 index 0000000000..1b55d6324d --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline.md @@ -0,0 +1,92 @@ +// === Document Symbols === +```js +// @FileName: /jsDocTypedef_form2.js +/** @typedef {(string | number)} NumberLike */ +/** @typedef {(string | number | string[])} */ +var NumberLike2; + +/** @type {NumberLike} */ +var numberLike; +``` + +# Symbols + +```json +[ + { + "name": "NumberLike", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 43 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 33 + }, + "end": { + "line": 0, + "character": 43 + } + }, + "children": [] + }, + { + "name": "NumberLike2", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "children": [] + }, + { + "name": "numberLike", + "kind": "Variable", + "range": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 14 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md new file mode 100644 index 0000000000..108e5f0e5a --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md @@ -0,0 +1,602 @@ +// === Document Symbols === +```ts +// @FileName: /navbar01.ts +// Interface +interface IPoint { + getDist(): number; + new(): IPoint; + (): any; + [x:string]: number; + prop: string; +} + +/// Module +module Shapes { + // Class + export class Point implements IPoint { + constructor (public x: number, public y: number) { } + + // Instance member + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } + + // Getter + get value(): number { return 0; } + + // Setter + set value(newValue: number) { return; } + + // Static member + static origin = new Point(0, 0); + + // Static method + private static getOrigin() { return Point.origin;} + } + + enum Values { value1, value2, value3 } +} + +// Local variables +var p: IPoint = new Shapes.Point(3, 4); +var dist = p.getDist(); +``` + +# Symbols + +```json +[ + { + "name": "IPoint", + "kind": "Interface", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 7, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 10 + }, + "end": { + "line": 1, + "character": 16 + } + }, + "children": [ + { + "name": "getDist", + "kind": "Method", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "children": [] + }, + { + "name": "new()", + "kind": "Constructor", + "range": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 18 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 4 + } + }, + "children": [] + }, + { + "name": "()", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 4 + } + }, + "children": [] + }, + { + "name": "[]", + "kind": "Property", + "range": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 4 + } + }, + "children": [] + }, + { + "name": "prop", + "kind": "Property", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 8 + } + }, + "children": [] + } + ] + }, + { + "name": "Shapes", + "kind": "Namespace", + "range": { + "start": { + "line": 10, + "character": 0 + }, + "end": { + "line": 32, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 7 + }, + "end": { + "line": 10, + "character": 13 + } + }, + "children": [ + { + "name": "Point", + "kind": "Class", + "range": { + "start": { + "line": 12, + "character": 4 + }, + "end": { + "line": 29, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 17 + }, + "end": { + "line": 12, + "character": 22 + } + }, + "children": [ + { + "name": "constructor", + "kind": "Constructor", + "range": { + "start": { + "line": 13, + "character": 8 + }, + "end": { + "line": 13, + "character": 60 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 8 + }, + "end": { + "line": 13, + "character": 8 + } + }, + "children": [] + }, + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 13, + "character": 21 + }, + "end": { + "line": 13, + "character": 37 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 28 + }, + "end": { + "line": 13, + "character": 29 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Property", + "range": { + "start": { + "line": 13, + "character": 39 + }, + "end": { + "line": 13, + "character": 55 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 46 + }, + "end": { + "line": 13, + "character": 47 + } + }, + "children": [] + }, + { + "name": "getDist", + "kind": "Method", + "range": { + "start": { + "line": 16, + "character": 8 + }, + "end": { + "line": 16, + "character": 74 + } + }, + "selectionRange": { + "start": { + "line": 16, + "character": 8 + }, + "end": { + "line": 16, + "character": 15 + } + }, + "children": [] + }, + { + "name": "value", + "kind": "Property", + "range": { + "start": { + "line": 19, + "character": 8 + }, + "end": { + "line": 19, + "character": 41 + } + }, + "selectionRange": { + "start": { + "line": 19, + "character": 12 + }, + "end": { + "line": 19, + "character": 17 + } + }, + "children": [] + }, + { + "name": "value", + "kind": "Property", + "range": { + "start": { + "line": 22, + "character": 8 + }, + "end": { + "line": 22, + "character": 47 + } + }, + "selectionRange": { + "start": { + "line": 22, + "character": 12 + }, + "end": { + "line": 22, + "character": 17 + } + }, + "children": [] + }, + { + "name": "origin", + "kind": "Property", + "range": { + "start": { + "line": 25, + "character": 8 + }, + "end": { + "line": 25, + "character": 40 + } + }, + "selectionRange": { + "start": { + "line": 25, + "character": 15 + }, + "end": { + "line": 25, + "character": 21 + } + }, + "children": [] + }, + { + "name": "getOrigin", + "kind": "Method", + "range": { + "start": { + "line": 28, + "character": 8 + }, + "end": { + "line": 28, + "character": 58 + } + }, + "selectionRange": { + "start": { + "line": 28, + "character": 23 + }, + "end": { + "line": 28, + "character": 32 + } + }, + "children": [] + } + ] + }, + { + "name": "Values", + "kind": "Enum", + "range": { + "start": { + "line": 31, + "character": 4 + }, + "end": { + "line": 31, + "character": 42 + } + }, + "selectionRange": { + "start": { + "line": 31, + "character": 9 + }, + "end": { + "line": 31, + "character": 15 + } + }, + "children": [ + { + "name": "value1", + "kind": "EnumMember", + "range": { + "start": { + "line": 31, + "character": 18 + }, + "end": { + "line": 31, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 31, + "character": 18 + }, + "end": { + "line": 31, + "character": 24 + } + }, + "children": [] + }, + { + "name": "value2", + "kind": "EnumMember", + "range": { + "start": { + "line": 31, + "character": 26 + }, + "end": { + "line": 31, + "character": 32 + } + }, + "selectionRange": { + "start": { + "line": 31, + "character": 26 + }, + "end": { + "line": 31, + "character": 32 + } + }, + "children": [] + }, + { + "name": "value3", + "kind": "EnumMember", + "range": { + "start": { + "line": 31, + "character": 34 + }, + "end": { + "line": 31, + "character": 40 + } + }, + "selectionRange": { + "start": { + "line": 31, + "character": 34 + }, + "end": { + "line": 31, + "character": 40 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "p", + "kind": "Variable", + "range": { + "start": { + "line": 35, + "character": 4 + }, + "end": { + "line": 35, + "character": 38 + } + }, + "selectionRange": { + "start": { + "line": 35, + "character": 4 + }, + "end": { + "line": 35, + "character": 5 + } + }, + "children": [] + }, + { + "name": "dist", + "kind": "Variable", + "range": { + "start": { + "line": 36, + "character": 4 + }, + "end": { + "line": 36, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 36, + "character": 4 + }, + "end": { + "line": 36, + "character": 8 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline.md new file mode 100644 index 0000000000..adab2eb701 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline.md @@ -0,0 +1,11 @@ +// === Document Symbols === +```js +// @FileName: /a.js +exports.a = exports.b = exports.c = 0; +``` + +# Symbols + +```json +[] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline.md new file mode 100644 index 0000000000..a997006dc9 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline.md @@ -0,0 +1,37 @@ +// === Document Symbols === +```ts +// @FileName: /navbar_const.ts +const c = 0; +``` + +# Symbols + +```json +[ + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline.md new file mode 100644 index 0000000000..69ad17282f --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline.md @@ -0,0 +1,344 @@ +// === Document Symbols === +```ts +// @FileName: /navbar_contains_no_duplicates.ts +declare module Windows { + export module Foundation { + export var A; + export class Test { + public wow(); + } + } +} + +declare module Windows { + export module Foundation { + export var B; + export module Test { + export function Boom(): number; + } + } +} + +class ABC { + public foo() { + return 3; + } +} + +module ABC { + export var x = 3; +} +``` + +# Symbols + +```json +[ + { + "name": "Windows", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 7, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 15 + }, + "end": { + "line": 0, + "character": 22 + } + }, + "children": [ + { + "name": "Foundation", + "kind": "Namespace", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 6, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 18 + }, + "end": { + "line": 1, + "character": 28 + } + }, + "children": [ + { + "name": "A", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 19 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 19 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "children": [] + }, + { + "name": "Test", + "kind": "Class", + "range": { + "start": { + "line": 3, + "character": 8 + }, + "end": { + "line": 5, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 21 + }, + "end": { + "line": 3, + "character": 25 + } + }, + "children": [ + { + "name": "wow", + "kind": "Method", + "range": { + "start": { + "line": 4, + "character": 12 + }, + "end": { + "line": 4, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 19 + }, + "end": { + "line": 4, + "character": 22 + } + }, + "children": [] + } + ] + }, + { + "name": "B", + "kind": "Variable", + "range": { + "start": { + "line": 11, + "character": 19 + }, + "end": { + "line": 11, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 11, + "character": 19 + }, + "end": { + "line": 11, + "character": 20 + } + }, + "children": [] + }, + { + "name": "Test", + "kind": "Namespace", + "range": { + "start": { + "line": 12, + "character": 8 + }, + "end": { + "line": 14, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 22 + }, + "end": { + "line": 12, + "character": 26 + } + }, + "children": [ + { + "name": "Boom", + "kind": "Function", + "range": { + "start": { + "line": 13, + "character": 12 + }, + "end": { + "line": 13, + "character": 43 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 28 + }, + "end": { + "line": 13, + "character": 32 + } + }, + "children": [] + } + ] + } + ] + } + ] + }, + { + "name": "ABC", + "kind": "Class", + "range": { + "start": { + "line": 18, + "character": 0 + }, + "end": { + "line": 22, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 18, + "character": 6 + }, + "end": { + "line": 18, + "character": 9 + } + }, + "children": [ + { + "name": "foo", + "kind": "Method", + "range": { + "start": { + "line": 19, + "character": 4 + }, + "end": { + "line": 21, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 19, + "character": 11 + }, + "end": { + "line": 19, + "character": 14 + } + }, + "children": [] + } + ] + }, + { + "name": "ABC", + "kind": "Namespace", + "range": { + "start": { + "line": 24, + "character": 0 + }, + "end": { + "line": 26, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 24, + "character": 7 + }, + "end": { + "line": 24, + "character": 10 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 25, + "character": 15 + }, + "end": { + "line": 25, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 25, + "character": 15 + }, + "end": { + "line": 25, + "character": 16 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline.md new file mode 100644 index 0000000000..ae0210e9ac --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline.md @@ -0,0 +1,157 @@ +// === Document Symbols === +```ts +// @FileName: /a.ts +export default class { } +``` + +# Symbols + +```json +[ + { + "name": "default", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "children": [] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /b.ts +export default class C { } +``` + +# Symbols + +```json +[ + { + "name": "C", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 26 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 21 + }, + "end": { + "line": 0, + "character": 22 + } + }, + "children": [] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /c.ts +export default function { } +``` + +# Symbols + +```json +[ + { + "name": "default", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 27 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "children": [] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /d.ts +export default function Func { } +``` + +# Symbols + +```json +[ + { + "name": "Func", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 32 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 24 + }, + "end": { + "line": 0, + "character": 28 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline.md new file mode 100644 index 0000000000..d2ce15ba4d --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline.md @@ -0,0 +1,37 @@ +// === Document Symbols === +```ts +// @FileName: /navbar_let.ts +let c = 0; +``` + +# Symbols + +```json +[ + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline.md new file mode 100644 index 0000000000..2216078705 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline.md @@ -0,0 +1,469 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarAnonymousClassAndFunctionExpressions.ts +global.cls = class { }; +(function() { + const x = () => { + // Presence of inner function causes x to be a top-level function. + function xx() {} + }; + const y = { + // This is not a top-level function (contains nothing, but shows up in childItems of its parent.) + foo: function() {} + }; + (function nest() { + function moreNest() {} + })(); +})(); +(function() { // Different anonymous functions are not merged + // These will only show up as childItems. + function z() {} + console.log(function() {}) + describe("this", 'function', `is a function`, `with template literal ${"a"}`, () => {}); + [].map(() => {}); +}) +(function classes() { + // Classes show up in top-level regardless of whether they have names or inner declarations. + const cls2 = class { }; + console.log(class cls3 {}); + (class { }); +}) +``` + +# Symbols + +```json +[ + { + "name": "cls", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 13 + }, + "end": { + "line": 0, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 13 + }, + "end": { + "line": 0, + "character": 13 + } + }, + "children": [] + }, + { + "name": "", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 1 + }, + "end": { + "line": 13, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 1 + }, + "end": { + "line": 1, + "character": 1 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "children": [ + { + "name": "xx", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 8 + }, + "end": { + "line": 4, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 17 + }, + "end": { + "line": 4, + "character": 19 + } + }, + "children": [] + } + ] + }, + { + "name": "y", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 10 + }, + "end": { + "line": 9, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 10 + }, + "end": { + "line": 6, + "character": 11 + } + }, + "children": [ + { + "name": "foo", + "kind": "Property", + "range": { + "start": { + "line": 8, + "character": 8 + }, + "end": { + "line": 8, + "character": 26 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 8 + }, + "end": { + "line": 8, + "character": 11 + } + }, + "children": [] + } + ] + }, + { + "name": "nest", + "kind": "Function", + "range": { + "start": { + "line": 10, + "character": 5 + }, + "end": { + "line": 12, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 14 + }, + "end": { + "line": 10, + "character": 18 + } + }, + "children": [ + { + "name": "moreNest", + "kind": "Function", + "range": { + "start": { + "line": 11, + "character": 8 + }, + "end": { + "line": 11, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 11, + "character": 17 + }, + "end": { + "line": 11, + "character": 25 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "", + "kind": "Function", + "range": { + "start": { + "line": 14, + "character": 1 + }, + "end": { + "line": 20, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 1 + }, + "end": { + "line": 14, + "character": 1 + } + }, + "children": [ + { + "name": "z", + "kind": "Function", + "range": { + "start": { + "line": 16, + "character": 4 + }, + "end": { + "line": 16, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 16, + "character": 13 + }, + "end": { + "line": 16, + "character": 14 + } + }, + "children": [] + }, + { + "name": "console.log() callback", + "kind": "Function", + "range": { + "start": { + "line": 17, + "character": 16 + }, + "end": { + "line": 17, + "character": 29 + } + }, + "selectionRange": { + "start": { + "line": 17, + "character": 16 + }, + "end": { + "line": 17, + "character": 16 + } + }, + "children": [] + }, + { + "name": "describe() callback", + "kind": "Function", + "range": { + "start": { + "line": 18, + "character": 82 + }, + "end": { + "line": 18, + "character": 90 + } + }, + "selectionRange": { + "start": { + "line": 18, + "character": 82 + }, + "end": { + "line": 18, + "character": 82 + } + }, + "children": [] + }, + { + "name": "map() callback", + "kind": "Function", + "range": { + "start": { + "line": 19, + "character": 11 + }, + "end": { + "line": 19, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 19, + "character": 11 + }, + "end": { + "line": 19, + "character": 11 + } + }, + "children": [] + } + ] + }, + { + "name": "classes", + "kind": "Function", + "range": { + "start": { + "line": 21, + "character": 1 + }, + "end": { + "line": 26, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 21, + "character": 10 + }, + "end": { + "line": 21, + "character": 17 + } + }, + "children": [ + { + "name": "cls2", + "kind": "Variable", + "range": { + "start": { + "line": 23, + "character": 10 + }, + "end": { + "line": 23, + "character": 26 + } + }, + "selectionRange": { + "start": { + "line": 23, + "character": 10 + }, + "end": { + "line": 23, + "character": 14 + } + }, + "children": [] + }, + { + "name": "cls3", + "kind": "Class", + "range": { + "start": { + "line": 24, + "character": 16 + }, + "end": { + "line": 24, + "character": 29 + } + }, + "selectionRange": { + "start": { + "line": 24, + "character": 22 + }, + "end": { + "line": 24, + "character": 26 + } + }, + "children": [] + }, + { + "name": "", + "kind": "Class", + "range": { + "start": { + "line": 25, + "character": 5 + }, + "end": { + "line": 25, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 25, + "character": 5 + }, + "end": { + "line": 25, + "character": 5 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline.md new file mode 100644 index 0000000000..fc1a1c867f --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline.md @@ -0,0 +1,164 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarAnonymousClassAndFunctionExpressions2.ts +console.log(console.log(class Y {}, class X {}), console.log(class B {}, class A {})); +console.log(class Cls { meth() {} }); +``` + +# Symbols + +```json +[ + { + "name": "Y", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 24 + }, + "end": { + "line": 0, + "character": 34 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 30 + }, + "end": { + "line": 0, + "character": 31 + } + }, + "children": [] + }, + { + "name": "X", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 36 + }, + "end": { + "line": 0, + "character": 46 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 42 + }, + "end": { + "line": 0, + "character": 43 + } + }, + "children": [] + }, + { + "name": "B", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 61 + }, + "end": { + "line": 0, + "character": 71 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 67 + }, + "end": { + "line": 0, + "character": 68 + } + }, + "children": [] + }, + { + "name": "A", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 73 + }, + "end": { + "line": 0, + "character": 83 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 79 + }, + "end": { + "line": 0, + "character": 80 + } + }, + "children": [] + }, + { + "name": "Cls", + "kind": "Class", + "range": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 35 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 18 + }, + "end": { + "line": 1, + "character": 21 + } + }, + "children": [ + { + "name": "meth", + "kind": "Method", + "range": { + "start": { + "line": 1, + "character": 24 + }, + "end": { + "line": 1, + "character": 33 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 24 + }, + "end": { + "line": 1, + "character": 28 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline.md new file mode 100644 index 0000000000..e8819be447 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline.md @@ -0,0 +1,172 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarAnonymousClassAndFunctionExpressions3.ts +describe('foo', () => { + test(`a ${1} b ${2}`, () => {}) +}) + +const a = 1; +const b = 2; +describe('foo', () => { + test(`a ${a} b {b}`, () => {}) +}) +``` + +# Symbols + +```json +[ + { + "name": "describe() callback", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 16 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 16 + }, + "end": { + "line": 0, + "character": 16 + } + }, + "children": [ + { + "name": "test() callback", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 26 + }, + "end": { + "line": 1, + "character": 34 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 26 + }, + "end": { + "line": 1, + "character": 26 + } + }, + "children": [] + } + ] + }, + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 7 + } + }, + "children": [] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 5, + "character": 6 + }, + "end": { + "line": 5, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 6 + }, + "end": { + "line": 5, + "character": 7 + } + }, + "children": [] + }, + { + "name": "describe() callback", + "kind": "Function", + "range": { + "start": { + "line": 6, + "character": 16 + }, + "end": { + "line": 8, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 16 + }, + "end": { + "line": 6, + "character": 16 + } + }, + "children": [ + { + "name": "test() callback", + "kind": "Function", + "range": { + "start": { + "line": 7, + "character": 25 + }, + "end": { + "line": 7, + "character": 33 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 25 + }, + "end": { + "line": 7, + "character": 25 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline.md new file mode 100644 index 0000000000..1550776c45 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline.md @@ -0,0 +1,118 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarAssignmentTypes.ts +'use strict' +const a = { + ...b, + c, + d: 0 +}; +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 5, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "children": [ + { + "name": "b", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 7 + }, + "end": { + "line": 2, + "character": 8 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Property", + "range": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "children": [] + }, + { + "name": "d", + "kind": "Property", + "range": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 5 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline.md new file mode 100644 index 0000000000..66ec6a3a60 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline.md @@ -0,0 +1,67 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarClassStaticBlock.ts +class C { + static { + let x; + } +} +``` + +# Symbols + +```json +[ + { + "name": "C", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 9 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline.md new file mode 100644 index 0000000000..71f88acf00 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline.md @@ -0,0 +1,93 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarComputedPropertyName.ts +function F(key, value) { + return { + [key]: value, + "prop": true + } +} +``` + +# Symbols + +```json +[ + { + "name": "F", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 5, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [ + { + "name": "[key]", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 13 + } + }, + "children": [] + }, + { + "name": "\"prop\"", + "kind": "Property", + "range": { + "start": { + "line": 3, + "character": 8 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 8 + }, + "end": { + "line": 3, + "character": 14 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline.md new file mode 100644 index 0000000000..d0cefa9493 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline.md @@ -0,0 +1,176 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarFunctionIndirectlyInVariableDeclaration.ts +var a = { + propA: function() { + var c; + } +}; +var b; +b = { + propB: function() { + // function must not have an empty body to appear top level + var d; + } +}; +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "children": [ + { + "name": "propA", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "children": [ + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 13 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "children": [] + }, + { + "name": "propB", + "kind": "Property", + "range": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 10, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 7, + "character": 9 + } + }, + "children": [ + { + "name": "d", + "kind": "Variable", + "range": { + "start": { + "line": 9, + "character": 12 + }, + "end": { + "line": 9, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 9, + "character": 12 + }, + "end": { + "line": 9, + "character": 13 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline.md new file mode 100644 index 0000000000..a83582eade --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline.md @@ -0,0 +1,195 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarFunctionLikePropertyAssignments.ts +var functions = { + a: 0, + b: function () { }, + c: function x() { }, + d: () => { }, + e: y(), + f() { } +}; +``` + +# Symbols + +```json +[ + { + "name": "functions", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 7, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 13 + } + }, + "children": [ + { + "name": "a", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 5 + } + }, + "children": [] + }, + { + "name": "b", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Property", + "range": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "children": [] + }, + { + "name": "d", + "kind": "Property", + "range": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 16 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 5 + } + }, + "children": [] + }, + { + "name": "e", + "kind": "Property", + "range": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 10 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "children": [] + }, + { + "name": "f", + "kind": "Method", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 5 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline.md new file mode 100644 index 0000000000..85af0672b6 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline.md @@ -0,0 +1,252 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +function f() {} +f.prototype.x = 0; +f.y = 0; +f.prototype.method = function () {}; +Object.defineProperty(f, 'staticProp', { + set: function() {}, + get: function(){ + } +}); +Object.defineProperty(f.prototype, 'name', { + set: function() {}, + get: function(){ + } +}); +``` + +# Symbols + +```json +[ + { + "name": "f", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 0 + }, + "end": { + "line": 2, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 3 + } + }, + "children": [] + }, + { + "name": "method", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 3, + "character": 18 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 12 + }, + "end": { + "line": 3, + "character": 18 + } + }, + "children": [ + { + "name": "method", + "kind": "Function", + "range": { + "start": { + "line": 3, + "character": 21 + }, + "end": { + "line": 3, + "character": 35 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 21 + }, + "end": { + "line": 3, + "character": 21 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "set", + "kind": "Property", + "range": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 7 + } + }, + "children": [] + }, + { + "name": "get", + "kind": "Property", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 7, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 7 + } + }, + "children": [] + }, + { + "name": "set", + "kind": "Property", + "range": { + "start": { + "line": 10, + "character": 4 + }, + "end": { + "line": 10, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 4 + }, + "end": { + "line": 10, + "character": 7 + } + }, + "children": [] + }, + { + "name": "get", + "kind": "Property", + "range": { + "start": { + "line": 11, + "character": 4 + }, + "end": { + "line": 12, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 11, + "character": 4 + }, + "end": { + "line": 11, + "character": 7 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline.md new file mode 100644 index 0000000000..80bf076750 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline.md @@ -0,0 +1,142 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +A.prototype.a = function() { }; +A.prototype.b = function() { }; +function A() {} +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Function", + "range": { + "start": { + "line": 2, + "character": 0 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 9 + }, + "end": { + "line": 2, + "character": 10 + } + }, + "children": [ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 12 + }, + "end": { + "line": 0, + "character": 13 + } + }, + "children": [ + { + "name": "a", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 16 + }, + "end": { + "line": 0, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 16 + }, + "end": { + "line": 0, + "character": 16 + } + }, + "children": [] + } + ] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "children": [ + { + "name": "b", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 16 + }, + "end": { + "line": 1, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 16 + }, + "end": { + "line": 1, + "character": 16 + } + }, + "children": [] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline.md new file mode 100644 index 0000000000..ccb12e8b48 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline.md @@ -0,0 +1,142 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +var A; +A.prototype.a = function() { }; +A.b = function() { }; +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "children": [ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 12 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "children": [ + { + "name": "a", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 16 + }, + "end": { + "line": 1, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 16 + }, + "end": { + "line": 1, + "character": 16 + } + }, + "children": [] + } + ] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 0 + }, + "end": { + "line": 2, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 3 + } + }, + "children": [ + { + "name": "b", + "kind": "Function", + "range": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 6 + } + }, + "children": [] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline.md new file mode 100644 index 0000000000..2d5c03b193 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline.md @@ -0,0 +1,328 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +var A; +A.prototype = { }; +A.prototype = { m() {} }; +A.prototype.a = function() { }; +A.b = function() { }; + +var B; +B["prototype"] = { }; +B["prototype"] = { m() {} }; +B["prototype"]["a"] = function() { }; +B["b"] = function() { }; +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "children": [ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 3, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 12 + }, + "end": { + "line": 3, + "character": 13 + } + }, + "children": [ + { + "name": "a", + "kind": "Function", + "range": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 16 + } + }, + "children": [] + } + ] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 4, + "character": 0 + }, + "end": { + "line": 4, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 2 + }, + "end": { + "line": 4, + "character": 3 + } + }, + "children": [ + { + "name": "b", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 6 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "m", + "kind": "Method", + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 17 + } + }, + "children": [] + }, + { + "name": "B", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 5 + } + }, + "children": [ + { + "name": "\"a\"", + "kind": "Variable", + "range": { + "start": { + "line": 9, + "character": 0 + }, + "end": { + "line": 9, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 9, + "character": 15 + }, + "end": { + "line": 9, + "character": 18 + } + }, + "children": [ + { + "name": "\"a\"", + "kind": "Function", + "range": { + "start": { + "line": 9, + "character": 22 + }, + "end": { + "line": 9, + "character": 36 + } + }, + "selectionRange": { + "start": { + "line": 9, + "character": 22 + }, + "end": { + "line": 9, + "character": 22 + } + }, + "children": [] + } + ] + }, + { + "name": "\"b\"", + "kind": "Variable", + "range": { + "start": { + "line": 10, + "character": 0 + }, + "end": { + "line": 10, + "character": 6 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 2 + }, + "end": { + "line": 10, + "character": 5 + } + }, + "children": [ + { + "name": "\"b\"", + "kind": "Function", + "range": { + "start": { + "line": 10, + "character": 9 + }, + "end": { + "line": 10, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 9 + }, + "end": { + "line": 10, + "character": 9 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "m", + "kind": "Method", + "range": { + "start": { + "line": 8, + "character": 19 + }, + "end": { + "line": 8, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 19 + }, + "end": { + "line": 8, + "character": 20 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline.md new file mode 100644 index 0000000000..b334e1cbce --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline.md @@ -0,0 +1,91 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +function A() {} +A. // Started typing something here +A.prototype.a = function() { }; +G. // Started typing something here +A.prototype.a = function() { }; +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [] + }, + { + "name": "a", + "kind": "Function", + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "children": [] + }, + { + "name": "a", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 16 + }, + "end": { + "line": 4, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 16 + }, + "end": { + "line": 4, + "character": 16 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline.md new file mode 100644 index 0000000000..ffc80186bb --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline.md @@ -0,0 +1,300 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +var b = 1; +function A() {}; +A.prototype.a = function() { }; +A.b = function() { }; +b = 2 +/* Comment */ +A.prototype.c = function() { } +var b = 2 +A.prototype.d = function() { } +``` + +# Symbols + +```json +[ + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "children": [] + }, + { + "name": "A", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 9 + }, + "end": { + "line": 1, + "character": 10 + } + }, + "children": [ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 0 + }, + "end": { + "line": 2, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 13 + } + }, + "children": [ + { + "name": "a", + "kind": "Function", + "range": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 16 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "children": [] + } + ] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 3, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 2 + }, + "end": { + "line": 3, + "character": 3 + } + }, + "children": [ + { + "name": "b", + "kind": "Function", + "range": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 6 + } + }, + "children": [] + } + ] + }, + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 0 + }, + "end": { + "line": 6, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 12 + }, + "end": { + "line": 6, + "character": 13 + } + }, + "children": [ + { + "name": "c", + "kind": "Function", + "range": { + "start": { + "line": 6, + "character": 16 + }, + "end": { + "line": 6, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 16 + }, + "end": { + "line": 6, + "character": 16 + } + }, + "children": [] + } + ] + }, + { + "name": "d", + "kind": "Variable", + "range": { + "start": { + "line": 8, + "character": 0 + }, + "end": { + "line": 8, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 12 + }, + "end": { + "line": 8, + "character": 13 + } + }, + "children": [ + { + "name": "d", + "kind": "Function", + "range": { + "start": { + "line": 8, + "character": 16 + }, + "end": { + "line": 8, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 16 + }, + "end": { + "line": 8, + "character": 16 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 7, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 7, + "character": 5 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline.md new file mode 100644 index 0000000000..c1d4900e2c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline.md @@ -0,0 +1,222 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +function A() {} +A.B = function () { } +A.B.prototype.d = function () { } +Object.defineProperty(A.B.prototype, "x", { + get() {} +}) +A.prototype.D = function () { } +A.prototype.D.prototype.d = function () { } +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [ + { + "name": "B", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 3 + } + }, + "children": [ + { + "name": "B", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 6 + } + }, + "children": [] + } + ] + }, + { + "name": "D", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 0 + }, + "end": { + "line": 6, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 12 + }, + "end": { + "line": 6, + "character": 13 + } + }, + "children": [ + { + "name": "D", + "kind": "Function", + "range": { + "start": { + "line": 6, + "character": 16 + }, + "end": { + "line": 6, + "character": 32 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 16 + }, + "end": { + "line": 6, + "character": 16 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "d", + "kind": "Function", + "range": { + "start": { + "line": 2, + "character": 18 + }, + "end": { + "line": 2, + "character": 34 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 18 + }, + "end": { + "line": 2, + "character": 18 + } + }, + "children": [] + }, + { + "name": "get", + "kind": "Method", + "range": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 7 + } + }, + "children": [] + }, + { + "name": "d", + "kind": "Function", + "range": { + "start": { + "line": 7, + "character": 28 + }, + "end": { + "line": 7, + "character": 44 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 28 + }, + "end": { + "line": 7, + "character": 28 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline.md new file mode 100644 index 0000000000..c7c08b1329 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline.md @@ -0,0 +1,120 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarGetterAndSetter.ts +class X { + get x() {} + set x(value) { + // Inner declaration should make the setter top-level. + function f() {} + } +} +``` + +# Symbols + +```json +[ + { + "name": "X", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 6, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "children": [] + }, + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 9 + } + }, + "children": [ + { + "name": "f", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 8 + }, + "end": { + "line": 4, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 17 + }, + "end": { + "line": 4, + "character": 18 + } + }, + "children": [] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline.md new file mode 100644 index 0000000000..c372333bb9 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline.md @@ -0,0 +1,114 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarImports.ts +import a, {b} from "m"; +import c = require("m"); +import * as d from "m"; +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 8 + } + }, + "children": [] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 11 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 11 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 7 + }, + "end": { + "line": 1, + "character": 8 + } + }, + "children": [] + }, + { + "name": "d", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 7 + }, + "end": { + "line": 2, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 13 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline.md new file mode 100644 index 0000000000..0b3b4a0ec1 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline.md @@ -0,0 +1,194 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarInitializerSpans.ts +// get the name for the navbar from the variable name rather than the function name +const x = () => { var a; }; +const f = function f() { var b; }; +const y = { z: function z() { var c; } }; +``` + +# Symbols + +```json +[ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 26 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "children": [ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 22 + }, + "end": { + "line": 1, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 22 + }, + "end": { + "line": 1, + "character": 23 + } + }, + "children": [] + } + ] + }, + { + "name": "f", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 33 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 7 + } + }, + "children": [ + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 29 + }, + "end": { + "line": 2, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 29 + }, + "end": { + "line": 2, + "character": 30 + } + }, + "children": [] + } + ] + }, + { + "name": "y", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 40 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 7 + } + }, + "children": [ + { + "name": "z", + "kind": "Property", + "range": { + "start": { + "line": 3, + "character": 12 + }, + "end": { + "line": 3, + "character": 38 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 12 + }, + "end": { + "line": 3, + "character": 13 + } + }, + "children": [ + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 34 + }, + "end": { + "line": 3, + "character": 35 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 34 + }, + "end": { + "line": 3, + "character": 35 + } + }, + "children": [] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline.md new file mode 100644 index 0000000000..ffbf8f570d --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline.md @@ -0,0 +1,318 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsBindingPatterns.ts +'use strict' +var foo, {} +var bar, [] +let foo1, {a, b} +const bar1, [c, d] +var {e, x: [f, g]} = {a:1, x:[]}; +var { h: i = function j() {} } = obj; +``` + +# Symbols + +```json +[ + { + "name": "foo", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "children": [] + }, + { + "name": "bar", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 7 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 7 + } + }, + "children": [] + }, + { + "name": "foo1", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 8 + } + }, + "children": [] + }, + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 11 + }, + "end": { + "line": 3, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 11 + }, + "end": { + "line": 3, + "character": 12 + } + }, + "children": [] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 14 + }, + "end": { + "line": 3, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 14 + }, + "end": { + "line": 3, + "character": 15 + } + }, + "children": [] + }, + { + "name": "bar1", + "kind": "Variable", + "range": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 10 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 10 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 4, + "character": 13 + }, + "end": { + "line": 4, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 13 + }, + "end": { + "line": 4, + "character": 14 + } + }, + "children": [] + }, + { + "name": "d", + "kind": "Variable", + "range": { + "start": { + "line": 4, + "character": 16 + }, + "end": { + "line": 4, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 16 + }, + "end": { + "line": 4, + "character": 17 + } + }, + "children": [] + }, + { + "name": "e", + "kind": "Variable", + "range": { + "start": { + "line": 5, + "character": 5 + }, + "end": { + "line": 5, + "character": 6 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 5 + }, + "end": { + "line": 5, + "character": 6 + } + }, + "children": [] + }, + { + "name": "f", + "kind": "Variable", + "range": { + "start": { + "line": 5, + "character": 12 + }, + "end": { + "line": 5, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 12 + }, + "end": { + "line": 5, + "character": 13 + } + }, + "children": [] + }, + { + "name": "g", + "kind": "Variable", + "range": { + "start": { + "line": 5, + "character": 15 + }, + "end": { + "line": 5, + "character": 16 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 15 + }, + "end": { + "line": 5, + "character": 16 + } + }, + "children": [] + }, + { + "name": "i", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 6 + }, + "end": { + "line": 6, + "character": 28 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 9 + }, + "end": { + "line": 6, + "character": 10 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline.md new file mode 100644 index 0000000000..f4bc8b47fa --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline.md @@ -0,0 +1,173 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsBindingPatternsInConstructor.ts +class A { + x: any + constructor([a]: any) { + } +} +class B { + x: any; + constructor( {a} = { a: 1 }) { + } +} +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 10 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 5 + } + }, + "children": [] + }, + { + "name": "constructor", + "kind": "Constructor", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 4 + } + }, + "children": [] + } + ] + }, + { + "name": "B", + "kind": "Class", + "range": { + "start": { + "line": 5, + "character": 0 + }, + "end": { + "line": 9, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 6 + }, + "end": { + "line": 5, + "character": 7 + } + }, + "children": [ + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 5 + } + }, + "children": [] + }, + { + "name": "constructor", + "kind": "Constructor", + "range": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 8, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 7, + "character": 4 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline.md new file mode 100644 index 0000000000..ae038080bc --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline.md @@ -0,0 +1,63 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsClass1.ts +function Foo() {} +class Foo {} +``` + +# Symbols + +```json +[ + { + "name": "Foo", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "children": [] + }, + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline.md new file mode 100644 index 0000000000..623fa22497 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline.md @@ -0,0 +1,63 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsClass2.ts +class Foo {} +function Foo() {} +``` + +# Symbols + +```json +[ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "children": [] + }, + { + "name": "Foo", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 9 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline.md new file mode 100644 index 0000000000..c04588fd4c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline.md @@ -0,0 +1,63 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +function Foo() {} +class Foo {} +``` + +# Symbols + +```json +[ + { + "name": "Foo", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "children": [] + }, + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline.md new file mode 100644 index 0000000000..a47dcbc662 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline.md @@ -0,0 +1,63 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +class Foo {} +function Foo() {} +``` + +# Symbols + +```json +[ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "children": [] + }, + { + "name": "Foo", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 9 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline.md new file mode 100644 index 0000000000..c8bd57c0f9 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline.md @@ -0,0 +1,63 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsClass5.ts +class Foo {} +let Foo = 1; +``` + +# Symbols + +```json +[ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "children": [] + }, + { + "name": "Foo", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline.md new file mode 100644 index 0000000000..96abee6343 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline.md @@ -0,0 +1,118 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsClass6.ts +function Z() { } + +Z.foo = 42 + +class Z { } +``` + +# Symbols + +```json +[ + { + "name": "Z", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 16 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [ + { + "name": "foo", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 0 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "children": [] + } + ] + }, + { + "name": "Z", + "kind": "Class", + "range": { + "start": { + "line": 4, + "character": 0 + }, + "end": { + "line": 4, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 6 + }, + "end": { + "line": 4, + "character": 7 + } + }, + "children": [ + { + "name": "foo", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 0 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline.md new file mode 100644 index 0000000000..342e8234e2 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline.md @@ -0,0 +1,235 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsComputedNames.ts +const enum E { + A = 'A', +} +const a = ''; + +class C { + [a]() { + return 1; + } + + [E.A]() { + return 1; + } + + [1]() { + return 1; + }, + + ["foo"]() { + return 1; + }, +} +``` + +# Symbols + +```json +[ + { + "name": "E", + "kind": "Enum", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 11 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "children": [ + { + "name": "A", + "kind": "EnumMember", + "range": { + "start": { + "line": 1, + "character": 1 + }, + "end": { + "line": 1, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 1 + }, + "end": { + "line": 1, + "character": 2 + } + }, + "children": [] + } + ] + }, + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 7 + } + }, + "children": [] + }, + { + "name": "C", + "kind": "Class", + "range": { + "start": { + "line": 5, + "character": 0 + }, + "end": { + "line": 21, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 6 + }, + "end": { + "line": 5, + "character": 7 + } + }, + "children": [ + { + "name": "[a]", + "kind": "Method", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 8, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 7 + } + }, + "children": [] + }, + { + "name": "[E.A]", + "kind": "Method", + "range": { + "start": { + "line": 10, + "character": 4 + }, + "end": { + "line": 12, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 4 + }, + "end": { + "line": 10, + "character": 9 + } + }, + "children": [] + }, + { + "name": "1", + "kind": "Method", + "range": { + "start": { + "line": 14, + "character": 4 + }, + "end": { + "line": 16, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 4 + }, + "end": { + "line": 14, + "character": 7 + } + }, + "children": [] + }, + { + "name": "\"foo\"", + "kind": "Method", + "range": { + "start": { + "line": 18, + "character": 4 + }, + "end": { + "line": 20, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 18, + "character": 4 + }, + "end": { + "line": 18, + "character": 11 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline.md new file mode 100644 index 0000000000..04ad8b218f --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline.md @@ -0,0 +1,66 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsEmptyConstructors.ts +class Test { + constructor() { + } +} +``` + +# Symbols + +```json +[ + { + "name": "Test", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [ + { + "name": "constructor", + "kind": "Constructor", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 4 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline.md new file mode 100644 index 0000000000..50ee83db8e --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline.md @@ -0,0 +1,93 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsExports.ts +export { a } from "a"; + +export { b as B } from "a" + +export import e = require("a"); + +export * from "a"; // no bindings here +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [] + }, + { + "name": "B", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 9 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 14 + }, + "end": { + "line": 2, + "character": 15 + } + }, + "children": [] + }, + { + "name": "e", + "kind": "Variable", + "range": { + "start": { + "line": 4, + "character": 0 + }, + "end": { + "line": 4, + "character": 31 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 14 + }, + "end": { + "line": 4, + "character": 15 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline.md new file mode 100644 index 0000000000..c44d29af9c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline.md @@ -0,0 +1,92 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsFunctionProperties.ts +(function(){ +var A; +A +.a = function() { }; +})(); +``` + +# Symbols + +```json +[ + { + "name": "", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 1 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 1 + }, + "end": { + "line": 0, + "character": 1 + } + }, + "children": [ + { + "name": "A", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 5 + } + }, + "children": [] + }, + { + "name": "a", + "kind": "Function", + "range": { + "start": { + "line": 3, + "character": 5 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 5 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline.md new file mode 100644 index 0000000000..cb97e6984b --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline.md @@ -0,0 +1,256 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsFunctions.ts +function foo() { + var x = 10; + function bar() { + var y = 10; + function biz() { + var z = 10; + } + function qux() { + // A function with an empty body should not be top level + } + } +} + +function baz() { + var v = 10; +} +``` + +# Symbols + +```json +[ + { + "name": "foo", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 11, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 12 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "children": [] + }, + { + "name": "bar", + "kind": "Function", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 10, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 13 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "children": [ + { + "name": "y", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 12 + }, + "end": { + "line": 3, + "character": 18 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 12 + }, + "end": { + "line": 3, + "character": 13 + } + }, + "children": [] + }, + { + "name": "biz", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 8 + }, + "end": { + "line": 6, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 17 + }, + "end": { + "line": 4, + "character": 20 + } + }, + "children": [ + { + "name": "z", + "kind": "Variable", + "range": { + "start": { + "line": 5, + "character": 16 + }, + "end": { + "line": 5, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 16 + }, + "end": { + "line": 5, + "character": 17 + } + }, + "children": [] + } + ] + }, + { + "name": "qux", + "kind": "Function", + "range": { + "start": { + "line": 7, + "character": 8 + }, + "end": { + "line": 9, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 17 + }, + "end": { + "line": 7, + "character": 20 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "baz", + "kind": "Function", + "range": { + "start": { + "line": 13, + "character": 0 + }, + "end": { + "line": 15, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 9 + }, + "end": { + "line": 13, + "character": 12 + } + }, + "children": [ + { + "name": "v", + "kind": "Variable", + "range": { + "start": { + "line": 14, + "character": 8 + }, + "end": { + "line": 14, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 8 + }, + "end": { + "line": 14, + "character": 9 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline.md new file mode 100644 index 0000000000..bc55224739 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline.md @@ -0,0 +1,39 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsFunctionsBroken.ts +function f() { + function; +} +``` + +# Symbols + +```json +[ + { + "name": "f", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline.md new file mode 100644 index 0000000000..ab5af87f5c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline.md @@ -0,0 +1,40 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsFunctionsBroken2.ts +function; +function f() { + function; +} +``` + +# Symbols + +```json +[ + { + "name": "f", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 9 + }, + "end": { + "line": 1, + "character": 10 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline.md new file mode 100644 index 0000000000..e272384328 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline.md @@ -0,0 +1,222 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsImports.ts +import d1 from "a"; + +import { a } from "a"; + +import { b as B } from "a" + +import d2, { c, d as D } from "a" + +import e = require("a"); + +import * as ns from "a"; +``` + +# Symbols + +```json +[ + { + "name": "d1", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "children": [] + }, + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 9 + }, + "end": { + "line": 2, + "character": 10 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 9 + }, + "end": { + "line": 2, + "character": 10 + } + }, + "children": [] + }, + { + "name": "B", + "kind": "Variable", + "range": { + "start": { + "line": 4, + "character": 9 + }, + "end": { + "line": 4, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 14 + }, + "end": { + "line": 4, + "character": 15 + } + }, + "children": [] + }, + { + "name": "d2", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 7 + }, + "end": { + "line": 6, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 7 + }, + "end": { + "line": 6, + "character": 9 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 13 + }, + "end": { + "line": 6, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 13 + }, + "end": { + "line": 6, + "character": 14 + } + }, + "children": [] + }, + { + "name": "D", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 16 + }, + "end": { + "line": 6, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 21 + }, + "end": { + "line": 6, + "character": 22 + } + }, + "children": [] + }, + { + "name": "e", + "kind": "Variable", + "range": { + "start": { + "line": 8, + "character": 0 + }, + "end": { + "line": 8, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 7 + }, + "end": { + "line": 8, + "character": 8 + } + }, + "children": [] + }, + { + "name": "ns", + "kind": "Variable", + "range": { + "start": { + "line": 10, + "character": 7 + }, + "end": { + "line": 10, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 12 + }, + "end": { + "line": 10, + "character": 14 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline.md new file mode 100644 index 0000000000..f634b7c6f0 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline.md @@ -0,0 +1,359 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsInsideMethodsAndConstructors.ts +class Class { + constructor() { + function LocalFunctionInConstructor() {} + interface LocalInterfaceInConstrcutor {} + enum LocalEnumInConstructor { LocalEnumMemberInConstructor } + } + + method() { + function LocalFunctionInMethod() { + function LocalFunctionInLocalFunctionInMethod() {} + } + interface LocalInterfaceInMethod {} + enum LocalEnumInMethod { LocalEnumMemberInMethod } + } + + emptyMethod() { } // Non child functions method should not be duplicated +} +``` + +# Symbols + +```json +[ + { + "name": "Class", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 16, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "children": [ + { + "name": "constructor", + "kind": "Constructor", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 4 + } + }, + "children": [ + { + "name": "LocalFunctionInConstructor", + "kind": "Function", + "range": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 48 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 17 + }, + "end": { + "line": 2, + "character": 43 + } + }, + "children": [] + }, + { + "name": "LocalInterfaceInConstrcutor", + "kind": "Interface", + "range": { + "start": { + "line": 3, + "character": 8 + }, + "end": { + "line": 3, + "character": 48 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 18 + }, + "end": { + "line": 3, + "character": 45 + } + }, + "children": [] + }, + { + "name": "LocalEnumInConstructor", + "kind": "Enum", + "range": { + "start": { + "line": 4, + "character": 8 + }, + "end": { + "line": 4, + "character": 68 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 13 + }, + "end": { + "line": 4, + "character": 35 + } + }, + "children": [ + { + "name": "LocalEnumMemberInConstructor", + "kind": "EnumMember", + "range": { + "start": { + "line": 4, + "character": 38 + }, + "end": { + "line": 4, + "character": 66 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 38 + }, + "end": { + "line": 4, + "character": 66 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "method", + "kind": "Method", + "range": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 13, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 7, + "character": 10 + } + }, + "children": [ + { + "name": "LocalFunctionInMethod", + "kind": "Function", + "range": { + "start": { + "line": 8, + "character": 8 + }, + "end": { + "line": 10, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 17 + }, + "end": { + "line": 8, + "character": 38 + } + }, + "children": [ + { + "name": "LocalFunctionInLocalFunctionInMethod", + "kind": "Function", + "range": { + "start": { + "line": 9, + "character": 12 + }, + "end": { + "line": 9, + "character": 62 + } + }, + "selectionRange": { + "start": { + "line": 9, + "character": 21 + }, + "end": { + "line": 9, + "character": 57 + } + }, + "children": [] + } + ] + }, + { + "name": "LocalInterfaceInMethod", + "kind": "Interface", + "range": { + "start": { + "line": 11, + "character": 8 + }, + "end": { + "line": 11, + "character": 43 + } + }, + "selectionRange": { + "start": { + "line": 11, + "character": 18 + }, + "end": { + "line": 11, + "character": 40 + } + }, + "children": [] + }, + { + "name": "LocalEnumInMethod", + "kind": "Enum", + "range": { + "start": { + "line": 12, + "character": 8 + }, + "end": { + "line": 12, + "character": 58 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 13 + }, + "end": { + "line": 12, + "character": 30 + } + }, + "children": [ + { + "name": "LocalEnumMemberInMethod", + "kind": "EnumMember", + "range": { + "start": { + "line": 12, + "character": 33 + }, + "end": { + "line": 12, + "character": 56 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 33 + }, + "end": { + "line": 12, + "character": 56 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "emptyMethod", + "kind": "Method", + "range": { + "start": { + "line": 15, + "character": 4 + }, + "end": { + "line": 15, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 15, + "character": 4 + }, + "end": { + "line": 15, + "character": 15 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md new file mode 100644 index 0000000000..91711003fd --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md @@ -0,0 +1,603 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsItems.ts +// Interface +interface IPoint { + getDist(): number; + new(): IPoint; + (): any; + [x:string]: number; + prop: string; +} + +/// Module +module Shapes { + + // Class + export class Point implements IPoint { + constructor (public x: number, public y: number) { } + + // Instance member + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } + + // Getter + get value(): number { return 0; } + + // Setter + set value(newValue: number) { return; } + + // Static member + static origin = new Point(0, 0); + + // Static method + private static getOrigin() { return Point.origin; } + } + + enum Values { value1, value2, value3 } +} + +// Local variables +var p: IPoint = new Shapes.Point(3, 4); +var dist = p.getDist(); +``` + +# Symbols + +```json +[ + { + "name": "IPoint", + "kind": "Interface", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 7, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 10 + }, + "end": { + "line": 1, + "character": 16 + } + }, + "children": [ + { + "name": "getDist", + "kind": "Method", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "children": [] + }, + { + "name": "new()", + "kind": "Constructor", + "range": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 18 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 4 + } + }, + "children": [] + }, + { + "name": "()", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 4 + } + }, + "children": [] + }, + { + "name": "[]", + "kind": "Property", + "range": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 4 + } + }, + "children": [] + }, + { + "name": "prop", + "kind": "Property", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 8 + } + }, + "children": [] + } + ] + }, + { + "name": "Shapes", + "kind": "Namespace", + "range": { + "start": { + "line": 10, + "character": 0 + }, + "end": { + "line": 33, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 7 + }, + "end": { + "line": 10, + "character": 13 + } + }, + "children": [ + { + "name": "Point", + "kind": "Class", + "range": { + "start": { + "line": 13, + "character": 4 + }, + "end": { + "line": 30, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 17 + }, + "end": { + "line": 13, + "character": 22 + } + }, + "children": [ + { + "name": "constructor", + "kind": "Constructor", + "range": { + "start": { + "line": 14, + "character": 8 + }, + "end": { + "line": 14, + "character": 60 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 8 + }, + "end": { + "line": 14, + "character": 8 + } + }, + "children": [] + }, + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 14, + "character": 21 + }, + "end": { + "line": 14, + "character": 37 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 28 + }, + "end": { + "line": 14, + "character": 29 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Property", + "range": { + "start": { + "line": 14, + "character": 39 + }, + "end": { + "line": 14, + "character": 55 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 46 + }, + "end": { + "line": 14, + "character": 47 + } + }, + "children": [] + }, + { + "name": "getDist", + "kind": "Method", + "range": { + "start": { + "line": 17, + "character": 8 + }, + "end": { + "line": 17, + "character": 74 + } + }, + "selectionRange": { + "start": { + "line": 17, + "character": 8 + }, + "end": { + "line": 17, + "character": 15 + } + }, + "children": [] + }, + { + "name": "value", + "kind": "Property", + "range": { + "start": { + "line": 20, + "character": 8 + }, + "end": { + "line": 20, + "character": 41 + } + }, + "selectionRange": { + "start": { + "line": 20, + "character": 12 + }, + "end": { + "line": 20, + "character": 17 + } + }, + "children": [] + }, + { + "name": "value", + "kind": "Property", + "range": { + "start": { + "line": 23, + "character": 8 + }, + "end": { + "line": 23, + "character": 47 + } + }, + "selectionRange": { + "start": { + "line": 23, + "character": 12 + }, + "end": { + "line": 23, + "character": 17 + } + }, + "children": [] + }, + { + "name": "origin", + "kind": "Property", + "range": { + "start": { + "line": 26, + "character": 8 + }, + "end": { + "line": 26, + "character": 40 + } + }, + "selectionRange": { + "start": { + "line": 26, + "character": 15 + }, + "end": { + "line": 26, + "character": 21 + } + }, + "children": [] + }, + { + "name": "getOrigin", + "kind": "Method", + "range": { + "start": { + "line": 29, + "character": 8 + }, + "end": { + "line": 29, + "character": 59 + } + }, + "selectionRange": { + "start": { + "line": 29, + "character": 23 + }, + "end": { + "line": 29, + "character": 32 + } + }, + "children": [] + } + ] + }, + { + "name": "Values", + "kind": "Enum", + "range": { + "start": { + "line": 32, + "character": 4 + }, + "end": { + "line": 32, + "character": 42 + } + }, + "selectionRange": { + "start": { + "line": 32, + "character": 9 + }, + "end": { + "line": 32, + "character": 15 + } + }, + "children": [ + { + "name": "value1", + "kind": "EnumMember", + "range": { + "start": { + "line": 32, + "character": 18 + }, + "end": { + "line": 32, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 32, + "character": 18 + }, + "end": { + "line": 32, + "character": 24 + } + }, + "children": [] + }, + { + "name": "value2", + "kind": "EnumMember", + "range": { + "start": { + "line": 32, + "character": 26 + }, + "end": { + "line": 32, + "character": 32 + } + }, + "selectionRange": { + "start": { + "line": 32, + "character": 26 + }, + "end": { + "line": 32, + "character": 32 + } + }, + "children": [] + }, + { + "name": "value3", + "kind": "EnumMember", + "range": { + "start": { + "line": 32, + "character": 34 + }, + "end": { + "line": 32, + "character": 40 + } + }, + "selectionRange": { + "start": { + "line": 32, + "character": 34 + }, + "end": { + "line": 32, + "character": 40 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "p", + "kind": "Variable", + "range": { + "start": { + "line": 36, + "character": 4 + }, + "end": { + "line": 36, + "character": 38 + } + }, + "selectionRange": { + "start": { + "line": 36, + "character": 4 + }, + "end": { + "line": 36, + "character": 5 + } + }, + "children": [] + }, + { + "name": "dist", + "kind": "Variable", + "range": { + "start": { + "line": 37, + "character": 4 + }, + "end": { + "line": 37, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 37, + "character": 4 + }, + "end": { + "line": 37, + "character": 8 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline.md new file mode 100644 index 0000000000..b5990e4eed --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline.md @@ -0,0 +1,63 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsItems2.ts +module A +export class +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 8 + } + }, + "children": [] + }, + { + "name": "", + "kind": "Class", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline.md new file mode 100644 index 0000000000..b56ecc5ce6 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline.md @@ -0,0 +1,65 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsItemsExternalModules.ts +export class Bar { + public s: string; +} +``` + +# Symbols + +```json +[ + { + "name": "Bar", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 13 + }, + "end": { + "line": 0, + "character": 16 + } + }, + "children": [ + { + "name": "s", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 11 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline.md new file mode 100644 index 0000000000..8474f2c043 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline.md @@ -0,0 +1,91 @@ +// === Document Symbols === +```ts +// @FileName: /test/file.ts +export class Bar { + public s: string; +} +export var x: number; +``` + +# Symbols + +```json +[ + { + "name": "Bar", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 13 + }, + "end": { + "line": 0, + "character": 16 + } + }, + "children": [ + { + "name": "s", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 11 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "children": [] + } + ] + }, + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 11 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 11 + }, + "end": { + "line": 3, + "character": 12 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline.md new file mode 100644 index 0000000000..1552fbd84c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline.md @@ -0,0 +1,91 @@ +// === Document Symbols === +```ts +// @FileName: /test/my fil e.ts +export class Bar { + public s: string; +} +export var x: number; +``` + +# Symbols + +```json +[ + { + "name": "Bar", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 13 + }, + "end": { + "line": 0, + "character": 16 + } + }, + "children": [ + { + "name": "s", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 11 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "children": [] + } + ] + }, + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 3, + "character": 11 + }, + "end": { + "line": 3, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 11 + }, + "end": { + "line": 3, + "character": 12 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline.md new file mode 100644 index 0000000000..0e443882eb --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline.md @@ -0,0 +1,135 @@ +// === Document Symbols === +```ts +// @FileName: /navigationItemsModuleVariables_0.ts + +module Module1 { + export var x = 0; +} +``` + +# Symbols + +```json +[ + { + "name": "Module1", + "kind": "Namespace", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 7 + }, + "end": { + "line": 1, + "character": 14 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "children": [] + } + ] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /navigationItemsModuleVariables_1.ts + +module Module1.SubModule { + export var y = 0; +} +``` + +# Symbols + +```json +[ + { + "name": "Module1.SubModule", + "kind": "Namespace", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 7 + }, + "end": { + "line": 1, + "character": 24 + } + }, + "children": [ + { + "name": "y", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline.md new file mode 100644 index 0000000000..3e20e9f7c1 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline.md @@ -0,0 +1,66 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsMissingName1.ts +export function +class C { + foo() {} +} +``` + +# Symbols + +```json +[ + { + "name": "C", + "kind": "Class", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "children": [ + { + "name": "foo", + "kind": "Method", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 7 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline.md new file mode 100644 index 0000000000..4e666e8aaf --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline.md @@ -0,0 +1,68 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsMissingName2.ts +/** + * This is a class. + */ +class /* But it has no name! */ { + foo() {} +} +``` + +# Symbols + +```json +[ + { + "name": "", + "kind": "Class", + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 5, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 3, + "character": 0 + } + }, + "children": [ + { + "name": "foo", + "kind": "Method", + "range": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 7 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline.md new file mode 100644 index 0000000000..e26f9e34c2 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline.md @@ -0,0 +1,341 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsModules1.ts +declare module "X.Y.Z" {} + +declare module 'X2.Y2.Z2' {} + +declare module "foo"; + +module A.B.C { + export var x; +} + +module A.B { + export var y; +} + +module A { + export var z; +} + +module A { + module B { + module C { + declare var x; + } + } +} +``` + +# Symbols + +```json +[ + { + "name": "\"X.Y.Z\"", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 15 + }, + "end": { + "line": 0, + "character": 22 + } + }, + "children": [] + }, + { + "name": "\"X2.Y2.Z2\"", + "kind": "Namespace", + "range": { + "start": { + "line": 2, + "character": 0 + }, + "end": { + "line": 2, + "character": 28 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 25 + } + }, + "children": [] + }, + { + "name": "\"foo\"", + "kind": "Namespace", + "range": { + "start": { + "line": 4, + "character": 0 + }, + "end": { + "line": 4, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 15 + }, + "end": { + "line": 4, + "character": 20 + } + }, + "children": [] + }, + { + "name": "A.B.C", + "kind": "Namespace", + "range": { + "start": { + "line": 6, + "character": 0 + }, + "end": { + "line": 8, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 7 + }, + "end": { + "line": 6, + "character": 12 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 7, + "character": 15 + }, + "end": { + "line": 7, + "character": 16 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 15 + }, + "end": { + "line": 7, + "character": 16 + } + }, + "children": [] + } + ] + }, + { + "name": "A.B", + "kind": "Namespace", + "range": { + "start": { + "line": 10, + "character": 0 + }, + "end": { + "line": 12, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 7 + }, + "end": { + "line": 10, + "character": 10 + } + }, + "children": [ + { + "name": "y", + "kind": "Variable", + "range": { + "start": { + "line": 11, + "character": 15 + }, + "end": { + "line": 11, + "character": 16 + } + }, + "selectionRange": { + "start": { + "line": 11, + "character": 15 + }, + "end": { + "line": 11, + "character": 16 + } + }, + "children": [] + } + ] + }, + { + "name": "A", + "kind": "Namespace", + "range": { + "start": { + "line": 14, + "character": 0 + }, + "end": { + "line": 16, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 7 + }, + "end": { + "line": 14, + "character": 8 + } + }, + "children": [ + { + "name": "z", + "kind": "Variable", + "range": { + "start": { + "line": 15, + "character": 15 + }, + "end": { + "line": 15, + "character": 16 + } + }, + "selectionRange": { + "start": { + "line": 15, + "character": 15 + }, + "end": { + "line": 15, + "character": 16 + } + }, + "children": [] + }, + { + "name": "B", + "kind": "Namespace", + "range": { + "start": { + "line": 19, + "character": 4 + }, + "end": { + "line": 23, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 19, + "character": 11 + }, + "end": { + "line": 19, + "character": 12 + } + }, + "children": [ + { + "name": "C", + "kind": "Namespace", + "range": { + "start": { + "line": 20, + "character": 8 + }, + "end": { + "line": 22, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 20, + "character": 15 + }, + "end": { + "line": 20, + "character": 16 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 21, + "character": 24 + }, + "end": { + "line": 21, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 21, + "character": 24 + }, + "end": { + "line": 21, + "character": 25 + } + }, + "children": [] + } + ] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline.md new file mode 100644 index 0000000000..77fea89c09 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline.md @@ -0,0 +1,92 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsModules2.ts +namespace Test.A { } + +namespace Test.B { + class Foo { } +} +``` + +# Symbols + +```json +[ + { + "name": "Test.A", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 16 + } + }, + "children": [] + }, + { + "name": "Test.B", + "kind": "Namespace", + "range": { + "start": { + "line": 2, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "children": [ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 10 + }, + "end": { + "line": 3, + "character": 13 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline.md new file mode 100644 index 0000000000..c4edf3a41e --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline.md @@ -0,0 +1,266 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsMultilineStringIdentifiers1.ts +declare module "Multiline\r\nMadness" { +} + +declare module "Multiline\ +Madness" { +} +declare module "MultilineMadness" {} + +declare module "Multiline\ +Madness2" { +} + +interface Foo { + "a1\\\r\nb"; + "a2\ + \ + b"(): Foo; +} + +class Bar implements Foo { + 'a1\\\r\nb': Foo; + + 'a2\ + \ + b'(): Foo { + return this; + } +} +``` + +# Symbols + +```json +[ + { + "name": "\"Multiline\\r\\nMadness\"", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 15 + }, + "end": { + "line": 0, + "character": 37 + } + }, + "children": [] + }, + { + "name": "\"MultilineMadness\"", + "kind": "Namespace", + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 5, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 15 + }, + "end": { + "line": 4, + "character": 8 + } + }, + "children": [] + }, + { + "name": "\"MultilineMadness2\"", + "kind": "Namespace", + "range": { + "start": { + "line": 8, + "character": 0 + }, + "end": { + "line": 10, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 15 + }, + "end": { + "line": 9, + "character": 9 + } + }, + "children": [] + }, + { + "name": "Foo", + "kind": "Interface", + "range": { + "start": { + "line": 12, + "character": 0 + }, + "end": { + "line": 17, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 10 + }, + "end": { + "line": 12, + "character": 13 + } + }, + "children": [ + { + "name": "\"a1\\\\\\r\\nb\"", + "kind": "Property", + "range": { + "start": { + "line": 13, + "character": 4 + }, + "end": { + "line": 13, + "character": 16 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 4 + }, + "end": { + "line": 13, + "character": 15 + } + }, + "children": [] + }, + { + "name": "\"a2 b\"", + "kind": "Method", + "range": { + "start": { + "line": 14, + "character": 4 + }, + "end": { + "line": 16, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 4 + }, + "end": { + "line": 16, + "character": 6 + } + }, + "children": [] + } + ] + }, + { + "name": "Bar", + "kind": "Class", + "range": { + "start": { + "line": 19, + "character": 0 + }, + "end": { + "line": 27, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 19, + "character": 6 + }, + "end": { + "line": 19, + "character": 9 + } + }, + "children": [ + { + "name": "\"a1\\\\\\r\\nb\"", + "kind": "Property", + "range": { + "start": { + "line": 20, + "character": 4 + }, + "end": { + "line": 20, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 20, + "character": 4 + }, + "end": { + "line": 20, + "character": 15 + } + }, + "children": [] + }, + { + "name": "\"a2 b\"", + "kind": "Method", + "range": { + "start": { + "line": 22, + "character": 4 + }, + "end": { + "line": 26, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 22, + "character": 4 + }, + "end": { + "line": 24, + "character": 6 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline.md new file mode 100644 index 0000000000..5192d549aa --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline.md @@ -0,0 +1,175 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsMultilineStringIdentifiers2.ts +function f(p1: () => any, p2: string) { } +f(() => { }, `line1\ +line2\ +line3`); + +class c1 { + const a = ' ''line1\ + line2'; +} + +f(() => { }, `unterminated backtick 1 +unterminated backtick 2 +unterminated backtick 3 +``` + +# Symbols + +```json +[ + { + "name": "f", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 41 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [] + }, + { + "name": "f() callback", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 2 + } + }, + "children": [] + }, + { + "name": "c1", + "kind": "Class", + "range": { + "start": { + "line": 5, + "character": 0 + }, + "end": { + "line": 8, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 6 + }, + "end": { + "line": 5, + "character": 8 + } + }, + "children": [ + { + "name": "a", + "kind": "Property", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 10 + }, + "end": { + "line": 6, + "character": 11 + } + }, + "children": [] + }, + { + "name": "\"line1 line2\"", + "kind": "Property", + "range": { + "start": { + "line": 6, + "character": 17 + }, + "end": { + "line": 7, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 17 + }, + "end": { + "line": 7, + "character": 14 + } + }, + "children": [] + } + ] + }, + { + "name": "f() callback", + "kind": "Function", + "range": { + "start": { + "line": 10, + "character": 2 + }, + "end": { + "line": 10, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 2 + }, + "end": { + "line": 10, + "character": 2 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline.md new file mode 100644 index 0000000000..23d661ea9f --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline.md @@ -0,0 +1,43 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsMultilineStringIdentifiers3.ts +declare module 'MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters\ +MoreThanOneHundredAndFiftyCharacters' { } +``` + +# Symbols + +```json +[ + { + "name": "\"MoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMore...", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 6, + "character": 41 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 15 + }, + "end": { + "line": 6, + "character": 37 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline.md new file mode 100644 index 0000000000..826d5376cb --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline.md @@ -0,0 +1,115 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsNamedArrowFunctions.ts +export const value = 2; +export const func = () => 2; +export const func2 = function() { }; +export function exportedFunction() { } +``` + +# Symbols + +```json +[ + { + "name": "value", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 13 + }, + "end": { + "line": 0, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 13 + }, + "end": { + "line": 0, + "character": 18 + } + }, + "children": [] + }, + { + "name": "func", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 13 + }, + "end": { + "line": 1, + "character": 27 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 13 + }, + "end": { + "line": 1, + "character": 17 + } + }, + "children": [] + }, + { + "name": "func2", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 13 + }, + "end": { + "line": 2, + "character": 35 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 13 + }, + "end": { + "line": 2, + "character": 18 + } + }, + "children": [] + }, + { + "name": "exportedFunction", + "kind": "Function", + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 3, + "character": 38 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 32 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline.md new file mode 100644 index 0000000000..1563a0175c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline.md @@ -0,0 +1,168 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsPropertiesDefinedInConstructors.ts +class List { + constructor(public a: boolean, private b: T, readonly c: string, d: number) { + var local = 0; + } +} +``` + +# Symbols + +```json +[ + { + "name": "List", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [ + { + "name": "constructor", + "kind": "Constructor", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 4 + } + }, + "children": [ + { + "name": "local", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 17 + } + }, + "children": [] + } + ] + }, + { + "name": "a", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 16 + }, + "end": { + "line": 1, + "character": 33 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 23 + }, + "end": { + "line": 1, + "character": 24 + } + }, + "children": [] + }, + { + "name": "b", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 35 + }, + "end": { + "line": 1, + "character": 47 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 43 + }, + "end": { + "line": 1, + "character": 44 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 49 + }, + "end": { + "line": 1, + "character": 67 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 58 + }, + "end": { + "line": 1, + "character": 59 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline.md new file mode 100644 index 0000000000..7194dfebae --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline.md @@ -0,0 +1,91 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsStaticAndNonStaticNoMerge.ts +class C { + static x; + x; +} +``` + +# Symbols + +```json +[ + { + "name": "C", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 11 + }, + "end": { + "line": 1, + "character": 12 + } + }, + "children": [] + }, + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 6 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline.md new file mode 100644 index 0000000000..05f0e82dc3 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline.md @@ -0,0 +1,117 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsSymbols1.ts +class C { + [Symbol.isRegExp] = 0; + [Symbol.iterator]() { } + get [Symbol.isConcatSpreadable]() { } +} +``` + +# Symbols + +```json +[ + { + "name": "C", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "[Symbol.isRegExp]", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 26 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 21 + } + }, + "children": [] + }, + { + "name": "[Symbol.iterator]", + "kind": "Method", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 27 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 21 + } + }, + "children": [] + }, + { + "name": "[Symbol.isConcatSpreadable]", + "kind": "Property", + "range": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 41 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 8 + }, + "end": { + "line": 3, + "character": 35 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline.md new file mode 100644 index 0000000000..e35eff8c6c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline.md @@ -0,0 +1,91 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsSymbols2.ts +interface I { + [Symbol.isRegExp]: string; + [Symbol.iterator](): string; +} +``` + +# Symbols + +```json +[ + { + "name": "I", + "kind": "Interface", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "children": [ + { + "name": "[Symbol.isRegExp]", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 21 + } + }, + "children": [] + }, + { + "name": "[Symbol.iterator]", + "kind": "Method", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 32 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 21 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline.md new file mode 100644 index 0000000000..ca79d2d59a --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline.md @@ -0,0 +1,66 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsSymbols3.ts +enum E { + // No nav bar entry for this + [Symbol.isRegExp] = 0 +} +``` + +# Symbols + +```json +[ + { + "name": "E", + "kind": "Enum", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 5 + }, + "end": { + "line": 0, + "character": 6 + } + }, + "children": [ + { + "name": "[Symbol.isRegExp]", + "kind": "EnumMember", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 21 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline.md new file mode 100644 index 0000000000..74a3e69ae6 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline.md @@ -0,0 +1,152 @@ +// === Document Symbols === +```js +// @FileName: /file.js +const _sym = Symbol("_sym"); +class MyClass { + constructor() { + // Dynamic assignment properties can't show up in navigation, + // as they're not syntactic members + // Additonally, late bound members are always filtered out, besides + this[_sym] = "ok"; + } + + method() { + this[_sym] = "yep"; + const x = this[_sym]; + } +} +``` + +# Symbols + +```json +[ + { + "name": "_sym", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 27 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [] + }, + { + "name": "MyClass", + "kind": "Class", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 13, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "children": [ + { + "name": "constructor", + "kind": "Constructor", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 7, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 4 + } + }, + "children": [] + }, + { + "name": "method", + "kind": "Method", + "range": { + "start": { + "line": 9, + "character": 4 + }, + "end": { + "line": 12, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 9, + "character": 4 + }, + "end": { + "line": 9, + "character": 10 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 11, + "character": 14 + }, + "end": { + "line": 11, + "character": 28 + } + }, + "selectionRange": { + "start": { + "line": 11, + "character": 14 + }, + "end": { + "line": 11, + "character": 15 + } + }, + "children": [] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline.md new file mode 100644 index 0000000000..55f7e219cb --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline.md @@ -0,0 +1,37 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarItemsTypeAlias.ts +type T = number | string; +``` + +# Symbols + +```json +[ + { + "name": "T", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 5 + }, + "end": { + "line": 0, + "character": 6 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline.md new file mode 100644 index 0000000000..0900b0a043 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline.md @@ -0,0 +1,64 @@ +// === Document Symbols === +```js +// @FileName: /foo.js +/** @typedef {(number|string)} NumberLike */ +/** @typedef {(string|number)} */ +const x = 0; +``` + +# Symbols + +```json +[ + { + "name": "NumberLike", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 41 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 31 + }, + "end": { + "line": 0, + "character": 41 + } + }, + "children": [] + }, + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 7 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline.md new file mode 100644 index 0000000000..d970a6d9b6 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline.md @@ -0,0 +1,38 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarJsDocCommentWithNoTags.ts +/** Test */ +export const Test = {} +``` + +# Symbols + +```json +[ + { + "name": "Test", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 13 + }, + "end": { + "line": 1, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 13 + }, + "end": { + "line": 1, + "character": 17 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline.md new file mode 100644 index 0000000000..19ebdddb9c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline.md @@ -0,0 +1,483 @@ +// === Document Symbols === +```ts +// @FileName: /file1.ts +module a { + function foo() {} +} +module b { + function foo() {} +} +module a { + function bar() {} +} +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 2, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 8 + } + }, + "children": [ + { + "name": "foo", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 13 + }, + "end": { + "line": 1, + "character": 16 + } + }, + "children": [] + }, + { + "name": "bar", + "kind": "Function", + "range": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 7, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 13 + }, + "end": { + "line": 7, + "character": 16 + } + }, + "children": [] + } + ] + }, + { + "name": "b", + "kind": "Namespace", + "range": { + "start": { + "line": 3, + "character": 0 + }, + "end": { + "line": 5, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 7 + }, + "end": { + "line": 3, + "character": 8 + } + }, + "children": [ + { + "name": "foo", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 13 + }, + "end": { + "line": 4, + "character": 16 + } + }, + "children": [] + } + ] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /file2.ts +module a {} +function a() {} +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 8 + } + }, + "children": [] + }, + { + "name": "a", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 9 + }, + "end": { + "line": 1, + "character": 10 + } + }, + "children": [] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /file3.ts +module a { + interface A { + foo: number; + } +} +module a { + interface A { + bar: number; + } +} +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 8 + } + }, + "children": [ + { + "name": "A", + "kind": "Interface", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 14 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "children": [ + { + "name": "foo", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "children": [] + } + ] + }, + { + "name": "A", + "kind": "Interface", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 8, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 14 + }, + "end": { + "line": 6, + "character": 15 + } + }, + "children": [ + { + "name": "bar", + "kind": "Property", + "range": { + "start": { + "line": 7, + "character": 8 + }, + "end": { + "line": 7, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 8 + }, + "end": { + "line": 7, + "character": 11 + } + }, + "children": [] + } + ] + } + ] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /file4.ts +module A { export var x; } +module A.B { export var y; } +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Namespace", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 26 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 8 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 22 + }, + "end": { + "line": 0, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 22 + }, + "end": { + "line": 0, + "character": 23 + } + }, + "children": [] + } + ] + }, + { + "name": "A.B", + "kind": "Namespace", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 28 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 7 + }, + "end": { + "line": 1, + "character": 10 + } + }, + "children": [ + { + "name": "y", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 24 + }, + "end": { + "line": 1, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 24 + }, + "end": { + "line": 1, + "character": 25 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline.md new file mode 100644 index 0000000000..1cc9f882d2 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline.md @@ -0,0 +1,148 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarMerging_grandchildren.ts +// Should not merge grandchildren with property assignments +const o = { + a: { + m() {}, + }, + b: { + m() {}, + }, +} +``` + +# Symbols + +```json +[ + { + "name": "o", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 8, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 7 + } + }, + "children": [ + { + "name": "a", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 4, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "children": [ + { + "name": "m", + "kind": "Method", + "range": { + "start": { + "line": 3, + "character": 8 + }, + "end": { + "line": 3, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 8 + }, + "end": { + "line": 3, + "character": 9 + } + }, + "children": [] + } + ] + }, + { + "name": "b", + "kind": "Property", + "range": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 7, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "children": [ + { + "name": "m", + "kind": "Method", + "range": { + "start": { + "line": 6, + "character": 8 + }, + "end": { + "line": 6, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 8 + }, + "end": { + "line": 6, + "character": 9 + } + }, + "children": [] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline.md new file mode 100644 index 0000000000..8bef848de7 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline.md @@ -0,0 +1,11 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarNamespaceImportWithNoName.ts +import *{} from 'foo'; +``` + +# Symbols + +```json +[] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline.md new file mode 100644 index 0000000000..6bbc91c151 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline.md @@ -0,0 +1,253 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarNestedObjectLiterals.ts +var a = { + b: 0, + c: {}, + d: { + e: 1, + }, + f: { + g: 2, + h: { + i: 3, + }, + }, +} +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 12, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "children": [ + { + "name": "b", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 5 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 5 + } + }, + "children": [] + }, + { + "name": "d", + "kind": "Property", + "range": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "children": [ + { + "name": "e", + "kind": "Property", + "range": { + "start": { + "line": 4, + "character": 8 + }, + "end": { + "line": 4, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 8 + }, + "end": { + "line": 4, + "character": 9 + } + }, + "children": [] + } + ] + }, + { + "name": "f", + "kind": "Property", + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 11, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 6, + "character": 5 + } + }, + "children": [ + { + "name": "g", + "kind": "Property", + "range": { + "start": { + "line": 7, + "character": 8 + }, + "end": { + "line": 7, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 8 + }, + "end": { + "line": 7, + "character": 9 + } + }, + "children": [] + }, + { + "name": "h", + "kind": "Property", + "range": { + "start": { + "line": 8, + "character": 8 + }, + "end": { + "line": 10, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 8 + }, + "end": { + "line": 8, + "character": 9 + } + }, + "children": [ + { + "name": "i", + "kind": "Property", + "range": { + "start": { + "line": 9, + "character": 12 + }, + "end": { + "line": 9, + "character": 16 + } + }, + "selectionRange": { + "start": { + "line": 9, + "character": 12 + }, + "end": { + "line": 9, + "character": 13 + } + }, + "children": [] + } + ] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline.md new file mode 100644 index 0000000000..fca8d5bcfc --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline.md @@ -0,0 +1,148 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarPrivateName.ts +class A { + #foo: () => { + class B { + #bar: () => { + function baz () { + } + } + } + } +} +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "#foo", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 6 + } + }, + "children": [] + } + ] + }, + { + "name": "B", + "kind": "Class", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "children": [ + { + "name": "#bar", + "kind": "Property", + "range": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 10 + } + }, + "children": [] + } + ] + }, + { + "name": "baz", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 9 + }, + "end": { + "line": 5, + "character": 10 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 18 + }, + "end": { + "line": 4, + "character": 21 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline.md new file mode 100644 index 0000000000..2e5aa3e724 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline.md @@ -0,0 +1,150 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarPrivateNameMethod.ts +class A { + #foo() { + class B { + #bar() { + function baz () { + } + } + } + } +} +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 9, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "#foo", + "kind": "Method", + "range": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 8, + "character": 3 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 6 + } + }, + "children": [ + { + "name": "B", + "kind": "Class", + "range": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 7, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "children": [ + { + "name": "#bar", + "kind": "Method", + "range": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 6, + "character": 7 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 10 + } + }, + "children": [ + { + "name": "baz", + "kind": "Function", + "range": { + "start": { + "line": 4, + "character": 9 + }, + "end": { + "line": 5, + "character": 10 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 18 + }, + "end": { + "line": 4, + "character": 21 + } + }, + "children": [] + } + ] + } + ] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline.md new file mode 100644 index 0000000000..1f7a2b7e6b --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline.md @@ -0,0 +1,598 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarPropertyDeclarations.ts +class A { + public A1 = class { + public x = 1; + private y() {} + protected z() {} + } + + public A2 = { + x: 1, + y() {}, + z() {} + } + + public A3 = function () {} + public A4 = () => {} + public A5 = 1; + public A6 = "A6"; + + public ["A7"] = class { + public x = 1; + private y() {} + protected z() {} + } + + public [1] = { + x: 1, + y() {}, + z() {} + } + + public [1 + 1] = 1; +} +``` + +# Symbols + +```json +[ + { + "name": "A", + "kind": "Class", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 31, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 7 + } + }, + "children": [ + { + "name": "A1", + "kind": "Property", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 5, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 11 + }, + "end": { + "line": 1, + "character": 13 + } + }, + "children": [ + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 15 + }, + "end": { + "line": 2, + "character": 16 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Method", + "range": { + "start": { + "line": 3, + "character": 8 + }, + "end": { + "line": 3, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 17 + } + }, + "children": [] + }, + { + "name": "z", + "kind": "Method", + "range": { + "start": { + "line": 4, + "character": 8 + }, + "end": { + "line": 4, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 4, + "character": 18 + }, + "end": { + "line": 4, + "character": 19 + } + }, + "children": [] + } + ] + }, + { + "name": "A2", + "kind": "Property", + "range": { + "start": { + "line": 7, + "character": 4 + }, + "end": { + "line": 11, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 11 + }, + "end": { + "line": 7, + "character": 13 + } + }, + "children": [ + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 8, + "character": 8 + }, + "end": { + "line": 8, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 8 + }, + "end": { + "line": 8, + "character": 9 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Method", + "range": { + "start": { + "line": 9, + "character": 8 + }, + "end": { + "line": 9, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 9, + "character": 8 + }, + "end": { + "line": 9, + "character": 9 + } + }, + "children": [] + }, + { + "name": "z", + "kind": "Method", + "range": { + "start": { + "line": 10, + "character": 8 + }, + "end": { + "line": 10, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 10, + "character": 8 + }, + "end": { + "line": 10, + "character": 9 + } + }, + "children": [] + } + ] + }, + { + "name": "A3", + "kind": "Property", + "range": { + "start": { + "line": 13, + "character": 4 + }, + "end": { + "line": 13, + "character": 30 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 11 + }, + "end": { + "line": 13, + "character": 13 + } + }, + "children": [] + }, + { + "name": "A4", + "kind": "Property", + "range": { + "start": { + "line": 14, + "character": 4 + }, + "end": { + "line": 14, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 11 + }, + "end": { + "line": 14, + "character": 13 + } + }, + "children": [] + }, + { + "name": "A5", + "kind": "Property", + "range": { + "start": { + "line": 15, + "character": 4 + }, + "end": { + "line": 15, + "character": 18 + } + }, + "selectionRange": { + "start": { + "line": 15, + "character": 11 + }, + "end": { + "line": 15, + "character": 13 + } + }, + "children": [] + }, + { + "name": "A6", + "kind": "Property", + "range": { + "start": { + "line": 16, + "character": 4 + }, + "end": { + "line": 16, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 16, + "character": 11 + }, + "end": { + "line": 16, + "character": 13 + } + }, + "children": [] + }, + { + "name": "\"A7\"", + "kind": "Property", + "range": { + "start": { + "line": 18, + "character": 4 + }, + "end": { + "line": 22, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 18, + "character": 11 + }, + "end": { + "line": 18, + "character": 17 + } + }, + "children": [ + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 19, + "character": 8 + }, + "end": { + "line": 19, + "character": 21 + } + }, + "selectionRange": { + "start": { + "line": 19, + "character": 15 + }, + "end": { + "line": 19, + "character": 16 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Method", + "range": { + "start": { + "line": 20, + "character": 8 + }, + "end": { + "line": 20, + "character": 22 + } + }, + "selectionRange": { + "start": { + "line": 20, + "character": 16 + }, + "end": { + "line": 20, + "character": 17 + } + }, + "children": [] + }, + { + "name": "z", + "kind": "Method", + "range": { + "start": { + "line": 21, + "character": 8 + }, + "end": { + "line": 21, + "character": 24 + } + }, + "selectionRange": { + "start": { + "line": 21, + "character": 18 + }, + "end": { + "line": 21, + "character": 19 + } + }, + "children": [] + } + ] + }, + { + "name": "1", + "kind": "Property", + "range": { + "start": { + "line": 24, + "character": 4 + }, + "end": { + "line": 28, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 24, + "character": 11 + }, + "end": { + "line": 24, + "character": 14 + } + }, + "children": [ + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 25, + "character": 8 + }, + "end": { + "line": 25, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 25, + "character": 8 + }, + "end": { + "line": 25, + "character": 9 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Method", + "range": { + "start": { + "line": 26, + "character": 8 + }, + "end": { + "line": 26, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 26, + "character": 8 + }, + "end": { + "line": 26, + "character": 9 + } + }, + "children": [] + }, + { + "name": "z", + "kind": "Method", + "range": { + "start": { + "line": 27, + "character": 8 + }, + "end": { + "line": 27, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 27, + "character": 8 + }, + "end": { + "line": 27, + "character": 9 + } + }, + "children": [] + } + ] + }, + { + "name": "[1 + 1]", + "kind": "Property", + "range": { + "start": { + "line": 30, + "character": 4 + }, + "end": { + "line": 30, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 30, + "character": 11 + }, + "end": { + "line": 30, + "character": 18 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline.md new file mode 100644 index 0000000000..9bce1e9e60 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline.md @@ -0,0 +1,181 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarVariables.ts +var x = 0; +let y = 1; +const z = 2; +``` + +# Symbols + +```json +[ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 4 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 1, + "character": 5 + } + }, + "children": [] + }, + { + "name": "z", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 11 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 7 + } + }, + "children": [] + } +] +``` + + + +// === Document Symbols === +```ts +// @FileName: /file2.ts +var {a} = 0; +let {a: b} = 0; +const [c] = 0; +``` + +# Symbols + +```json +[ + { + "name": "a", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 5 + }, + "end": { + "line": 0, + "character": 6 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 5 + }, + "end": { + "line": 0, + "character": 6 + } + }, + "children": [] + }, + { + "name": "b", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 5 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Variable", + "range": { + "start": { + "line": 2, + "character": 7 + }, + "end": { + "line": 2, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 7 + }, + "end": { + "line": 2, + "character": 8 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline.md new file mode 100644 index 0000000000..821054631a --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline.md @@ -0,0 +1,90 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarWellKnownSymbolExpando.ts +function f() {} +f[Symbol.iterator] = function() {} +``` + +# Symbols + +```json +[ + { + "name": "f", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 15 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [ + { + "name": "Symbol.iterator", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 18 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 17 + } + }, + "children": [ + { + "name": "", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 21 + }, + "end": { + "line": 1, + "character": 34 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 21 + }, + "end": { + "line": 1, + "character": 21 + } + }, + "children": [] + } + ] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline.md new file mode 100644 index 0000000000..bfd3136b86 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline.md @@ -0,0 +1,66 @@ +// === Document Symbols === +```ts +// @FileName: /navigationBarWithLocalVariables.ts +function x(){ + const x = Object() + x.foo = "" +} +``` + +# Symbols + +```json +[ + { + "name": "x", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 10 + } + }, + "children": [ + { + "name": "x", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 7 + }, + "end": { + "line": 1, + "character": 19 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 7 + }, + "end": { + "line": 1, + "character": 8 + } + }, + "children": [] + } + ] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline.md new file mode 100644 index 0000000000..fe484e07c9 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline.md @@ -0,0 +1,496 @@ +// === Document Symbols === +```ts +// @FileName: /navigationItemsExportDefaultExpression.ts +export default function () {} +export default function () { + return class Foo { + } +} + +export default () => "" +export default () => { + return class Foo { + } +} + +export default function f1() {} +export default function f2() { + return class Foo { + } +} + +const abc = 12; +export default abc; +export default class AB {} +export default { + a: 1, + b: 1, + c: { + d: 1 + } +} + +function foo(props: { x: number; y: number }) {} +export default foo({ x: 1, y: 1 }); +``` + +# Symbols + +```json +[ + { + "name": "default", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 29 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "children": [] + }, + { + "name": "default", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 1, + "character": 0 + } + }, + "children": [ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 2, + "character": 11 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 17 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "children": [] + } + ] + }, + { + "name": "default", + "kind": "Function", + "range": { + "start": { + "line": 6, + "character": 15 + }, + "end": { + "line": 6, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 15 + }, + "end": { + "line": 6, + "character": 15 + } + }, + "children": [] + }, + { + "name": "default", + "kind": "Function", + "range": { + "start": { + "line": 7, + "character": 15 + }, + "end": { + "line": 10, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 15 + }, + "end": { + "line": 7, + "character": 15 + } + }, + "children": [ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 8, + "character": 11 + }, + "end": { + "line": 9, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 17 + }, + "end": { + "line": 8, + "character": 20 + } + }, + "children": [] + } + ] + }, + { + "name": "f1", + "kind": "Function", + "range": { + "start": { + "line": 12, + "character": 0 + }, + "end": { + "line": 12, + "character": 31 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 24 + }, + "end": { + "line": 12, + "character": 26 + } + }, + "children": [] + }, + { + "name": "f2", + "kind": "Function", + "range": { + "start": { + "line": 13, + "character": 0 + }, + "end": { + "line": 16, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 24 + }, + "end": { + "line": 13, + "character": 26 + } + }, + "children": [ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 14, + "character": 11 + }, + "end": { + "line": 15, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 17 + }, + "end": { + "line": 14, + "character": 20 + } + }, + "children": [] + } + ] + }, + { + "name": "abc", + "kind": "Variable", + "range": { + "start": { + "line": 18, + "character": 6 + }, + "end": { + "line": 18, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 18, + "character": 6 + }, + "end": { + "line": 18, + "character": 9 + } + }, + "children": [] + }, + { + "name": "AB", + "kind": "Class", + "range": { + "start": { + "line": 20, + "character": 0 + }, + "end": { + "line": 20, + "character": 26 + } + }, + "selectionRange": { + "start": { + "line": 20, + "character": 21 + }, + "end": { + "line": 20, + "character": 23 + } + }, + "children": [] + }, + { + "name": "a", + "kind": "Property", + "range": { + "start": { + "line": 22, + "character": 4 + }, + "end": { + "line": 22, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 22, + "character": 4 + }, + "end": { + "line": 22, + "character": 5 + } + }, + "children": [] + }, + { + "name": "b", + "kind": "Property", + "range": { + "start": { + "line": 23, + "character": 4 + }, + "end": { + "line": 23, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 23, + "character": 4 + }, + "end": { + "line": 23, + "character": 5 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Property", + "range": { + "start": { + "line": 24, + "character": 4 + }, + "end": { + "line": 26, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 24, + "character": 4 + }, + "end": { + "line": 24, + "character": 5 + } + }, + "children": [ + { + "name": "d", + "kind": "Property", + "range": { + "start": { + "line": 25, + "character": 8 + }, + "end": { + "line": 25, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 25, + "character": 8 + }, + "end": { + "line": 25, + "character": 9 + } + }, + "children": [] + } + ] + }, + { + "name": "foo", + "kind": "Function", + "range": { + "start": { + "line": 29, + "character": 0 + }, + "end": { + "line": 29, + "character": 48 + } + }, + "selectionRange": { + "start": { + "line": 29, + "character": 9 + }, + "end": { + "line": 29, + "character": 12 + } + }, + "children": [] + }, + { + "name": "x", + "kind": "Property", + "range": { + "start": { + "line": 30, + "character": 21 + }, + "end": { + "line": 30, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 30, + "character": 21 + }, + "end": { + "line": 30, + "character": 22 + } + }, + "children": [] + }, + { + "name": "y", + "kind": "Property", + "range": { + "start": { + "line": 30, + "character": 27 + }, + "end": { + "line": 30, + "character": 31 + } + }, + "selectionRange": { + "start": { + "line": 30, + "character": 27 + }, + "end": { + "line": 30, + "character": 28 + } + }, + "children": [] + } +] +``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline.md new file mode 100644 index 0000000000..1271c11e99 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline.md @@ -0,0 +1,651 @@ +// === Document Symbols === +```ts +// @FileName: /navigationItemsExportEqualsExpression.ts +export = function () {} +export = function () { + return class Foo { + } +} + +export = () => "" +export = () => { + return class Foo { + } +} + +export = function f1() {} +export = function f2() { + return class Foo { + } +} + +const abc = 12; +export = abc; +export = class AB {} +export = { + a: 1, + b: 1, + c: { + d: 1 + } +} +``` + +# Symbols + +```json +[ + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 23 + } + }, + "children": [ + { + "name": "export=", + "kind": "Function", + "range": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 23 + } + }, + "selectionRange": { + "start": { + "line": 0, + "character": 9 + }, + "end": { + "line": 0, + "character": 9 + } + }, + "children": [] + } + ] + }, + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "children": [ + { + "name": "export=", + "kind": "Function", + "range": { + "start": { + "line": 1, + "character": 9 + }, + "end": { + "line": 4, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 1, + "character": 9 + }, + "end": { + "line": 1, + "character": 9 + } + }, + "children": [ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 2, + "character": 11 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 2, + "character": 17 + }, + "end": { + "line": 2, + "character": 20 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 6, + "character": 0 + }, + "end": { + "line": 6, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 0 + }, + "end": { + "line": 6, + "character": 17 + } + }, + "children": [ + { + "name": "export=", + "kind": "Function", + "range": { + "start": { + "line": 6, + "character": 9 + }, + "end": { + "line": 6, + "character": 17 + } + }, + "selectionRange": { + "start": { + "line": 6, + "character": 9 + }, + "end": { + "line": 6, + "character": 9 + } + }, + "children": [] + } + ] + }, + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 7, + "character": 0 + }, + "end": { + "line": 10, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 0 + }, + "end": { + "line": 10, + "character": 1 + } + }, + "children": [ + { + "name": "export=", + "kind": "Function", + "range": { + "start": { + "line": 7, + "character": 9 + }, + "end": { + "line": 10, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 7, + "character": 9 + }, + "end": { + "line": 7, + "character": 9 + } + }, + "children": [ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 8, + "character": 11 + }, + "end": { + "line": 9, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 8, + "character": 17 + }, + "end": { + "line": 8, + "character": 20 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 12, + "character": 0 + }, + "end": { + "line": 12, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 0 + }, + "end": { + "line": 12, + "character": 25 + } + }, + "children": [ + { + "name": "f1", + "kind": "Function", + "range": { + "start": { + "line": 12, + "character": 9 + }, + "end": { + "line": 12, + "character": 25 + } + }, + "selectionRange": { + "start": { + "line": 12, + "character": 18 + }, + "end": { + "line": 12, + "character": 20 + } + }, + "children": [] + } + ] + }, + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 13, + "character": 0 + }, + "end": { + "line": 16, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 0 + }, + "end": { + "line": 16, + "character": 1 + } + }, + "children": [ + { + "name": "f2", + "kind": "Function", + "range": { + "start": { + "line": 13, + "character": 9 + }, + "end": { + "line": 16, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 13, + "character": 18 + }, + "end": { + "line": 13, + "character": 20 + } + }, + "children": [ + { + "name": "Foo", + "kind": "Class", + "range": { + "start": { + "line": 14, + "character": 11 + }, + "end": { + "line": 15, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 14, + "character": 17 + }, + "end": { + "line": 14, + "character": 20 + } + }, + "children": [] + } + ] + } + ] + }, + { + "name": "abc", + "kind": "Variable", + "range": { + "start": { + "line": 18, + "character": 6 + }, + "end": { + "line": 18, + "character": 14 + } + }, + "selectionRange": { + "start": { + "line": 18, + "character": 6 + }, + "end": { + "line": 18, + "character": 9 + } + }, + "children": [] + }, + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 19, + "character": 0 + }, + "end": { + "line": 19, + "character": 13 + } + }, + "selectionRange": { + "start": { + "line": 19, + "character": 9 + }, + "end": { + "line": 19, + "character": 12 + } + }, + "children": [] + }, + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 20, + "character": 0 + }, + "end": { + "line": 20, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 20, + "character": 0 + }, + "end": { + "line": 20, + "character": 20 + } + }, + "children": [ + { + "name": "AB", + "kind": "Class", + "range": { + "start": { + "line": 20, + "character": 9 + }, + "end": { + "line": 20, + "character": 20 + } + }, + "selectionRange": { + "start": { + "line": 20, + "character": 15 + }, + "end": { + "line": 20, + "character": 17 + } + }, + "children": [] + } + ] + }, + { + "name": "export=", + "kind": "Variable", + "range": { + "start": { + "line": 21, + "character": 0 + }, + "end": { + "line": 27, + "character": 1 + } + }, + "selectionRange": { + "start": { + "line": 21, + "character": 0 + }, + "end": { + "line": 27, + "character": 1 + } + }, + "children": [ + { + "name": "a", + "kind": "Property", + "range": { + "start": { + "line": 22, + "character": 4 + }, + "end": { + "line": 22, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 22, + "character": 4 + }, + "end": { + "line": 22, + "character": 5 + } + }, + "children": [] + }, + { + "name": "b", + "kind": "Property", + "range": { + "start": { + "line": 23, + "character": 4 + }, + "end": { + "line": 23, + "character": 8 + } + }, + "selectionRange": { + "start": { + "line": 23, + "character": 4 + }, + "end": { + "line": 23, + "character": 5 + } + }, + "children": [] + }, + { + "name": "c", + "kind": "Property", + "range": { + "start": { + "line": 24, + "character": 4 + }, + "end": { + "line": 26, + "character": 5 + } + }, + "selectionRange": { + "start": { + "line": 24, + "character": 4 + }, + "end": { + "line": 24, + "character": 5 + } + }, + "children": [ + { + "name": "d", + "kind": "Property", + "range": { + "start": { + "line": 25, + "character": 8 + }, + "end": { + "line": 25, + "character": 12 + } + }, + "selectionRange": { + "start": { + "line": 25, + "character": 8 + }, + "end": { + "line": 25, + "character": 9 + } + }, + "children": [] + } + ] + } + ] + } +] +``` \ No newline at end of file From de60865f2612a334ba6bf5ce5fcf5862696b0876 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 3 Dec 2025 16:26:56 -0800 Subject: [PATCH 05/10] regen tests --- internal/fourslash/_scripts/convertFourslash.mts | 2 +- internal/fourslash/tests/documentSymbolPrivateName_test.go | 3 ++- internal/fourslash/tests/gen/getNavigationBarItems_test.go | 3 ++- internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go | 3 ++- internal/fourslash/tests/gen/navbar01_test.go | 3 ++- .../fourslash/tests/gen/navbarNestedCommonJsExports_test.go | 3 ++- internal/fourslash/tests/gen/navbar_const_test.go | 3 ++- .../fourslash/tests/gen/navbar_contains-no-duplicates_test.go | 3 ++- internal/fourslash/tests/gen/navbar_exportDefault_test.go | 3 ++- internal/fourslash/tests/gen/navbar_let_test.go | 3 ++- .../navigationBarAnonymousClassAndFunctionExpressions2_test.go | 3 ++- .../navigationBarAnonymousClassAndFunctionExpressions3_test.go | 3 ++- .../navigationBarAnonymousClassAndFunctionExpressions_test.go | 3 ++- .../fourslash/tests/gen/navigationBarAssignmentTypes_test.go | 3 ++- .../fourslash/tests/gen/navigationBarClassStaticBlock_test.go | 3 ++- .../tests/gen/navigationBarComputedPropertyName_test.go | 3 ++- ...avigationBarFunctionIndirectlyInVariableDeclaration_test.go | 3 ++- .../gen/navigationBarFunctionLikePropertyAssignments_test.go | 3 ++- .../fourslash/tests/gen/navigationBarGetterAndSetter_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarImports_test.go | 3 ++- .../fourslash/tests/gen/navigationBarInitializerSpans_test.go | 3 ++- .../gen/navigationBarItemsBindingPatternsInConstructor_test.go | 3 ++- .../tests/gen/navigationBarItemsBindingPatterns_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsClass1_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsClass2_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsClass3_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsClass4_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsClass5_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsClass6_test.go | 3 ++- .../tests/gen/navigationBarItemsComputedNames_test.go | 3 ++- .../tests/gen/navigationBarItemsEmptyConstructors_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsExports_test.go | 3 ++- .../tests/gen/navigationBarItemsFunctionProperties_test.go | 3 ++- .../tests/gen/navigationBarItemsFunctionsBroken2_test.go | 3 ++- .../tests/gen/navigationBarItemsFunctionsBroken_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsFunctions_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsImports_test.go | 3 ++- .../gen/navigationBarItemsInsideMethodsAndConstructors_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsItems2_test.go | 3 ++- .../tests/gen/navigationBarItemsItemsExternalModules2_test.go | 3 ++- .../tests/gen/navigationBarItemsItemsExternalModules3_test.go | 3 ++- .../tests/gen/navigationBarItemsItemsExternalModules_test.go | 3 ++- .../tests/gen/navigationBarItemsItemsModuleVariables_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarItemsItems_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsMissingName1_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsMissingName2_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsModules1_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsModules2_test.go | 3 ++- .../gen/navigationBarItemsMultilineStringIdentifiers1_test.go | 3 ++- .../gen/navigationBarItemsMultilineStringIdentifiers2_test.go | 3 ++- .../gen/navigationBarItemsMultilineStringIdentifiers3_test.go | 3 ++- .../tests/gen/navigationBarItemsNamedArrowFunctions_test.go | 3 ++- .../navigationBarItemsPropertiesDefinedInConstructors_test.go | 3 ++- .../gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsSymbols1_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsSymbols2_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsSymbols3_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsSymbols4_test.go | 3 ++- .../fourslash/tests/gen/navigationBarItemsTypeAlias_test.go | 3 ++- .../tests/gen/navigationBarJsDocCommentWithNoTags_test.go | 3 ++- .../tests/gen/navigationBarMerging_grandchildren_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarMerging_test.go | 3 ++- .../tests/gen/navigationBarNamespaceImportWithNoName_test.go | 3 ++- .../tests/gen/navigationBarNestedObjectLiterals_test.go | 3 ++- .../fourslash/tests/gen/navigationBarPrivateNameMethod_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarPrivateName_test.go | 3 ++- .../tests/gen/navigationBarPropertyDeclarations_test.go | 3 ++- internal/fourslash/tests/gen/navigationBarVariables_test.go | 3 ++- .../tests/gen/navigationBarWellKnownSymbolExpando_test.go | 3 ++- .../tests/gen/navigationBarWithLocalVariables_test.go | 3 ++- .../tests/gen/navigationItemsExportDefaultExpression_test.go | 3 ++- .../tests/gen/navigationItemsExportEqualsExpression_test.go | 3 ++- 72 files changed, 143 insertions(+), 72 deletions(-) diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts index 0828202f72..ec18c25113 100644 --- a/internal/fourslash/_scripts/convertFourslash.mts +++ b/internal/fourslash/_scripts/convertFourslash.mts @@ -2421,7 +2421,7 @@ function getSymbolKindWorker(kind: string): string { case "string": return "SymbolKindString"; case "type": - return "SymbolKindInterface"; + return "SymbolKindClass"; default: return "SymbolKindVariable"; } diff --git a/internal/fourslash/tests/documentSymbolPrivateName_test.go b/internal/fourslash/tests/documentSymbolPrivateName_test.go index dd771e13fa..b7a9cdd09b 100644 --- a/internal/fourslash/tests/documentSymbolPrivateName_test.go +++ b/internal/fourslash/tests/documentSymbolPrivateName_test.go @@ -27,7 +27,8 @@ class Foo { #privateMethod() {} } ` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "second.ts") f.VerifyBaselineDocumentSymbol(t) diff --git a/internal/fourslash/tests/gen/getNavigationBarItems_test.go b/internal/fourslash/tests/gen/getNavigationBarItems_test.go index b52eb5581d..476da2b5e9 100644 --- a/internal/fourslash/tests/gen/getNavigationBarItems_test.go +++ b/internal/fourslash/tests/gen/getNavigationBarItems_test.go @@ -15,6 +15,7 @@ func TestGetNavigationBarItems(t *testing.T) { foo; ["bar"]: string; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go b/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go index e13db5c96d..8d188f2067 100644 --- a/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go +++ b/internal/fourslash/tests/gen/jsdocTypedefTagNavigateTo_test.go @@ -20,7 +20,8 @@ var NumberLike2; /** @type {/*1*/NumberLike} */ var numberLike;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.MarkTestAsStradaServer() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar01_test.go b/internal/fourslash/tests/gen/navbar01_test.go index 51e356a139..79c365347a 100644 --- a/internal/fourslash/tests/gen/navbar01_test.go +++ b/internal/fourslash/tests/gen/navbar01_test.go @@ -48,7 +48,8 @@ module Shapes { // Local variables var p: IPoint = new Shapes.Point(3, 4); var dist = p.getDist();` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.MarkTestAsStradaServer() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go b/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go index 529bc3164a..2f125efc33 100644 --- a/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go +++ b/internal/fourslash/tests/gen/navbarNestedCommonJsExports_test.go @@ -14,6 +14,7 @@ func TestNavbarNestedCommonJsExports(t *testing.T) { const content = `// @allowJs: true // @Filename: /a.js exports.a = exports.b = exports.c = 0;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar_const_test.go b/internal/fourslash/tests/gen/navbar_const_test.go index 6c0489a348..1a10265003 100644 --- a/internal/fourslash/tests/gen/navbar_const_test.go +++ b/internal/fourslash/tests/gen/navbar_const_test.go @@ -12,6 +12,7 @@ func TestNavbar_const(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `const c = 0;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go b/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go index 88ec4218d8..741c0a61b2 100644 --- a/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go +++ b/internal/fourslash/tests/gen/navbar_contains-no-duplicates_test.go @@ -38,6 +38,7 @@ class ABC { module ABC { export var x = 3; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navbar_exportDefault_test.go b/internal/fourslash/tests/gen/navbar_exportDefault_test.go index ebba5d36d9..7a84339734 100644 --- a/internal/fourslash/tests/gen/navbar_exportDefault_test.go +++ b/internal/fourslash/tests/gen/navbar_exportDefault_test.go @@ -19,7 +19,8 @@ export default class C { } export default function { } // @Filename: d.ts export default function Func { }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.GoToFile(t, "a.ts") f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "b.ts") diff --git a/internal/fourslash/tests/gen/navbar_let_test.go b/internal/fourslash/tests/gen/navbar_let_test.go index 5d3fe1c922..67c8b6c467 100644 --- a/internal/fourslash/tests/gen/navbar_let_test.go +++ b/internal/fourslash/tests/gen/navbar_let_test.go @@ -12,6 +12,7 @@ func TestNavbar_let(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `let c = 0;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go index 6be83c9ed6..9148c39776 100644 --- a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions2_test.go @@ -13,6 +13,7 @@ func TestNavigationBarAnonymousClassAndFunctionExpressions2(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `console.log(console.log(class Y {}, class X {}), console.log(class B {}, class A {})); console.log(class Cls { meth() {} });` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go index 3e6315a74f..23d5445344 100644 --- a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions3_test.go @@ -20,6 +20,7 @@ const b = 2; describe('foo', () => { test(` + "`" + `a ${a} b {b}` + "`" + `, () => {}) })` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go index 4c3f1e20e4..4efee99b64 100644 --- a/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go +++ b/internal/fourslash/tests/gen/navigationBarAnonymousClassAndFunctionExpressions_test.go @@ -38,6 +38,7 @@ func TestNavigationBarAnonymousClassAndFunctionExpressions(t *testing.T) { console.log(class cls3 {}); (class { }); })` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go b/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go index 2034931ef7..6207737485 100644 --- a/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go +++ b/internal/fourslash/tests/gen/navigationBarAssignmentTypes_test.go @@ -17,6 +17,7 @@ const a = { c, d: 0 };` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go b/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go index 3e2e9047e4..f45966b6a7 100644 --- a/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go +++ b/internal/fourslash/tests/gen/navigationBarClassStaticBlock_test.go @@ -16,6 +16,7 @@ func TestNavigationBarClassStaticBlock(t *testing.T) { let x; } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go b/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go index 3018f664c5..036db2380c 100644 --- a/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go +++ b/internal/fourslash/tests/gen/navigationBarComputedPropertyName_test.go @@ -17,6 +17,7 @@ func TestNavigationBarComputedPropertyName(t *testing.T) { "prop": true } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go b/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go index 596c77a19e..162009df08 100644 --- a/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go +++ b/internal/fourslash/tests/gen/navigationBarFunctionIndirectlyInVariableDeclaration_test.go @@ -23,6 +23,7 @@ b = { var d; } };` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go b/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go index c2dfe76137..cbabc984e8 100644 --- a/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go +++ b/internal/fourslash/tests/gen/navigationBarFunctionLikePropertyAssignments_test.go @@ -19,6 +19,7 @@ func TestNavigationBarFunctionLikePropertyAssignments(t *testing.T) { e: y(), f() { } };` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go b/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go index 87e2b61912..577a99b041 100644 --- a/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go +++ b/internal/fourslash/tests/gen/navigationBarGetterAndSetter_test.go @@ -18,6 +18,7 @@ func TestNavigationBarGetterAndSetter(t *testing.T) { function f() {} } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarImports_test.go b/internal/fourslash/tests/gen/navigationBarImports_test.go index 42daf22049..60044cfea9 100644 --- a/internal/fourslash/tests/gen/navigationBarImports_test.go +++ b/internal/fourslash/tests/gen/navigationBarImports_test.go @@ -14,6 +14,7 @@ func TestNavigationBarImports(t *testing.T) { const content = `import a, {b} from "m"; import c = require("m"); import * as d from "m";` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go b/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go index 43601d3f1b..2e489ec61e 100644 --- a/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go +++ b/internal/fourslash/tests/gen/navigationBarInitializerSpans_test.go @@ -15,6 +15,7 @@ func TestNavigationBarInitializerSpans(t *testing.T) { const [|[|x|] = () => { var [|a|]; }|]; const [|[|f|] = function f() { var [|b|]; }|]; const [|[|y|] = { [|[|z|]: function z() { var [|c|]; }|] }|];` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go b/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go index dfc1b5c25d..b1d15f0ec6 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsBindingPatternsInConstructor_test.go @@ -21,6 +21,7 @@ class B { constructor( {a} = { a: 1 }) { } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go b/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go index 6021acab20..12cf8f4f58 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsBindingPatterns_test.go @@ -18,6 +18,7 @@ let foo1, {a, b} const bar1, [c, d] var {e, x: [f, g]} = {a:1, x:[]}; var { h: i = function j() {} } = obj;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go index 06170b235f..7b896c4ad3 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass1_test.go @@ -13,6 +13,7 @@ func TestNavigationBarItemsClass1(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `function Foo() {} class Foo {}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go index 9cb5aa9e5a..377a64a9f6 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass2_test.go @@ -13,6 +13,7 @@ func TestNavigationBarItemsClass2(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `class Foo {} function Foo() {}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go index 85db7b11ec..4ccea8df9a 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass3_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsClass3(t *testing.T) { // @filename: /foo.js function Foo() {} class Foo {}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go index 17261e51e8..e3a8670a5d 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass4_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsClass4(t *testing.T) { // @filename: /foo.js class Foo {} function Foo() {}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go index 676385b054..3f8c73c728 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass5_test.go @@ -13,6 +13,7 @@ func TestNavigationBarItemsClass5(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `class Foo {} let Foo = 1;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go b/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go index 411043628c..47cf1c6c54 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsClass6_test.go @@ -16,6 +16,7 @@ func TestNavigationBarItemsClass6(t *testing.T) { Z.foo = 42 class Z { }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go b/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go index 3ed622586d..5657250e22 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsComputedNames_test.go @@ -33,6 +33,7 @@ class C { return 1; }, }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go index 01303931fd..0fda289592 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsEmptyConstructors_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsEmptyConstructors(t *testing.T) { constructor() { } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsExports_test.go b/internal/fourslash/tests/gen/navigationBarItemsExports_test.go index 0bbc289f2e..18cb9c0d30 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsExports_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsExports_test.go @@ -18,6 +18,7 @@ export { b as B } from "a" export import e = require("a"); export * from "a"; // no bindings here` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go index 88adbe8ad6..1ba2084c52 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionProperties_test.go @@ -16,6 +16,7 @@ var A; A/*1*/ .a = function() { }; })();` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go index 050a29e602..60087425b6 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken2_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsFunctionsBroken2(t *testing.T) { function f() { function; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go index 1836d386fb..b16a7e8367 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctionsBroken_test.go @@ -14,6 +14,7 @@ func TestNavigationBarItemsFunctionsBroken(t *testing.T) { const content = `function f() { function; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go b/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go index bacced2afa..0980f4bf65 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsFunctions_test.go @@ -27,6 +27,7 @@ func TestNavigationBarItemsFunctions(t *testing.T) { function baz() { var v = 10; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsImports_test.go b/internal/fourslash/tests/gen/navigationBarItemsImports_test.go index b558e58be1..dad31f19cb 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsImports_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsImports_test.go @@ -22,6 +22,7 @@ import d2, { c, d as D } from "a" import e = require("a"); import * as ns from "a";` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go index bfa7a66225..2dca7bdc43 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsInsideMethodsAndConstructors_test.go @@ -28,6 +28,7 @@ func TestNavigationBarItemsInsideMethodsAndConstructors(t *testing.T) { emptyMethod() { } // Non child functions method should not be duplicated }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go b/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go index 49db825c7b..e3f1cdb822 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItems2_test.go @@ -12,7 +12,8 @@ func TestNavigationBarItemsItems2(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `/**/` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.GoToMarker(t, "") f.InsertLine(t, "module A") f.Insert(t, "export class ") diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go index c80e1cdb53..42b9fa0376 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules2_test.go @@ -16,6 +16,7 @@ export class Bar { public s: string; } export var x: number;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go index 4b8ac090e5..83a9ae0d35 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules3_test.go @@ -16,6 +16,7 @@ export class Bar { public s: string; } export var x: number;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go index 2ca612e67b..fc1d90c605 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsExternalModules_test.go @@ -14,6 +14,7 @@ func TestNavigationBarItemsItemsExternalModules(t *testing.T) { const content = `export class Bar { public s: string; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go b/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go index 8ebf5cef76..d3a11fd5c5 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItemsModuleVariables_test.go @@ -26,7 +26,8 @@ module Module1.SubModule { module Module1 { export var z = 0; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.GoToMarker(t, "file1") f.VerifyBaselineDocumentSymbol(t) f.GoToMarker(t, "file2") diff --git a/internal/fourslash/tests/gen/navigationBarItemsItems_test.go b/internal/fourslash/tests/gen/navigationBarItemsItems_test.go index 290874ced6..232c7317f6 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsItems_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsItems_test.go @@ -49,6 +49,7 @@ module Shapes { // Local variables var p: IPoint = new Shapes.Point(3, 4); var dist = p.getDist();` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go b/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go index 9c4691c92b..9d47714161 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMissingName1_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsMissingName1(t *testing.T) { class C { foo() {} }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go b/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go index e26ba91734..43ace1f216 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMissingName2_test.go @@ -17,6 +17,7 @@ func TestNavigationBarItemsMissingName2(t *testing.T) { class /* But it has no name! */ { foo() {} }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go b/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go index c4f757141b..140aeafe12 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsModules1_test.go @@ -36,6 +36,7 @@ module A { } } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go b/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go index bd5bf6ca16..b0456dfc44 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsModules2_test.go @@ -16,6 +16,7 @@ func TestNavigationBarItemsModules2(t *testing.T) { namespace Test.B { class Foo { } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go index b344f04b09..c42df06511 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers1_test.go @@ -39,6 +39,7 @@ class Bar implements Foo { return this; } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go index 80bfbe5b48..5ca46e5d1f 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers2_test.go @@ -24,6 +24,7 @@ class c1 { f(() => { }, ` + "`" + `unterminated backtick 1 unterminated backtick 2 unterminated backtick 3` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go index 49c737112e..5f1712d0d1 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsMultilineStringIdentifiers3_test.go @@ -18,6 +18,7 @@ MoreThanOneHundredAndFiftyCharacters\ MoreThanOneHundredAndFiftyCharacters\ MoreThanOneHundredAndFiftyCharacters\ MoreThanOneHundredAndFiftyCharacters' { }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go b/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go index 1c32997418..44039a26bc 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsNamedArrowFunctions_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsNamedArrowFunctions(t *testing.T) { export const func = () => 2; export const func2 = function() { }; export function exportedFunction() { }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go b/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go index 66c46bddd2..9d5017df51 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsPropertiesDefinedInConstructors_test.go @@ -16,6 +16,7 @@ func TestNavigationBarItemsPropertiesDefinedInConstructors(t *testing.T) { var local = 0; } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go b/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go index 59b1c4acea..2d8477a848 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsStaticAndNonStaticNoMerge_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsStaticAndNonStaticNoMerge(t *testing.T) { static x; x; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go index 5626f58a98..552a7bf69a 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols1_test.go @@ -16,6 +16,7 @@ func TestNavigationBarItemsSymbols1(t *testing.T) { [Symbol.iterator]() { } get [Symbol.isConcatSpreadable]() { } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go index 15dfd24e66..185fbda68d 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols2_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsSymbols2(t *testing.T) { [Symbol.isRegExp]: string; [Symbol.iterator](): string; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go index 6cb36bbbce..60a5c1a7c4 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols3_test.go @@ -15,6 +15,7 @@ func TestNavigationBarItemsSymbols3(t *testing.T) { // No nav bar entry for this [Symbol.isRegExp] = 0 }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go b/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go index c343e4eaaa..a56bd9984b 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsSymbols4_test.go @@ -29,6 +29,7 @@ class MyClass { const x = this[_sym]; } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go b/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go index 1a32cfb5d7..0de41debd8 100644 --- a/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go +++ b/internal/fourslash/tests/gen/navigationBarItemsTypeAlias_test.go @@ -12,6 +12,7 @@ func TestNavigationBarItemsTypeAlias(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `type T = number | string;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go b/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go index 4f4ded877a..83e45aa646 100644 --- a/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go +++ b/internal/fourslash/tests/gen/navigationBarJsDocCommentWithNoTags_test.go @@ -13,6 +13,7 @@ func TestNavigationBarJsDocCommentWithNoTags(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `/** Test */ export const Test = {}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go b/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go index e22ec72d34..1988fdf4c0 100644 --- a/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go +++ b/internal/fourslash/tests/gen/navigationBarMerging_grandchildren_test.go @@ -20,6 +20,7 @@ const o = { m() {}, }, }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarMerging_test.go b/internal/fourslash/tests/gen/navigationBarMerging_test.go index d1418aa249..0de54ad83b 100644 --- a/internal/fourslash/tests/gen/navigationBarMerging_test.go +++ b/internal/fourslash/tests/gen/navigationBarMerging_test.go @@ -38,7 +38,8 @@ module a { // @Filename: file4.ts module A { export var x; } module A.B { export var y; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "file2.ts") f.VerifyBaselineDocumentSymbol(t) diff --git a/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go b/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go index 7d14d0b20e..dd4469b62a 100644 --- a/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go +++ b/internal/fourslash/tests/gen/navigationBarNamespaceImportWithNoName_test.go @@ -12,6 +12,7 @@ func TestNavigationBarNamespaceImportWithNoName(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `import *{} from 'foo';` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go b/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go index 418b24ced0..e90ebdb6f3 100644 --- a/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go +++ b/internal/fourslash/tests/gen/navigationBarNestedObjectLiterals_test.go @@ -24,6 +24,7 @@ func TestNavigationBarNestedObjectLiterals(t *testing.T) { }, }, }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go b/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go index d2d1c99105..2147d2038b 100644 --- a/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go +++ b/internal/fourslash/tests/gen/navigationBarPrivateNameMethod_test.go @@ -21,6 +21,7 @@ func TestNavigationBarPrivateNameMethod(t *testing.T) { } } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarPrivateName_test.go b/internal/fourslash/tests/gen/navigationBarPrivateName_test.go index b4ace062c2..e7e4525d4e 100644 --- a/internal/fourslash/tests/gen/navigationBarPrivateName_test.go +++ b/internal/fourslash/tests/gen/navigationBarPrivateName_test.go @@ -21,6 +21,7 @@ func TestNavigationBarPrivateName(t *testing.T) { } } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go b/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go index c28a7b972e..b10d3b60af 100644 --- a/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go +++ b/internal/fourslash/tests/gen/navigationBarPropertyDeclarations_test.go @@ -43,6 +43,7 @@ func TestNavigationBarPropertyDeclarations(t *testing.T) { public [1 + 1] = 1; }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarVariables_test.go b/internal/fourslash/tests/gen/navigationBarVariables_test.go index 9591b15034..bfc1b5fdec 100644 --- a/internal/fourslash/tests/gen/navigationBarVariables_test.go +++ b/internal/fourslash/tests/gen/navigationBarVariables_test.go @@ -18,7 +18,8 @@ const z = 2; var {a} = 0; let {a: b} = 0; const [c] = 0;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) f.GoToFile(t, "file2.ts") f.VerifyBaselineDocumentSymbol(t) diff --git a/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go b/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go index 9f0b4a8404..8bd3c9dfb6 100644 --- a/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go +++ b/internal/fourslash/tests/gen/navigationBarWellKnownSymbolExpando_test.go @@ -13,6 +13,7 @@ func TestNavigationBarWellKnownSymbolExpando(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `function f() {} f[Symbol.iterator] = function() {}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go b/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go index 851399bc19..26382e552e 100644 --- a/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go +++ b/internal/fourslash/tests/gen/navigationBarWithLocalVariables_test.go @@ -15,6 +15,7 @@ func TestNavigationBarWithLocalVariables(t *testing.T) { const x = Object() x.foo = "" }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go b/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go index 6311e18332..7eddf52790 100644 --- a/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go +++ b/internal/fourslash/tests/gen/navigationItemsExportDefaultExpression_test.go @@ -42,6 +42,7 @@ export default { function foo(props: { x: number; y: number }) {} export default foo({ x: 1, y: 1 });` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go b/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go index db93131fa9..3883e29769 100644 --- a/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go +++ b/internal/fourslash/tests/gen/navigationItemsExportEqualsExpression_test.go @@ -39,6 +39,7 @@ export = { d: 1 } }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } From 0d955155a453650d45a7d22b23467b6d71695586 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 3 Dec 2025 16:39:50 -0800 Subject: [PATCH 06/10] fix manual tests --- internal/fourslash/tests/manual/NavigationBarJsDoc_test.go | 3 ++- .../tests/manual/navigationBarFunctionPrototype2_test.go | 3 ++- .../tests/manual/navigationBarFunctionPrototype3_test.go | 3 ++- .../tests/manual/navigationBarFunctionPrototype4_test.go | 3 ++- .../tests/manual/navigationBarFunctionPrototypeBroken_test.go | 3 ++- .../manual/navigationBarFunctionPrototypeInterlaced_test.go | 3 ++- .../tests/manual/navigationBarFunctionPrototypeNested_test.go | 3 ++- .../tests/manual/navigationBarFunctionPrototype_test.go | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/internal/fourslash/tests/manual/NavigationBarJsDoc_test.go b/internal/fourslash/tests/manual/NavigationBarJsDoc_test.go index 567d82fa03..079ce17f38 100644 --- a/internal/fourslash/tests/manual/NavigationBarJsDoc_test.go +++ b/internal/fourslash/tests/manual/NavigationBarJsDoc_test.go @@ -16,6 +16,7 @@ func TestNavigationBarJsDoc(t *testing.T) { /** @typedef {(number|string)} NumberLike */ /** @typedef {(string|number)} */ const x = 0;` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototype2_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototype2_test.go index ef69c1be93..d51117325e 100644 --- a/internal/fourslash/tests/manual/navigationBarFunctionPrototype2_test.go +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototype2_test.go @@ -16,6 +16,7 @@ func TestNavigationBarFunctionPrototype2(t *testing.T) { A.prototype.a = function() { }; A.prototype.b = function() { }; function A() {}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototype3_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototype3_test.go index 459d91a959..88f4c28793 100644 --- a/internal/fourslash/tests/manual/navigationBarFunctionPrototype3_test.go +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototype3_test.go @@ -16,6 +16,7 @@ func TestNavigationBarFunctionPrototype3(t *testing.T) { var A; A.prototype.a = function() { }; A.b = function() { };` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototype4_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototype4_test.go index a086bd9d61..0f77296de9 100644 --- a/internal/fourslash/tests/manual/navigationBarFunctionPrototype4_test.go +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototype4_test.go @@ -24,6 +24,7 @@ B["prototype"] = { }; B["prototype"] = { m() {} }; B["prototype"]["a"] = function() { }; B["b"] = function() { };` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeBroken_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeBroken_test.go index b7f6a88ea2..68f30c5851 100644 --- a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeBroken_test.go +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeBroken_test.go @@ -18,6 +18,7 @@ A. // Started typing something here A.prototype.a = function() { }; G. // Started typing something here A.prototype.a = function() { };` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeInterlaced_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeInterlaced_test.go index 23de790666..73a7f9f378 100644 --- a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeInterlaced_test.go +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeInterlaced_test.go @@ -22,6 +22,7 @@ b = 2 A.prototype.c = function() { } var b = 2 A.prototype.d = function() { }` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeNested_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeNested_test.go index f876b19f79..51554685d6 100644 --- a/internal/fourslash/tests/manual/navigationBarFunctionPrototypeNested_test.go +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototypeNested_test.go @@ -21,6 +21,7 @@ Object.defineProperty(A.B.prototype, "x", { }) A.prototype.D = function () { } A.prototype.D.prototype.d = function () { } ` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } diff --git a/internal/fourslash/tests/manual/navigationBarFunctionPrototype_test.go b/internal/fourslash/tests/manual/navigationBarFunctionPrototype_test.go index cb46468929..7f54da4ef5 100644 --- a/internal/fourslash/tests/manual/navigationBarFunctionPrototype_test.go +++ b/internal/fourslash/tests/manual/navigationBarFunctionPrototype_test.go @@ -27,6 +27,7 @@ Object.defineProperty(f.prototype, 'name', { get: function(){ } }); ` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() f.VerifyBaselineDocumentSymbol(t) } From 74b7e6725fb7b7ed3566712f3eafc239fa2a6d5c Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 4 Dec 2025 08:32:39 -0800 Subject: [PATCH 07/10] update baselines --- internal/fourslash/fourslash.go | 2 +- .../reference/fourslash/documentSymbols/navbar01.baseline.md | 2 +- .../documentSymbols/navigationBarItemsItems.baseline.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 8757d24161..a14b81c7f4 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -3675,7 +3675,7 @@ func verifyIncludesSymbols( } } -var marshalSymbolKind = func(v lsproto.SymbolKind) ([]byte, error) { +func marshalSymbolKind(v lsproto.SymbolKind) ([]byte, error) { return []byte(`"` + v.String() + `"`), nil } diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md index 108e5f0e5a..81dcc80dc6 100644 --- a/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md @@ -120,7 +120,7 @@ var dist = p.getDist(); }, { "name": "()", - "kind": "Function", + "kind": "Method", "range": { "start": { "line": 4, diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md index 91711003fd..19d549b410 100644 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md @@ -121,7 +121,7 @@ var dist = p.getDist(); }, { "name": "()", - "kind": "Function", + "kind": "Method", "range": { "start": { "line": 4, From 95282490da84ad336bbd9e4bfb6e7a4158f63cb6 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 5 Dec 2025 21:17:08 +0000 Subject: [PATCH 08/10] use new baseline format --- internal/fourslash/baselineutil.go | 4 +- internal/fourslash/fourslash.go | 68 +- .../tests/documentSymbolPrivateName_test.go | 11 +- .../documentSymbolPrivateName.baseline | 41 ++ .../documentSymbolPrivateName.baseline.md | 217 ------ .../getNavigationBarItems.baseline | 11 + .../getNavigationBarItems.baseline.md | 91 --- .../jsdocTypedefTagNavigateTo.baseline | 13 + .../jsdocTypedefTagNavigateTo.baseline.md | 92 --- .../documentSymbols/navbar01.baseline | 63 ++ .../documentSymbols/navbar01.baseline.md | 602 ---------------- .../navbarNestedCommonJsExports.baseline | 4 + .../navbarNestedCommonJsExports.baseline.md | 11 - .../documentSymbols/navbar_const.baseline | 6 + .../documentSymbols/navbar_const.baseline.md | 37 - .../navbar_contains_no_duplicates.baseline | 43 ++ .../navbar_contains_no_duplicates.baseline.md | 344 --------- .../navbar_exportDefault.baseline | 36 + .../navbar_exportDefault.baseline.md | 157 ----- .../documentSymbols/navbar_let.baseline | 6 + .../documentSymbols/navbar_let.baseline.md | 37 - ...nymousClassAndFunctionExpressions.baseline | 48 ++ ...ousClassAndFunctionExpressions.baseline.md | 469 ------------- ...ymousClassAndFunctionExpressions2.baseline | 12 + ...usClassAndFunctionExpressions2.baseline.md | 164 ----- ...ymousClassAndFunctionExpressions3.baseline | 19 + ...usClassAndFunctionExpressions3.baseline.md | 172 ----- .../navigationBarAssignmentTypes.baseline | 14 + .../navigationBarAssignmentTypes.baseline.md | 118 ---- .../navigationBarClassStaticBlock.baseline | 11 + .../navigationBarClassStaticBlock.baseline.md | 67 -- ...navigationBarComputedPropertyName.baseline | 13 + ...igationBarComputedPropertyName.baseline.md | 93 --- ...onIndirectlyInVariableDeclaration.baseline | 22 + ...ndirectlyInVariableDeclaration.baseline.md | 176 ----- ...arFunctionLikePropertyAssignments.baseline | 19 + ...unctionLikePropertyAssignments.baseline.md | 195 ------ .../navigationBarFunctionPrototype.baseline | 27 + ...navigationBarFunctionPrototype.baseline.md | 252 ------- .../navigationBarFunctionPrototype2.baseline | 12 + ...avigationBarFunctionPrototype2.baseline.md | 142 ---- .../navigationBarFunctionPrototype3.baseline | 12 + ...avigationBarFunctionPrototype3.baseline.md | 142 ---- .../navigationBarFunctionPrototype4.baseline | 27 + ...avigationBarFunctionPrototype4.baseline.md | 328 --------- ...igationBarFunctionPrototypeBroken.baseline | 12 + ...tionBarFunctionPrototypeBroken.baseline.md | 91 --- ...ionBarFunctionPrototypeInterlaced.baseline | 24 + ...BarFunctionPrototypeInterlaced.baseline.md | 300 -------- ...igationBarFunctionPrototypeNested.baseline | 20 + ...tionBarFunctionPrototypeNested.baseline.md | 222 ------ .../navigationBarGetterAndSetter.baseline | 15 + .../navigationBarGetterAndSetter.baseline.md | 120 ---- .../navigationBarImports.baseline | 11 + .../navigationBarImports.baseline.md | 114 --- .../navigationBarInitializerSpans.baseline | 15 + .../navigationBarInitializerSpans.baseline.md | 194 ------ ...navigationBarItemsBindingPatterns.baseline | 23 + ...igationBarItemsBindingPatterns.baseline.md | 318 --------- ...ItemsBindingPatternsInConstructor.baseline | 20 + ...msBindingPatternsInConstructor.baseline.md | 173 ----- .../navigationBarItemsClass1.baseline | 8 + .../navigationBarItemsClass1.baseline.md | 63 -- .../navigationBarItemsClass2.baseline | 8 + .../navigationBarItemsClass2.baseline.md | 63 -- .../navigationBarItemsClass3.baseline | 8 + .../navigationBarItemsClass3.baseline.md | 63 -- .../navigationBarItemsClass4.baseline | 8 + .../navigationBarItemsClass4.baseline.md | 63 -- .../navigationBarItemsClass5.baseline | 8 + .../navigationBarItemsClass5.baseline.md | 63 -- .../navigationBarItemsClass6.baseline | 13 + .../navigationBarItemsClass6.baseline.md | 118 ---- .../navigationBarItemsComputedNames.baseline | 34 + ...avigationBarItemsComputedNames.baseline.md | 235 ------- ...vigationBarItemsEmptyConstructors.baseline | 10 + ...ationBarItemsEmptyConstructors.baseline.md | 66 -- .../navigationBarItemsExports.baseline | 14 + .../navigationBarItemsExports.baseline.md | 93 --- ...igationBarItemsFunctionProperties.baseline | 12 + ...tionBarItemsFunctionProperties.baseline.md | 92 --- .../navigationBarItemsFunctions.baseline | 29 + .../navigationBarItemsFunctions.baseline.md | 256 ------- ...navigationBarItemsFunctionsBroken.baseline | 8 + ...igationBarItemsFunctionsBroken.baseline.md | 39 -- ...avigationBarItemsFunctionsBroken2.baseline | 9 + ...gationBarItemsFunctionsBroken2.baseline.md | 40 -- .../navigationBarItemsImports.baseline | 23 + .../navigationBarItemsImports.baseline.md | 222 ------ ...ItemsInsideMethodsAndConstructors.baseline | 34 + ...msInsideMethodsAndConstructors.baseline.md | 359 ---------- .../navigationBarItemsItems.baseline | 64 ++ .../navigationBarItemsItems.baseline.md | 603 ---------------- .../navigationBarItemsItems2.baseline | 8 + .../navigationBarItemsItems2.baseline.md | 63 -- ...ationBarItemsItemsExternalModules.baseline | 9 + ...onBarItemsItemsExternalModules.baseline.md | 65 -- ...tionBarItemsItemsExternalModules2.baseline | 11 + ...nBarItemsItemsExternalModules2.baseline.md | 91 --- ...tionBarItemsItemsExternalModules3.baseline | 11 + ...nBarItemsItemsExternalModules3.baseline.md | 91 --- ...ationBarItemsItemsModuleVariables.baseline | 24 + ...onBarItemsItemsModuleVariables.baseline.md | 135 ---- .../navigationBarItemsMissingName1.baseline | 10 + ...navigationBarItemsMissingName1.baseline.md | 66 -- .../navigationBarItemsMissingName2.baseline | 12 + ...navigationBarItemsMissingName2.baseline.md | 68 -- .../navigationBarItemsModules1.baseline | 41 ++ .../navigationBarItemsModules1.baseline.md | 341 --------- .../navigationBarItemsModules2.baseline | 12 + .../navigationBarItemsModules2.baseline.md | 92 --- ...rItemsMultilineStringIdentifiers1.baseline | 41 ++ ...emsMultilineStringIdentifiers1.baseline.md | 266 ------- ...rItemsMultilineStringIdentifiers2.baseline | 23 + ...emsMultilineStringIdentifiers2.baseline.md | 175 ----- ...rItemsMultilineStringIdentifiers3.baseline | 12 + ...emsMultilineStringIdentifiers3.baseline.md | 43 -- ...gationBarItemsNamedArrowFunctions.baseline | 12 + ...ionBarItemsNamedArrowFunctions.baseline.md | 115 ---- ...msPropertiesDefinedInConstructors.baseline | 15 + ...ropertiesDefinedInConstructors.baseline.md | 168 ----- ...BarItemsStaticAndNonStaticNoMerge.baseline | 11 + ...ItemsStaticAndNonStaticNoMerge.baseline.md | 91 --- .../navigationBarItemsSymbols1.baseline | 13 + .../navigationBarItemsSymbols1.baseline.md | 117 ---- .../navigationBarItemsSymbols2.baseline | 11 + .../navigationBarItemsSymbols2.baseline.md | 91 --- .../navigationBarItemsSymbols3.baseline | 10 + .../navigationBarItemsSymbols3.baseline.md | 66 -- .../navigationBarItemsSymbols4.baseline | 23 + .../navigationBarItemsSymbols4.baseline.md | 152 ---- .../navigationBarItemsTypeAlias.baseline | 6 + .../navigationBarItemsTypeAlias.baseline.md | 37 - .../navigationBarJsDoc.baseline | 9 + .../navigationBarJsDoc.baseline.md | 64 -- ...vigationBarJsDocCommentWithNoTags.baseline | 7 + ...ationBarJsDocCommentWithNoTags.baseline.md | 38 - .../navigationBarMerging.baseline | 67 ++ .../navigationBarMerging.baseline.md | 483 ------------- ...avigationBarMerging_grandchildren.baseline | 18 + ...gationBarMerging_grandchildren.baseline.md | 148 ---- ...ationBarNamespaceImportWithNoName.baseline | 4 + ...onBarNamespaceImportWithNoName.baseline.md | 11 - ...navigationBarNestedObjectLiterals.baseline | 26 + ...igationBarNestedObjectLiterals.baseline.md | 253 ------- .../navigationBarPrivateName.baseline | 19 + .../navigationBarPrivateName.baseline.md | 148 ---- .../navigationBarPrivateNameMethod.baseline | 19 + ...navigationBarPrivateNameMethod.baseline.md | 150 ---- ...navigationBarPropertyDeclarations.baseline | 58 ++ ...igationBarPropertyDeclarations.baseline.md | 598 ---------------- .../navigationBarVariables.baseline | 24 + .../navigationBarVariables.baseline.md | 181 ----- ...vigationBarWellKnownSymbolExpando.baseline | 9 + ...ationBarWellKnownSymbolExpando.baseline.md | 90 --- .../navigationBarWithLocalVariables.baseline | 10 + ...avigationBarWithLocalVariables.baseline.md | 66 -- ...ationItemsExportDefaultExpression.baseline | 53 ++ ...onItemsExportDefaultExpression.baseline.md | 496 ------------- ...gationItemsExportEqualsExpression.baseline | 56 ++ ...ionItemsExportEqualsExpression.baseline.md | 651 ------------------ 161 files changed, 1641 insertions(+), 13611 deletions(-) create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline.md create mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline delete mode 100644 testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline.md diff --git a/internal/fourslash/baselineutil.go b/internal/fourslash/baselineutil.go index 2439749502..54fe0967df 100644 --- a/internal/fourslash/baselineutil.go +++ b/internal/fourslash/baselineutil.go @@ -72,11 +72,11 @@ func getBaselineFileName(t *testing.T, command baselineCommand) string { func getBaselineExtension(command baselineCommand) string { switch command { - case quickInfoCmd, signatureHelpCmd, smartSelectionCmd, inlayHintsCmd, nonSuggestionDiagnosticsCmd: + case quickInfoCmd, signatureHelpCmd, smartSelectionCmd, inlayHintsCmd, nonSuggestionDiagnosticsCmd, documentSymbolsCmd: return "baseline" case callHierarchyCmd: return "callHierarchy.txt" - case autoImportsCmd, documentSymbolsCmd: + case autoImportsCmd: return "baseline.md" default: return "baseline.jsonc" diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index a14b81c7f4..43b388cc55 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -15,7 +15,6 @@ import ( "unicode/utf8" "github.com/go-json-experiment/json" - "github.com/go-json-experiment/json/jsontext" "github.com/google/go-cmp/cmp" "github.com/microsoft/typescript-go/internal/bundled" "github.com/microsoft/typescript-go/internal/collections" @@ -3675,10 +3674,6 @@ func verifyIncludesSymbols( } } -func marshalSymbolKind(v lsproto.SymbolKind) ([]byte, error) { - return []byte(`"` + v.String() + `"`), nil -} - func (f *FourslashTest) VerifyBaselineDocumentSymbol(t *testing.T) { params := &lsproto.DocumentSymbolParams{ TextDocument: lsproto.TextDocumentIdentifier{ @@ -3686,21 +3681,54 @@ func (f *FourslashTest) VerifyBaselineDocumentSymbol(t *testing.T) { }, } result := sendRequest(t, f, lsproto.TextDocumentDocumentSymbolInfo, params) - var content strings.Builder - ext := strings.TrimPrefix(tspath.GetAnyExtensionFromPath(f.activeFilename, nil, true), ".") - lang := core.IfElse(ext == "mts" || ext == "cts", "ts", ext) - content.WriteString(codeFence(lang, "// @FileName: "+f.activeFilename+"\n"+f.scriptInfos[f.activeFilename].content)) - content.WriteString("\n\n# Symbols\n\n") - content.WriteString("```json\n") - err := json.MarshalWrite( - &content, - result.DocumentSymbols, - jsontext.Multiline(true), - json.WithMarshalers(json.MarshalFunc(marshalSymbolKind)), + uri := lsconv.FileNameToDocumentURI(f.activeFilename) + spansToSymbol := make(map[documentSpan]*lsproto.DocumentSymbol) + if result.DocumentSymbols != nil { + for _, symbol := range *result.DocumentSymbols { + collectDocumentSymbolSpans(uri, symbol, spansToSymbol) + } + } + f.addResultToBaseline( + t, + documentSymbolsCmd, + f.getBaselineForSpansWithFileContents(slices.Collect(maps.Keys(spansToSymbol)), baselineFourslashLocationsOptions{ + getLocationData: func(span documentSpan) string { + symbol := spansToSymbol[span] + return fmt.Sprintf("{| name: %s, kind: %s |}", symbol.Name, symbol.Kind.String()) + }, + }), ) - if err != nil { - t.Fatalf("Failed to marshal document symbols for baseline: %v", err) + + var detailsBuilder strings.Builder + if result.DocumentSymbols != nil { + writeDocumentSymbolDetails(*result.DocumentSymbols, 0, &detailsBuilder) + } + f.writeToBaseline(documentSymbolsCmd, "\n\n// === Details ===\n"+detailsBuilder.String()) +} + +func writeDocumentSymbolDetails(symbols []*lsproto.DocumentSymbol, indent int, builder *strings.Builder) { + for _, symbol := range symbols { + fmt.Fprintf(builder, "%s(%s) %s\n", strings.Repeat(" ", indent), symbol.Kind.String(), symbol.Name) + if symbol.Children != nil { + writeDocumentSymbolDetails(*symbol.Children, indent+1, builder) + } + } +} + +func collectDocumentSymbolSpans( + uri lsproto.DocumentUri, + symbol *lsproto.DocumentSymbol, + spansToSymbol map[documentSpan]*lsproto.DocumentSymbol, +) { + span := documentSpan{ + uri: uri, + textSpan: symbol.SelectionRange, + contextSpan: &symbol.Range, + } + spansToSymbol[span] = symbol + if symbol.Children != nil { + for _, child := range *symbol.Children { + collectDocumentSymbolSpans(uri, child, spansToSymbol) + } } - content.WriteString("\n```") - f.addResultToBaseline(t, documentSymbolsCmd, content.String()) } diff --git a/internal/fourslash/tests/documentSymbolPrivateName_test.go b/internal/fourslash/tests/documentSymbolPrivateName_test.go index b7a9cdd09b..c77e828a6f 100644 --- a/internal/fourslash/tests/documentSymbolPrivateName_test.go +++ b/internal/fourslash/tests/documentSymbolPrivateName_test.go @@ -13,18 +13,23 @@ func TestDocumentSymbolPrivateName(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @Filename: first.ts class A { - #foo: () => { + #foo() { class B { - #bar: () => { + #bar() { function baz () { } } } } } + +class B { + constructor(private prop: string) {} +} + // @Filename: second.ts class Foo { - #privateMethod() {} + #privateProp: string; } ` f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) diff --git a/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline b/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline new file mode 100644 index 0000000000..bed5091507 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline @@ -0,0 +1,41 @@ +// === Document Symbols === +// === /first.ts === +// <|class [|{| name: A, kind: Class |}A|] { +// <|[|{| name: #foo, kind: Method |}#foo|]() { +// <|class [|{| name: B, kind: Class |}B|] { +// <|[|{| name: #bar, kind: Method |}#bar|]() { +// <|function [|{| name: baz, kind: Function |}baz|] () { +// }|> +// }|> +// }|> +// }|> +// }|> +// +// <|class [|{| name: B, kind: Class |}B|] { +// <|[|{| name: constructor, kind: Constructor |}|]constructor(<|private [|{| name: prop, kind: Property |}prop|]: string|>) {}|> +// }|> +// + +// === Details === +(Class) A + (Method) #foo + (Class) B + (Method) #bar + (Function) baz +(Class) B + (Constructor) constructor + (Property) prop + + + + +// === Document Symbols === +// === /second.ts === +// <|class [|{| name: Foo, kind: Class |}Foo|] { +// <|[|{| name: #privateProp, kind: Property |}#privateProp|]: string;|> +// }|> +// + +// === Details === +(Class) Foo + (Property) #privateProp diff --git a/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline.md deleted file mode 100644 index 5948d22531..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolPrivateName.baseline.md +++ /dev/null @@ -1,217 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /first.ts -class A { - #foo: () => { - class B { - #bar: () => { - function baz () { - } - } - } - } -} -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "#foo", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 6 - } - }, - "children": [] - } - ] - }, - { - "name": "B", - "kind": "Class", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 3, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 10 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "children": [ - { - "name": "#bar", - "kind": "Property", - "range": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 10 - } - }, - "children": [] - } - ] - }, - { - "name": "baz", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 9 - }, - "end": { - "line": 5, - "character": 10 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 18 - }, - "end": { - "line": 4, - "character": 21 - } - }, - "children": [] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /second.ts -class Foo { - #privateMethod() {} -} - -``` - -# Symbols - -```json -[ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "children": [ - { - "name": "#privateMethod", - "kind": "Method", - "range": { - "start": { - "line": 1, - "character": 1 - }, - "end": { - "line": 1, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 1 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline b/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline new file mode 100644 index 0000000000..985d1229c7 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline @@ -0,0 +1,11 @@ +// === Document Symbols === +// === /getNavigationBarItems.ts === +// <|class [|{| name: C, kind: Class |}C|] { +// <|[|{| name: foo, kind: Property |}foo|];|> +// <|[|{| name: "bar", kind: Property |}["bar"]|]: string;|> +// }|> + +// === Details === +(Class) C + (Property) foo + (Property) "bar" diff --git a/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline.md deleted file mode 100644 index 4769b06389..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/getNavigationBarItems.baseline.md +++ /dev/null @@ -1,91 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /getNavigationBarItems.ts -class C { - foo; - ["bar"]: string; -} -``` - -# Symbols - -```json -[ - { - "name": "C", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "foo", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "children": [] - }, - { - "name": "\"bar\"", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline b/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline new file mode 100644 index 0000000000..9d9df97ac3 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline @@ -0,0 +1,13 @@ +// === Document Symbols === +// === /jsDocTypedef_form2.js === +// /** <|@typedef {(string | number)} [|{| name: NumberLike, kind: Class |}NumberLike|]|> */ +// /** @typedef {(string | number | string[])} */ +// var <|[|{| name: NumberLike2, kind: Variable |}NumberLike2|]|>; +// +// /** @type {NumberLike} */ +// var <|[|{| name: numberLike, kind: Variable |}numberLike|]|>; + +// === Details === +(Class) NumberLike +(Variable) NumberLike2 +(Variable) numberLike diff --git a/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline.md deleted file mode 100644 index 1b55d6324d..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/jsdocTypedefTagNavigateTo.baseline.md +++ /dev/null @@ -1,92 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /jsDocTypedef_form2.js -/** @typedef {(string | number)} NumberLike */ -/** @typedef {(string | number | string[])} */ -var NumberLike2; - -/** @type {NumberLike} */ -var numberLike; -``` - -# Symbols - -```json -[ - { - "name": "NumberLike", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 43 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 33 - }, - "end": { - "line": 0, - "character": 43 - } - }, - "children": [] - }, - { - "name": "NumberLike2", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "children": [] - }, - { - "name": "numberLike", - "kind": "Variable", - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 14 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline new file mode 100644 index 0000000000..2fefdd8428 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline @@ -0,0 +1,63 @@ +// === Document Symbols === +// === /navbar01.ts === +// // Interface +// <|interface [|{| name: IPoint, kind: Interface |}IPoint|] { +// <|[|{| name: getDist, kind: Method |}getDist|](): number;|> +// <|[|{| name: new(), kind: Constructor |}|]new(): IPoint;|> +// <|[|{| name: (), kind: Method |}|](): any;|> +// <|[|{| name: [], kind: Property |}|][x:string]: number;|> +// <|[|{| name: prop, kind: Property |}prop|]: string;|> +// }|> +// +// /// Module +// <|module [|{| name: Shapes, kind: Namespace |}Shapes|] { +// // Class +// <|export class [|{| name: Point, kind: Class |}Point|] implements IPoint { +// <|[|{| name: constructor, kind: Constructor |}|]constructor (<|public [|{| name: x, kind: Property |}x|]: number|>, <|public [|{| name: y, kind: Property |}y|]: number|>) { }|> +// +// // Instance member +// <|[|{| name: getDist, kind: Method |}getDist|]() { return Math.sqrt(this.x * this.x + this.y * this.y); }|> +// +// // Getter +// <|get [|{| name: value, kind: Property |}value|](): number { return 0; }|> +// +// // Setter +// <|set [|{| name: value, kind: Property |}value|](newValue: number) { return; }|> +// +// // Static member +// <|static [|{| name: origin, kind: Property |}origin|] = new Point(0, 0);|> +// +// // Static method +// <|private static [|{| name: getOrigin, kind: Method |}getOrigin|]() { return Point.origin;}|> +// }|> +// +// <|enum [|{| name: Values, kind: Enum |}Values|] { <|[|{| name: value1, kind: EnumMember |}value1|]|>, <|[|{| name: value2, kind: EnumMember |}value2|]|>, <|[|{| name: value3, kind: EnumMember |}value3|]|> }|> +// }|> +// +// // Local variables +// var <|[|{| name: p, kind: Variable |}p|]: IPoint = new Shapes.Point(3, 4)|>; +// var <|[|{| name: dist, kind: Variable |}dist|] = p.getDist()|>; + +// === Details === +(Interface) IPoint + (Method) getDist + (Constructor) new() + (Method) () + (Property) [] + (Property) prop +(Namespace) Shapes + (Class) Point + (Constructor) constructor + (Property) x + (Property) y + (Method) getDist + (Property) value + (Property) value + (Property) origin + (Method) getOrigin + (Enum) Values + (EnumMember) value1 + (EnumMember) value2 + (EnumMember) value3 +(Variable) p +(Variable) dist diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md deleted file mode 100644 index 81dcc80dc6..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navbar01.baseline.md +++ /dev/null @@ -1,602 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navbar01.ts -// Interface -interface IPoint { - getDist(): number; - new(): IPoint; - (): any; - [x:string]: number; - prop: string; -} - -/// Module -module Shapes { - // Class - export class Point implements IPoint { - constructor (public x: number, public y: number) { } - - // Instance member - getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } - - // Getter - get value(): number { return 0; } - - // Setter - set value(newValue: number) { return; } - - // Static member - static origin = new Point(0, 0); - - // Static method - private static getOrigin() { return Point.origin;} - } - - enum Values { value1, value2, value3 } -} - -// Local variables -var p: IPoint = new Shapes.Point(3, 4); -var dist = p.getDist(); -``` - -# Symbols - -```json -[ - { - "name": "IPoint", - "kind": "Interface", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 7, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 10 - }, - "end": { - "line": 1, - "character": 16 - } - }, - "children": [ - { - "name": "getDist", - "kind": "Method", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "children": [] - }, - { - "name": "new()", - "kind": "Constructor", - "range": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 18 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 4 - } - }, - "children": [] - }, - { - "name": "()", - "kind": "Method", - "range": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 4 - } - }, - "children": [] - }, - { - "name": "[]", - "kind": "Property", - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 4 - } - }, - "children": [] - }, - { - "name": "prop", - "kind": "Property", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 8 - } - }, - "children": [] - } - ] - }, - { - "name": "Shapes", - "kind": "Namespace", - "range": { - "start": { - "line": 10, - "character": 0 - }, - "end": { - "line": 32, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 7 - }, - "end": { - "line": 10, - "character": 13 - } - }, - "children": [ - { - "name": "Point", - "kind": "Class", - "range": { - "start": { - "line": 12, - "character": 4 - }, - "end": { - "line": 29, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 17 - }, - "end": { - "line": 12, - "character": 22 - } - }, - "children": [ - { - "name": "constructor", - "kind": "Constructor", - "range": { - "start": { - "line": 13, - "character": 8 - }, - "end": { - "line": 13, - "character": 60 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 8 - }, - "end": { - "line": 13, - "character": 8 - } - }, - "children": [] - }, - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 13, - "character": 21 - }, - "end": { - "line": 13, - "character": 37 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 28 - }, - "end": { - "line": 13, - "character": 29 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Property", - "range": { - "start": { - "line": 13, - "character": 39 - }, - "end": { - "line": 13, - "character": 55 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 46 - }, - "end": { - "line": 13, - "character": 47 - } - }, - "children": [] - }, - { - "name": "getDist", - "kind": "Method", - "range": { - "start": { - "line": 16, - "character": 8 - }, - "end": { - "line": 16, - "character": 74 - } - }, - "selectionRange": { - "start": { - "line": 16, - "character": 8 - }, - "end": { - "line": 16, - "character": 15 - } - }, - "children": [] - }, - { - "name": "value", - "kind": "Property", - "range": { - "start": { - "line": 19, - "character": 8 - }, - "end": { - "line": 19, - "character": 41 - } - }, - "selectionRange": { - "start": { - "line": 19, - "character": 12 - }, - "end": { - "line": 19, - "character": 17 - } - }, - "children": [] - }, - { - "name": "value", - "kind": "Property", - "range": { - "start": { - "line": 22, - "character": 8 - }, - "end": { - "line": 22, - "character": 47 - } - }, - "selectionRange": { - "start": { - "line": 22, - "character": 12 - }, - "end": { - "line": 22, - "character": 17 - } - }, - "children": [] - }, - { - "name": "origin", - "kind": "Property", - "range": { - "start": { - "line": 25, - "character": 8 - }, - "end": { - "line": 25, - "character": 40 - } - }, - "selectionRange": { - "start": { - "line": 25, - "character": 15 - }, - "end": { - "line": 25, - "character": 21 - } - }, - "children": [] - }, - { - "name": "getOrigin", - "kind": "Method", - "range": { - "start": { - "line": 28, - "character": 8 - }, - "end": { - "line": 28, - "character": 58 - } - }, - "selectionRange": { - "start": { - "line": 28, - "character": 23 - }, - "end": { - "line": 28, - "character": 32 - } - }, - "children": [] - } - ] - }, - { - "name": "Values", - "kind": "Enum", - "range": { - "start": { - "line": 31, - "character": 4 - }, - "end": { - "line": 31, - "character": 42 - } - }, - "selectionRange": { - "start": { - "line": 31, - "character": 9 - }, - "end": { - "line": 31, - "character": 15 - } - }, - "children": [ - { - "name": "value1", - "kind": "EnumMember", - "range": { - "start": { - "line": 31, - "character": 18 - }, - "end": { - "line": 31, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 31, - "character": 18 - }, - "end": { - "line": 31, - "character": 24 - } - }, - "children": [] - }, - { - "name": "value2", - "kind": "EnumMember", - "range": { - "start": { - "line": 31, - "character": 26 - }, - "end": { - "line": 31, - "character": 32 - } - }, - "selectionRange": { - "start": { - "line": 31, - "character": 26 - }, - "end": { - "line": 31, - "character": 32 - } - }, - "children": [] - }, - { - "name": "value3", - "kind": "EnumMember", - "range": { - "start": { - "line": 31, - "character": 34 - }, - "end": { - "line": 31, - "character": 40 - } - }, - "selectionRange": { - "start": { - "line": 31, - "character": 34 - }, - "end": { - "line": 31, - "character": 40 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "p", - "kind": "Variable", - "range": { - "start": { - "line": 35, - "character": 4 - }, - "end": { - "line": 35, - "character": 38 - } - }, - "selectionRange": { - "start": { - "line": 35, - "character": 4 - }, - "end": { - "line": 35, - "character": 5 - } - }, - "children": [] - }, - { - "name": "dist", - "kind": "Variable", - "range": { - "start": { - "line": 36, - "character": 4 - }, - "end": { - "line": 36, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 36, - "character": 4 - }, - "end": { - "line": 36, - "character": 8 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline new file mode 100644 index 0000000000..7e6f2febaf --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline @@ -0,0 +1,4 @@ +// === Document Symbols === + + +// === Details === diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline.md deleted file mode 100644 index adab2eb701..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navbarNestedCommonJsExports.baseline.md +++ /dev/null @@ -1,11 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /a.js -exports.a = exports.b = exports.c = 0; -``` - -# Symbols - -```json -[] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline new file mode 100644 index 0000000000..b46f520493 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline @@ -0,0 +1,6 @@ +// === Document Symbols === +// === /navbar_const.ts === +// const <|[|{| name: c, kind: Variable |}c|] = 0|>; + +// === Details === +(Variable) c diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline.md deleted file mode 100644 index a997006dc9..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navbar_const.baseline.md +++ /dev/null @@ -1,37 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navbar_const.ts -const c = 0; -``` - -# Symbols - -```json -[ - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline new file mode 100644 index 0000000000..929a495325 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline @@ -0,0 +1,43 @@ +// === Document Symbols === +// === /navbar_contains_no_duplicates.ts === +// <|declare module [|{| name: Windows, kind: Namespace |}Windows|] { +// <|export module [|{| name: Foundation, kind: Namespace |}Foundation|] { +// export var <|[|{| name: A, kind: Variable |}A|]|>; +// <|export class [|{| name: Test, kind: Class |}Test|] { +// <|public [|{| name: wow, kind: Method |}wow|]();|> +// }|> +// }|> +// }|> +// +// declare module Windows { +// export module Foundation { +// export var <|[|{| name: B, kind: Variable |}B|]|>; +// <|export module [|{| name: Test, kind: Namespace |}Test|] { +// <|export function [|{| name: Boom, kind: Function |}Boom|](): number;|> +// }|> +// } +// } +// +// <|class [|{| name: ABC, kind: Class |}ABC|] { +// <|public [|{| name: foo, kind: Method |}foo|]() { +// return 3; +// }|> +// }|> +// +// <|module [|{| name: ABC, kind: Namespace |}ABC|] { +// export var <|[|{| name: x, kind: Variable |}x|] = 3|>; +// }|> + +// === Details === +(Namespace) Windows + (Namespace) Foundation + (Variable) A + (Class) Test + (Method) wow + (Variable) B + (Namespace) Test + (Function) Boom +(Class) ABC + (Method) foo +(Namespace) ABC + (Variable) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline.md deleted file mode 100644 index 69ad17282f..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navbar_contains_no_duplicates.baseline.md +++ /dev/null @@ -1,344 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navbar_contains_no_duplicates.ts -declare module Windows { - export module Foundation { - export var A; - export class Test { - public wow(); - } - } -} - -declare module Windows { - export module Foundation { - export var B; - export module Test { - export function Boom(): number; - } - } -} - -class ABC { - public foo() { - return 3; - } -} - -module ABC { - export var x = 3; -} -``` - -# Symbols - -```json -[ - { - "name": "Windows", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 7, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 15 - }, - "end": { - "line": 0, - "character": 22 - } - }, - "children": [ - { - "name": "Foundation", - "kind": "Namespace", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 6, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 18 - }, - "end": { - "line": 1, - "character": 28 - } - }, - "children": [ - { - "name": "A", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 19 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 19 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "children": [] - }, - { - "name": "Test", - "kind": "Class", - "range": { - "start": { - "line": 3, - "character": 8 - }, - "end": { - "line": 5, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 21 - }, - "end": { - "line": 3, - "character": 25 - } - }, - "children": [ - { - "name": "wow", - "kind": "Method", - "range": { - "start": { - "line": 4, - "character": 12 - }, - "end": { - "line": 4, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 19 - }, - "end": { - "line": 4, - "character": 22 - } - }, - "children": [] - } - ] - }, - { - "name": "B", - "kind": "Variable", - "range": { - "start": { - "line": 11, - "character": 19 - }, - "end": { - "line": 11, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 11, - "character": 19 - }, - "end": { - "line": 11, - "character": 20 - } - }, - "children": [] - }, - { - "name": "Test", - "kind": "Namespace", - "range": { - "start": { - "line": 12, - "character": 8 - }, - "end": { - "line": 14, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 22 - }, - "end": { - "line": 12, - "character": 26 - } - }, - "children": [ - { - "name": "Boom", - "kind": "Function", - "range": { - "start": { - "line": 13, - "character": 12 - }, - "end": { - "line": 13, - "character": 43 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 28 - }, - "end": { - "line": 13, - "character": 32 - } - }, - "children": [] - } - ] - } - ] - } - ] - }, - { - "name": "ABC", - "kind": "Class", - "range": { - "start": { - "line": 18, - "character": 0 - }, - "end": { - "line": 22, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 18, - "character": 6 - }, - "end": { - "line": 18, - "character": 9 - } - }, - "children": [ - { - "name": "foo", - "kind": "Method", - "range": { - "start": { - "line": 19, - "character": 4 - }, - "end": { - "line": 21, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 19, - "character": 11 - }, - "end": { - "line": 19, - "character": 14 - } - }, - "children": [] - } - ] - }, - { - "name": "ABC", - "kind": "Namespace", - "range": { - "start": { - "line": 24, - "character": 0 - }, - "end": { - "line": 26, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 24, - "character": 7 - }, - "end": { - "line": 24, - "character": 10 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 25, - "character": 15 - }, - "end": { - "line": 25, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 25, - "character": 15 - }, - "end": { - "line": 25, - "character": 16 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline new file mode 100644 index 0000000000..1b1e3cdc50 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline @@ -0,0 +1,36 @@ +// === Document Symbols === +// === /a.ts === +// <|[|{| name: default, kind: Class |}|]export default class { }|> + +// === Details === +(Class) default + + + + +// === Document Symbols === +// === /b.ts === +// <|export default class [|{| name: C, kind: Class |}C|] { }|> + +// === Details === +(Class) C + + + + +// === Document Symbols === +// === /c.ts === +// <|[|{| name: default, kind: Function |}|]export default function { }|> + +// === Details === +(Function) default + + + + +// === Document Symbols === +// === /d.ts === +// <|export default function [|{| name: Func, kind: Function |}Func|] { }|> + +// === Details === +(Function) Func diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline.md deleted file mode 100644 index ae0210e9ac..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navbar_exportDefault.baseline.md +++ /dev/null @@ -1,157 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /a.ts -export default class { } -``` - -# Symbols - -```json -[ - { - "name": "default", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "children": [] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /b.ts -export default class C { } -``` - -# Symbols - -```json -[ - { - "name": "C", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 26 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 21 - }, - "end": { - "line": 0, - "character": 22 - } - }, - "children": [] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /c.ts -export default function { } -``` - -# Symbols - -```json -[ - { - "name": "default", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 27 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "children": [] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /d.ts -export default function Func { } -``` - -# Symbols - -```json -[ - { - "name": "Func", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 32 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 24 - }, - "end": { - "line": 0, - "character": 28 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline new file mode 100644 index 0000000000..3e54bfc24d --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline @@ -0,0 +1,6 @@ +// === Document Symbols === +// === /navbar_let.ts === +// let <|[|{| name: c, kind: Variable |}c|] = 0|>; + +// === Details === +(Variable) c diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline.md deleted file mode 100644 index d2ce15ba4d..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navbar_let.baseline.md +++ /dev/null @@ -1,37 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navbar_let.ts -let c = 0; -``` - -# Symbols - -```json -[ - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline new file mode 100644 index 0000000000..b5edd20291 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline @@ -0,0 +1,48 @@ +// === Document Symbols === +// === /navigationBarAnonymousClassAndFunctionExpressions.ts === +// global.cls = <|[|{| name: cls, kind: Class |}|]class { }|>; +// (<|[|{| name: , kind: Function |}|]function() { +// const <|[|{| name: x, kind: Variable |}x|] = () => { +// // Presence of inner function causes x to be a top-level function. +// <|function [|{| name: xx, kind: Function |}xx|]() {}|> +// }|>; +// const <|[|{| name: y, kind: Variable |}y|] = { +// // This is not a top-level function (contains nothing, but shows up in childItems of its parent.) +// <|[|{| name: foo, kind: Property |}foo|]: function() {}|> +// }|>; +// (<|function [|{| name: nest, kind: Function |}nest|]() { +// <|function [|{| name: moreNest, kind: Function |}moreNest|]() {}|> +// }|>)(); +// }|>)(); +// (<|[|{| name: , kind: Function |}|]function() { // Different anonymous functions are not merged +// // These will only show up as childItems. +// <|function [|{| name: z, kind: Function |}z|]() {}|> +// console.log(<|[|{| name: console.log() callback, kind: Function |}|]function() {}|>) +// describe("this", 'function', `is a function`, `with template literal ${"a"}`, <|[|{| name: describe() callback, kind: Function |}|]() => {}|>); +// [].map(<|[|{| name: map() callback, kind: Function |}|]() => {}|>); +// }|>) +// (<|function [|{| name: classes, kind: Function |}classes|]() { +// // Classes show up in top-level regardless of whether they have names or inner declarations. +// const <|[|{| name: cls2, kind: Variable |}cls2|] = class { }|>; +// console.log(<|class [|{| name: cls3, kind: Class |}cls3|] {}|>); +// (<|[|{| name: , kind: Class |}|]class { }|>); +// }|>) + +// === Details === +(Class) cls +(Function) + (Variable) x + (Function) xx + (Variable) y + (Property) foo + (Function) nest + (Function) moreNest +(Function) + (Function) z + (Function) console.log() callback + (Function) describe() callback + (Function) map() callback +(Function) classes + (Variable) cls2 + (Class) cls3 + (Class) diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline.md deleted file mode 100644 index 2216078705..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions.baseline.md +++ /dev/null @@ -1,469 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarAnonymousClassAndFunctionExpressions.ts -global.cls = class { }; -(function() { - const x = () => { - // Presence of inner function causes x to be a top-level function. - function xx() {} - }; - const y = { - // This is not a top-level function (contains nothing, but shows up in childItems of its parent.) - foo: function() {} - }; - (function nest() { - function moreNest() {} - })(); -})(); -(function() { // Different anonymous functions are not merged - // These will only show up as childItems. - function z() {} - console.log(function() {}) - describe("this", 'function', `is a function`, `with template literal ${"a"}`, () => {}); - [].map(() => {}); -}) -(function classes() { - // Classes show up in top-level regardless of whether they have names or inner declarations. - const cls2 = class { }; - console.log(class cls3 {}); - (class { }); -}) -``` - -# Symbols - -```json -[ - { - "name": "cls", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 13 - }, - "end": { - "line": 0, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 13 - }, - "end": { - "line": 0, - "character": 13 - } - }, - "children": [] - }, - { - "name": "", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 1 - }, - "end": { - "line": 13, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 1 - }, - "end": { - "line": 1, - "character": 1 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 10 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 10 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "children": [ - { - "name": "xx", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 8 - }, - "end": { - "line": 4, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 17 - }, - "end": { - "line": 4, - "character": 19 - } - }, - "children": [] - } - ] - }, - { - "name": "y", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 10 - }, - "end": { - "line": 9, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 10 - }, - "end": { - "line": 6, - "character": 11 - } - }, - "children": [ - { - "name": "foo", - "kind": "Property", - "range": { - "start": { - "line": 8, - "character": 8 - }, - "end": { - "line": 8, - "character": 26 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 8 - }, - "end": { - "line": 8, - "character": 11 - } - }, - "children": [] - } - ] - }, - { - "name": "nest", - "kind": "Function", - "range": { - "start": { - "line": 10, - "character": 5 - }, - "end": { - "line": 12, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 14 - }, - "end": { - "line": 10, - "character": 18 - } - }, - "children": [ - { - "name": "moreNest", - "kind": "Function", - "range": { - "start": { - "line": 11, - "character": 8 - }, - "end": { - "line": 11, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 11, - "character": 17 - }, - "end": { - "line": 11, - "character": 25 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "", - "kind": "Function", - "range": { - "start": { - "line": 14, - "character": 1 - }, - "end": { - "line": 20, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 1 - }, - "end": { - "line": 14, - "character": 1 - } - }, - "children": [ - { - "name": "z", - "kind": "Function", - "range": { - "start": { - "line": 16, - "character": 4 - }, - "end": { - "line": 16, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 16, - "character": 13 - }, - "end": { - "line": 16, - "character": 14 - } - }, - "children": [] - }, - { - "name": "console.log() callback", - "kind": "Function", - "range": { - "start": { - "line": 17, - "character": 16 - }, - "end": { - "line": 17, - "character": 29 - } - }, - "selectionRange": { - "start": { - "line": 17, - "character": 16 - }, - "end": { - "line": 17, - "character": 16 - } - }, - "children": [] - }, - { - "name": "describe() callback", - "kind": "Function", - "range": { - "start": { - "line": 18, - "character": 82 - }, - "end": { - "line": 18, - "character": 90 - } - }, - "selectionRange": { - "start": { - "line": 18, - "character": 82 - }, - "end": { - "line": 18, - "character": 82 - } - }, - "children": [] - }, - { - "name": "map() callback", - "kind": "Function", - "range": { - "start": { - "line": 19, - "character": 11 - }, - "end": { - "line": 19, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 19, - "character": 11 - }, - "end": { - "line": 19, - "character": 11 - } - }, - "children": [] - } - ] - }, - { - "name": "classes", - "kind": "Function", - "range": { - "start": { - "line": 21, - "character": 1 - }, - "end": { - "line": 26, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 21, - "character": 10 - }, - "end": { - "line": 21, - "character": 17 - } - }, - "children": [ - { - "name": "cls2", - "kind": "Variable", - "range": { - "start": { - "line": 23, - "character": 10 - }, - "end": { - "line": 23, - "character": 26 - } - }, - "selectionRange": { - "start": { - "line": 23, - "character": 10 - }, - "end": { - "line": 23, - "character": 14 - } - }, - "children": [] - }, - { - "name": "cls3", - "kind": "Class", - "range": { - "start": { - "line": 24, - "character": 16 - }, - "end": { - "line": 24, - "character": 29 - } - }, - "selectionRange": { - "start": { - "line": 24, - "character": 22 - }, - "end": { - "line": 24, - "character": 26 - } - }, - "children": [] - }, - { - "name": "", - "kind": "Class", - "range": { - "start": { - "line": 25, - "character": 5 - }, - "end": { - "line": 25, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 25, - "character": 5 - }, - "end": { - "line": 25, - "character": 5 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline new file mode 100644 index 0000000000..1bdac1f0cf --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /navigationBarAnonymousClassAndFunctionExpressions2.ts === +// console.log(console.log(<|class [|{| name: Y, kind: Class |}Y|] {}|>, <|class [|{| name: X, kind: Class |}X|] {}|>), console.log(<|class [|{| name: B, kind: Class |}B|] {}|>, <|class [|{| name: A, kind: Class |}A|] {}|>)); +// console.log(<|class [|{| name: Cls, kind: Class |}Cls|] { <|[|{| name: meth, kind: Method |}meth|]() {}|> }|>); + +// === Details === +(Class) Y +(Class) X +(Class) B +(Class) A +(Class) Cls + (Method) meth diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline.md deleted file mode 100644 index fc1a1c867f..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions2.baseline.md +++ /dev/null @@ -1,164 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarAnonymousClassAndFunctionExpressions2.ts -console.log(console.log(class Y {}, class X {}), console.log(class B {}, class A {})); -console.log(class Cls { meth() {} }); -``` - -# Symbols - -```json -[ - { - "name": "Y", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 24 - }, - "end": { - "line": 0, - "character": 34 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 30 - }, - "end": { - "line": 0, - "character": 31 - } - }, - "children": [] - }, - { - "name": "X", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 36 - }, - "end": { - "line": 0, - "character": 46 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 42 - }, - "end": { - "line": 0, - "character": 43 - } - }, - "children": [] - }, - { - "name": "B", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 61 - }, - "end": { - "line": 0, - "character": 71 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 67 - }, - "end": { - "line": 0, - "character": 68 - } - }, - "children": [] - }, - { - "name": "A", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 73 - }, - "end": { - "line": 0, - "character": 83 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 79 - }, - "end": { - "line": 0, - "character": 80 - } - }, - "children": [] - }, - { - "name": "Cls", - "kind": "Class", - "range": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 35 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 18 - }, - "end": { - "line": 1, - "character": 21 - } - }, - "children": [ - { - "name": "meth", - "kind": "Method", - "range": { - "start": { - "line": 1, - "character": 24 - }, - "end": { - "line": 1, - "character": 33 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 24 - }, - "end": { - "line": 1, - "character": 28 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline new file mode 100644 index 0000000000..9c4d60e29c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline @@ -0,0 +1,19 @@ +// === Document Symbols === +// === /navigationBarAnonymousClassAndFunctionExpressions3.ts === +// describe('foo', <|[|{| name: describe() callback, kind: Function |}|]() => { +// test(`a ${1} b ${2}`, <|[|{| name: test() callback, kind: Function |}|]() => {}|>) +// }|>) +// +// const <|[|{| name: a, kind: Variable |}a|] = 1|>; +// const <|[|{| name: b, kind: Variable |}b|] = 2|>; +// describe('foo', <|[|{| name: describe() callback, kind: Function |}|]() => { +// test(`a ${a} b {b}`, <|[|{| name: test() callback, kind: Function |}|]() => {}|>) +// }|>) + +// === Details === +(Function) describe() callback + (Function) test() callback +(Variable) a +(Variable) b +(Function) describe() callback + (Function) test() callback diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline.md deleted file mode 100644 index e8819be447..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAnonymousClassAndFunctionExpressions3.baseline.md +++ /dev/null @@ -1,172 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarAnonymousClassAndFunctionExpressions3.ts -describe('foo', () => { - test(`a ${1} b ${2}`, () => {}) -}) - -const a = 1; -const b = 2; -describe('foo', () => { - test(`a ${a} b {b}`, () => {}) -}) -``` - -# Symbols - -```json -[ - { - "name": "describe() callback", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 16 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 16 - }, - "end": { - "line": 0, - "character": 16 - } - }, - "children": [ - { - "name": "test() callback", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 26 - }, - "end": { - "line": 1, - "character": 34 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 26 - }, - "end": { - "line": 1, - "character": 26 - } - }, - "children": [] - } - ] - }, - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 7 - } - }, - "children": [] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 5, - "character": 6 - }, - "end": { - "line": 5, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 6 - }, - "end": { - "line": 5, - "character": 7 - } - }, - "children": [] - }, - { - "name": "describe() callback", - "kind": "Function", - "range": { - "start": { - "line": 6, - "character": 16 - }, - "end": { - "line": 8, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 16 - }, - "end": { - "line": 6, - "character": 16 - } - }, - "children": [ - { - "name": "test() callback", - "kind": "Function", - "range": { - "start": { - "line": 7, - "character": 25 - }, - "end": { - "line": 7, - "character": 33 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 25 - }, - "end": { - "line": 7, - "character": 25 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline new file mode 100644 index 0000000000..a6beab67ea --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline @@ -0,0 +1,14 @@ +// === Document Symbols === +// === /navigationBarAssignmentTypes.ts === +// 'use strict' +// const <|[|{| name: a, kind: Variable |}a|] = { +// <|...[|{| name: b, kind: Property |}b|]|>, +// <|[|{| name: c, kind: Property |}c|]|>, +// <|[|{| name: d, kind: Property |}d|]: 0|> +// }|>; + +// === Details === +(Variable) a + (Property) b + (Property) c + (Property) d diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline.md deleted file mode 100644 index 1550776c45..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarAssignmentTypes.baseline.md +++ /dev/null @@ -1,118 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarAssignmentTypes.ts -'use strict' -const a = { - ...b, - c, - d: 0 -}; -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 5, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "children": [ - { - "name": "b", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 7 - }, - "end": { - "line": 2, - "character": 8 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Property", - "range": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "children": [] - }, - { - "name": "d", - "kind": "Property", - "range": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 5 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline new file mode 100644 index 0000000000..2ccb58c610 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline @@ -0,0 +1,11 @@ +// === Document Symbols === +// === /navigationBarClassStaticBlock.ts === +// <|class [|{| name: C, kind: Class |}C|] { +// static { +// let <|[|{| name: x, kind: Variable |}x|]|>; +// } +// }|> + +// === Details === +(Class) C + (Variable) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline.md deleted file mode 100644 index 66ec6a3a60..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarClassStaticBlock.baseline.md +++ /dev/null @@ -1,67 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarClassStaticBlock.ts -class C { - static { - let x; - } -} -``` - -# Symbols - -```json -[ - { - "name": "C", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 9 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline new file mode 100644 index 0000000000..78bba5bfc1 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline @@ -0,0 +1,13 @@ +// === Document Symbols === +// === /navigationBarComputedPropertyName.ts === +// <|function [|{| name: F, kind: Function |}F|](key, value) { +// return { +// <|[|{| name: [key], kind: Property |}[key]|]: value|>, +// <|[|{| name: "prop", kind: Property |}"prop"|]: true|> +// } +// }|> + +// === Details === +(Function) F + (Property) [key] + (Property) "prop" diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline.md deleted file mode 100644 index 71f88acf00..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarComputedPropertyName.baseline.md +++ /dev/null @@ -1,93 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarComputedPropertyName.ts -function F(key, value) { - return { - [key]: value, - "prop": true - } -} -``` - -# Symbols - -```json -[ - { - "name": "F", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 5, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [ - { - "name": "[key]", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 13 - } - }, - "children": [] - }, - { - "name": "\"prop\"", - "kind": "Property", - "range": { - "start": { - "line": 3, - "character": 8 - }, - "end": { - "line": 3, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 8 - }, - "end": { - "line": 3, - "character": 14 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline new file mode 100644 index 0000000000..25cc805303 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline @@ -0,0 +1,22 @@ +// === Document Symbols === +// === /navigationBarFunctionIndirectlyInVariableDeclaration.ts === +// var <|[|{| name: a, kind: Variable |}a|] = { +// <|[|{| name: propA, kind: Property |}propA|]: function() { +// var <|[|{| name: c, kind: Variable |}c|]|>; +// }|> +// }|>; +// var <|[|{| name: b, kind: Variable |}b|]|>; +// b = { +// <|[|{| name: propB, kind: Property |}propB|]: function() { +// // function must not have an empty body to appear top level +// var <|[|{| name: d, kind: Variable |}d|]|>; +// }|> +// }; + +// === Details === +(Variable) a + (Property) propA + (Variable) c +(Variable) b +(Property) propB + (Variable) d diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline.md deleted file mode 100644 index d0cefa9493..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionIndirectlyInVariableDeclaration.baseline.md +++ /dev/null @@ -1,176 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarFunctionIndirectlyInVariableDeclaration.ts -var a = { - propA: function() { - var c; - } -}; -var b; -b = { - propB: function() { - // function must not have an empty body to appear top level - var d; - } -}; -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "children": [ - { - "name": "propA", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "children": [ - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 13 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "children": [] - }, - { - "name": "propB", - "kind": "Property", - "range": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 10, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 9 - } - }, - "children": [ - { - "name": "d", - "kind": "Variable", - "range": { - "start": { - "line": 9, - "character": 12 - }, - "end": { - "line": 9, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 9, - "character": 12 - }, - "end": { - "line": 9, - "character": 13 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline new file mode 100644 index 0000000000..d89e23c91f --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline @@ -0,0 +1,19 @@ +// === Document Symbols === +// === /navigationBarFunctionLikePropertyAssignments.ts === +// var <|[|{| name: functions, kind: Variable |}functions|] = { +// <|[|{| name: a, kind: Property |}a|]: 0|>, +// <|[|{| name: b, kind: Property |}b|]: function () { }|>, +// <|[|{| name: c, kind: Property |}c|]: function x() { }|>, +// <|[|{| name: d, kind: Property |}d|]: () => { }|>, +// <|[|{| name: e, kind: Property |}e|]: y()|>, +// <|[|{| name: f, kind: Method |}f|]() { }|> +// }|>; + +// === Details === +(Variable) functions + (Property) a + (Property) b + (Property) c + (Property) d + (Property) e + (Method) f diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline.md deleted file mode 100644 index a83582eade..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionLikePropertyAssignments.baseline.md +++ /dev/null @@ -1,195 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarFunctionLikePropertyAssignments.ts -var functions = { - a: 0, - b: function () { }, - c: function x() { }, - d: () => { }, - e: y(), - f() { } -}; -``` - -# Symbols - -```json -[ - { - "name": "functions", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 7, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 13 - } - }, - "children": [ - { - "name": "a", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 5 - } - }, - "children": [] - }, - { - "name": "b", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Property", - "range": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "children": [] - }, - { - "name": "d", - "kind": "Property", - "range": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 16 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 5 - } - }, - "children": [] - }, - { - "name": "e", - "kind": "Property", - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 10 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "children": [] - }, - { - "name": "f", - "kind": "Method", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 5 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline new file mode 100644 index 0000000000..00341aea9d --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline @@ -0,0 +1,27 @@ +// === Document Symbols === +// === /foo.js === +// <|function [|{| name: f, kind: Function |}f|]() {}|> +// <|f.prototype.[|{| name: x, kind: Variable |}x|]|> = 0; +// <|f.[|{| name: y, kind: Variable |}y|]|> = 0; +// <|f.prototype.[|{| name: method, kind: Variable |}method|]|> = <|[|{| name: method, kind: Function |}|]function () {}|>; +// Object.defineProperty(f, 'staticProp', { +// <|[|{| name: set, kind: Property |}set|]: function() {}|>, +// <|[|{| name: get, kind: Property |}get|]: function(){ +// }|> +// }); +// Object.defineProperty(f.prototype, 'name', { +// <|[|{| name: set, kind: Property |}set|]: function() {}|>, +// <|[|{| name: get, kind: Property |}get|]: function(){ +// }|> +// }); + +// === Details === +(Function) f + (Variable) x + (Variable) y + (Variable) method + (Function) method +(Property) set +(Property) get +(Property) set +(Property) get diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline.md deleted file mode 100644 index 85af0672b6..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype.baseline.md +++ /dev/null @@ -1,252 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -function f() {} -f.prototype.x = 0; -f.y = 0; -f.prototype.method = function () {}; -Object.defineProperty(f, 'staticProp', { - set: function() {}, - get: function(){ - } -}); -Object.defineProperty(f.prototype, 'name', { - set: function() {}, - get: function(){ - } -}); -``` - -# Symbols - -```json -[ - { - "name": "f", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 2, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 2 - }, - "end": { - "line": 2, - "character": 3 - } - }, - "children": [] - }, - { - "name": "method", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 3, - "character": 18 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 12 - }, - "end": { - "line": 3, - "character": 18 - } - }, - "children": [ - { - "name": "method", - "kind": "Function", - "range": { - "start": { - "line": 3, - "character": 21 - }, - "end": { - "line": 3, - "character": 35 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 21 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "set", - "kind": "Property", - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 7 - } - }, - "children": [] - }, - { - "name": "get", - "kind": "Property", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 7, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 7 - } - }, - "children": [] - }, - { - "name": "set", - "kind": "Property", - "range": { - "start": { - "line": 10, - "character": 4 - }, - "end": { - "line": 10, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 4 - }, - "end": { - "line": 10, - "character": 7 - } - }, - "children": [] - }, - { - "name": "get", - "kind": "Property", - "range": { - "start": { - "line": 11, - "character": 4 - }, - "end": { - "line": 12, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 11, - "character": 4 - }, - "end": { - "line": 11, - "character": 7 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline new file mode 100644 index 0000000000..7a1dd74179 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /foo.js === +// <|A.prototype.[|{| name: a, kind: Variable |}a|]|> = <|[|{| name: a, kind: Function |}|]function() { }|>; +// <|A.prototype.[|{| name: b, kind: Variable |}b|]|> = <|[|{| name: b, kind: Function |}|]function() { }|>; +// <|function [|{| name: A, kind: Function |}A|]() {}|> + +// === Details === +(Function) A + (Variable) a + (Function) a + (Variable) b + (Function) b diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline.md deleted file mode 100644 index 80bf076750..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype2.baseline.md +++ /dev/null @@ -1,142 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -A.prototype.a = function() { }; -A.prototype.b = function() { }; -function A() {} -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Function", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 9 - }, - "end": { - "line": 2, - "character": 10 - } - }, - "children": [ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 12 - }, - "end": { - "line": 0, - "character": 13 - } - }, - "children": [ - { - "name": "a", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 16 - }, - "end": { - "line": 0, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 16 - }, - "end": { - "line": 0, - "character": 16 - } - }, - "children": [] - } - ] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "children": [ - { - "name": "b", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 16 - }, - "end": { - "line": 1, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 16 - }, - "end": { - "line": 1, - "character": 16 - } - }, - "children": [] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline new file mode 100644 index 0000000000..193ef039da --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /foo.js === +// var <|[|{| name: A, kind: Variable |}A|]|>; +// <|A.prototype.[|{| name: a, kind: Variable |}a|]|> = <|[|{| name: a, kind: Function |}|]function() { }|>; +// <|A.[|{| name: b, kind: Variable |}b|]|> = <|[|{| name: b, kind: Function |}|]function() { }|>; + +// === Details === +(Variable) A + (Variable) a + (Function) a + (Variable) b + (Function) b diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline.md deleted file mode 100644 index ccb12e8b48..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype3.baseline.md +++ /dev/null @@ -1,142 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -var A; -A.prototype.a = function() { }; -A.b = function() { }; -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "children": [ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 12 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "children": [ - { - "name": "a", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 16 - }, - "end": { - "line": 1, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 16 - }, - "end": { - "line": 1, - "character": 16 - } - }, - "children": [] - } - ] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 2, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 2 - }, - "end": { - "line": 2, - "character": 3 - } - }, - "children": [ - { - "name": "b", - "kind": "Function", - "range": { - "start": { - "line": 2, - "character": 6 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 6 - }, - "end": { - "line": 2, - "character": 6 - } - }, - "children": [] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline new file mode 100644 index 0000000000..8326a90b0a --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline @@ -0,0 +1,27 @@ +// === Document Symbols === +// === /foo.js === +// var <|[|{| name: A, kind: Variable |}A|]|>; +// A.prototype = { }; +// A.prototype = { <|[|{| name: m, kind: Method |}m|]() {}|> }; +// <|A.prototype.[|{| name: a, kind: Variable |}a|]|> = <|[|{| name: a, kind: Function |}|]function() { }|>; +// <|A.[|{| name: b, kind: Variable |}b|]|> = <|[|{| name: b, kind: Function |}|]function() { }|>; +// +// var <|[|{| name: B, kind: Variable |}B|]|>; +// B["prototype"] = { }; +// B["prototype"] = { <|[|{| name: m, kind: Method |}m|]() {}|> }; +// <|B["prototype"][[|{| name: "a", kind: Variable |}"a"|]]|> = <|[|{| name: "a", kind: Function |}|]function() { }|>; +// <|B[[|{| name: "b", kind: Variable |}"b"|]]|> = <|[|{| name: "b", kind: Function |}|]function() { }|>; + +// === Details === +(Variable) A + (Variable) a + (Function) a + (Variable) b + (Function) b +(Method) m +(Variable) B + (Variable) "a" + (Function) "a" + (Variable) "b" + (Function) "b" +(Method) m diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline.md deleted file mode 100644 index 2d5c03b193..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototype4.baseline.md +++ /dev/null @@ -1,328 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -var A; -A.prototype = { }; -A.prototype = { m() {} }; -A.prototype.a = function() { }; -A.b = function() { }; - -var B; -B["prototype"] = { }; -B["prototype"] = { m() {} }; -B["prototype"]["a"] = function() { }; -B["b"] = function() { }; -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "children": [ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 3, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 12 - }, - "end": { - "line": 3, - "character": 13 - } - }, - "children": [ - { - "name": "a", - "kind": "Function", - "range": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 16 - } - }, - "children": [] - } - ] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 4, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 2 - }, - "end": { - "line": 4, - "character": 3 - } - }, - "children": [ - { - "name": "b", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 6 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "m", - "kind": "Method", - "range": { - "start": { - "line": 2, - "character": 16 - }, - "end": { - "line": 2, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 16 - }, - "end": { - "line": 2, - "character": 17 - } - }, - "children": [] - }, - { - "name": "B", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 5 - } - }, - "children": [ - { - "name": "\"a\"", - "kind": "Variable", - "range": { - "start": { - "line": 9, - "character": 0 - }, - "end": { - "line": 9, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 9, - "character": 15 - }, - "end": { - "line": 9, - "character": 18 - } - }, - "children": [ - { - "name": "\"a\"", - "kind": "Function", - "range": { - "start": { - "line": 9, - "character": 22 - }, - "end": { - "line": 9, - "character": 36 - } - }, - "selectionRange": { - "start": { - "line": 9, - "character": 22 - }, - "end": { - "line": 9, - "character": 22 - } - }, - "children": [] - } - ] - }, - { - "name": "\"b\"", - "kind": "Variable", - "range": { - "start": { - "line": 10, - "character": 0 - }, - "end": { - "line": 10, - "character": 6 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 2 - }, - "end": { - "line": 10, - "character": 5 - } - }, - "children": [ - { - "name": "\"b\"", - "kind": "Function", - "range": { - "start": { - "line": 10, - "character": 9 - }, - "end": { - "line": 10, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 9 - }, - "end": { - "line": 10, - "character": 9 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "m", - "kind": "Method", - "range": { - "start": { - "line": 8, - "character": 19 - }, - "end": { - "line": 8, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 19 - }, - "end": { - "line": 8, - "character": 20 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline new file mode 100644 index 0000000000..e0dead311f --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /foo.js === +// <|function [|{| name: A, kind: Function |}A|]() {}|> +// A. // Started typing something here +// A.prototype.a = <|[|{| name: a, kind: Function |}|]function() { }|>; +// G. // Started typing something here +// A.prototype.a = <|[|{| name: a, kind: Function |}|]function() { }|>; + +// === Details === +(Function) A +(Function) a +(Function) a diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline.md deleted file mode 100644 index b334e1cbce..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeBroken.baseline.md +++ /dev/null @@ -1,91 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -function A() {} -A. // Started typing something here -A.prototype.a = function() { }; -G. // Started typing something here -A.prototype.a = function() { }; -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [] - }, - { - "name": "a", - "kind": "Function", - "range": { - "start": { - "line": 2, - "character": 16 - }, - "end": { - "line": 2, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 16 - }, - "end": { - "line": 2, - "character": 16 - } - }, - "children": [] - }, - { - "name": "a", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 16 - }, - "end": { - "line": 4, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 16 - }, - "end": { - "line": 4, - "character": 16 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline new file mode 100644 index 0000000000..bb4baea8a9 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline @@ -0,0 +1,24 @@ +// === Document Symbols === +// === /foo.js === +// var <|[|{| name: b, kind: Variable |}b|] = 1|>; +// <|function [|{| name: A, kind: Function |}A|]() {}|>; +// <|A.prototype.[|{| name: a, kind: Variable |}a|]|> = <|[|{| name: a, kind: Function |}|]function() { }|>; +// <|A.[|{| name: b, kind: Variable |}b|]|> = <|[|{| name: b, kind: Function |}|]function() { }|>; +// b = 2 +// /* Comment */ +// <|A.prototype.[|{| name: c, kind: Variable |}c|]|> = <|[|{| name: c, kind: Function |}|]function() { }|> +// var <|[|{| name: b, kind: Variable |}b|] = 2|> +// <|A.prototype.[|{| name: d, kind: Variable |}d|]|> = <|[|{| name: d, kind: Function |}|]function() { }|> + +// === Details === +(Variable) b +(Function) A + (Variable) a + (Function) a + (Variable) b + (Function) b + (Variable) c + (Function) c + (Variable) d + (Function) d +(Variable) b diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline.md deleted file mode 100644 index ffc80186bb..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeInterlaced.baseline.md +++ /dev/null @@ -1,300 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -var b = 1; -function A() {}; -A.prototype.a = function() { }; -A.b = function() { }; -b = 2 -/* Comment */ -A.prototype.c = function() { } -var b = 2 -A.prototype.d = function() { } -``` - -# Symbols - -```json -[ - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "children": [] - }, - { - "name": "A", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 9 - }, - "end": { - "line": 1, - "character": 10 - } - }, - "children": [ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 2, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 13 - } - }, - "children": [ - { - "name": "a", - "kind": "Function", - "range": { - "start": { - "line": 2, - "character": 16 - }, - "end": { - "line": 2, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 16 - }, - "end": { - "line": 2, - "character": 16 - } - }, - "children": [] - } - ] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 3, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 2 - }, - "end": { - "line": 3, - "character": 3 - } - }, - "children": [ - { - "name": "b", - "kind": "Function", - "range": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 6 - } - }, - "children": [] - } - ] - }, - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 6, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 12 - }, - "end": { - "line": 6, - "character": 13 - } - }, - "children": [ - { - "name": "c", - "kind": "Function", - "range": { - "start": { - "line": 6, - "character": 16 - }, - "end": { - "line": 6, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 16 - }, - "end": { - "line": 6, - "character": 16 - } - }, - "children": [] - } - ] - }, - { - "name": "d", - "kind": "Variable", - "range": { - "start": { - "line": 8, - "character": 0 - }, - "end": { - "line": 8, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 12 - }, - "end": { - "line": 8, - "character": 13 - } - }, - "children": [ - { - "name": "d", - "kind": "Function", - "range": { - "start": { - "line": 8, - "character": 16 - }, - "end": { - "line": 8, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 16 - }, - "end": { - "line": 8, - "character": 16 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 5 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline new file mode 100644 index 0000000000..5de1065441 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline @@ -0,0 +1,20 @@ +// === Document Symbols === +// === /foo.js === +// <|function [|{| name: A, kind: Function |}A|]() {}|> +// <|A.[|{| name: B, kind: Variable |}B|]|> = <|[|{| name: B, kind: Function |}|]function () { }|> +// A.B.prototype.d = <|[|{| name: d, kind: Function |}|]function () { }|> +// Object.defineProperty(A.B.prototype, "x", { +// <|[|{| name: get, kind: Method |}get|]() {}|> +// }) +// <|A.prototype.[|{| name: D, kind: Variable |}D|]|> = <|[|{| name: D, kind: Function |}|]function () { }|> +// A.prototype.D.prototype.d = <|[|{| name: d, kind: Function |}|]function () { }|> + +// === Details === +(Function) A + (Variable) B + (Function) B + (Variable) D + (Function) D +(Function) d +(Method) get +(Function) d diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline.md deleted file mode 100644 index c1d4900e2c..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarFunctionPrototypeNested.baseline.md +++ /dev/null @@ -1,222 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -function A() {} -A.B = function () { } -A.B.prototype.d = function () { } -Object.defineProperty(A.B.prototype, "x", { - get() {} -}) -A.prototype.D = function () { } -A.prototype.D.prototype.d = function () { } -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [ - { - "name": "B", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 3 - } - }, - "children": [ - { - "name": "B", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 6 - } - }, - "children": [] - } - ] - }, - { - "name": "D", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 6, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 12 - }, - "end": { - "line": 6, - "character": 13 - } - }, - "children": [ - { - "name": "D", - "kind": "Function", - "range": { - "start": { - "line": 6, - "character": 16 - }, - "end": { - "line": 6, - "character": 32 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 16 - }, - "end": { - "line": 6, - "character": 16 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "d", - "kind": "Function", - "range": { - "start": { - "line": 2, - "character": 18 - }, - "end": { - "line": 2, - "character": 34 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 18 - }, - "end": { - "line": 2, - "character": 18 - } - }, - "children": [] - }, - { - "name": "get", - "kind": "Method", - "range": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 7 - } - }, - "children": [] - }, - { - "name": "d", - "kind": "Function", - "range": { - "start": { - "line": 7, - "character": 28 - }, - "end": { - "line": 7, - "character": 44 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 28 - }, - "end": { - "line": 7, - "character": 28 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline new file mode 100644 index 0000000000..0cb13770ad --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline @@ -0,0 +1,15 @@ +// === Document Symbols === +// === /navigationBarGetterAndSetter.ts === +// <|class [|{| name: X, kind: Class |}X|] { +// <|get [|{| name: x, kind: Property |}x|]() {}|> +// <|set [|{| name: x, kind: Property |}x|](value) { +// // Inner declaration should make the setter top-level. +// <|function [|{| name: f, kind: Function |}f|]() {}|> +// }|> +// }|> + +// === Details === +(Class) X + (Property) x + (Property) x + (Function) f diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline.md deleted file mode 100644 index c7c08b1329..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarGetterAndSetter.baseline.md +++ /dev/null @@ -1,120 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarGetterAndSetter.ts -class X { - get x() {} - set x(value) { - // Inner declaration should make the setter top-level. - function f() {} - } -} -``` - -# Symbols - -```json -[ - { - "name": "X", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 6, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 8 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "children": [] - }, - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 9 - } - }, - "children": [ - { - "name": "f", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 8 - }, - "end": { - "line": 4, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 17 - }, - "end": { - "line": 4, - "character": 18 - } - }, - "children": [] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline new file mode 100644 index 0000000000..3c9221113f --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline @@ -0,0 +1,11 @@ +// === Document Symbols === +// === /navigationBarImports.ts === +// import <|[|{| name: a, kind: Variable |}a|]|>, {<|[|{| name: b, kind: Variable |}b|]|>} from "m"; +// <|import [|{| name: c, kind: Variable |}c|] = require("m");|> +// import <|* as [|{| name: d, kind: Variable |}d|]|> from "m"; + +// === Details === +(Variable) a +(Variable) b +(Variable) c +(Variable) d diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline.md deleted file mode 100644 index c372333bb9..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline.md +++ /dev/null @@ -1,114 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarImports.ts -import a, {b} from "m"; -import c = require("m"); -import * as d from "m"; -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "children": [] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 11 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 11 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 7 - }, - "end": { - "line": 1, - "character": 8 - } - }, - "children": [] - }, - { - "name": "d", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 7 - }, - "end": { - "line": 2, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 13 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline new file mode 100644 index 0000000000..fcabe53f38 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline @@ -0,0 +1,15 @@ +// === Document Symbols === +// === /navigationBarInitializerSpans.ts === +// // get the name for the navbar from the variable name rather than the function name +// const <|[|{| name: x, kind: Variable |}x|] = () => { var <|[|{| name: a, kind: Variable |}a|]|>; }|>; +// const <|[|{| name: f, kind: Variable |}f|] = function f() { var <|[|{| name: b, kind: Variable |}b|]|>; }|>; +// const <|[|{| name: y, kind: Variable |}y|] = { <|[|{| name: z, kind: Property |}z|]: function z() { var <|[|{| name: c, kind: Variable |}c|]|>; }|> }|>; + +// === Details === +(Variable) x + (Variable) a +(Variable) f + (Variable) b +(Variable) y + (Property) z + (Variable) c diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline.md deleted file mode 100644 index 0b3b4a0ec1..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarInitializerSpans.baseline.md +++ /dev/null @@ -1,194 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarInitializerSpans.ts -// get the name for the navbar from the variable name rather than the function name -const x = () => { var a; }; -const f = function f() { var b; }; -const y = { z: function z() { var c; } }; -``` - -# Symbols - -```json -[ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 26 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "children": [ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 22 - }, - "end": { - "line": 1, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 22 - }, - "end": { - "line": 1, - "character": 23 - } - }, - "children": [] - } - ] - }, - { - "name": "f", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 6 - }, - "end": { - "line": 2, - "character": 33 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 6 - }, - "end": { - "line": 2, - "character": 7 - } - }, - "children": [ - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 29 - }, - "end": { - "line": 2, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 29 - }, - "end": { - "line": 2, - "character": 30 - } - }, - "children": [] - } - ] - }, - { - "name": "y", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 40 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 7 - } - }, - "children": [ - { - "name": "z", - "kind": "Property", - "range": { - "start": { - "line": 3, - "character": 12 - }, - "end": { - "line": 3, - "character": 38 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 12 - }, - "end": { - "line": 3, - "character": 13 - } - }, - "children": [ - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 34 - }, - "end": { - "line": 3, - "character": 35 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 34 - }, - "end": { - "line": 3, - "character": 35 - } - }, - "children": [] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline new file mode 100644 index 0000000000..461be18311 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline @@ -0,0 +1,23 @@ +// === Document Symbols === +// === /navigationBarItemsBindingPatterns.ts === +// 'use strict' +// var <|[|{| name: foo, kind: Variable |}foo|]|>, {} +// var <|[|{| name: bar, kind: Variable |}bar|]|>, [] +// let <|[|{| name: foo1, kind: Variable |}foo1|]|>, {<|[|{| name: a, kind: Variable |}a|]|>, <|[|{| name: b, kind: Variable |}b|]|>} +// const <|[|{| name: bar1, kind: Variable |}bar1|]|>, [<|[|{| name: c, kind: Variable |}c|]|>, <|[|{| name: d, kind: Variable |}d|]|>] +// var {<|[|{| name: e, kind: Variable |}e|]|>, x: [<|[|{| name: f, kind: Variable |}f|]|>, <|[|{| name: g, kind: Variable |}g|]|>]} = {a:1, x:[]}; +// var { <|h: [|{| name: i, kind: Variable |}i|] = function j() {}|> } = obj; + +// === Details === +(Variable) foo +(Variable) bar +(Variable) foo1 +(Variable) a +(Variable) b +(Variable) bar1 +(Variable) c +(Variable) d +(Variable) e +(Variable) f +(Variable) g +(Variable) i diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline.md deleted file mode 100644 index ffbf8f570d..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatterns.baseline.md +++ /dev/null @@ -1,318 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsBindingPatterns.ts -'use strict' -var foo, {} -var bar, [] -let foo1, {a, b} -const bar1, [c, d] -var {e, x: [f, g]} = {a:1, x:[]}; -var { h: i = function j() {} } = obj; -``` - -# Symbols - -```json -[ - { - "name": "foo", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "children": [] - }, - { - "name": "bar", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 7 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 7 - } - }, - "children": [] - }, - { - "name": "foo1", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 8 - } - }, - "children": [] - }, - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 11 - }, - "end": { - "line": 3, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 11 - }, - "end": { - "line": 3, - "character": 12 - } - }, - "children": [] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 14 - }, - "end": { - "line": 3, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 14 - }, - "end": { - "line": 3, - "character": 15 - } - }, - "children": [] - }, - { - "name": "bar1", - "kind": "Variable", - "range": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 10 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 10 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 4, - "character": 13 - }, - "end": { - "line": 4, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 13 - }, - "end": { - "line": 4, - "character": 14 - } - }, - "children": [] - }, - { - "name": "d", - "kind": "Variable", - "range": { - "start": { - "line": 4, - "character": 16 - }, - "end": { - "line": 4, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 16 - }, - "end": { - "line": 4, - "character": 17 - } - }, - "children": [] - }, - { - "name": "e", - "kind": "Variable", - "range": { - "start": { - "line": 5, - "character": 5 - }, - "end": { - "line": 5, - "character": 6 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 5 - }, - "end": { - "line": 5, - "character": 6 - } - }, - "children": [] - }, - { - "name": "f", - "kind": "Variable", - "range": { - "start": { - "line": 5, - "character": 12 - }, - "end": { - "line": 5, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 12 - }, - "end": { - "line": 5, - "character": 13 - } - }, - "children": [] - }, - { - "name": "g", - "kind": "Variable", - "range": { - "start": { - "line": 5, - "character": 15 - }, - "end": { - "line": 5, - "character": 16 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 15 - }, - "end": { - "line": 5, - "character": 16 - } - }, - "children": [] - }, - { - "name": "i", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 6 - }, - "end": { - "line": 6, - "character": 28 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 9 - }, - "end": { - "line": 6, - "character": 10 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline new file mode 100644 index 0000000000..7b1ef9fa52 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline @@ -0,0 +1,20 @@ +// === Document Symbols === +// === /navigationBarItemsBindingPatternsInConstructor.ts === +// <|class [|{| name: A, kind: Class |}A|] { +// <|[|{| name: x, kind: Property |}x|]: any|> +// <|[|{| name: constructor, kind: Constructor |}|]constructor([a]: any) { +// }|> +// }|> +// <|class [|{| name: B, kind: Class |}B|] { +// <|[|{| name: x, kind: Property |}x|]: any;|> +// <|[|{| name: constructor, kind: Constructor |}|]constructor( {a} = { a: 1 }) { +// }|> +// }|> + +// === Details === +(Class) A + (Property) x + (Constructor) constructor +(Class) B + (Property) x + (Constructor) constructor diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline.md deleted file mode 100644 index f4bc8b47fa..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsBindingPatternsInConstructor.baseline.md +++ /dev/null @@ -1,173 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsBindingPatternsInConstructor.ts -class A { - x: any - constructor([a]: any) { - } -} -class B { - x: any; - constructor( {a} = { a: 1 }) { - } -} -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 10 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 5 - } - }, - "children": [] - }, - { - "name": "constructor", - "kind": "Constructor", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 4 - } - }, - "children": [] - } - ] - }, - { - "name": "B", - "kind": "Class", - "range": { - "start": { - "line": 5, - "character": 0 - }, - "end": { - "line": 9, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 6 - }, - "end": { - "line": 5, - "character": 7 - } - }, - "children": [ - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 5 - } - }, - "children": [] - }, - { - "name": "constructor", - "kind": "Constructor", - "range": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 8, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 4 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline new file mode 100644 index 0000000000..0cd7f3c7ba --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline @@ -0,0 +1,8 @@ +// === Document Symbols === +// === /navigationBarItemsClass1.ts === +// <|function [|{| name: Foo, kind: Function |}Foo|]() {}|> +// <|class [|{| name: Foo, kind: Class |}Foo|] {}|> + +// === Details === +(Function) Foo +(Class) Foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline.md deleted file mode 100644 index ae038080bc..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass1.baseline.md +++ /dev/null @@ -1,63 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsClass1.ts -function Foo() {} -class Foo {} -``` - -# Symbols - -```json -[ - { - "name": "Foo", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "children": [] - }, - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline new file mode 100644 index 0000000000..ab2a2ba530 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline @@ -0,0 +1,8 @@ +// === Document Symbols === +// === /navigationBarItemsClass2.ts === +// <|class [|{| name: Foo, kind: Class |}Foo|] {}|> +// <|function [|{| name: Foo, kind: Function |}Foo|]() {}|> + +// === Details === +(Class) Foo +(Function) Foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline.md deleted file mode 100644 index 623fa22497..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass2.baseline.md +++ /dev/null @@ -1,63 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsClass2.ts -class Foo {} -function Foo() {} -``` - -# Symbols - -```json -[ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "children": [] - }, - { - "name": "Foo", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 9 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline new file mode 100644 index 0000000000..8dabbeec6e --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline @@ -0,0 +1,8 @@ +// === Document Symbols === +// === /foo.js === +// <|function [|{| name: Foo, kind: Function |}Foo|]() {}|> +// <|class [|{| name: Foo, kind: Class |}Foo|] {}|> + +// === Details === +(Function) Foo +(Class) Foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline.md deleted file mode 100644 index c04588fd4c..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass3.baseline.md +++ /dev/null @@ -1,63 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -function Foo() {} -class Foo {} -``` - -# Symbols - -```json -[ - { - "name": "Foo", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "children": [] - }, - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline new file mode 100644 index 0000000000..2839a7c4b8 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline @@ -0,0 +1,8 @@ +// === Document Symbols === +// === /foo.js === +// <|class [|{| name: Foo, kind: Class |}Foo|] {}|> +// <|function [|{| name: Foo, kind: Function |}Foo|]() {}|> + +// === Details === +(Class) Foo +(Function) Foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline.md deleted file mode 100644 index a47dcbc662..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass4.baseline.md +++ /dev/null @@ -1,63 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -class Foo {} -function Foo() {} -``` - -# Symbols - -```json -[ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "children": [] - }, - { - "name": "Foo", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 9 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline new file mode 100644 index 0000000000..6eeca8c93d --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline @@ -0,0 +1,8 @@ +// === Document Symbols === +// === /navigationBarItemsClass5.ts === +// <|class [|{| name: Foo, kind: Class |}Foo|] {}|> +// let <|[|{| name: Foo, kind: Variable |}Foo|] = 1|>; + +// === Details === +(Class) Foo +(Variable) Foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline.md deleted file mode 100644 index c8bd57c0f9..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass5.baseline.md +++ /dev/null @@ -1,63 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsClass5.ts -class Foo {} -let Foo = 1; -``` - -# Symbols - -```json -[ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "children": [] - }, - { - "name": "Foo", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline new file mode 100644 index 0000000000..a48334f8cb --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline @@ -0,0 +1,13 @@ +// === Document Symbols === +// === /navigationBarItemsClass6.ts === +// <|function [|{| name: Z, kind: Function |}Z|]() { }|> +// +// <|Z.[|{| name: foo, kind: Variable |}foo|]|> = 42 +// +// <|class [|{| name: Z, kind: Class |}Z|] { }|> + +// === Details === +(Function) Z + (Variable) foo +(Class) Z + (Variable) foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline.md deleted file mode 100644 index 96abee6343..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsClass6.baseline.md +++ /dev/null @@ -1,118 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsClass6.ts -function Z() { } - -Z.foo = 42 - -class Z { } -``` - -# Symbols - -```json -[ - { - "name": "Z", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 16 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [ - { - "name": "foo", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 2 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "children": [] - } - ] - }, - { - "name": "Z", - "kind": "Class", - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 4, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 6 - }, - "end": { - "line": 4, - "character": 7 - } - }, - "children": [ - { - "name": "foo", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 2 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline new file mode 100644 index 0000000000..ddb7ac1c08 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline @@ -0,0 +1,34 @@ +// === Document Symbols === +// === /navigationBarItemsComputedNames.ts === +// <|const enum [|{| name: E, kind: Enum |}E|] { +// <|[|{| name: A, kind: EnumMember |}A|] = 'A'|>, +// }|> +// const <|[|{| name: a, kind: Variable |}a|] = ''|>; +// +// <|class [|{| name: C, kind: Class |}C|] { +// <|[|{| name: [a], kind: Method |}[a]|]() { +// return 1; +// }|> +// +// <|[|{| name: [E.A], kind: Method |}[E.A]|]() { +// return 1; +// }|> +// +// <|[|{| name: 1, kind: Method |}[1]|]() { +// return 1; +// }|>, +// +// <|[|{| name: "foo", kind: Method |}["foo"]|]() { +// return 1; +// }|>, +// }|> + +// === Details === +(Enum) E + (EnumMember) A +(Variable) a +(Class) C + (Method) [a] + (Method) [E.A] + (Method) 1 + (Method) "foo" diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline.md deleted file mode 100644 index 342e8234e2..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsComputedNames.baseline.md +++ /dev/null @@ -1,235 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsComputedNames.ts -const enum E { - A = 'A', -} -const a = ''; - -class C { - [a]() { - return 1; - } - - [E.A]() { - return 1; - } - - [1]() { - return 1; - }, - - ["foo"]() { - return 1; - }, -} -``` - -# Symbols - -```json -[ - { - "name": "E", - "kind": "Enum", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 11 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "children": [ - { - "name": "A", - "kind": "EnumMember", - "range": { - "start": { - "line": 1, - "character": 1 - }, - "end": { - "line": 1, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 1 - }, - "end": { - "line": 1, - "character": 2 - } - }, - "children": [] - } - ] - }, - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 7 - } - }, - "children": [] - }, - { - "name": "C", - "kind": "Class", - "range": { - "start": { - "line": 5, - "character": 0 - }, - "end": { - "line": 21, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 6 - }, - "end": { - "line": 5, - "character": 7 - } - }, - "children": [ - { - "name": "[a]", - "kind": "Method", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 8, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 7 - } - }, - "children": [] - }, - { - "name": "[E.A]", - "kind": "Method", - "range": { - "start": { - "line": 10, - "character": 4 - }, - "end": { - "line": 12, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 4 - }, - "end": { - "line": 10, - "character": 9 - } - }, - "children": [] - }, - { - "name": "1", - "kind": "Method", - "range": { - "start": { - "line": 14, - "character": 4 - }, - "end": { - "line": 16, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 4 - }, - "end": { - "line": 14, - "character": 7 - } - }, - "children": [] - }, - { - "name": "\"foo\"", - "kind": "Method", - "range": { - "start": { - "line": 18, - "character": 4 - }, - "end": { - "line": 20, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 18, - "character": 4 - }, - "end": { - "line": 18, - "character": 11 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline new file mode 100644 index 0000000000..415c9b9f53 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline @@ -0,0 +1,10 @@ +// === Document Symbols === +// === /navigationBarItemsEmptyConstructors.ts === +// <|class [|{| name: Test, kind: Class |}Test|] { +// <|[|{| name: constructor, kind: Constructor |}|]constructor() { +// }|> +// }|> + +// === Details === +(Class) Test + (Constructor) constructor diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline.md deleted file mode 100644 index 04ad8b218f..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsEmptyConstructors.baseline.md +++ /dev/null @@ -1,66 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsEmptyConstructors.ts -class Test { - constructor() { - } -} -``` - -# Symbols - -```json -[ - { - "name": "Test", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [ - { - "name": "constructor", - "kind": "Constructor", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 4 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline new file mode 100644 index 0000000000..fab8b1a03e --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline @@ -0,0 +1,14 @@ +// === Document Symbols === +// === /navigationBarItemsExports.ts === +// export { <|[|{| name: a, kind: Variable |}a|]|> } from "a"; +// +// export { <|b as [|{| name: B, kind: Variable |}B|]|> } from "a" +// +// <|export import [|{| name: e, kind: Variable |}e|] = require("a");|> +// +// export * from "a"; // no bindings here + +// === Details === +(Variable) a +(Variable) B +(Variable) e diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline.md deleted file mode 100644 index 50ee83db8e..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline.md +++ /dev/null @@ -1,93 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsExports.ts -export { a } from "a"; - -export { b as B } from "a" - -export import e = require("a"); - -export * from "a"; // no bindings here -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [] - }, - { - "name": "B", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 9 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 14 - }, - "end": { - "line": 2, - "character": 15 - } - }, - "children": [] - }, - { - "name": "e", - "kind": "Variable", - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 4, - "character": 31 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 14 - }, - "end": { - "line": 4, - "character": 15 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline new file mode 100644 index 0000000000..f931ccfa51 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /navigationBarItemsFunctionProperties.ts === +// (<|[|{| name: , kind: Function |}|]function(){ +// var <|[|{| name: A, kind: Variable |}A|]|>; +// A +// .a = <|[|{| name: a, kind: Function |}|]function() { }|>; +// }|>)(); + +// === Details === +(Function) + (Variable) A + (Function) a diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline.md deleted file mode 100644 index c44d29af9c..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionProperties.baseline.md +++ /dev/null @@ -1,92 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsFunctionProperties.ts -(function(){ -var A; -A -.a = function() { }; -})(); -``` - -# Symbols - -```json -[ - { - "name": "", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 1 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 1 - }, - "end": { - "line": 0, - "character": 1 - } - }, - "children": [ - { - "name": "A", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 5 - } - }, - "children": [] - }, - { - "name": "a", - "kind": "Function", - "range": { - "start": { - "line": 3, - "character": 5 - }, - "end": { - "line": 3, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 5 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline new file mode 100644 index 0000000000..9d44e2b057 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline @@ -0,0 +1,29 @@ +// === Document Symbols === +// === /navigationBarItemsFunctions.ts === +// <|function [|{| name: foo, kind: Function |}foo|]() { +// var <|[|{| name: x, kind: Variable |}x|] = 10|>; +// <|function [|{| name: bar, kind: Function |}bar|]() { +// var <|[|{| name: y, kind: Variable |}y|] = 10|>; +// <|function [|{| name: biz, kind: Function |}biz|]() { +// var <|[|{| name: z, kind: Variable |}z|] = 10|>; +// }|> +// <|function [|{| name: qux, kind: Function |}qux|]() { +// // A function with an empty body should not be top level +// }|> +// }|> +// }|> +// +// <|function [|{| name: baz, kind: Function |}baz|]() { +// var <|[|{| name: v, kind: Variable |}v|] = 10|>; +// }|> + +// === Details === +(Function) foo + (Variable) x + (Function) bar + (Variable) y + (Function) biz + (Variable) z + (Function) qux +(Function) baz + (Variable) v diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline.md deleted file mode 100644 index cb97e6984b..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctions.baseline.md +++ /dev/null @@ -1,256 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsFunctions.ts -function foo() { - var x = 10; - function bar() { - var y = 10; - function biz() { - var z = 10; - } - function qux() { - // A function with an empty body should not be top level - } - } -} - -function baz() { - var v = 10; -} -``` - -# Symbols - -```json -[ - { - "name": "foo", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 11, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 12 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 8 - }, - "end": { - "line": 1, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 8 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "children": [] - }, - { - "name": "bar", - "kind": "Function", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 10, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 13 - }, - "end": { - "line": 2, - "character": 16 - } - }, - "children": [ - { - "name": "y", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 12 - }, - "end": { - "line": 3, - "character": 18 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 12 - }, - "end": { - "line": 3, - "character": 13 - } - }, - "children": [] - }, - { - "name": "biz", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 8 - }, - "end": { - "line": 6, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 17 - }, - "end": { - "line": 4, - "character": 20 - } - }, - "children": [ - { - "name": "z", - "kind": "Variable", - "range": { - "start": { - "line": 5, - "character": 16 - }, - "end": { - "line": 5, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 16 - }, - "end": { - "line": 5, - "character": 17 - } - }, - "children": [] - } - ] - }, - { - "name": "qux", - "kind": "Function", - "range": { - "start": { - "line": 7, - "character": 8 - }, - "end": { - "line": 9, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 17 - }, - "end": { - "line": 7, - "character": 20 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "baz", - "kind": "Function", - "range": { - "start": { - "line": 13, - "character": 0 - }, - "end": { - "line": 15, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 9 - }, - "end": { - "line": 13, - "character": 12 - } - }, - "children": [ - { - "name": "v", - "kind": "Variable", - "range": { - "start": { - "line": 14, - "character": 8 - }, - "end": { - "line": 14, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 8 - }, - "end": { - "line": 14, - "character": 9 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline new file mode 100644 index 0000000000..37c9537f11 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline @@ -0,0 +1,8 @@ +// === Document Symbols === +// === /navigationBarItemsFunctionsBroken.ts === +// <|function [|{| name: f, kind: Function |}f|]() { +// function; +// }|> + +// === Details === +(Function) f diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline.md deleted file mode 100644 index bc55224739..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken.baseline.md +++ /dev/null @@ -1,39 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsFunctionsBroken.ts -function f() { - function; -} -``` - -# Symbols - -```json -[ - { - "name": "f", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline new file mode 100644 index 0000000000..a80c8ff5c7 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline @@ -0,0 +1,9 @@ +// === Document Symbols === +// === /navigationBarItemsFunctionsBroken2.ts === +// function; +// <|function [|{| name: f, kind: Function |}f|]() { +// function; +// }|> + +// === Details === +(Function) f diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline.md deleted file mode 100644 index ab5af87f5c..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsFunctionsBroken2.baseline.md +++ /dev/null @@ -1,40 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsFunctionsBroken2.ts -function; -function f() { - function; -} -``` - -# Symbols - -```json -[ - { - "name": "f", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 9 - }, - "end": { - "line": 1, - "character": 10 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline new file mode 100644 index 0000000000..5d2b303fd6 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline @@ -0,0 +1,23 @@ +// === Document Symbols === +// === /navigationBarItemsImports.ts === +// import <|[|{| name: d1, kind: Variable |}d1|]|> from "a"; +// +// import { <|[|{| name: a, kind: Variable |}a|]|> } from "a"; +// +// import { <|b as [|{| name: B, kind: Variable |}B|]|> } from "a" +// +// import <|[|{| name: d2, kind: Variable |}d2|]|>, { <|[|{| name: c, kind: Variable |}c|]|>, <|d as [|{| name: D, kind: Variable |}D|]|> } from "a" +// +// <|import [|{| name: e, kind: Variable |}e|] = require("a");|> +// +// import <|* as [|{| name: ns, kind: Variable |}ns|]|> from "a"; + +// === Details === +(Variable) d1 +(Variable) a +(Variable) B +(Variable) d2 +(Variable) c +(Variable) D +(Variable) e +(Variable) ns diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline.md deleted file mode 100644 index e272384328..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline.md +++ /dev/null @@ -1,222 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsImports.ts -import d1 from "a"; - -import { a } from "a"; - -import { b as B } from "a" - -import d2, { c, d as D } from "a" - -import e = require("a"); - -import * as ns from "a"; -``` - -# Symbols - -```json -[ - { - "name": "d1", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "children": [] - }, - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 9 - }, - "end": { - "line": 2, - "character": 10 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 9 - }, - "end": { - "line": 2, - "character": 10 - } - }, - "children": [] - }, - { - "name": "B", - "kind": "Variable", - "range": { - "start": { - "line": 4, - "character": 9 - }, - "end": { - "line": 4, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 14 - }, - "end": { - "line": 4, - "character": 15 - } - }, - "children": [] - }, - { - "name": "d2", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 7 - }, - "end": { - "line": 6, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 7 - }, - "end": { - "line": 6, - "character": 9 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 13 - }, - "end": { - "line": 6, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 13 - }, - "end": { - "line": 6, - "character": 14 - } - }, - "children": [] - }, - { - "name": "D", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 16 - }, - "end": { - "line": 6, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 21 - }, - "end": { - "line": 6, - "character": 22 - } - }, - "children": [] - }, - { - "name": "e", - "kind": "Variable", - "range": { - "start": { - "line": 8, - "character": 0 - }, - "end": { - "line": 8, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 7 - }, - "end": { - "line": 8, - "character": 8 - } - }, - "children": [] - }, - { - "name": "ns", - "kind": "Variable", - "range": { - "start": { - "line": 10, - "character": 7 - }, - "end": { - "line": 10, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 12 - }, - "end": { - "line": 10, - "character": 14 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline new file mode 100644 index 0000000000..e2c88a1ba8 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline @@ -0,0 +1,34 @@ +// === Document Symbols === +// === /navigationBarItemsInsideMethodsAndConstructors.ts === +// <|class [|{| name: Class, kind: Class |}Class|] { +// <|[|{| name: constructor, kind: Constructor |}|]constructor() { +// <|function [|{| name: LocalFunctionInConstructor, kind: Function |}LocalFunctionInConstructor|]() {}|> +// <|interface [|{| name: LocalInterfaceInConstrcutor, kind: Interface |}LocalInterfaceInConstrcutor|] {}|> +// <|enum [|{| name: LocalEnumInConstructor, kind: Enum |}LocalEnumInConstructor|] { <|[|{| name: LocalEnumMemberInConstructor, kind: EnumMember |}LocalEnumMemberInConstructor|]|> }|> +// }|> +// +// <|[|{| name: method, kind: Method |}method|]() { +// <|function [|{| name: LocalFunctionInMethod, kind: Function |}LocalFunctionInMethod|]() { +// <|function [|{| name: LocalFunctionInLocalFunctionInMethod, kind: Function |}LocalFunctionInLocalFunctionInMethod|]() {}|> +// }|> +// <|interface [|{| name: LocalInterfaceInMethod, kind: Interface |}LocalInterfaceInMethod|] {}|> +// <|enum [|{| name: LocalEnumInMethod, kind: Enum |}LocalEnumInMethod|] { <|[|{| name: LocalEnumMemberInMethod, kind: EnumMember |}LocalEnumMemberInMethod|]|> }|> +// }|> +// +// <|[|{| name: emptyMethod, kind: Method |}emptyMethod|]() { }|> // Non child functions method should not be duplicated +// }|> + +// === Details === +(Class) Class + (Constructor) constructor + (Function) LocalFunctionInConstructor + (Interface) LocalInterfaceInConstrcutor + (Enum) LocalEnumInConstructor + (EnumMember) LocalEnumMemberInConstructor + (Method) method + (Function) LocalFunctionInMethod + (Function) LocalFunctionInLocalFunctionInMethod + (Interface) LocalInterfaceInMethod + (Enum) LocalEnumInMethod + (EnumMember) LocalEnumMemberInMethod + (Method) emptyMethod diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline.md deleted file mode 100644 index f634b7c6f0..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsInsideMethodsAndConstructors.baseline.md +++ /dev/null @@ -1,359 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsInsideMethodsAndConstructors.ts -class Class { - constructor() { - function LocalFunctionInConstructor() {} - interface LocalInterfaceInConstrcutor {} - enum LocalEnumInConstructor { LocalEnumMemberInConstructor } - } - - method() { - function LocalFunctionInMethod() { - function LocalFunctionInLocalFunctionInMethod() {} - } - interface LocalInterfaceInMethod {} - enum LocalEnumInMethod { LocalEnumMemberInMethod } - } - - emptyMethod() { } // Non child functions method should not be duplicated -} -``` - -# Symbols - -```json -[ - { - "name": "Class", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 16, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "children": [ - { - "name": "constructor", - "kind": "Constructor", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 4 - } - }, - "children": [ - { - "name": "LocalFunctionInConstructor", - "kind": "Function", - "range": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 48 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 17 - }, - "end": { - "line": 2, - "character": 43 - } - }, - "children": [] - }, - { - "name": "LocalInterfaceInConstrcutor", - "kind": "Interface", - "range": { - "start": { - "line": 3, - "character": 8 - }, - "end": { - "line": 3, - "character": 48 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 18 - }, - "end": { - "line": 3, - "character": 45 - } - }, - "children": [] - }, - { - "name": "LocalEnumInConstructor", - "kind": "Enum", - "range": { - "start": { - "line": 4, - "character": 8 - }, - "end": { - "line": 4, - "character": 68 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 13 - }, - "end": { - "line": 4, - "character": 35 - } - }, - "children": [ - { - "name": "LocalEnumMemberInConstructor", - "kind": "EnumMember", - "range": { - "start": { - "line": 4, - "character": 38 - }, - "end": { - "line": 4, - "character": 66 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 38 - }, - "end": { - "line": 4, - "character": 66 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "method", - "kind": "Method", - "range": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 13, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 10 - } - }, - "children": [ - { - "name": "LocalFunctionInMethod", - "kind": "Function", - "range": { - "start": { - "line": 8, - "character": 8 - }, - "end": { - "line": 10, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 17 - }, - "end": { - "line": 8, - "character": 38 - } - }, - "children": [ - { - "name": "LocalFunctionInLocalFunctionInMethod", - "kind": "Function", - "range": { - "start": { - "line": 9, - "character": 12 - }, - "end": { - "line": 9, - "character": 62 - } - }, - "selectionRange": { - "start": { - "line": 9, - "character": 21 - }, - "end": { - "line": 9, - "character": 57 - } - }, - "children": [] - } - ] - }, - { - "name": "LocalInterfaceInMethod", - "kind": "Interface", - "range": { - "start": { - "line": 11, - "character": 8 - }, - "end": { - "line": 11, - "character": 43 - } - }, - "selectionRange": { - "start": { - "line": 11, - "character": 18 - }, - "end": { - "line": 11, - "character": 40 - } - }, - "children": [] - }, - { - "name": "LocalEnumInMethod", - "kind": "Enum", - "range": { - "start": { - "line": 12, - "character": 8 - }, - "end": { - "line": 12, - "character": 58 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 13 - }, - "end": { - "line": 12, - "character": 30 - } - }, - "children": [ - { - "name": "LocalEnumMemberInMethod", - "kind": "EnumMember", - "range": { - "start": { - "line": 12, - "character": 33 - }, - "end": { - "line": 12, - "character": 56 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 33 - }, - "end": { - "line": 12, - "character": 56 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "emptyMethod", - "kind": "Method", - "range": { - "start": { - "line": 15, - "character": 4 - }, - "end": { - "line": 15, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 15, - "character": 4 - }, - "end": { - "line": 15, - "character": 15 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline new file mode 100644 index 0000000000..d92d017076 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline @@ -0,0 +1,64 @@ +// === Document Symbols === +// === /navigationBarItemsItems.ts === +// // Interface +// <|interface [|{| name: IPoint, kind: Interface |}IPoint|] { +// <|[|{| name: getDist, kind: Method |}getDist|](): number;|> +// <|[|{| name: new(), kind: Constructor |}|]new(): IPoint;|> +// <|[|{| name: (), kind: Method |}|](): any;|> +// <|[|{| name: [], kind: Property |}|][x:string]: number;|> +// <|[|{| name: prop, kind: Property |}prop|]: string;|> +// }|> +// +// /// Module +// <|module [|{| name: Shapes, kind: Namespace |}Shapes|] { +// +// // Class +// <|export class [|{| name: Point, kind: Class |}Point|] implements IPoint { +// <|[|{| name: constructor, kind: Constructor |}|]constructor (<|public [|{| name: x, kind: Property |}x|]: number|>, <|public [|{| name: y, kind: Property |}y|]: number|>) { }|> +// +// // Instance member +// <|[|{| name: getDist, kind: Method |}getDist|]() { return Math.sqrt(this.x * this.x + this.y * this.y); }|> +// +// // Getter +// <|get [|{| name: value, kind: Property |}value|](): number { return 0; }|> +// +// // Setter +// <|set [|{| name: value, kind: Property |}value|](newValue: number) { return; }|> +// +// // Static member +// <|static [|{| name: origin, kind: Property |}origin|] = new Point(0, 0);|> +// +// // Static method +// <|private static [|{| name: getOrigin, kind: Method |}getOrigin|]() { return Point.origin; }|> +// }|> +// +// <|enum [|{| name: Values, kind: Enum |}Values|] { <|[|{| name: value1, kind: EnumMember |}value1|]|>, <|[|{| name: value2, kind: EnumMember |}value2|]|>, <|[|{| name: value3, kind: EnumMember |}value3|]|> }|> +// }|> +// +// // Local variables +// var <|[|{| name: p, kind: Variable |}p|]: IPoint = new Shapes.Point(3, 4)|>; +// var <|[|{| name: dist, kind: Variable |}dist|] = p.getDist()|>; + +// === Details === +(Interface) IPoint + (Method) getDist + (Constructor) new() + (Method) () + (Property) [] + (Property) prop +(Namespace) Shapes + (Class) Point + (Constructor) constructor + (Property) x + (Property) y + (Method) getDist + (Property) value + (Property) value + (Property) origin + (Method) getOrigin + (Enum) Values + (EnumMember) value1 + (EnumMember) value2 + (EnumMember) value3 +(Variable) p +(Variable) dist diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md deleted file mode 100644 index 19d549b410..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems.baseline.md +++ /dev/null @@ -1,603 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsItems.ts -// Interface -interface IPoint { - getDist(): number; - new(): IPoint; - (): any; - [x:string]: number; - prop: string; -} - -/// Module -module Shapes { - - // Class - export class Point implements IPoint { - constructor (public x: number, public y: number) { } - - // Instance member - getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } - - // Getter - get value(): number { return 0; } - - // Setter - set value(newValue: number) { return; } - - // Static member - static origin = new Point(0, 0); - - // Static method - private static getOrigin() { return Point.origin; } - } - - enum Values { value1, value2, value3 } -} - -// Local variables -var p: IPoint = new Shapes.Point(3, 4); -var dist = p.getDist(); -``` - -# Symbols - -```json -[ - { - "name": "IPoint", - "kind": "Interface", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 7, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 10 - }, - "end": { - "line": 1, - "character": 16 - } - }, - "children": [ - { - "name": "getDist", - "kind": "Method", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "children": [] - }, - { - "name": "new()", - "kind": "Constructor", - "range": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 18 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 4 - } - }, - "children": [] - }, - { - "name": "()", - "kind": "Method", - "range": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 4 - } - }, - "children": [] - }, - { - "name": "[]", - "kind": "Property", - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 4 - } - }, - "children": [] - }, - { - "name": "prop", - "kind": "Property", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 8 - } - }, - "children": [] - } - ] - }, - { - "name": "Shapes", - "kind": "Namespace", - "range": { - "start": { - "line": 10, - "character": 0 - }, - "end": { - "line": 33, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 7 - }, - "end": { - "line": 10, - "character": 13 - } - }, - "children": [ - { - "name": "Point", - "kind": "Class", - "range": { - "start": { - "line": 13, - "character": 4 - }, - "end": { - "line": 30, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 17 - }, - "end": { - "line": 13, - "character": 22 - } - }, - "children": [ - { - "name": "constructor", - "kind": "Constructor", - "range": { - "start": { - "line": 14, - "character": 8 - }, - "end": { - "line": 14, - "character": 60 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 8 - }, - "end": { - "line": 14, - "character": 8 - } - }, - "children": [] - }, - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 14, - "character": 21 - }, - "end": { - "line": 14, - "character": 37 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 28 - }, - "end": { - "line": 14, - "character": 29 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Property", - "range": { - "start": { - "line": 14, - "character": 39 - }, - "end": { - "line": 14, - "character": 55 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 46 - }, - "end": { - "line": 14, - "character": 47 - } - }, - "children": [] - }, - { - "name": "getDist", - "kind": "Method", - "range": { - "start": { - "line": 17, - "character": 8 - }, - "end": { - "line": 17, - "character": 74 - } - }, - "selectionRange": { - "start": { - "line": 17, - "character": 8 - }, - "end": { - "line": 17, - "character": 15 - } - }, - "children": [] - }, - { - "name": "value", - "kind": "Property", - "range": { - "start": { - "line": 20, - "character": 8 - }, - "end": { - "line": 20, - "character": 41 - } - }, - "selectionRange": { - "start": { - "line": 20, - "character": 12 - }, - "end": { - "line": 20, - "character": 17 - } - }, - "children": [] - }, - { - "name": "value", - "kind": "Property", - "range": { - "start": { - "line": 23, - "character": 8 - }, - "end": { - "line": 23, - "character": 47 - } - }, - "selectionRange": { - "start": { - "line": 23, - "character": 12 - }, - "end": { - "line": 23, - "character": 17 - } - }, - "children": [] - }, - { - "name": "origin", - "kind": "Property", - "range": { - "start": { - "line": 26, - "character": 8 - }, - "end": { - "line": 26, - "character": 40 - } - }, - "selectionRange": { - "start": { - "line": 26, - "character": 15 - }, - "end": { - "line": 26, - "character": 21 - } - }, - "children": [] - }, - { - "name": "getOrigin", - "kind": "Method", - "range": { - "start": { - "line": 29, - "character": 8 - }, - "end": { - "line": 29, - "character": 59 - } - }, - "selectionRange": { - "start": { - "line": 29, - "character": 23 - }, - "end": { - "line": 29, - "character": 32 - } - }, - "children": [] - } - ] - }, - { - "name": "Values", - "kind": "Enum", - "range": { - "start": { - "line": 32, - "character": 4 - }, - "end": { - "line": 32, - "character": 42 - } - }, - "selectionRange": { - "start": { - "line": 32, - "character": 9 - }, - "end": { - "line": 32, - "character": 15 - } - }, - "children": [ - { - "name": "value1", - "kind": "EnumMember", - "range": { - "start": { - "line": 32, - "character": 18 - }, - "end": { - "line": 32, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 32, - "character": 18 - }, - "end": { - "line": 32, - "character": 24 - } - }, - "children": [] - }, - { - "name": "value2", - "kind": "EnumMember", - "range": { - "start": { - "line": 32, - "character": 26 - }, - "end": { - "line": 32, - "character": 32 - } - }, - "selectionRange": { - "start": { - "line": 32, - "character": 26 - }, - "end": { - "line": 32, - "character": 32 - } - }, - "children": [] - }, - { - "name": "value3", - "kind": "EnumMember", - "range": { - "start": { - "line": 32, - "character": 34 - }, - "end": { - "line": 32, - "character": 40 - } - }, - "selectionRange": { - "start": { - "line": 32, - "character": 34 - }, - "end": { - "line": 32, - "character": 40 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "p", - "kind": "Variable", - "range": { - "start": { - "line": 36, - "character": 4 - }, - "end": { - "line": 36, - "character": 38 - } - }, - "selectionRange": { - "start": { - "line": 36, - "character": 4 - }, - "end": { - "line": 36, - "character": 5 - } - }, - "children": [] - }, - { - "name": "dist", - "kind": "Variable", - "range": { - "start": { - "line": 37, - "character": 4 - }, - "end": { - "line": 37, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 37, - "character": 4 - }, - "end": { - "line": 37, - "character": 8 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline new file mode 100644 index 0000000000..e470a764cb --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline @@ -0,0 +1,8 @@ +// === Document Symbols === +// === /navigationBarItemsItems2.ts === +// <|module [|{| name: A, kind: Namespace |}A|]|> +// <|[|{| name: , kind: Class |}|]export class|> + +// === Details === +(Namespace) A +(Class) diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline.md deleted file mode 100644 index b5990e4eed..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItems2.baseline.md +++ /dev/null @@ -1,63 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsItems2.ts -module A -export class -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "children": [] - }, - { - "name": "", - "kind": "Class", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline new file mode 100644 index 0000000000..16ed4a2898 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline @@ -0,0 +1,9 @@ +// === Document Symbols === +// === /navigationBarItemsItemsExternalModules.ts === +// <|export class [|{| name: Bar, kind: Class |}Bar|] { +// <|public [|{| name: s, kind: Property |}s|]: string;|> +// }|> + +// === Details === +(Class) Bar + (Property) s diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline.md deleted file mode 100644 index b56ecc5ce6..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules.baseline.md +++ /dev/null @@ -1,65 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsItemsExternalModules.ts -export class Bar { - public s: string; -} -``` - -# Symbols - -```json -[ - { - "name": "Bar", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 13 - }, - "end": { - "line": 0, - "character": 16 - } - }, - "children": [ - { - "name": "s", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 11 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline new file mode 100644 index 0000000000..3ae45e23d9 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline @@ -0,0 +1,11 @@ +// === Document Symbols === +// === /test/file.ts === +// <|export class [|{| name: Bar, kind: Class |}Bar|] { +// <|public [|{| name: s, kind: Property |}s|]: string;|> +// }|> +// export var <|[|{| name: x, kind: Variable |}x|]: number|>; + +// === Details === +(Class) Bar + (Property) s +(Variable) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline.md deleted file mode 100644 index 8474f2c043..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules2.baseline.md +++ /dev/null @@ -1,91 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /test/file.ts -export class Bar { - public s: string; -} -export var x: number; -``` - -# Symbols - -```json -[ - { - "name": "Bar", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 13 - }, - "end": { - "line": 0, - "character": 16 - } - }, - "children": [ - { - "name": "s", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 11 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "children": [] - } - ] - }, - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 11 - }, - "end": { - "line": 3, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 11 - }, - "end": { - "line": 3, - "character": 12 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline new file mode 100644 index 0000000000..17191dfda2 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline @@ -0,0 +1,11 @@ +// === Document Symbols === +// === /test/my fil e.ts === +// <|export class [|{| name: Bar, kind: Class |}Bar|] { +// <|public [|{| name: s, kind: Property |}s|]: string;|> +// }|> +// export var <|[|{| name: x, kind: Variable |}x|]: number|>; + +// === Details === +(Class) Bar + (Property) s +(Variable) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline.md deleted file mode 100644 index 1552fbd84c..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsExternalModules3.baseline.md +++ /dev/null @@ -1,91 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /test/my fil e.ts -export class Bar { - public s: string; -} -export var x: number; -``` - -# Symbols - -```json -[ - { - "name": "Bar", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 13 - }, - "end": { - "line": 0, - "character": 16 - } - }, - "children": [ - { - "name": "s", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 11 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "children": [] - } - ] - }, - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 3, - "character": 11 - }, - "end": { - "line": 3, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 11 - }, - "end": { - "line": 3, - "character": 12 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline new file mode 100644 index 0000000000..6c06151eb3 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline @@ -0,0 +1,24 @@ +// === Document Symbols === +// === /navigationItemsModuleVariables_0.ts === +// +// <|module [|{| name: Module1, kind: Namespace |}Module1|] { +// export var <|[|{| name: x, kind: Variable |}x|] = 0|>; +// }|> + +// === Details === +(Namespace) Module1 + (Variable) x + + + + +// === Document Symbols === +// === /navigationItemsModuleVariables_1.ts === +// +// <|module [|{| name: Module1.SubModule, kind: Namespace |}Module1.SubModule|] { +// export var <|[|{| name: y, kind: Variable |}y|] = 0|>; +// }|> + +// === Details === +(Namespace) Module1.SubModule + (Variable) y diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline.md deleted file mode 100644 index 0e443882eb..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsItemsModuleVariables.baseline.md +++ /dev/null @@ -1,135 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationItemsModuleVariables_0.ts - -module Module1 { - export var x = 0; -} -``` - -# Symbols - -```json -[ - { - "name": "Module1", - "kind": "Namespace", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 7 - }, - "end": { - "line": 1, - "character": 14 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 15 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 15 - }, - "end": { - "line": 2, - "character": 16 - } - }, - "children": [] - } - ] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /navigationItemsModuleVariables_1.ts - -module Module1.SubModule { - export var y = 0; -} -``` - -# Symbols - -```json -[ - { - "name": "Module1.SubModule", - "kind": "Namespace", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 7 - }, - "end": { - "line": 1, - "character": 24 - } - }, - "children": [ - { - "name": "y", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 15 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 15 - }, - "end": { - "line": 2, - "character": 16 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline new file mode 100644 index 0000000000..506bda0e9c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline @@ -0,0 +1,10 @@ +// === Document Symbols === +// === /navigationBarItemsMissingName1.ts === +// export function +// <|class [|{| name: C, kind: Class |}C|] { +// <|[|{| name: foo, kind: Method |}foo|]() {}|> +// }|> + +// === Details === +(Class) C + (Method) foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline.md deleted file mode 100644 index 3e20e9f7c1..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName1.baseline.md +++ /dev/null @@ -1,66 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsMissingName1.ts -export function -class C { - foo() {} -} -``` - -# Symbols - -```json -[ - { - "name": "C", - "kind": "Class", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "children": [ - { - "name": "foo", - "kind": "Method", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 7 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline new file mode 100644 index 0000000000..c7fac970c6 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /navigationBarItemsMissingName2.ts === +// /** +// * This is a class. +// */ +// <|[|{| name: , kind: Class |}|]class /* But it has no name! */ { +// <|[|{| name: foo, kind: Method |}foo|]() {}|> +// }|> + +// === Details === +(Class) + (Method) foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline.md deleted file mode 100644 index 4e666e8aaf..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMissingName2.baseline.md +++ /dev/null @@ -1,68 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsMissingName2.ts -/** - * This is a class. - */ -class /* But it has no name! */ { - foo() {} -} -``` - -# Symbols - -```json -[ - { - "name": "", - "kind": "Class", - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 5, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 3, - "character": 0 - } - }, - "children": [ - { - "name": "foo", - "kind": "Method", - "range": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 7 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline new file mode 100644 index 0000000000..8630be766d --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline @@ -0,0 +1,41 @@ +// === Document Symbols === +// === /navigationBarItemsModules1.ts === +// <|declare module [|{| name: "X.Y.Z", kind: Namespace |}"X.Y.Z"|] {}|> +// +// <|declare module [|{| name: "X2.Y2.Z2", kind: Namespace |}'X2.Y2.Z2'|] {}|> +// +// <|declare module [|{| name: "foo", kind: Namespace |}"foo"|];|> +// +// <|module [|{| name: A.B.C, kind: Namespace |}A.B.C|] { +// export var <|[|{| name: x, kind: Variable |}x|]|>; +// }|> +// +// <|module [|{| name: A.B, kind: Namespace |}A.B|] { +// export var <|[|{| name: y, kind: Variable |}y|]|>; +// }|> +// +// <|module [|{| name: A, kind: Namespace |}A|] { +// export var <|[|{| name: z, kind: Variable |}z|]|>; +// }|> +// +// module A { +// <|module [|{| name: B, kind: Namespace |}B|] { +// <|module [|{| name: C, kind: Namespace |}C|] { +// declare var <|[|{| name: x, kind: Variable |}x|]|>; +// }|> +// }|> +// } + +// === Details === +(Namespace) "X.Y.Z" +(Namespace) "X2.Y2.Z2" +(Namespace) "foo" +(Namespace) A.B.C + (Variable) x +(Namespace) A.B + (Variable) y +(Namespace) A + (Variable) z + (Namespace) B + (Namespace) C + (Variable) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline.md deleted file mode 100644 index e26f9e34c2..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules1.baseline.md +++ /dev/null @@ -1,341 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsModules1.ts -declare module "X.Y.Z" {} - -declare module 'X2.Y2.Z2' {} - -declare module "foo"; - -module A.B.C { - export var x; -} - -module A.B { - export var y; -} - -module A { - export var z; -} - -module A { - module B { - module C { - declare var x; - } - } -} -``` - -# Symbols - -```json -[ - { - "name": "\"X.Y.Z\"", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 15 - }, - "end": { - "line": 0, - "character": 22 - } - }, - "children": [] - }, - { - "name": "\"X2.Y2.Z2\"", - "kind": "Namespace", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 2, - "character": 28 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 15 - }, - "end": { - "line": 2, - "character": 25 - } - }, - "children": [] - }, - { - "name": "\"foo\"", - "kind": "Namespace", - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 4, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 15 - }, - "end": { - "line": 4, - "character": 20 - } - }, - "children": [] - }, - { - "name": "A.B.C", - "kind": "Namespace", - "range": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 8, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 7 - }, - "end": { - "line": 6, - "character": 12 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 7, - "character": 15 - }, - "end": { - "line": 7, - "character": 16 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 15 - }, - "end": { - "line": 7, - "character": 16 - } - }, - "children": [] - } - ] - }, - { - "name": "A.B", - "kind": "Namespace", - "range": { - "start": { - "line": 10, - "character": 0 - }, - "end": { - "line": 12, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 7 - }, - "end": { - "line": 10, - "character": 10 - } - }, - "children": [ - { - "name": "y", - "kind": "Variable", - "range": { - "start": { - "line": 11, - "character": 15 - }, - "end": { - "line": 11, - "character": 16 - } - }, - "selectionRange": { - "start": { - "line": 11, - "character": 15 - }, - "end": { - "line": 11, - "character": 16 - } - }, - "children": [] - } - ] - }, - { - "name": "A", - "kind": "Namespace", - "range": { - "start": { - "line": 14, - "character": 0 - }, - "end": { - "line": 16, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 7 - }, - "end": { - "line": 14, - "character": 8 - } - }, - "children": [ - { - "name": "z", - "kind": "Variable", - "range": { - "start": { - "line": 15, - "character": 15 - }, - "end": { - "line": 15, - "character": 16 - } - }, - "selectionRange": { - "start": { - "line": 15, - "character": 15 - }, - "end": { - "line": 15, - "character": 16 - } - }, - "children": [] - }, - { - "name": "B", - "kind": "Namespace", - "range": { - "start": { - "line": 19, - "character": 4 - }, - "end": { - "line": 23, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 19, - "character": 11 - }, - "end": { - "line": 19, - "character": 12 - } - }, - "children": [ - { - "name": "C", - "kind": "Namespace", - "range": { - "start": { - "line": 20, - "character": 8 - }, - "end": { - "line": 22, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 20, - "character": 15 - }, - "end": { - "line": 20, - "character": 16 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 21, - "character": 24 - }, - "end": { - "line": 21, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 21, - "character": 24 - }, - "end": { - "line": 21, - "character": 25 - } - }, - "children": [] - } - ] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline new file mode 100644 index 0000000000..b27d76a4c1 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /navigationBarItemsModules2.ts === +// <|namespace [|{| name: Test.A, kind: Namespace |}Test.A|] { }|> +// +// <|namespace [|{| name: Test.B, kind: Namespace |}Test.B|] { +// <|class [|{| name: Foo, kind: Class |}Foo|] { }|> +// }|> + +// === Details === +(Namespace) Test.A +(Namespace) Test.B + (Class) Foo diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline.md deleted file mode 100644 index 77fea89c09..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsModules2.baseline.md +++ /dev/null @@ -1,92 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsModules2.ts -namespace Test.A { } - -namespace Test.B { - class Foo { } -} -``` - -# Symbols - -```json -[ - { - "name": "Test.A", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 10 - }, - "end": { - "line": 0, - "character": 16 - } - }, - "children": [] - }, - { - "name": "Test.B", - "kind": "Namespace", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 10 - }, - "end": { - "line": 2, - "character": 16 - } - }, - "children": [ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 10 - }, - "end": { - "line": 3, - "character": 13 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline new file mode 100644 index 0000000000..0b0ab30bd9 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline @@ -0,0 +1,41 @@ +// === Document Symbols === +// === /navigationBarItemsMultilineStringIdentifiers1.ts === +// <|declare module [|{| name: "Multiline\r\nMadness", kind: Namespace |}"Multiline\r\nMadness"|] { +// }|> +// +// <|declare module [|{| name: "MultilineMadness", kind: Namespace |}"Multiline\ +// Madness"|] { +// }|> +// declare module "MultilineMadness" {} +// +// <|declare module [|{| name: "MultilineMadness2", kind: Namespace |}"Multiline\ +// Madness2"|] { +// }|> +// +// <|interface [|{| name: Foo, kind: Interface |}Foo|] { +// <|[|{| name: "a1\\\r\nb", kind: Property |}"a1\\\r\nb"|];|> +// <|[|{| name: "a2 b", kind: Method |}"a2\ +// \ +// b"|](): Foo;|> +// }|> +// +// <|class [|{| name: Bar, kind: Class |}Bar|] implements Foo { +// <|[|{| name: "a1\\\r\nb", kind: Property |}'a1\\\r\nb'|]: Foo;|> +// +// <|[|{| name: "a2 b", kind: Method |}'a2\ +// \ +// b'|](): Foo { +// return this; +// }|> +// }|> + +// === Details === +(Namespace) "Multiline\r\nMadness" +(Namespace) "MultilineMadness" +(Namespace) "MultilineMadness2" +(Interface) Foo + (Property) "a1\\\r\nb" + (Method) "a2 b" +(Class) Bar + (Property) "a1\\\r\nb" + (Method) "a2 b" diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline.md deleted file mode 100644 index c4edf3a41e..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers1.baseline.md +++ /dev/null @@ -1,266 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsMultilineStringIdentifiers1.ts -declare module "Multiline\r\nMadness" { -} - -declare module "Multiline\ -Madness" { -} -declare module "MultilineMadness" {} - -declare module "Multiline\ -Madness2" { -} - -interface Foo { - "a1\\\r\nb"; - "a2\ - \ - b"(): Foo; -} - -class Bar implements Foo { - 'a1\\\r\nb': Foo; - - 'a2\ - \ - b'(): Foo { - return this; - } -} -``` - -# Symbols - -```json -[ - { - "name": "\"Multiline\\r\\nMadness\"", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 15 - }, - "end": { - "line": 0, - "character": 37 - } - }, - "children": [] - }, - { - "name": "\"MultilineMadness\"", - "kind": "Namespace", - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 5, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 15 - }, - "end": { - "line": 4, - "character": 8 - } - }, - "children": [] - }, - { - "name": "\"MultilineMadness2\"", - "kind": "Namespace", - "range": { - "start": { - "line": 8, - "character": 0 - }, - "end": { - "line": 10, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 15 - }, - "end": { - "line": 9, - "character": 9 - } - }, - "children": [] - }, - { - "name": "Foo", - "kind": "Interface", - "range": { - "start": { - "line": 12, - "character": 0 - }, - "end": { - "line": 17, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 10 - }, - "end": { - "line": 12, - "character": 13 - } - }, - "children": [ - { - "name": "\"a1\\\\\\r\\nb\"", - "kind": "Property", - "range": { - "start": { - "line": 13, - "character": 4 - }, - "end": { - "line": 13, - "character": 16 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 4 - }, - "end": { - "line": 13, - "character": 15 - } - }, - "children": [] - }, - { - "name": "\"a2 b\"", - "kind": "Method", - "range": { - "start": { - "line": 14, - "character": 4 - }, - "end": { - "line": 16, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 4 - }, - "end": { - "line": 16, - "character": 6 - } - }, - "children": [] - } - ] - }, - { - "name": "Bar", - "kind": "Class", - "range": { - "start": { - "line": 19, - "character": 0 - }, - "end": { - "line": 27, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 19, - "character": 6 - }, - "end": { - "line": 19, - "character": 9 - } - }, - "children": [ - { - "name": "\"a1\\\\\\r\\nb\"", - "kind": "Property", - "range": { - "start": { - "line": 20, - "character": 4 - }, - "end": { - "line": 20, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 20, - "character": 4 - }, - "end": { - "line": 20, - "character": 15 - } - }, - "children": [] - }, - { - "name": "\"a2 b\"", - "kind": "Method", - "range": { - "start": { - "line": 22, - "character": 4 - }, - "end": { - "line": 26, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 22, - "character": 4 - }, - "end": { - "line": 24, - "character": 6 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline new file mode 100644 index 0000000000..48c86c4eba --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline @@ -0,0 +1,23 @@ +// === Document Symbols === +// === /navigationBarItemsMultilineStringIdentifiers2.ts === +// <|function [|{| name: f, kind: Function |}f|](p1: () => any, p2: string) { }|> +// f(<|[|{| name: f() callback, kind: Function |}|]() => { }|>, `line1\ +// line2\ +// line3`); +// +// <|class [|{| name: c1, kind: Class |}c1|] { +// <|const [|{| name: a, kind: Property |}a|] = ' '|><|[|{| name: "line1 line2", kind: Property |}'line1\ +// line2'|];|> +// }|> +// +// f(<|[|{| name: f() callback, kind: Function |}|]() => { }|>, `unterminated backtick 1 +// unterminated backtick 2 +// unterminated backtick 3 + +// === Details === +(Function) f +(Function) f() callback +(Class) c1 + (Property) a + (Property) "line1 line2" +(Function) f() callback diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline.md deleted file mode 100644 index 5192d549aa..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers2.baseline.md +++ /dev/null @@ -1,175 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsMultilineStringIdentifiers2.ts -function f(p1: () => any, p2: string) { } -f(() => { }, `line1\ -line2\ -line3`); - -class c1 { - const a = ' ''line1\ - line2'; -} - -f(() => { }, `unterminated backtick 1 -unterminated backtick 2 -unterminated backtick 3 -``` - -# Symbols - -```json -[ - { - "name": "f", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 41 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [] - }, - { - "name": "f() callback", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 2 - } - }, - "children": [] - }, - { - "name": "c1", - "kind": "Class", - "range": { - "start": { - "line": 5, - "character": 0 - }, - "end": { - "line": 8, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 6 - }, - "end": { - "line": 5, - "character": 8 - } - }, - "children": [ - { - "name": "a", - "kind": "Property", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 10 - }, - "end": { - "line": 6, - "character": 11 - } - }, - "children": [] - }, - { - "name": "\"line1 line2\"", - "kind": "Property", - "range": { - "start": { - "line": 6, - "character": 17 - }, - "end": { - "line": 7, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 17 - }, - "end": { - "line": 7, - "character": 14 - } - }, - "children": [] - } - ] - }, - { - "name": "f() callback", - "kind": "Function", - "range": { - "start": { - "line": 10, - "character": 2 - }, - "end": { - "line": 10, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 2 - }, - "end": { - "line": 10, - "character": 2 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline new file mode 100644 index 0000000000..a62da0e6aa --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /navigationBarItemsMultilineStringIdentifiers3.ts === +// <|declare module [|{| name: "MoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMore..., kind: Namespace |}'MoreThanOneHundredAndFiftyCharacters\ +// MoreThanOneHundredAndFiftyCharacters\ +// MoreThanOneHundredAndFiftyCharacters\ +// MoreThanOneHundredAndFiftyCharacters\ +// MoreThanOneHundredAndFiftyCharacters\ +// MoreThanOneHundredAndFiftyCharacters\ +// MoreThanOneHundredAndFiftyCharacters'|] { }|> + +// === Details === +(Namespace) "MoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMore... diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline.md deleted file mode 100644 index 23d661ea9f..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsMultilineStringIdentifiers3.baseline.md +++ /dev/null @@ -1,43 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsMultilineStringIdentifiers3.ts -declare module 'MoreThanOneHundredAndFiftyCharacters\ -MoreThanOneHundredAndFiftyCharacters\ -MoreThanOneHundredAndFiftyCharacters\ -MoreThanOneHundredAndFiftyCharacters\ -MoreThanOneHundredAndFiftyCharacters\ -MoreThanOneHundredAndFiftyCharacters\ -MoreThanOneHundredAndFiftyCharacters' { } -``` - -# Symbols - -```json -[ - { - "name": "\"MoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMoreThanOneHundredAndFiftyCharactersMore...", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 6, - "character": 41 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 15 - }, - "end": { - "line": 6, - "character": 37 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline new file mode 100644 index 0000000000..e84ff8c5e3 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline @@ -0,0 +1,12 @@ +// === Document Symbols === +// === /navigationBarItemsNamedArrowFunctions.ts === +// export const <|[|{| name: value, kind: Variable |}value|] = 2|>; +// export const <|[|{| name: func, kind: Variable |}func|] = () => 2|>; +// export const <|[|{| name: func2, kind: Variable |}func2|] = function() { }|>; +// <|export function [|{| name: exportedFunction, kind: Function |}exportedFunction|]() { }|> + +// === Details === +(Variable) value +(Variable) func +(Variable) func2 +(Function) exportedFunction diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline.md deleted file mode 100644 index 826d5376cb..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsNamedArrowFunctions.baseline.md +++ /dev/null @@ -1,115 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsNamedArrowFunctions.ts -export const value = 2; -export const func = () => 2; -export const func2 = function() { }; -export function exportedFunction() { } -``` - -# Symbols - -```json -[ - { - "name": "value", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 13 - }, - "end": { - "line": 0, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 13 - }, - "end": { - "line": 0, - "character": 18 - } - }, - "children": [] - }, - { - "name": "func", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 13 - }, - "end": { - "line": 1, - "character": 27 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 13 - }, - "end": { - "line": 1, - "character": 17 - } - }, - "children": [] - }, - { - "name": "func2", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 13 - }, - "end": { - "line": 2, - "character": 35 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 13 - }, - "end": { - "line": 2, - "character": 18 - } - }, - "children": [] - }, - { - "name": "exportedFunction", - "kind": "Function", - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 3, - "character": 38 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 32 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline new file mode 100644 index 0000000000..74ca121aba --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline @@ -0,0 +1,15 @@ +// === Document Symbols === +// === /navigationBarItemsPropertiesDefinedInConstructors.ts === +// <|class [|{| name: List, kind: Class |}List|] { +// <|[|{| name: constructor, kind: Constructor |}|]constructor(<|public [|{| name: a, kind: Property |}a|]: boolean|>, <|private [|{| name: b, kind: Property |}b|]: T|>, <|readonly [|{| name: c, kind: Property |}c|]: string|>, d: number) { +// var <|[|{| name: local, kind: Variable |}local|] = 0|>; +// }|> +// }|> + +// === Details === +(Class) List + (Constructor) constructor + (Variable) local + (Property) a + (Property) b + (Property) c diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline.md deleted file mode 100644 index 1563a0175c..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsPropertiesDefinedInConstructors.baseline.md +++ /dev/null @@ -1,168 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsPropertiesDefinedInConstructors.ts -class List { - constructor(public a: boolean, private b: T, readonly c: string, d: number) { - var local = 0; - } -} -``` - -# Symbols - -```json -[ - { - "name": "List", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [ - { - "name": "constructor", - "kind": "Constructor", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 4 - } - }, - "children": [ - { - "name": "local", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 17 - } - }, - "children": [] - } - ] - }, - { - "name": "a", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 16 - }, - "end": { - "line": 1, - "character": 33 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 23 - }, - "end": { - "line": 1, - "character": 24 - } - }, - "children": [] - }, - { - "name": "b", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 35 - }, - "end": { - "line": 1, - "character": 47 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 43 - }, - "end": { - "line": 1, - "character": 44 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 49 - }, - "end": { - "line": 1, - "character": 67 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 58 - }, - "end": { - "line": 1, - "character": 59 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline new file mode 100644 index 0000000000..7bb5d9cb92 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline @@ -0,0 +1,11 @@ +// === Document Symbols === +// === /navigationBarItemsStaticAndNonStaticNoMerge.ts === +// <|class [|{| name: C, kind: Class |}C|] { +// <|static [|{| name: x, kind: Property |}x|];|> +// <|[|{| name: x, kind: Property |}x|];|> +// }|> + +// === Details === +(Class) C + (Property) x + (Property) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline.md deleted file mode 100644 index 7194dfebae..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsStaticAndNonStaticNoMerge.baseline.md +++ /dev/null @@ -1,91 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsStaticAndNonStaticNoMerge.ts -class C { - static x; - x; -} -``` - -# Symbols - -```json -[ - { - "name": "C", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 11 - }, - "end": { - "line": 1, - "character": 12 - } - }, - "children": [] - }, - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 6 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline new file mode 100644 index 0000000000..4bdc6799db --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline @@ -0,0 +1,13 @@ +// === Document Symbols === +// === /navigationBarItemsSymbols1.ts === +// <|class [|{| name: C, kind: Class |}C|] { +// <|[|{| name: [Symbol.isRegExp], kind: Property |}[Symbol.isRegExp]|] = 0;|> +// <|[|{| name: [Symbol.iterator], kind: Method |}[Symbol.iterator]|]() { }|> +// <|get [|{| name: [Symbol.isConcatSpreadable], kind: Property |}[Symbol.isConcatSpreadable]|]() { }|> +// }|> + +// === Details === +(Class) C + (Property) [Symbol.isRegExp] + (Method) [Symbol.iterator] + (Property) [Symbol.isConcatSpreadable] diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline.md deleted file mode 100644 index 05f0e82dc3..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols1.baseline.md +++ /dev/null @@ -1,117 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsSymbols1.ts -class C { - [Symbol.isRegExp] = 0; - [Symbol.iterator]() { } - get [Symbol.isConcatSpreadable]() { } -} -``` - -# Symbols - -```json -[ - { - "name": "C", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "[Symbol.isRegExp]", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 26 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 21 - } - }, - "children": [] - }, - { - "name": "[Symbol.iterator]", - "kind": "Method", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 27 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 21 - } - }, - "children": [] - }, - { - "name": "[Symbol.isConcatSpreadable]", - "kind": "Property", - "range": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 41 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 8 - }, - "end": { - "line": 3, - "character": 35 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline new file mode 100644 index 0000000000..aa1023457f --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline @@ -0,0 +1,11 @@ +// === Document Symbols === +// === /navigationBarItemsSymbols2.ts === +// <|interface [|{| name: I, kind: Interface |}I|] { +// <|[|{| name: [Symbol.isRegExp], kind: Property |}[Symbol.isRegExp]|]: string;|> +// <|[|{| name: [Symbol.iterator], kind: Method |}[Symbol.iterator]|](): string;|> +// }|> + +// === Details === +(Interface) I + (Property) [Symbol.isRegExp] + (Method) [Symbol.iterator] diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline.md deleted file mode 100644 index e35eff8c6c..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols2.baseline.md +++ /dev/null @@ -1,91 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsSymbols2.ts -interface I { - [Symbol.isRegExp]: string; - [Symbol.iterator](): string; -} -``` - -# Symbols - -```json -[ - { - "name": "I", - "kind": "Interface", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 10 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "children": [ - { - "name": "[Symbol.isRegExp]", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 21 - } - }, - "children": [] - }, - { - "name": "[Symbol.iterator]", - "kind": "Method", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 32 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 21 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline new file mode 100644 index 0000000000..1b9866ed8d --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline @@ -0,0 +1,10 @@ +// === Document Symbols === +// === /navigationBarItemsSymbols3.ts === +// <|enum [|{| name: E, kind: Enum |}E|] { +// // No nav bar entry for this +// <|[|{| name: [Symbol.isRegExp], kind: EnumMember |}[Symbol.isRegExp]|] = 0|> +// }|> + +// === Details === +(Enum) E + (EnumMember) [Symbol.isRegExp] diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline.md deleted file mode 100644 index ca79d2d59a..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols3.baseline.md +++ /dev/null @@ -1,66 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsSymbols3.ts -enum E { - // No nav bar entry for this - [Symbol.isRegExp] = 0 -} -``` - -# Symbols - -```json -[ - { - "name": "E", - "kind": "Enum", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 5 - }, - "end": { - "line": 0, - "character": 6 - } - }, - "children": [ - { - "name": "[Symbol.isRegExp]", - "kind": "EnumMember", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 21 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline new file mode 100644 index 0000000000..3de61ec63c --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline @@ -0,0 +1,23 @@ +// === Document Symbols === +// === /file.js === +// const <|[|{| name: _sym, kind: Variable |}_sym|] = Symbol("_sym")|>; +// <|class [|{| name: MyClass, kind: Class |}MyClass|] { +// <|[|{| name: constructor, kind: Constructor |}|]constructor() { +// // Dynamic assignment properties can't show up in navigation, +// // as they're not syntactic members +// // Additonally, late bound members are always filtered out, besides +// this[_sym] = "ok"; +// }|> +// +// <|[|{| name: method, kind: Method |}method|]() { +// this[_sym] = "yep"; +// const <|[|{| name: x, kind: Variable |}x|] = this[_sym]|>; +// }|> +// }|> + +// === Details === +(Variable) _sym +(Class) MyClass + (Constructor) constructor + (Method) method + (Variable) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline.md deleted file mode 100644 index 74a3e69ae6..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsSymbols4.baseline.md +++ /dev/null @@ -1,152 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /file.js -const _sym = Symbol("_sym"); -class MyClass { - constructor() { - // Dynamic assignment properties can't show up in navigation, - // as they're not syntactic members - // Additonally, late bound members are always filtered out, besides - this[_sym] = "ok"; - } - - method() { - this[_sym] = "yep"; - const x = this[_sym]; - } -} -``` - -# Symbols - -```json -[ - { - "name": "_sym", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 27 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [] - }, - { - "name": "MyClass", - "kind": "Class", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 13, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "children": [ - { - "name": "constructor", - "kind": "Constructor", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 7, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 4 - } - }, - "children": [] - }, - { - "name": "method", - "kind": "Method", - "range": { - "start": { - "line": 9, - "character": 4 - }, - "end": { - "line": 12, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 9, - "character": 4 - }, - "end": { - "line": 9, - "character": 10 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 11, - "character": 14 - }, - "end": { - "line": 11, - "character": 28 - } - }, - "selectionRange": { - "start": { - "line": 11, - "character": 14 - }, - "end": { - "line": 11, - "character": 15 - } - }, - "children": [] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline new file mode 100644 index 0000000000..42e076d5c2 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline @@ -0,0 +1,6 @@ +// === Document Symbols === +// === /navigationBarItemsTypeAlias.ts === +// <|type [|{| name: T, kind: Class |}T|] = number | string;|> + +// === Details === +(Class) T diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline.md deleted file mode 100644 index 55f7e219cb..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsTypeAlias.baseline.md +++ /dev/null @@ -1,37 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarItemsTypeAlias.ts -type T = number | string; -``` - -# Symbols - -```json -[ - { - "name": "T", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 5 - }, - "end": { - "line": 0, - "character": 6 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline new file mode 100644 index 0000000000..a71590e3cb --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline @@ -0,0 +1,9 @@ +// === Document Symbols === +// === /foo.js === +// /** <|@typedef {(number|string)} [|{| name: NumberLike, kind: Class |}NumberLike|]|> */ +// /** @typedef {(string|number)} */ +// const <|[|{| name: x, kind: Variable |}x|] = 0|>; + +// === Details === +(Class) NumberLike +(Variable) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline.md deleted file mode 100644 index 0900b0a043..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDoc.baseline.md +++ /dev/null @@ -1,64 +0,0 @@ -// === Document Symbols === -```js -// @FileName: /foo.js -/** @typedef {(number|string)} NumberLike */ -/** @typedef {(string|number)} */ -const x = 0; -``` - -# Symbols - -```json -[ - { - "name": "NumberLike", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 41 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 31 - }, - "end": { - "line": 0, - "character": 41 - } - }, - "children": [] - }, - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 6 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 6 - }, - "end": { - "line": 2, - "character": 7 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline new file mode 100644 index 0000000000..f2aa982d03 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline @@ -0,0 +1,7 @@ +// === Document Symbols === +// === /navigationBarJsDocCommentWithNoTags.ts === +// /** Test */ +// export const <|[|{| name: Test, kind: Variable |}Test|] = {}|> + +// === Details === +(Variable) Test diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline.md deleted file mode 100644 index d970a6d9b6..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarJsDocCommentWithNoTags.baseline.md +++ /dev/null @@ -1,38 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarJsDocCommentWithNoTags.ts -/** Test */ -export const Test = {} -``` - -# Symbols - -```json -[ - { - "name": "Test", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 13 - }, - "end": { - "line": 1, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 13 - }, - "end": { - "line": 1, - "character": 17 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline new file mode 100644 index 0000000000..e22b81da37 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline @@ -0,0 +1,67 @@ +// === Document Symbols === +// === /file1.ts === +// <|module [|{| name: a, kind: Namespace |}a|] { +// <|function [|{| name: foo, kind: Function |}foo|]() {}|> +// }|> +// <|module [|{| name: b, kind: Namespace |}b|] { +// <|function [|{| name: foo, kind: Function |}foo|]() {}|> +// }|> +// module a { +// <|function [|{| name: bar, kind: Function |}bar|]() {}|> +// } + +// === Details === +(Namespace) a + (Function) foo + (Function) bar +(Namespace) b + (Function) foo + + + + +// === Document Symbols === +// === /file2.ts === +// <|module [|{| name: a, kind: Namespace |}a|] {}|> +// <|function [|{| name: a, kind: Function |}a|]() {}|> + +// === Details === +(Namespace) a +(Function) a + + + + +// === Document Symbols === +// === /file3.ts === +// <|module [|{| name: a, kind: Namespace |}a|] { +// <|interface [|{| name: A, kind: Interface |}A|] { +// <|[|{| name: foo, kind: Property |}foo|]: number;|> +// }|> +// }|> +// module a { +// <|interface [|{| name: A, kind: Interface |}A|] { +// <|[|{| name: bar, kind: Property |}bar|]: number;|> +// }|> +// } + +// === Details === +(Namespace) a + (Interface) A + (Property) foo + (Interface) A + (Property) bar + + + + +// === Document Symbols === +// === /file4.ts === +// <|module [|{| name: A, kind: Namespace |}A|] { export var <|[|{| name: x, kind: Variable |}x|]|>; }|> +// <|module [|{| name: A.B, kind: Namespace |}A.B|] { export var <|[|{| name: y, kind: Variable |}y|]|>; }|> + +// === Details === +(Namespace) A + (Variable) x +(Namespace) A.B + (Variable) y diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline.md deleted file mode 100644 index 19ebdddb9c..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging.baseline.md +++ /dev/null @@ -1,483 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /file1.ts -module a { - function foo() {} -} -module b { - function foo() {} -} -module a { - function bar() {} -} -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 2, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "children": [ - { - "name": "foo", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 13 - }, - "end": { - "line": 1, - "character": 16 - } - }, - "children": [] - }, - { - "name": "bar", - "kind": "Function", - "range": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 13 - }, - "end": { - "line": 7, - "character": 16 - } - }, - "children": [] - } - ] - }, - { - "name": "b", - "kind": "Namespace", - "range": { - "start": { - "line": 3, - "character": 0 - }, - "end": { - "line": 5, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 7 - }, - "end": { - "line": 3, - "character": 8 - } - }, - "children": [ - { - "name": "foo", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 13 - }, - "end": { - "line": 4, - "character": 16 - } - }, - "children": [] - } - ] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /file2.ts -module a {} -function a() {} -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "children": [] - }, - { - "name": "a", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 9 - }, - "end": { - "line": 1, - "character": 10 - } - }, - "children": [] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /file3.ts -module a { - interface A { - foo: number; - } -} -module a { - interface A { - bar: number; - } -} -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "children": [ - { - "name": "A", - "kind": "Interface", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 14 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "children": [ - { - "name": "foo", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "children": [] - } - ] - }, - { - "name": "A", - "kind": "Interface", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 8, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 14 - }, - "end": { - "line": 6, - "character": 15 - } - }, - "children": [ - { - "name": "bar", - "kind": "Property", - "range": { - "start": { - "line": 7, - "character": 8 - }, - "end": { - "line": 7, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 8 - }, - "end": { - "line": 7, - "character": 11 - } - }, - "children": [] - } - ] - } - ] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /file4.ts -module A { export var x; } -module A.B { export var y; } -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Namespace", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 26 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 7 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 22 - }, - "end": { - "line": 0, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 22 - }, - "end": { - "line": 0, - "character": 23 - } - }, - "children": [] - } - ] - }, - { - "name": "A.B", - "kind": "Namespace", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 28 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 7 - }, - "end": { - "line": 1, - "character": 10 - } - }, - "children": [ - { - "name": "y", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 24 - }, - "end": { - "line": 1, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 24 - }, - "end": { - "line": 1, - "character": 25 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline new file mode 100644 index 0000000000..ebf749dba1 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline @@ -0,0 +1,18 @@ +// === Document Symbols === +// === /navigationBarMerging_grandchildren.ts === +// // Should not merge grandchildren with property assignments +// const <|[|{| name: o, kind: Variable |}o|] = { +// <|[|{| name: a, kind: Property |}a|]: { +// <|[|{| name: m, kind: Method |}m|]() {}|>, +// }|>, +// <|[|{| name: b, kind: Property |}b|]: { +// <|[|{| name: m, kind: Method |}m|]() {}|>, +// }|>, +// }|> + +// === Details === +(Variable) o + (Property) a + (Method) m + (Property) b + (Method) m diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline.md deleted file mode 100644 index 1cc9f882d2..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarMerging_grandchildren.baseline.md +++ /dev/null @@ -1,148 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarMerging_grandchildren.ts -// Should not merge grandchildren with property assignments -const o = { - a: { - m() {}, - }, - b: { - m() {}, - }, -} -``` - -# Symbols - -```json -[ - { - "name": "o", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 8, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 6 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "children": [ - { - "name": "a", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 4, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "children": [ - { - "name": "m", - "kind": "Method", - "range": { - "start": { - "line": 3, - "character": 8 - }, - "end": { - "line": 3, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 8 - }, - "end": { - "line": 3, - "character": 9 - } - }, - "children": [] - } - ] - }, - { - "name": "b", - "kind": "Property", - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 7, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "children": [ - { - "name": "m", - "kind": "Method", - "range": { - "start": { - "line": 6, - "character": 8 - }, - "end": { - "line": 6, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 8 - }, - "end": { - "line": 6, - "character": 9 - } - }, - "children": [] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline new file mode 100644 index 0000000000..7e6f2febaf --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline @@ -0,0 +1,4 @@ +// === Document Symbols === + + +// === Details === diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline.md deleted file mode 100644 index 8bef848de7..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNamespaceImportWithNoName.baseline.md +++ /dev/null @@ -1,11 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarNamespaceImportWithNoName.ts -import *{} from 'foo'; -``` - -# Symbols - -```json -[] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline new file mode 100644 index 0000000000..1877f8d900 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline @@ -0,0 +1,26 @@ +// === Document Symbols === +// === /navigationBarNestedObjectLiterals.ts === +// var <|[|{| name: a, kind: Variable |}a|] = { +// <|[|{| name: b, kind: Property |}b|]: 0|>, +// <|[|{| name: c, kind: Property |}c|]: {}|>, +// <|[|{| name: d, kind: Property |}d|]: { +// <|[|{| name: e, kind: Property |}e|]: 1|>, +// }|>, +// <|[|{| name: f, kind: Property |}f|]: { +// <|[|{| name: g, kind: Property |}g|]: 2|>, +// <|[|{| name: h, kind: Property |}h|]: { +// <|[|{| name: i, kind: Property |}i|]: 3|>, +// }|>, +// }|>, +// }|> + +// === Details === +(Variable) a + (Property) b + (Property) c + (Property) d + (Property) e + (Property) f + (Property) g + (Property) h + (Property) i diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline.md deleted file mode 100644 index 6bbc91c151..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarNestedObjectLiterals.baseline.md +++ /dev/null @@ -1,253 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarNestedObjectLiterals.ts -var a = { - b: 0, - c: {}, - d: { - e: 1, - }, - f: { - g: 2, - h: { - i: 3, - }, - }, -} -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 12, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "children": [ - { - "name": "b", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 5 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 5 - } - }, - "children": [] - }, - { - "name": "d", - "kind": "Property", - "range": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 4 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "children": [ - { - "name": "e", - "kind": "Property", - "range": { - "start": { - "line": 4, - "character": 8 - }, - "end": { - "line": 4, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 8 - }, - "end": { - "line": 4, - "character": 9 - } - }, - "children": [] - } - ] - }, - { - "name": "f", - "kind": "Property", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 11, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 5 - } - }, - "children": [ - { - "name": "g", - "kind": "Property", - "range": { - "start": { - "line": 7, - "character": 8 - }, - "end": { - "line": 7, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 8 - }, - "end": { - "line": 7, - "character": 9 - } - }, - "children": [] - }, - { - "name": "h", - "kind": "Property", - "range": { - "start": { - "line": 8, - "character": 8 - }, - "end": { - "line": 10, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 8 - }, - "end": { - "line": 8, - "character": 9 - } - }, - "children": [ - { - "name": "i", - "kind": "Property", - "range": { - "start": { - "line": 9, - "character": 12 - }, - "end": { - "line": 9, - "character": 16 - } - }, - "selectionRange": { - "start": { - "line": 9, - "character": 12 - }, - "end": { - "line": 9, - "character": 13 - } - }, - "children": [] - } - ] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline new file mode 100644 index 0000000000..ffe6f113c7 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline @@ -0,0 +1,19 @@ +// === Document Symbols === +// === /navigationBarPrivateName.ts === +// <|class [|{| name: A, kind: Class |}A|] { +// <|[|{| name: #foo, kind: Property |}#foo|]: () => {|>|> +// <|class [|{| name: B, kind: Class |}B|] { +// <|[|{| name: #bar, kind: Property |}#bar|]: () => {|>|> +// <|function [|{| name: baz, kind: Function |}baz|] () { +// }|> +// } +// } +// } +// } + +// === Details === +(Class) A + (Property) #foo +(Class) B + (Property) #bar +(Function) baz diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline.md deleted file mode 100644 index fca8d5bcfc..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateName.baseline.md +++ /dev/null @@ -1,148 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarPrivateName.ts -class A { - #foo: () => { - class B { - #bar: () => { - function baz () { - } - } - } - } -} -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "#foo", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 6 - } - }, - "children": [] - } - ] - }, - { - "name": "B", - "kind": "Class", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 3, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 10 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "children": [ - { - "name": "#bar", - "kind": "Property", - "range": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 10 - } - }, - "children": [] - } - ] - }, - { - "name": "baz", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 9 - }, - "end": { - "line": 5, - "character": 10 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 18 - }, - "end": { - "line": 4, - "character": 21 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline new file mode 100644 index 0000000000..0f883cf7d0 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline @@ -0,0 +1,19 @@ +// === Document Symbols === +// === /navigationBarPrivateNameMethod.ts === +// <|class [|{| name: A, kind: Class |}A|] { +// <|[|{| name: #foo, kind: Method |}#foo|]() { +// <|class [|{| name: B, kind: Class |}B|] { +// <|[|{| name: #bar, kind: Method |}#bar|]() { +// <|function [|{| name: baz, kind: Function |}baz|] () { +// }|> +// }|> +// }|> +// }|> +// }|> + +// === Details === +(Class) A + (Method) #foo + (Class) B + (Method) #bar + (Function) baz diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline.md deleted file mode 100644 index 2e5aa3e724..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPrivateNameMethod.baseline.md +++ /dev/null @@ -1,150 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarPrivateNameMethod.ts -class A { - #foo() { - class B { - #bar() { - function baz () { - } - } - } - } -} -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 9, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "#foo", - "kind": "Method", - "range": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 8, - "character": 3 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 6 - } - }, - "children": [ - { - "name": "B", - "kind": "Class", - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 7, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 10 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "children": [ - { - "name": "#bar", - "kind": "Method", - "range": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 6, - "character": 7 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 10 - } - }, - "children": [ - { - "name": "baz", - "kind": "Function", - "range": { - "start": { - "line": 4, - "character": 9 - }, - "end": { - "line": 5, - "character": 10 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 18 - }, - "end": { - "line": 4, - "character": 21 - } - }, - "children": [] - } - ] - } - ] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline new file mode 100644 index 0000000000..65f06685c4 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline @@ -0,0 +1,58 @@ +// === Document Symbols === +// === /navigationBarPropertyDeclarations.ts === +// <|class [|{| name: A, kind: Class |}A|] { +// <|public [|{| name: A1, kind: Property |}A1|] = class { +// <|public [|{| name: x, kind: Property |}x|] = 1;|> +// <|private [|{| name: y, kind: Method |}y|]() {}|> +// <|protected [|{| name: z, kind: Method |}z|]() {}|> +// }|> +// +// <|public [|{| name: A2, kind: Property |}A2|] = { +// <|[|{| name: x, kind: Property |}x|]: 1|>, +// <|[|{| name: y, kind: Method |}y|]() {}|>, +// <|[|{| name: z, kind: Method |}z|]() {}|> +// }|> +// +// <|public [|{| name: A3, kind: Property |}A3|] = function () {}|> +// <|public [|{| name: A4, kind: Property |}A4|] = () => {}|> +// <|public [|{| name: A5, kind: Property |}A5|] = 1;|> +// <|public [|{| name: A6, kind: Property |}A6|] = "A6";|> +// +// <|public [|{| name: "A7", kind: Property |}["A7"]|] = class { +// <|public [|{| name: x, kind: Property |}x|] = 1;|> +// <|private [|{| name: y, kind: Method |}y|]() {}|> +// <|protected [|{| name: z, kind: Method |}z|]() {}|> +// }|> +// +// <|public [|{| name: 1, kind: Property |}[1]|] = { +// <|[|{| name: x, kind: Property |}x|]: 1|>, +// <|[|{| name: y, kind: Method |}y|]() {}|>, +// <|[|{| name: z, kind: Method |}z|]() {}|> +// }|> +// +// <|public [|{| name: [1 + 1], kind: Property |}[1 + 1]|] = 1;|> +// }|> + +// === Details === +(Class) A + (Property) A1 + (Property) x + (Method) y + (Method) z + (Property) A2 + (Property) x + (Method) y + (Method) z + (Property) A3 + (Property) A4 + (Property) A5 + (Property) A6 + (Property) "A7" + (Property) x + (Method) y + (Method) z + (Property) 1 + (Property) x + (Method) y + (Method) z + (Property) [1 + 1] diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline.md deleted file mode 100644 index 1f7a2b7e6b..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarPropertyDeclarations.baseline.md +++ /dev/null @@ -1,598 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarPropertyDeclarations.ts -class A { - public A1 = class { - public x = 1; - private y() {} - protected z() {} - } - - public A2 = { - x: 1, - y() {}, - z() {} - } - - public A3 = function () {} - public A4 = () => {} - public A5 = 1; - public A6 = "A6"; - - public ["A7"] = class { - public x = 1; - private y() {} - protected z() {} - } - - public [1] = { - x: 1, - y() {}, - z() {} - } - - public [1 + 1] = 1; -} -``` - -# Symbols - -```json -[ - { - "name": "A", - "kind": "Class", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 31, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 6 - }, - "end": { - "line": 0, - "character": 7 - } - }, - "children": [ - { - "name": "A1", - "kind": "Property", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 5, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 11 - }, - "end": { - "line": 1, - "character": 13 - } - }, - "children": [ - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 2, - "character": 8 - }, - "end": { - "line": 2, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 15 - }, - "end": { - "line": 2, - "character": 16 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Method", - "range": { - "start": { - "line": 3, - "character": 8 - }, - "end": { - "line": 3, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 17 - } - }, - "children": [] - }, - { - "name": "z", - "kind": "Method", - "range": { - "start": { - "line": 4, - "character": 8 - }, - "end": { - "line": 4, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 18 - }, - "end": { - "line": 4, - "character": 19 - } - }, - "children": [] - } - ] - }, - { - "name": "A2", - "kind": "Property", - "range": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 11, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 11 - }, - "end": { - "line": 7, - "character": 13 - } - }, - "children": [ - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 8, - "character": 8 - }, - "end": { - "line": 8, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 8 - }, - "end": { - "line": 8, - "character": 9 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Method", - "range": { - "start": { - "line": 9, - "character": 8 - }, - "end": { - "line": 9, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 9, - "character": 8 - }, - "end": { - "line": 9, - "character": 9 - } - }, - "children": [] - }, - { - "name": "z", - "kind": "Method", - "range": { - "start": { - "line": 10, - "character": 8 - }, - "end": { - "line": 10, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 8 - }, - "end": { - "line": 10, - "character": 9 - } - }, - "children": [] - } - ] - }, - { - "name": "A3", - "kind": "Property", - "range": { - "start": { - "line": 13, - "character": 4 - }, - "end": { - "line": 13, - "character": 30 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 11 - }, - "end": { - "line": 13, - "character": 13 - } - }, - "children": [] - }, - { - "name": "A4", - "kind": "Property", - "range": { - "start": { - "line": 14, - "character": 4 - }, - "end": { - "line": 14, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 11 - }, - "end": { - "line": 14, - "character": 13 - } - }, - "children": [] - }, - { - "name": "A5", - "kind": "Property", - "range": { - "start": { - "line": 15, - "character": 4 - }, - "end": { - "line": 15, - "character": 18 - } - }, - "selectionRange": { - "start": { - "line": 15, - "character": 11 - }, - "end": { - "line": 15, - "character": 13 - } - }, - "children": [] - }, - { - "name": "A6", - "kind": "Property", - "range": { - "start": { - "line": 16, - "character": 4 - }, - "end": { - "line": 16, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 16, - "character": 11 - }, - "end": { - "line": 16, - "character": 13 - } - }, - "children": [] - }, - { - "name": "\"A7\"", - "kind": "Property", - "range": { - "start": { - "line": 18, - "character": 4 - }, - "end": { - "line": 22, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 18, - "character": 11 - }, - "end": { - "line": 18, - "character": 17 - } - }, - "children": [ - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 19, - "character": 8 - }, - "end": { - "line": 19, - "character": 21 - } - }, - "selectionRange": { - "start": { - "line": 19, - "character": 15 - }, - "end": { - "line": 19, - "character": 16 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Method", - "range": { - "start": { - "line": 20, - "character": 8 - }, - "end": { - "line": 20, - "character": 22 - } - }, - "selectionRange": { - "start": { - "line": 20, - "character": 16 - }, - "end": { - "line": 20, - "character": 17 - } - }, - "children": [] - }, - { - "name": "z", - "kind": "Method", - "range": { - "start": { - "line": 21, - "character": 8 - }, - "end": { - "line": 21, - "character": 24 - } - }, - "selectionRange": { - "start": { - "line": 21, - "character": 18 - }, - "end": { - "line": 21, - "character": 19 - } - }, - "children": [] - } - ] - }, - { - "name": "1", - "kind": "Property", - "range": { - "start": { - "line": 24, - "character": 4 - }, - "end": { - "line": 28, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 24, - "character": 11 - }, - "end": { - "line": 24, - "character": 14 - } - }, - "children": [ - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 25, - "character": 8 - }, - "end": { - "line": 25, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 25, - "character": 8 - }, - "end": { - "line": 25, - "character": 9 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Method", - "range": { - "start": { - "line": 26, - "character": 8 - }, - "end": { - "line": 26, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 26, - "character": 8 - }, - "end": { - "line": 26, - "character": 9 - } - }, - "children": [] - }, - { - "name": "z", - "kind": "Method", - "range": { - "start": { - "line": 27, - "character": 8 - }, - "end": { - "line": 27, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 27, - "character": 8 - }, - "end": { - "line": 27, - "character": 9 - } - }, - "children": [] - } - ] - }, - { - "name": "[1 + 1]", - "kind": "Property", - "range": { - "start": { - "line": 30, - "character": 4 - }, - "end": { - "line": 30, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 30, - "character": 11 - }, - "end": { - "line": 30, - "character": 18 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline new file mode 100644 index 0000000000..87dbbdfe75 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline @@ -0,0 +1,24 @@ +// === Document Symbols === +// === /navigationBarVariables.ts === +// var <|[|{| name: x, kind: Variable |}x|] = 0|>; +// let <|[|{| name: y, kind: Variable |}y|] = 1|>; +// const <|[|{| name: z, kind: Variable |}z|] = 2|>; + +// === Details === +(Variable) x +(Variable) y +(Variable) z + + + + +// === Document Symbols === +// === /file2.ts === +// var {<|[|{| name: a, kind: Variable |}a|]|>} = 0; +// let {<|a: [|{| name: b, kind: Variable |}b|]|>} = 0; +// const [<|[|{| name: c, kind: Variable |}c|]|>] = 0; + +// === Details === +(Variable) a +(Variable) b +(Variable) c diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline.md deleted file mode 100644 index 9bce1e9e60..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarVariables.baseline.md +++ /dev/null @@ -1,181 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarVariables.ts -var x = 0; -let y = 1; -const z = 2; -``` - -# Symbols - -```json -[ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 4 - }, - "end": { - "line": 0, - "character": 5 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 4 - }, - "end": { - "line": 1, - "character": 5 - } - }, - "children": [] - }, - { - "name": "z", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 6 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 6 - }, - "end": { - "line": 2, - "character": 7 - } - }, - "children": [] - } -] -``` - - - -// === Document Symbols === -```ts -// @FileName: /file2.ts -var {a} = 0; -let {a: b} = 0; -const [c] = 0; -``` - -# Symbols - -```json -[ - { - "name": "a", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 5 - }, - "end": { - "line": 0, - "character": 6 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 5 - }, - "end": { - "line": 0, - "character": 6 - } - }, - "children": [] - }, - { - "name": "b", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 5 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 8 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Variable", - "range": { - "start": { - "line": 2, - "character": 7 - }, - "end": { - "line": 2, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 7 - }, - "end": { - "line": 2, - "character": 8 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline new file mode 100644 index 0000000000..5072f6d825 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline @@ -0,0 +1,9 @@ +// === Document Symbols === +// === /navigationBarWellKnownSymbolExpando.ts === +// <|function [|{| name: f, kind: Function |}f|]() {}|> +// <|f[[|{| name: Symbol.iterator, kind: Variable |}Symbol.iterator|]]|> = <|[|{| name: , kind: Function |}|]function() {}|> + +// === Details === +(Function) f + (Variable) Symbol.iterator + (Function) diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline.md deleted file mode 100644 index 821054631a..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWellKnownSymbolExpando.baseline.md +++ /dev/null @@ -1,90 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarWellKnownSymbolExpando.ts -function f() {} -f[Symbol.iterator] = function() {} -``` - -# Symbols - -```json -[ - { - "name": "f", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [ - { - "name": "Symbol.iterator", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 18 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 2 - }, - "end": { - "line": 1, - "character": 17 - } - }, - "children": [ - { - "name": "", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 21 - }, - "end": { - "line": 1, - "character": 34 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 21 - }, - "end": { - "line": 1, - "character": 21 - } - }, - "children": [] - } - ] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline new file mode 100644 index 0000000000..ce7541548e --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline @@ -0,0 +1,10 @@ +// === Document Symbols === +// === /navigationBarWithLocalVariables.ts === +// <|function [|{| name: x, kind: Function |}x|](){ +// const <|[|{| name: x, kind: Variable |}x|] = Object()|> +// x.foo = "" +// }|> + +// === Details === +(Function) x + (Variable) x diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline.md deleted file mode 100644 index bfd3136b86..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationBarWithLocalVariables.baseline.md +++ /dev/null @@ -1,66 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationBarWithLocalVariables.ts -function x(){ - const x = Object() - x.foo = "" -} -``` - -# Symbols - -```json -[ - { - "name": "x", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 3, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 10 - } - }, - "children": [ - { - "name": "x", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 7 - }, - "end": { - "line": 1, - "character": 19 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 7 - }, - "end": { - "line": 1, - "character": 8 - } - }, - "children": [] - } - ] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline new file mode 100644 index 0000000000..39a657278e --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline @@ -0,0 +1,53 @@ +// === Document Symbols === +// === /navigationItemsExportDefaultExpression.ts === +// <|[|{| name: default, kind: Function |}|]export default function () {}|> +// <|[|{| name: default, kind: Function |}|]export default function () { +// return <|class [|{| name: Foo, kind: Class |}Foo|] { +// }|> +// }|> +// +// export default <|[|{| name: default, kind: Function |}|]() => ""|> +// export default <|[|{| name: default, kind: Function |}|]() => { +// return <|class [|{| name: Foo, kind: Class |}Foo|] { +// }|> +// }|> +// +// <|export default function [|{| name: f1, kind: Function |}f1|]() {}|> +// <|export default function [|{| name: f2, kind: Function |}f2|]() { +// return <|class [|{| name: Foo, kind: Class |}Foo|] { +// }|> +// }|> +// +// const <|[|{| name: abc, kind: Variable |}abc|] = 12|>; +// export default abc; +// <|export default class [|{| name: AB, kind: Class |}AB|] {}|> +// export default { +// <|[|{| name: a, kind: Property |}a|]: 1|>, +// <|[|{| name: b, kind: Property |}b|]: 1|>, +// <|[|{| name: c, kind: Property |}c|]: { +// <|[|{| name: d, kind: Property |}d|]: 1|> +// }|> +// } +// +// <|function [|{| name: foo, kind: Function |}foo|](props: { x: number; y: number }) {}|> +// export default foo({ <|[|{| name: x, kind: Property |}x|]: 1|>, <|[|{| name: y, kind: Property |}y|]: 1|> }); + +// === Details === +(Function) default +(Function) default + (Class) Foo +(Function) default +(Function) default + (Class) Foo +(Function) f1 +(Function) f2 + (Class) Foo +(Variable) abc +(Class) AB +(Property) a +(Property) b +(Property) c + (Property) d +(Function) foo +(Property) x +(Property) y diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline.md deleted file mode 100644 index fe484e07c9..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportDefaultExpression.baseline.md +++ /dev/null @@ -1,496 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationItemsExportDefaultExpression.ts -export default function () {} -export default function () { - return class Foo { - } -} - -export default () => "" -export default () => { - return class Foo { - } -} - -export default function f1() {} -export default function f2() { - return class Foo { - } -} - -const abc = 12; -export default abc; -export default class AB {} -export default { - a: 1, - b: 1, - c: { - d: 1 - } -} - -function foo(props: { x: number; y: number }) {} -export default foo({ x: 1, y: 1 }); -``` - -# Symbols - -```json -[ - { - "name": "default", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 29 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "children": [] - }, - { - "name": "default", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 0 - } - }, - "children": [ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 2, - "character": 11 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 17 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "children": [] - } - ] - }, - { - "name": "default", - "kind": "Function", - "range": { - "start": { - "line": 6, - "character": 15 - }, - "end": { - "line": 6, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 15 - }, - "end": { - "line": 6, - "character": 15 - } - }, - "children": [] - }, - { - "name": "default", - "kind": "Function", - "range": { - "start": { - "line": 7, - "character": 15 - }, - "end": { - "line": 10, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 15 - }, - "end": { - "line": 7, - "character": 15 - } - }, - "children": [ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 8, - "character": 11 - }, - "end": { - "line": 9, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 17 - }, - "end": { - "line": 8, - "character": 20 - } - }, - "children": [] - } - ] - }, - { - "name": "f1", - "kind": "Function", - "range": { - "start": { - "line": 12, - "character": 0 - }, - "end": { - "line": 12, - "character": 31 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 24 - }, - "end": { - "line": 12, - "character": 26 - } - }, - "children": [] - }, - { - "name": "f2", - "kind": "Function", - "range": { - "start": { - "line": 13, - "character": 0 - }, - "end": { - "line": 16, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 24 - }, - "end": { - "line": 13, - "character": 26 - } - }, - "children": [ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 14, - "character": 11 - }, - "end": { - "line": 15, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 17 - }, - "end": { - "line": 14, - "character": 20 - } - }, - "children": [] - } - ] - }, - { - "name": "abc", - "kind": "Variable", - "range": { - "start": { - "line": 18, - "character": 6 - }, - "end": { - "line": 18, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 18, - "character": 6 - }, - "end": { - "line": 18, - "character": 9 - } - }, - "children": [] - }, - { - "name": "AB", - "kind": "Class", - "range": { - "start": { - "line": 20, - "character": 0 - }, - "end": { - "line": 20, - "character": 26 - } - }, - "selectionRange": { - "start": { - "line": 20, - "character": 21 - }, - "end": { - "line": 20, - "character": 23 - } - }, - "children": [] - }, - { - "name": "a", - "kind": "Property", - "range": { - "start": { - "line": 22, - "character": 4 - }, - "end": { - "line": 22, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 22, - "character": 4 - }, - "end": { - "line": 22, - "character": 5 - } - }, - "children": [] - }, - { - "name": "b", - "kind": "Property", - "range": { - "start": { - "line": 23, - "character": 4 - }, - "end": { - "line": 23, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 23, - "character": 4 - }, - "end": { - "line": 23, - "character": 5 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Property", - "range": { - "start": { - "line": 24, - "character": 4 - }, - "end": { - "line": 26, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 24, - "character": 4 - }, - "end": { - "line": 24, - "character": 5 - } - }, - "children": [ - { - "name": "d", - "kind": "Property", - "range": { - "start": { - "line": 25, - "character": 8 - }, - "end": { - "line": 25, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 25, - "character": 8 - }, - "end": { - "line": 25, - "character": 9 - } - }, - "children": [] - } - ] - }, - { - "name": "foo", - "kind": "Function", - "range": { - "start": { - "line": 29, - "character": 0 - }, - "end": { - "line": 29, - "character": 48 - } - }, - "selectionRange": { - "start": { - "line": 29, - "character": 9 - }, - "end": { - "line": 29, - "character": 12 - } - }, - "children": [] - }, - { - "name": "x", - "kind": "Property", - "range": { - "start": { - "line": 30, - "character": 21 - }, - "end": { - "line": 30, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 30, - "character": 21 - }, - "end": { - "line": 30, - "character": 22 - } - }, - "children": [] - }, - { - "name": "y", - "kind": "Property", - "range": { - "start": { - "line": 30, - "character": 27 - }, - "end": { - "line": 30, - "character": 31 - } - }, - "selectionRange": { - "start": { - "line": 30, - "character": 27 - }, - "end": { - "line": 30, - "character": 28 - } - }, - "children": [] - } -] -``` \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline new file mode 100644 index 0000000000..a576a2bfcb --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline @@ -0,0 +1,56 @@ +// === Document Symbols === +// === /navigationItemsExportEqualsExpression.ts === +// <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]function () {}|]|>|> +// <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]function () { +// return <|class [|{| name: Foo, kind: Class |}Foo|] { +// }|> +// }|]|>|> +// +// <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]() => ""|]|>|> +// <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]() => { +// return <|class [|{| name: Foo, kind: Class |}Foo|] { +// }|> +// }|>|]|> +// +// <|[|{| name: export=, kind: Variable |}export = <|function [|{| name: f1, kind: Function |}f1|]() {}|]|>|> +// <|[|{| name: export=, kind: Variable |}export = <|function [|{| name: f2, kind: Function |}f2|]() { +// return <|class [|{| name: Foo, kind: Class |}Foo|] { +// }|> +// }|>|]|> +// +// const <|[|{| name: abc, kind: Variable |}abc|] = 12|>; +// <|export = [|{| name: export=, kind: Variable |}abc|];|> +// <|[|{| name: export=, kind: Variable |}export = <|class [|{| name: AB, kind: Class |}AB|] {}|>|]|> +// <|[|{| name: export=, kind: Variable |}export = { +// <|[|{| name: a, kind: Property |}a|]: 1|>, +// <|[|{| name: b, kind: Property |}b|]: 1|>, +// <|[|{| name: c, kind: Property |}c|]: { +// <|[|{| name: d, kind: Property |}d|]: 1|> +// }|> +// }|]|> + +// === Details === +(Variable) export= + (Function) export= +(Variable) export= + (Function) export= + (Class) Foo +(Variable) export= + (Function) export= +(Variable) export= + (Function) export= + (Class) Foo +(Variable) export= + (Function) f1 +(Variable) export= + (Function) f2 + (Class) Foo +(Variable) abc +(Variable) export= +(Variable) export= + (Class) AB +(Variable) export= + (Property) a + (Property) b + (Property) c + (Property) d diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline.md b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline.md deleted file mode 100644 index 1271c11e99..0000000000 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline.md +++ /dev/null @@ -1,651 +0,0 @@ -// === Document Symbols === -```ts -// @FileName: /navigationItemsExportEqualsExpression.ts -export = function () {} -export = function () { - return class Foo { - } -} - -export = () => "" -export = () => { - return class Foo { - } -} - -export = function f1() {} -export = function f2() { - return class Foo { - } -} - -const abc = 12; -export = abc; -export = class AB {} -export = { - a: 1, - b: 1, - c: { - d: 1 - } -} -``` - -# Symbols - -```json -[ - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 23 - } - }, - "children": [ - { - "name": "export=", - "kind": "Function", - "range": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 23 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 9 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "children": [] - } - ] - }, - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "children": [ - { - "name": "export=", - "kind": "Function", - "range": { - "start": { - "line": 1, - "character": 9 - }, - "end": { - "line": 4, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 9 - }, - "end": { - "line": 1, - "character": 9 - } - }, - "children": [ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 2, - "character": 11 - }, - "end": { - "line": 3, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 17 - }, - "end": { - "line": 2, - "character": 20 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 6, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 6, - "character": 17 - } - }, - "children": [ - { - "name": "export=", - "kind": "Function", - "range": { - "start": { - "line": 6, - "character": 9 - }, - "end": { - "line": 6, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 9 - }, - "end": { - "line": 6, - "character": 9 - } - }, - "children": [] - } - ] - }, - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 7, - "character": 0 - }, - "end": { - "line": 10, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 0 - }, - "end": { - "line": 10, - "character": 1 - } - }, - "children": [ - { - "name": "export=", - "kind": "Function", - "range": { - "start": { - "line": 7, - "character": 9 - }, - "end": { - "line": 10, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 9 - }, - "end": { - "line": 7, - "character": 9 - } - }, - "children": [ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 8, - "character": 11 - }, - "end": { - "line": 9, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 17 - }, - "end": { - "line": 8, - "character": 20 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 12, - "character": 0 - }, - "end": { - "line": 12, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 0 - }, - "end": { - "line": 12, - "character": 25 - } - }, - "children": [ - { - "name": "f1", - "kind": "Function", - "range": { - "start": { - "line": 12, - "character": 9 - }, - "end": { - "line": 12, - "character": 25 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 18 - }, - "end": { - "line": 12, - "character": 20 - } - }, - "children": [] - } - ] - }, - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 13, - "character": 0 - }, - "end": { - "line": 16, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 0 - }, - "end": { - "line": 16, - "character": 1 - } - }, - "children": [ - { - "name": "f2", - "kind": "Function", - "range": { - "start": { - "line": 13, - "character": 9 - }, - "end": { - "line": 16, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 13, - "character": 18 - }, - "end": { - "line": 13, - "character": 20 - } - }, - "children": [ - { - "name": "Foo", - "kind": "Class", - "range": { - "start": { - "line": 14, - "character": 11 - }, - "end": { - "line": 15, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 17 - }, - "end": { - "line": 14, - "character": 20 - } - }, - "children": [] - } - ] - } - ] - }, - { - "name": "abc", - "kind": "Variable", - "range": { - "start": { - "line": 18, - "character": 6 - }, - "end": { - "line": 18, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 18, - "character": 6 - }, - "end": { - "line": 18, - "character": 9 - } - }, - "children": [] - }, - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 19, - "character": 0 - }, - "end": { - "line": 19, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 19, - "character": 9 - }, - "end": { - "line": 19, - "character": 12 - } - }, - "children": [] - }, - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 20, - "character": 0 - }, - "end": { - "line": 20, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 20, - "character": 0 - }, - "end": { - "line": 20, - "character": 20 - } - }, - "children": [ - { - "name": "AB", - "kind": "Class", - "range": { - "start": { - "line": 20, - "character": 9 - }, - "end": { - "line": 20, - "character": 20 - } - }, - "selectionRange": { - "start": { - "line": 20, - "character": 15 - }, - "end": { - "line": 20, - "character": 17 - } - }, - "children": [] - } - ] - }, - { - "name": "export=", - "kind": "Variable", - "range": { - "start": { - "line": 21, - "character": 0 - }, - "end": { - "line": 27, - "character": 1 - } - }, - "selectionRange": { - "start": { - "line": 21, - "character": 0 - }, - "end": { - "line": 27, - "character": 1 - } - }, - "children": [ - { - "name": "a", - "kind": "Property", - "range": { - "start": { - "line": 22, - "character": 4 - }, - "end": { - "line": 22, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 22, - "character": 4 - }, - "end": { - "line": 22, - "character": 5 - } - }, - "children": [] - }, - { - "name": "b", - "kind": "Property", - "range": { - "start": { - "line": 23, - "character": 4 - }, - "end": { - "line": 23, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 23, - "character": 4 - }, - "end": { - "line": 23, - "character": 5 - } - }, - "children": [] - }, - { - "name": "c", - "kind": "Property", - "range": { - "start": { - "line": 24, - "character": 4 - }, - "end": { - "line": 26, - "character": 5 - } - }, - "selectionRange": { - "start": { - "line": 24, - "character": 4 - }, - "end": { - "line": 24, - "character": 5 - } - }, - "children": [ - { - "name": "d", - "kind": "Property", - "range": { - "start": { - "line": 25, - "character": 8 - }, - "end": { - "line": 25, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 25, - "character": 8 - }, - "end": { - "line": 25, - "character": 9 - } - }, - "children": [] - } - ] - } - ] - } -] -``` \ No newline at end of file From 4ac78dc62ab2be6ca71eb5d5bbdbf50a1b8eade1 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 5 Dec 2025 22:57:54 +0000 Subject: [PATCH 09/10] properly sort baseline details --- internal/fourslash/baselineutil.go | 120 +++++++++++++----- ...gationItemsExportEqualsExpression.baseline | 6 +- 2 files changed, 89 insertions(+), 37 deletions(-) diff --git a/internal/fourslash/baselineutil.go b/internal/fourslash/baselineutil.go index 54fe0967df..cc4643eba2 100644 --- a/internal/fourslash/baselineutil.go +++ b/internal/fourslash/baselineutil.go @@ -473,11 +473,49 @@ func (f *FourslashTest) textOfFile(fileName string) (string, bool) { return f.vfs.ReadFile(fileName) } +type detailKind int + +const ( + detailKindMarker detailKind = iota // /*MARKER*/ + detailKindContextStart // <| + detailKindTextStart // [| + detailKindTextEnd // |] + detailKindContextEnd // |> +) + +func (k detailKind) isEnd() bool { + return k == detailKindContextEnd || k == detailKindTextEnd +} + +func (k detailKind) isStart() bool { + return k == detailKindContextStart || k == detailKindTextStart +} + type baselineDetail struct { pos lsproto.Position positionMarker string span *documentSpan - kind string + kind detailKind +} + +func (d *baselineDetail) getRange() lsproto.Range { + switch d.kind { + case detailKindContextStart: + return *d.span.contextSpan + case detailKindContextEnd: + return *d.span.contextSpan + case detailKindTextStart: + return d.span.textSpan + case detailKindTextEnd: + return d.span.textSpan + case detailKindMarker: + return lsproto.Range{ + Start: d.pos, + End: d.pos, + } + default: + panic("unknown detail kind") + } } func (f *FourslashTest) getBaselineContentForFile( @@ -505,7 +543,7 @@ func (f *FourslashTest) getBaselineContentForFile( pos: span.contextSpan.Start, positionMarker: "<|", span: &span, - kind: "contextStart", + kind: detailKindContextStart, }) // Check if context span starts after text span @@ -520,8 +558,8 @@ func (f *FourslashTest) getBaselineContentForFile( startMarker += options.getLocationData(span) } details = append(details, - &baselineDetail{pos: span.textSpan.Start, positionMarker: startMarker, span: &span, kind: "textStart"}, - &baselineDetail{pos: span.textSpan.End, positionMarker: core.OrElse(options.endMarker, "|]"), span: &span, kind: "textEnd"}, + &baselineDetail{pos: span.textSpan.Start, positionMarker: startMarker, span: &span, kind: detailKindTextStart}, + &baselineDetail{pos: span.textSpan.End, positionMarker: core.OrElse(options.endMarker, "|]"), span: &span, kind: detailKindTextEnd}, ) if span.contextSpan != nil { @@ -529,7 +567,7 @@ func (f *FourslashTest) getBaselineContentForFile( pos: span.contextSpan.End, positionMarker: "|>", span: &span, - kind: "contextEnd", + kind: detailKindContextEnd, }) } @@ -567,37 +605,51 @@ func (f *FourslashTest) getBaselineContentForFile( } } + // Our preferred way to write markers is + // /*MARKER*/[| some text |] + // [| some /*MARKER*/ text |] + // [| some text |]/*MARKER*/ slices.SortStableFunc(details, func(d1, d2 *baselineDetail) int { - return lsproto.ComparePositions(d1.pos, d2.pos) + c := lsproto.ComparePositions(d1.pos, d2.pos) + if c != 0 || d1.kind == detailKindMarker && d2.kind == detailKindMarker { + return c + } + + // /*MARKER*/[| some text |] + if d1.kind == detailKindMarker && d2.kind.isStart() { + return -1 + } + if d2.kind == detailKindMarker && d1.kind.isStart() { + return 1 + } + + // [| some text |]/*MARKER*/ + if d1.kind == detailKindMarker && d2.kind.isEnd() { + return 1 + } + if d2.kind == detailKindMarker && d1.kind.isEnd() { + return -1 + } + + // [||] or <||> + if d1.span == d2.span { + return int(d1.kind - d2.kind) + } + + // ...|><|... + if d1.kind.isStart() && d2.kind.isEnd() { + return 1 + } + if d1.kind.isEnd() && d2.kind.isStart() { + return -1 + } + + return 0 }) // !!! if canDetermineContextIdInline textWithContext := newTextWithContext(fileName, content) - - // Our preferred way to write marker is - // /*MARKER*/[| some text |] - // [| some /*MARKER*/ text |] - // [| some text |]/*MARKER*/ - // Stable sort should handle first two cases but with that marker will be before rangeEnd if locations match - // So we will defer writing marker in this case by checking and finding index of rangeEnd if same - var deferredMarkerIndex *int - for index, detail := range details { - if detail.span == nil && deferredMarkerIndex == nil { - // If this is marker position and its same as textEnd and/or contextEnd we want to write marker after those - for matchingEndPosIndex := index + 1; matchingEndPosIndex < len(details); matchingEndPosIndex++ { - // Defer after the location if its same as rangeEnd - if details[matchingEndPosIndex].pos == detail.pos && strings.HasSuffix(details[matchingEndPosIndex].kind, "End") { - deferredMarkerIndex = ptrTo(matchingEndPosIndex) - } - // Dont defer further than already determined - break - } - // Defer writing marker position to deffered marker index - if deferredMarkerIndex != nil { - continue - } - } textWithContext.add(detail) textWithContext.pos = detail.pos // Prefix @@ -608,13 +660,13 @@ func (f *FourslashTest) getBaselineContentForFile( textWithContext.newContent.WriteString(detail.positionMarker) if detail.span != nil { switch detail.kind { - case "textStart": + case detailKindTextStart: var text string if contextId, ok := spanToContextId[*detail.span]; ok { isAfterContextStart := false for textStartIndex := index - 1; textStartIndex >= 0; textStartIndex-- { textStartDetail := details[textStartIndex] - if textStartDetail.kind == "contextStart" && textStartDetail.span == detail.span { + if textStartDetail.kind == detailKindContextStart && textStartDetail.span == detail.span { isAfterContextStart = true break } @@ -635,7 +687,7 @@ func (f *FourslashTest) getBaselineContentForFile( if text != "" { textWithContext.newContent.WriteString(`{ ` + text + ` |}`) } - case "contextStart": + case detailKindContextStart: if canDetermineContextIdInline { spanToContextId[*detail.span] = len(spanToContextId) } @@ -715,7 +767,7 @@ func (t *textWithContext) add(detail *baselineDetail) { if t.content == "" && detail == nil { panic("Unsupported") } - if detail == nil || (detail.kind != "textEnd" && detail.kind != "contextEnd") { + if detail == nil || (detail.kind != detailKindTextEnd && detail.kind != detailKindContextEnd) { // Calculate pos to location number of lines posLineIndex := t.lineInfo if t.posInfo == nil || *t.posInfo != t.pos { diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline index a576a2bfcb..4b7ff00e47 100644 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline @@ -6,17 +6,17 @@ // }|> // }|]|>|> // -// <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]() => ""|]|>|> +// <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]() => ""|>|]|> // <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]() => { // return <|class [|{| name: Foo, kind: Class |}Foo|] { // }|> -// }|>|]|> +// }|]|>|> // // <|[|{| name: export=, kind: Variable |}export = <|function [|{| name: f1, kind: Function |}f1|]() {}|]|>|> // <|[|{| name: export=, kind: Variable |}export = <|function [|{| name: f2, kind: Function |}f2|]() { // return <|class [|{| name: Foo, kind: Class |}Foo|] { // }|> -// }|>|]|> +// }|]|>|> // // const <|[|{| name: abc, kind: Variable |}abc|] = 12|>; // <|export = [|{| name: export=, kind: Variable |}abc|];|> From 3333305b2f84ea38399f8a3acd9f8a4e77e08a0a Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 5 Dec 2025 23:15:31 +0000 Subject: [PATCH 10/10] now actually sort details properly --- internal/fourslash/baselineutil.go | 25 +++++++++++++------ ...gationItemsExportEqualsExpression.baseline | 10 ++++---- ...itionSignatureAlias_require.baseline.jsonc | 4 +-- ...SignatureAlias_require.baseline.jsonc.diff | 4 +-- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/internal/fourslash/baselineutil.go b/internal/fourslash/baselineutil.go index cc4643eba2..1e8e488380 100644 --- a/internal/fourslash/baselineutil.go +++ b/internal/fourslash/baselineutil.go @@ -644,6 +644,24 @@ func (f *FourslashTest) getBaselineContentForFile( return -1 } + // <| ... [| ... |]|> + if d1.kind.isEnd() && d2.kind.isEnd() { + c := lsproto.ComparePositions(d2.getRange().Start, d1.getRange().Start) + if c != 0 { + return c + } + return int(d1.kind - d2.kind) + } + + // <|[| ... |] ... |> + if d1.kind.isStart() && d2.kind.isStart() { + c := lsproto.ComparePositions(d2.getRange().End, d2.getRange().End) + if c != 0 { + return c + } + return int(d1.kind - d2.kind) + } + return 0 }) // !!! if canDetermineContextIdInline @@ -692,13 +710,6 @@ func (f *FourslashTest) getBaselineContentForFile( spanToContextId[*detail.span] = len(spanToContextId) } } - - if deferredMarkerIndex != nil && *deferredMarkerIndex == index { - // Write the marker - textWithContext.newContent.WriteString(options.markerName) - deferredMarkerIndex = nil - detail = details[0] // Marker detail - } } if suffix, ok := detailSuffixes[detail]; ok { textWithContext.newContent.WriteString(suffix) diff --git a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline index 4b7ff00e47..1055eab22b 100644 --- a/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline +++ b/testdata/baselines/reference/fourslash/documentSymbols/navigationItemsExportEqualsExpression.baseline @@ -1,22 +1,22 @@ // === Document Symbols === // === /navigationItemsExportEqualsExpression.ts === -// <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]function () {}|]|>|> +// <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]function () {}|>|]|> // <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]function () { // return <|class [|{| name: Foo, kind: Class |}Foo|] { // }|> -// }|]|>|> +// }|>|]|> // // <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]() => ""|>|]|> // <|[|{| name: export=, kind: Variable |}export = <|[|{| name: export=, kind: Function |}|]() => { // return <|class [|{| name: Foo, kind: Class |}Foo|] { // }|> -// }|]|>|> +// }|>|]|> // -// <|[|{| name: export=, kind: Variable |}export = <|function [|{| name: f1, kind: Function |}f1|]() {}|]|>|> +// <|[|{| name: export=, kind: Variable |}export = <|function [|{| name: f1, kind: Function |}f1|]() {}|>|]|> // <|[|{| name: export=, kind: Variable |}export = <|function [|{| name: f2, kind: Function |}f2|]() { // return <|class [|{| name: Foo, kind: Class |}Foo|] { // }|> -// }|]|>|> +// }|>|]|> // // const <|[|{| name: abc, kind: Variable |}abc|] = 12|>; // <|export = [|{| name: export=, kind: Variable |}abc|];|> diff --git a/testdata/baselines/reference/submodule/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc index 44fa8c0917..556862928d 100644 --- a/testdata/baselines/reference/submodule/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc @@ -1,6 +1,6 @@ // === goToDefinition === // === /a.js === -// [|module.exports = <|function [|f|]() {}|]|> +// [|module.exports = <|function [|f|]() {}|>|] // === /b.js === // const f = require("./a"); @@ -10,7 +10,7 @@ // === goToDefinition === // === /a.js === -// [|module.exports = <|function [|f|]() {}|]|> +// [|module.exports = <|function [|f|]() {}|>|] // === /bar.ts === // import f = require("./a"); diff --git a/testdata/baselines/reference/submodule/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc.diff index a66791c13b..e544b7cc1c 100644 --- a/testdata/baselines/reference/submodule/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc.diff +++ b/testdata/baselines/reference/submodule/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc.diff @@ -4,7 +4,7 @@ // === goToDefinition === // === /a.js === -// module.exports = <|function [|f|]() {}|> -+// [|module.exports = <|function [|f|]() {}|]|> ++// [|module.exports = <|function [|f|]() {}|>|] // === /b.js === // const f = require("./a"); @@ -13,7 +13,7 @@ // === goToDefinition === // === /a.js === -// module.exports = <|function [|f|]() {}|> -+// [|module.exports = <|function [|f|]() {}|]|> ++// [|module.exports = <|function [|f|]() {}|>|] // === /bar.ts === // import f = require("./a"); \ No newline at end of file