diff --git a/internal/bundled/embed.go b/internal/bundled/embed.go index cf92102db3..184bc76ccb 100644 --- a/internal/bundled/embed.go +++ b/internal/bundled/embed.go @@ -22,6 +22,11 @@ func libPath() string { return scheme + "libs" } +func IsBundled(path string) bool { + _, ok := splitPath(path) + return ok +} + // wrappedFS is implemented directly rather than going through [io/fs.FS]. // Our vfs.FS works with file contents in terms of strings, and that's // what go:embed does under the hood, but going through fs.FS will cause diff --git a/internal/bundled/noembed.go b/internal/bundled/noembed.go index 5ca2a9676b..39b204b450 100644 --- a/internal/bundled/noembed.go +++ b/internal/bundled/noembed.go @@ -42,3 +42,7 @@ var libPath = sync.OnceValue(func() string { return dir }) + +func IsBundled(path string) bool { + return false +} diff --git a/internal/checker/nodebuilder.go b/internal/checker/nodebuilder.go index 484c5abfc5..0bab537060 100644 --- a/internal/checker/nodebuilder.go +++ b/internal/checker/nodebuilder.go @@ -177,10 +177,19 @@ func (b *NodeBuilder) TypeToTypeNode(typ *Type, enclosingDeclaration *ast.Node, // var _ NodeBuilderInterface = NewNodeBuilderAPI(nil, nil) func NewNodeBuilder(ch *Checker, e *printer.EmitContext) *NodeBuilder { - impl := newNodeBuilderImpl(ch, e) + return NewNodeBuilderEx(ch, e, nil /*idToSymbol*/) +} + +func NewNodeBuilderEx(ch *Checker, e *printer.EmitContext, idToSymbol map[*ast.IdentifierNode]*ast.Symbol) *NodeBuilder { + impl := newNodeBuilderImpl(ch, e, idToSymbol) return &NodeBuilder{impl: impl, ctxStack: make([]*NodeBuilderContext, 0, 1), basicHost: ch.program} } func (c *Checker) getNodeBuilder() *NodeBuilder { - return NewNodeBuilder(c, printer.NewEmitContext()) + return c.getNodeBuilderEx(nil /*idToSymbol*/) +} + +func (c *Checker) getNodeBuilderEx(idToSymbol map[*ast.IdentifierNode]*ast.Symbol) *NodeBuilder { + b := NewNodeBuilderEx(c, printer.NewEmitContext(), idToSymbol) + return b } diff --git a/internal/checker/nodebuilderimpl.go b/internal/checker/nodebuilderimpl.go index 1fb4c35794..0bf33aac03 100644 --- a/internal/checker/nodebuilderimpl.go +++ b/internal/checker/nodebuilderimpl.go @@ -98,6 +98,9 @@ type NodeBuilderImpl struct { // reusable visitor cloneBindingNameVisitor *ast.NodeVisitor + + // symbols for synthesized identifiers, needed for e.g. inlay hints + idToSymbol map[*ast.IdentifierNode]*ast.Symbol } const ( @@ -107,8 +110,11 @@ const ( // Node builder utility functions -func newNodeBuilderImpl(ch *Checker, e *printer.EmitContext) *NodeBuilderImpl { - b := &NodeBuilderImpl{f: e.Factory.AsNodeFactory(), ch: ch, e: e} +func newNodeBuilderImpl(ch *Checker, e *printer.EmitContext, idToSymbol map[*ast.IdentifierNode]*ast.Symbol) *NodeBuilderImpl { + if idToSymbol == nil { + idToSymbol = make(map[*ast.IdentifierNode]*ast.Symbol) + } + b := &NodeBuilderImpl{f: e.Factory.AsNodeFactory(), ch: ch, e: e, idToSymbol: idToSymbol} b.cloneBindingNameVisitor = ast.NewNodeVisitor(b.cloneBindingName, b.f, ast.NodeVisitorHooks{}) return b } @@ -482,7 +488,7 @@ func (b *NodeBuilderImpl) createEntityNameFromSymbolChain(chain []*ast.Symbol, i b.ctx.flags ^= nodebuilder.FlagsInInitialEntityName } - identifier := b.f.NewIdentifier(symbolName) + identifier := b.newIdentifier(symbolName, symbol) b.e.AddEmitFlags(identifier, printer.EFNoAsciiEscaping) // !!! TODO: smuggle type arguments out // if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); @@ -499,7 +505,7 @@ func (b *NodeBuilderImpl) createEntityNameFromSymbolChain(chain []*ast.Symbol, i // TODO: Audit usages of symbolToEntityNameNode - they should probably all be symbolToName func (b *NodeBuilderImpl) symbolToEntityNameNode(symbol *ast.Symbol) *ast.EntityName { - identifier := b.f.NewIdentifier(symbol.Name) + identifier := b.newIdentifier(symbol.Name, symbol) if symbol.Parent != nil { return b.f.NewQualifiedName(b.symbolToEntityNameNode(symbol.Parent), identifier) } @@ -701,7 +707,7 @@ func (b *NodeBuilderImpl) createAccessFromSymbolChain(chain []*ast.Symbol, index ) } - identifier := b.f.NewIdentifier(symbolName) + identifier := b.newIdentifier(symbolName, symbol) b.e.AddEmitFlags(identifier, printer.EFNoAsciiEscaping) // !!! TODO: smuggle type arguments out // if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); @@ -740,7 +746,7 @@ func (b *NodeBuilderImpl) createExpressionFromSymbolChain(chain []*ast.Symbol, i } if index == 0 || canUsePropertyAccess(symbolName) { - identifier := b.f.NewIdentifier(symbolName) + identifier := b.newIdentifier(symbolName, symbol) b.e.AddEmitFlags(identifier, printer.EFNoAsciiEscaping) // !!! TODO: smuggle type arguments out // if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); @@ -764,7 +770,7 @@ func (b *NodeBuilderImpl) createExpressionFromSymbolChain(chain []*ast.Symbol, i expression = b.f.NewNumericLiteral(symbolName, ast.TokenFlagsNone) } if expression == nil { - expression = b.f.NewIdentifier(symbolName) + expression = b.newIdentifier(symbolName, symbol) b.e.AddEmitFlags(expression, printer.EFNoAsciiEscaping) // !!! TODO: smuggle type arguments out // if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); @@ -1252,7 +1258,11 @@ func (b *NodeBuilderImpl) setTextRange(range_ *ast.Node, location *ast.Node) *as return range_ } if !ast.NodeIsSynthesized(range_) || (range_.Flags&ast.NodeFlagsSynthesized == 0) || b.ctx.enclosingFile == nil || b.ctx.enclosingFile != ast.GetSourceFileOfNode(b.e.MostOriginal(range_)) { + original := range_ range_ = range_.Clone(b.f) // if `range` is synthesized or originates in another file, copy it so it definitely has synthetic positions + if symbol, ok := b.idToSymbol[original]; ok { + b.idToSymbol[range_] = symbol + } } if range_ == location || location == nil { return range_ @@ -1327,7 +1337,7 @@ func (b *NodeBuilderImpl) typeParameterToName(typeParameter *Type) *ast.Identifi if text != rawText { // !!! TODO: smuggle type arguments out // const typeArguments = getIdentifierTypeArguments(result); - result = b.f.NewIdentifier(text) + result = b.newIdentifier(text, typeParameter.symbol) // setIdentifierTypeArguments(result, typeArguments); } @@ -1584,7 +1594,7 @@ func (b *NodeBuilderImpl) symbolToParameterDeclaration(parameterSymbol *ast.Symb func (b *NodeBuilderImpl) parameterToParameterDeclarationName(parameterSymbol *ast.Symbol, parameterDeclaration *ast.Node) *ast.Node { if parameterDeclaration == nil || parameterDeclaration.Name() == nil { - return b.f.NewIdentifier(parameterSymbol.Name) + return b.newIdentifier(parameterSymbol.Name, parameterSymbol) } name := parameterDeclaration.Name() @@ -1592,10 +1602,12 @@ func (b *NodeBuilderImpl) parameterToParameterDeclarationName(parameterSymbol *a case ast.KindIdentifier: cloned := b.f.DeepCloneNode(name) b.e.SetEmitFlags(cloned, printer.EFNoAsciiEscaping) + b.idToSymbol[cloned] = parameterSymbol return cloned case ast.KindQualifiedName: cloned := b.f.DeepCloneNode(name.AsQualifiedName().Right) b.e.SetEmitFlags(cloned, printer.EFNoAsciiEscaping) + b.idToSymbol[cloned] = parameterSymbol return cloned default: return b.cloneBindingName(name) @@ -1667,7 +1679,7 @@ func (b *NodeBuilderImpl) typePredicateToTypePredicateNodeHelper(typePredicate * } var parameterName *ast.Node if typePredicate.kind == TypePredicateKindIdentifier || typePredicate.kind == TypePredicateKindAssertsIdentifier { - parameterName = b.f.NewIdentifier(typePredicate.parameterName) + parameterName = b.newIdentifier(typePredicate.parameterName, nil /*symbol*/) b.e.SetEmitFlags(parameterName, printer.EFNoAsciiEscaping) } else { parameterName = b.f.NewThisTypeNode() @@ -1950,7 +1962,7 @@ func (b *NodeBuilderImpl) indexInfoToIndexSignatureDeclarationHelper(indexInfo * name := getNameFromIndexInfo(indexInfo) indexerTypeNode := b.typeToTypeNode(indexInfo.keyType) - indexingParameter := b.f.NewParameterDeclaration(nil, nil, b.f.NewIdentifier(name), nil, indexerTypeNode, nil) + indexingParameter := b.f.NewParameterDeclaration(nil, nil, b.newIdentifier(name, nil /*symbol*/), nil, indexerTypeNode, nil) if typeNode == nil { if indexInfo.valueType == nil { typeNode = b.f.NewKeywordTypeNode(ast.KindAnyKeyword) @@ -2082,10 +2094,10 @@ func (b *NodeBuilderImpl) trackComputedName(accessExpression *ast.Node, enclosin } } -func (b *NodeBuilderImpl) createPropertyNameNodeForIdentifierOrLiteral(name string, singleQuote bool, stringNamed bool, isMethod bool) *ast.Node { +func (b *NodeBuilderImpl) createPropertyNameNodeForIdentifierOrLiteral(name string, singleQuote bool, stringNamed bool, isMethod bool, symbol *ast.Symbol) *ast.Node { isMethodNamedNew := isMethod && name == "new" if !isMethodNamedNew && scanner.IsIdentifierText(name, core.LanguageVariantStandard) { - return b.f.NewIdentifier(name) + return b.newIdentifier(name, symbol) } if !stringNamed && !isMethodNamedNew && isNumericLiteralName(name) && jsnum.FromString(name) >= 0 { return b.f.NewNumericLiteral(name, ast.TokenFlagsNone) @@ -2133,7 +2145,7 @@ func (b *NodeBuilderImpl) getPropertyNameNodeForSymbol(symbol *ast.Symbol) *ast. name = "__#private" + name } - return b.createPropertyNameNodeForIdentifierOrLiteral(name, singleQuote, stringNamed, isMethod) + return b.createPropertyNameNodeForIdentifierOrLiteral(name, singleQuote, stringNamed, isMethod, symbol) } // See getNameForSymbolFromNameType for a stringy equivalent @@ -2160,7 +2172,7 @@ func (b *NodeBuilderImpl) getPropertyNameNodeForSymbolFromNameType(symbol *ast.S if isNumericLiteralName(name) && name[0] == '-' { return b.f.NewComputedPropertyName(b.f.NewPrefixUnaryExpression(ast.KindMinusToken, b.f.NewNumericLiteral(name[1:], ast.TokenFlagsNone))) } - return b.createPropertyNameNodeForIdentifierOrLiteral(name, singleQuote, stringNamed, isMethod) + return b.createPropertyNameNodeForIdentifierOrLiteral(name, singleQuote, stringNamed, isMethod, symbol) } if nameType.flags&TypeFlagsUniqueESSymbol != 0 { return b.f.NewComputedPropertyName(b.symbolToExpression(nameType.AsUniqueESSymbolType().symbol, ast.SymbolFlagsValue)) @@ -2596,7 +2608,10 @@ func (b *NodeBuilderImpl) typeReferenceToTypeNode(t *Type) *ast.TypeNode { if t.Target() == b.ch.globalArrayType || t.Target() == b.ch.globalReadonlyArrayType { if b.ctx.flags&nodebuilder.FlagsWriteArrayAsGenericType != 0 { typeArgumentNode := b.typeToTypeNode(typeArguments[0]) - return b.f.NewTypeReferenceNode(b.f.NewIdentifier(core.IfElse(t.Target() == b.ch.globalArrayType, "Array", "ReadonlyArray")), b.f.NewNodeList([]*ast.TypeNode{typeArgumentNode})) + return b.f.NewTypeReferenceNode( + b.newIdentifier(core.IfElse(t.Target() == b.ch.globalArrayType, "Array", "ReadonlyArray"), t.Target().symbol), + b.f.NewNodeList([]*ast.TypeNode{typeArgumentNode}), + ) } elementType := b.typeToTypeNode(typeArguments[0]) arrayType := b.f.NewArrayTypeNode(elementType) @@ -2622,7 +2637,12 @@ func (b *NodeBuilderImpl) typeReferenceToTypeNode(t *Type) *ast.TypeNode { labeledElementDeclaration := t.Target().AsTupleType().elementInfos[i].labeledDeclaration if labeledElementDeclaration != nil { - tupleConstituentNodes.Nodes[i] = b.f.NewNamedTupleMember(core.IfElse(flags&ElementFlagsVariable != 0, b.f.NewToken(ast.KindDotDotDotToken), nil), b.f.NewIdentifier(b.ch.getTupleElementLabel(t.Target().AsTupleType().elementInfos[i], nil, i)), core.IfElse(flags&ElementFlagsOptional != 0, b.f.NewToken(ast.KindQuestionToken), nil), core.IfElse(flags&ElementFlagsRest != 0, b.f.NewArrayTypeNode(tupleConstituentNodes.Nodes[i]), tupleConstituentNodes.Nodes[i])) + tupleConstituentNodes.Nodes[i] = b.f.NewNamedTupleMember( + core.IfElse(flags&ElementFlagsVariable != 0, b.f.NewToken(ast.KindDotDotDotToken), nil), + b.newIdentifier(b.ch.getTupleElementLabel(t.Target().AsTupleType().elementInfos[i], nil, i), nil /*symbol*/), + core.IfElse(flags&ElementFlagsOptional != 0, b.f.NewToken(ast.KindQuestionToken), nil), + core.IfElse(flags&ElementFlagsRest != 0, b.f.NewArrayTypeNode(tupleConstituentNodes.Nodes[i]), tupleConstituentNodes.Nodes[i]), + ) } else { switch { case flags&ElementFlagsVariable != 0: @@ -2997,7 +3017,7 @@ func (b *NodeBuilderImpl) typeToTypeNode(t *Type) *ast.TypeNode { if b.ctx.flags&nodebuilder.FlagsGenerateNamesForShadowedTypeParams != 0 && t.flags&TypeFlagsTypeParameter != 0 { name := b.typeParameterToName(t) b.ctx.approximateLength += len(name.Text) - return b.f.NewTypeReferenceNode(b.f.NewIdentifier(name.Text), nil /*typeArguments*/) + return b.f.NewTypeReferenceNode(b.newIdentifier(name.Text, t.symbol), nil /*typeArguments*/) } // Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter. if t.symbol != nil { @@ -3009,7 +3029,7 @@ func (b *NodeBuilderImpl) typeToTypeNode(t *Type) *ast.TypeNode { } else { name = "?" } - return b.f.NewTypeReferenceNode(b.f.NewIdentifier(name), nil /*typeArguments*/) + return b.f.NewTypeReferenceNode(b.newIdentifier(name, nil /*symbol*/), nil /*typeArguments*/) } if t.flags&TypeFlagsUnion != 0 && t.AsUnionType().origin != nil { t = t.AsUnionType().origin @@ -3113,3 +3133,11 @@ func (b *NodeBuilderImpl) newStringLiteralEx(text string, isSingleQuote bool) *a func (t *TypeAlias) ToTypeReferenceNode(b *NodeBuilderImpl) *ast.Node { return b.f.NewTypeReferenceNode(b.symbolToEntityNameNode(t.Symbol()), b.mapToTypeNodes(t.TypeArguments(), false /*isBareList*/)) } + +func (b *NodeBuilderImpl) newIdentifier(text string, symbol *ast.Symbol) *ast.Node { + id := b.f.NewIdentifier(text) + if symbol != nil { + b.idToSymbol[id] = symbol + } + return id +} diff --git a/internal/checker/printer.go b/internal/checker/printer.go index f7c231650a..b24dd378fc 100644 --- a/internal/checker/printer.go +++ b/internal/checker/printer.go @@ -373,12 +373,12 @@ func (c *Checker) formatUnionTypes(types []*Type) []*Type { return result } -func (c *Checker) TypeToTypeNode(t *Type, enclosingDeclaration *ast.Node, flags nodebuilder.Flags) *ast.TypeNode { - nodeBuilder := c.getNodeBuilder() +func (c *Checker) TypeToTypeNode(t *Type, enclosingDeclaration *ast.Node, flags nodebuilder.Flags, idToSymbol map[*ast.IdentifierNode]*ast.Symbol) *ast.TypeNode { + nodeBuilder := c.getNodeBuilderEx(idToSymbol) return nodeBuilder.TypeToTypeNode(t, enclosingDeclaration, flags, nodebuilder.InternalFlagsNone, nil) } -func (c *Checker) TypePredicateToTypePredicateNode(t *TypePredicate, enclosingDeclaration *ast.Node, flags nodebuilder.Flags) *ast.TypePredicateNodeNode { - nodeBuilder := c.getNodeBuilder() +func (c *Checker) TypePredicateToTypePredicateNode(t *TypePredicate, enclosingDeclaration *ast.Node, flags nodebuilder.Flags, idToSymbol map[*ast.IdentifierNode]*ast.Symbol) *ast.TypePredicateNodeNode { + nodeBuilder := c.getNodeBuilderEx(idToSymbol) return nodeBuilder.TypePredicateToTypePredicateNode(t, enclosingDeclaration, flags, nodebuilder.InternalFlagsNone, nil) } diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index ab9ddec985..e8d54139e4 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -3450,12 +3450,13 @@ func (f *FourslashTest) VerifyBaselineInlayHints( annotations = core.Map(*result.InlayHints, func(hint *lsproto.InlayHint) string { if hint.Label.InlayHintLabelParts != nil { for _, part := range *hint.Label.InlayHintLabelParts { + // Avoid diffs caused by lib file updates. if part.Location != nil && isLibFile(part.Location.Uri.FileName()) { part.Location.Range.Start = lsproto.Position{Line: 0, Character: 0} + part.Location.Range.End = lsproto.Position{Line: 0, Character: 0} } } } - underline := strings.Repeat(" ", int(hint.Position.Character)) + "^" hintJson, err := core.StringifyJson(hint, "", " ") if err != nil { diff --git a/internal/fourslash/tests/inlayHintsIdentifierLocation_test.go b/internal/fourslash/tests/inlayHintsIdentifierLocation_test.go new file mode 100644 index 0000000000..676304fc62 --- /dev/null +++ b/internal/fourslash/tests/inlayHintsIdentifierLocation_test.go @@ -0,0 +1,20 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/ls/lsutil" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestInlayHintsIdentifierLocation(t *testing.T) { + fourslash.SkipIfFailing(t) + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `interface Foo {} +const p = (a: Foo[]) => a;` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) +} diff --git a/internal/ls/completions.go b/internal/ls/completions.go index e8e7003b36..cec71e9d84 100644 --- a/internal/ls/completions.go +++ b/internal/ls/completions.go @@ -2483,20 +2483,6 @@ func strPtrTo(v string) *string { return &v } -func ptrIsTrue(ptr *bool) bool { - if ptr == nil { - return false - } - return *ptr -} - -func ptrIsFalse(ptr *bool) bool { - if ptr == nil { - return false - } - return !*ptr -} - func boolToPtr(v bool) *bool { if v { return ptrTo(true) @@ -5902,7 +5888,12 @@ func getJSDocParamAnnotation( nodebuilder.FlagsUseSingleQuotesForStringLiteralType, nodebuilder.FlagsNone, ) - typeNode := typeChecker.TypeToTypeNode(inferredType, ast.FindAncestor(initializer, ast.IsFunctionLike), builderFlags) + typeNode := typeChecker.TypeToTypeNode( + inferredType, + ast.FindAncestor(initializer, ast.IsFunctionLike), + builderFlags, + nil, /*idToSymbol*/ + ) if typeNode != nil { emitContext := printer.NewEmitContext() // !!! snippet p diff --git a/internal/ls/inlay_hints.go b/internal/ls/inlay_hints.go index 5db495a290..30b84afd76 100644 --- a/internal/ls/inlay_hints.go +++ b/internal/ls/inlay_hints.go @@ -310,20 +310,24 @@ func (s *inlayHintState) getParameterDeclarationTypeHints(symbol *ast.Symbol) *l func (s *inlayHintState) typeToInlayHintParts(t *checker.Type) lsproto.StringOrInlayHintLabelParts { flags := nodebuilder.FlagsIgnoreErrors | nodebuilder.FlagsAllowUniqueESSymbolType | nodebuilder.FlagsUseAliasDefinedOutsideCurrentScope - typeNode := s.checker.TypeToTypeNode(t, nil /*enclosingDeclaration*/, flags) + idToSymbol := make(map[*ast.IdentifierNode]*ast.Symbol) + // !!! Avoid type node reuse so we collect identifier symbols. + typeNode := s.checker.TypeToTypeNode(t, nil /*enclosingDeclaration*/, flags, idToSymbol) debug.AssertIsDefined(typeNode, "should always get typenode") return lsproto.StringOrInlayHintLabelParts{ - InlayHintLabelParts: ptrTo(s.getInlayHintLabelParts(typeNode)), + InlayHintLabelParts: ptrTo(s.getInlayHintLabelParts(typeNode, idToSymbol)), } } func (s *inlayHintState) typePredicateToInlayHintParts(typePredicate *checker.TypePredicate) lsproto.StringOrInlayHintLabelParts { flags := nodebuilder.FlagsIgnoreErrors | nodebuilder.FlagsAllowUniqueESSymbolType | nodebuilder.FlagsUseAliasDefinedOutsideCurrentScope - typeNode := s.checker.TypePredicateToTypePredicateNode(typePredicate, nil /*enclosingDeclaration*/, flags) + idToSymbol := make(map[*ast.IdentifierNode]*ast.Symbol) + // !!! Avoid type node reuse so we collect identifier symbols. + typeNode := s.checker.TypePredicateToTypePredicateNode(typePredicate, nil /*enclosingDeclaration*/, flags, idToSymbol) debug.AssertIsDefined(typeNode, "should always get typePredicateNode") return lsproto.StringOrInlayHintLabelParts{ - InlayHintLabelParts: ptrTo(s.getInlayHintLabelParts(typeNode)), + InlayHintLabelParts: ptrTo(s.getInlayHintLabelParts(typeNode, idToSymbol)), } } @@ -414,7 +418,7 @@ func isModuleReferenceType(t *checker.Type) bool { return symbol != nil && symbol.Flags&ast.SymbolFlagsModule != 0 } -func (s *inlayHintState) getInlayHintLabelParts(node *ast.Node) []*lsproto.InlayHintLabelPart { +func (s *inlayHintState) getInlayHintLabelParts(node *ast.Node, idToSymbol map[*ast.IdentifierNode]*ast.Symbol) []*lsproto.InlayHintLabelPart { var parts []*lsproto.InlayHintLabelPart var visitForDisplayParts func(node *ast.Node) @@ -441,9 +445,8 @@ func (s *inlayHintState) getInlayHintLabelParts(node *ast.Node) []*lsproto.Inlay case ast.KindIdentifier: identifierText := node.Text() var name *ast.Node - // !!! This won't work in Corsa since we don't store symbols on identifiers. We need another strategy for it. - if node.Symbol() != nil && len(node.Symbol().Declarations) != 0 { - name = ast.GetNameOfDeclaration(node.Symbol().Declarations[0]) + if symbol := idToSymbol[node]; symbol != nil && len(symbol.Declarations) != 0 { + name = ast.GetNameOfDeclaration(symbol.Declarations[0]) } if name != nil { parts = append(parts, s.getNodeDisplayPart(identifierText, name)) @@ -760,11 +763,13 @@ func (s *inlayHintState) getInlayHintLabelParts(node *ast.Node) []*lsproto.Inlay func (s *inlayHintState) getNodeDisplayPart(text string, node *ast.Node) *lsproto.InlayHintLabelPart { file := ast.GetSourceFileOfNode(node) + pos := astnav.GetStartOfNode(node, file, false /*includeJSDoc*/) + end := node.End() return &lsproto.InlayHintLabelPart{ Value: text, Location: &lsproto.Location{ Uri: lsconv.FileNameToDocumentURI(file.FileName()), - Range: s.converters.ToLSPRange(file, node.Loc), + Range: s.converters.ToLSPRange(file, core.NewTextRange(pos, end)), }, } } diff --git a/internal/ls/lsconv/converters.go b/internal/ls/lsconv/converters.go index 406d713f88..2e076b6237 100644 --- a/internal/ls/lsconv/converters.go +++ b/internal/ls/lsconv/converters.go @@ -10,6 +10,7 @@ import ( "unicode/utf8" "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/bundled" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnostics" @@ -107,6 +108,9 @@ var extraEscapeReplacer = strings.NewReplacer( ) func FileNameToDocumentURI(fileName string) lsproto.DocumentUri { + if bundled.IsBundled(fileName) { + return lsproto.DocumentUri(fileName) + } if strings.HasPrefix(fileName, "^/") { scheme, rest, ok := strings.Cut(fileName[2:], "/") if !ok { diff --git a/internal/lsp/lsproto/lsp.go b/internal/lsp/lsproto/lsp.go index f8d85867e2..c4b657f884 100644 --- a/internal/lsp/lsproto/lsp.go +++ b/internal/lsp/lsproto/lsp.go @@ -8,12 +8,16 @@ import ( "github.com/go-json-experiment/json" "github.com/go-json-experiment/json/jsontext" + "github.com/microsoft/typescript-go/internal/bundled" "github.com/microsoft/typescript-go/internal/tspath" ) type DocumentUri string // !!! func (uri DocumentUri) FileName() string { + if bundled.IsBundled(string(uri)) { + return string(uri) + } if strings.HasPrefix(string(uri), "file://") { parsed, err := url.Parse(string(uri)) if err != nil { diff --git a/testdata/baselines/reference/fourslash/inlayHints/inlayHintsElementAccess.baseline b/testdata/baselines/reference/fourslash/inlayHints/inlayHintsElementAccess.baseline index 177d52d0a8..b8b2ba65a8 100644 --- a/testdata/baselines/reference/fourslash/inlayHints/inlayHintsElementAccess.baseline +++ b/testdata/baselines/reference/fourslash/inlayHints/inlayHintsElementAccess.baseline @@ -20,7 +20,20 @@ let foo = { "value": "[" }, { - "value": "MySymbol" + "value": "MySymbol", + "location": { + "uri": "file:///inlayHintsElementAccess.ts", + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 18 + } + } + } }, { "value": "[" diff --git a/testdata/baselines/reference/fourslash/inlayHints/inlayHintsIdentifierLocation.baseline b/testdata/baselines/reference/fourslash/inlayHints/inlayHintsIdentifierLocation.baseline new file mode 100644 index 0000000000..c4c462af8b --- /dev/null +++ b/testdata/baselines/reference/fourslash/inlayHints/inlayHintsIdentifierLocation.baseline @@ -0,0 +1,82 @@ +// === Inlay Hints === +const p = (a: Foo[]) => a; + ^ +{ + "position": { + "line": 1, + "character": 7 + }, + "label": [ + { + "value": ": " + }, + { + "value": "(" + }, + { + "value": "a", + "location": { + "uri": "file:///inlayHintsIdentifierLocation.ts", + "range": { + "start": { + "line": 1, + "character": 11 + }, + "end": { + "line": 1, + "character": 12 + } + } + } + }, + { + "value": ": " + }, + { + "value": "Foo", + "location": { + "uri": "file:///inlayHintsIdentifierLocation.ts", + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 13 + } + } + } + }, + { + "value": "[]" + }, + { + "value": ")" + }, + { + "value": " => " + }, + { + "value": "Foo", + "location": { + "uri": "file:///inlayHintsIdentifierLocation.ts", + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 13 + } + } + } + }, + { + "value": "[]" + } + ], + "kind": 1, + "paddingLeft": true +} \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/inlayHints/inlayHintsUsing.baseline b/testdata/baselines/reference/fourslash/inlayHints/inlayHintsUsing.baseline index e58bfb51c3..a84e74435e 100644 --- a/testdata/baselines/reference/fourslash/inlayHints/inlayHintsUsing.baseline +++ b/testdata/baselines/reference/fourslash/inlayHints/inlayHintsUsing.baseline @@ -20,13 +20,39 @@ using _defer = { "value": "[" }, { - "value": "Symbol" + "value": "Symbol", + "location": { + "uri": "bundled:///libs/lib.es5.d.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + } + } }, { "value": "." }, { - "value": "dispose" + "value": "dispose", + "location": { + "uri": "bundled:///libs/lib.esnext.disposable.d.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + } + } }, { "value": "]" diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes1.baseline index 8ba9fc9994..9763c14f23 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes1.baseline @@ -115,7 +115,20 @@ foo3(a => { "value": "(" }, { - "value": "c" + "value": "c", + "location": { + "uri": "file:///inlayHintsFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 7, + "character": 23 + }, + "end": { + "line": 7, + "character": 24 + } + } + } }, { "value": ": " @@ -124,7 +137,20 @@ foo3(a => { "value": "(" }, { - "value": "d" + "value": "d", + "location": { + "uri": "file:///inlayHintsFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 7, + "character": 27 + }, + "end": { + "line": 7, + "character": 28 + } + } + } }, { "value": ": " @@ -223,7 +249,20 @@ const foo5: F2 = (a) => { } "value": " " }, { - "value": "a" + "value": "a", + "location": { + "uri": "file:///inlayHintsFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 14, + "character": 4 + }, + "end": { + "line": 14, + "character": 5 + } + } + } }, { "value": ": " @@ -235,7 +274,20 @@ const foo5: F2 = (a) => { } "value": "; " }, { - "value": "b" + "value": "b", + "location": { + "uri": "file:///inlayHintsFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 15, + "character": 4 + }, + "end": { + "line": 15, + "character": 5 + } + } + } }, { "value": ": " diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes5.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes5.baseline index 869bfce9f8..f4f9709f25 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes5.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes5.baseline @@ -20,7 +20,20 @@ test((state) => {}); "value": "[" }, { - "value": "STATE_SIGNAL" + "value": "STATE_SIGNAL", + "location": { + "uri": "file:///inlayHintsFunctionParameterTypes5.ts", + "range": { + "start": { + "line": 0, + "character": 14 + }, + "end": { + "line": 0, + "character": 26 + } + } + } }, { "value": "]" diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes5.baseline.diff b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes5.baseline.diff deleted file mode 100644 index 2b92898107..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsFunctionParameterTypes5.baseline.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.inlayHintsFunctionParameterTypes5.baseline -+++ new.inlayHintsFunctionParameterTypes5.baseline -@@= skipped -15, +15 lines =@@ - "value": "[" - }, - { -- "value": "STATE_SIGNAL", -- "location": {}, -+ "value": "STATE_SIGNAL" - }, - { - "value": "]" \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline index 9c4d89568f..596dc32b15 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline @@ -115,7 +115,20 @@ "value": "(" }, { - "value": "c" + "value": "c", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 7, + "character": 24 + }, + "end": { + "line": 7, + "character": 25 + } + } + } }, { "value": ": " @@ -124,7 +137,20 @@ "value": "(" }, { - "value": "d" + "value": "d", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 7, + "character": 28 + }, + "end": { + "line": 7, + "character": 29 + } + } + } }, { "value": ": " @@ -226,13 +252,39 @@ "value": "<" }, { - "value": "X" + "value": "X", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 22, + "character": 6 + }, + "end": { + "line": 22, + "character": 7 + } + } + } }, { "value": ", " }, { - "value": "Y" + "value": "Y", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 22, + "character": 9 + }, + "end": { + "line": 22, + "character": 10 + } + } + } }, { "value": ">" @@ -241,13 +293,39 @@ "value": "(" }, { - "value": "x" + "value": "x", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 22, + "character": 12 + }, + "end": { + "line": 22, + "character": 13 + } + } + } }, { "value": ": " }, { - "value": "X" + "value": "X", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 22, + "character": 6 + }, + "end": { + "line": 22, + "character": 7 + } + } + } }, { "value": ")" @@ -256,7 +334,20 @@ "value": ": " }, { - "value": "Y" + "value": "Y", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 22, + "character": 9 + }, + "end": { + "line": 22, + "character": 10 + } + } + } }, { "value": "; " @@ -286,7 +377,20 @@ "value": "; " }, { - "value": "a" + "value": "a", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 14, + "character": 5 + }, + "end": { + "line": 14, + "character": 6 + } + } + } }, { "value": ": " @@ -298,7 +402,20 @@ "value": "; " }, { - "value": "b" + "value": "b", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 15, + "character": 5 + }, + "end": { + "line": 15, + "character": 6 + } + } + } }, { "value": ": " @@ -316,7 +433,20 @@ "value": " " }, { - "value": "c" + "value": "c", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 16, + "character": 14 + }, + "end": { + "line": 16, + "character": 15 + } + } + } }, { "value": ": " @@ -328,7 +458,20 @@ "value": "; " }, { - "value": "d" + "value": "d", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 17, + "character": 5 + }, + "end": { + "line": 17, + "character": 6 + } + } + } }, { "value": "?" @@ -343,7 +486,20 @@ "value": "; " }, { - "value": "e" + "value": "e", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 18, + "character": 5 + }, + "end": { + "line": 18, + "character": 6 + } + } + } }, { "value": "(" @@ -361,7 +517,20 @@ "value": "; " }, { - "value": "f" + "value": "f", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 19, + "character": 5 + }, + "end": { + "line": 19, + "character": 6 + } + } + } }, { "value": "?" @@ -382,13 +551,39 @@ "value": "; " }, { - "value": "g" + "value": "g", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 20, + "character": 5 + }, + "end": { + "line": 20, + "character": 6 + } + } + } }, { "value": "<" }, { - "value": "T" + "value": "T", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 20, + "character": 7 + }, + "end": { + "line": 20, + "character": 8 + } + } + } }, { "value": ">" @@ -403,13 +598,39 @@ "value": ": " }, { - "value": "T" + "value": "T", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 20, + "character": 7 + }, + "end": { + "line": 20, + "character": 8 + } + } + } }, { "value": "; " }, { - "value": "h" + "value": "h", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 21, + "character": 5 + }, + "end": { + "line": 21, + "character": 6 + } + } + } }, { "value": "?" @@ -418,13 +639,39 @@ "value": "<" }, { - "value": "X" + "value": "X", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 21, + "character": 8 + }, + "end": { + "line": 21, + "character": 9 + } + } + } }, { "value": ", " }, { - "value": "Y" + "value": "Y", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 21, + "character": 11 + }, + "end": { + "line": 21, + "character": 12 + } + } + } }, { "value": ">" @@ -433,13 +680,39 @@ "value": "(" }, { - "value": "x" + "value": "x", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 21, + "character": 14 + }, + "end": { + "line": 21, + "character": 15 + } + } + } }, { "value": ": " }, { - "value": "X" + "value": "X", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 21, + "character": 8 + }, + "end": { + "line": 21, + "character": 9 + } + } + } }, { "value": ")" @@ -448,7 +721,20 @@ "value": ": " }, { - "value": "Y" + "value": "Y", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 21, + "character": 11 + }, + "end": { + "line": 21, + "character": 12 + } + } + } }, { "value": " " @@ -501,7 +787,20 @@ foo4(p => {}) "value": ": " }, { - "value": "Thing" + "value": "Thing", + "location": { + "uri": "file:///inlayHintsInteractiveFunctionParameterTypes1.ts", + "range": { + "start": { + "line": 30, + "character": 10 + }, + "end": { + "line": 30, + "character": 15 + } + } + } } ], "kind": 1, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline.diff b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline.diff deleted file mode 100644 index 0d326b1dff..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline.diff +++ /dev/null @@ -1,108 +0,0 @@ ---- old.inlayHintsInteractiveFunctionParameterTypes1.baseline -+++ new.inlayHintsInteractiveFunctionParameterTypes1.baseline -@@= skipped -189, +189 lines =@@ - "value": "<" - }, - { -- "value": "X", -- "location": {}, -+ "value": "X" - }, - { - "value": ", " - }, - { -- "value": "Y", -- "location": {}, -+ "value": "Y" - }, - { - "value": ">" -@@= skipped -23, +21 lines =@@ - "value": ": " - }, - { -- "value": "X", -- "location": {}, -+ "value": "X" - }, - { - "value": ")" -@@= skipped -10, +9 lines =@@ - "value": ": " - }, - { -- "value": "Y", -- "location": {}, -+ "value": "Y" - }, - { - "value": "; " -@@= skipped -133, +132 lines =@@ - "value": "<" - }, - { -- "value": "T", -- "location": {}, -+ "value": "T" - }, - { - "value": ">" -@@= skipped -16, +15 lines =@@ - "value": ": " - }, - { -- "value": "T", -- "location": {}, -+ "value": "T" - }, - { - "value": "; " -@@= skipped -16, +15 lines =@@ - "value": "<" - }, - { -- "value": "X", -- "location": {}, -+ "value": "X" - }, - { - "value": ", " - }, - { -- "value": "Y", -- "location": {}, -+ "value": "Y" - }, - { - "value": ">" -@@= skipped -23, +21 lines =@@ - "value": ": " - }, - { -- "value": "X", -- "location": {}, -+ "value": "X" - }, - { - "value": ")" -@@= skipped -10, +9 lines =@@ - "value": ": " - }, - { -- "value": "Y", -- "location": {}, -+ "value": "Y" - }, - { - "value": " " -@@= skipped -46, +45 lines =@@ - "value": ": " - }, - { -- "value": "Thing", -- "location": {}, -+ "value": "Thing" - } - ], - "kind": 1, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveJsDocParameterNames.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveJsDocParameterNames.baseline index 8d0d159c6a..665e5f2989 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveJsDocParameterNames.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveJsDocParameterNames.baseline @@ -46,7 +46,7 @@ y.foo(1, 2) "range": { "start": { "line": 3, - "character": 27 + "character": 28 }, "end": { "line": 3, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveMultifile1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveMultifile1.baseline index d6bbfa3307..35ef20651b 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveMultifile1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveMultifile1.baseline @@ -11,13 +11,39 @@ async function foo () { "value": ": " }, { - "value": "Promise" + "value": "Promise", + "location": { + "uri": "bundled:///libs/lib.es5.d.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + } + } }, { "value": "<" }, { - "value": "Foo" + "value": "Foo", + "location": { + "uri": "file:///a.ts", + "range": { + "start": { + "line": 0, + "character": 17 + }, + "end": { + "line": 0, + "character": 20 + } + } + } }, { "value": ">" @@ -39,7 +65,20 @@ function bar () { return import('./a') } "value": ": " }, { - "value": "Promise" + "value": "Promise", + "location": { + "uri": "bundled:///libs/lib.es5.d.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + } + } }, { "value": "<" @@ -76,7 +115,20 @@ async function main () { "value": ": " }, { - "value": "Promise" + "value": "Promise", + "location": { + "uri": "bundled:///libs/lib.es5.d.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + } + } }, { "value": "<" @@ -104,7 +156,20 @@ async function main () { "value": ": " }, { - "value": "Foo" + "value": "Foo", + "location": { + "uri": "file:///a.ts", + "range": { + "start": { + "line": 0, + "character": 17 + }, + "end": { + "line": 0, + "character": 20 + } + } + } } ], "kind": 1, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveMultifile1.baseline.diff b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveMultifile1.baseline.diff deleted file mode 100644 index 3d7188e652..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveMultifile1.baseline.diff +++ /dev/null @@ -1,50 +0,0 @@ ---- old.inlayHintsInteractiveMultifile1.baseline -+++ new.inlayHintsInteractiveMultifile1.baseline -@@= skipped -6, +6 lines =@@ - "value": ": " - }, - { -- "value": "Promise", -- "location": {}, -+ "value": "Promise" - }, - { - "value": "<" - }, - { -- "value": "Foo", -- "location": {}, -+ "value": "Foo" - }, - { - "value": ">" -@@= skipped -26, +24 lines =@@ - "value": ": " - }, - { -- "value": "Promise", -- "location": {}, -+ "value": "Promise" - }, - { - "value": "<" -@@= skipped -34, +33 lines =@@ - "value": ": " - }, - { -- "value": "Promise", -- "location": {}, -+ "value": "Promise" - }, - { - "value": "<" -@@= skipped -25, +24 lines =@@ - "value": ": " - }, - { -- "value": "Foo", -- "location": {}, -+ "value": "Foo" - } - ], - "kind": 1, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveOverloadCall.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveOverloadCall.baseline index 0e366c5747..8cb23e5302 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveOverloadCall.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveOverloadCall.baseline @@ -78,7 +78,7 @@ call(1, 2); "range": { "start": { "line": 2, - "character": 15 + "character": 16 }, "end": { "line": 2, @@ -206,7 +206,7 @@ foo(1, 2) "range": { "start": { "line": 10, - "character": 31 + "character": 32 }, "end": { "line": 10, @@ -302,7 +302,7 @@ new Class(1, 2) "range": { "start": { "line": 16, - "character": 26 + "character": 27 }, "end": { "line": 16, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNames.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNames.baseline index 6636f58d5e..a9761cd1be 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNames.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNames.baseline @@ -46,7 +46,7 @@ "range": { "start": { "line": 0, - "character": 26 + "character": 27 }, "end": { "line": 0, @@ -206,7 +206,7 @@ foo4(1, +1, -1, +"1"); "range": { "start": { "line": 7, - "character": 24 + "character": 25 }, "end": { "line": 7, @@ -238,7 +238,7 @@ foo4(1, +1, -1, +"1"); "range": { "start": { "line": 7, - "character": 35 + "character": 36 }, "end": { "line": 7, @@ -270,7 +270,7 @@ foo4(1, +1, -1, +"1"); "range": { "start": { "line": 7, - "character": 46 + "character": 47 }, "end": { "line": 7, @@ -301,8 +301,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 9, - "character": 14 + "line": 10, + "character": 4 }, "end": { "line": 10, @@ -333,8 +333,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 10, - "character": 14 + "line": 11, + "character": 4 }, "end": { "line": 11, @@ -365,8 +365,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 11, - "character": 17 + "line": 12, + "character": 4 }, "end": { "line": 12, @@ -397,8 +397,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 12, - "character": 12 + "line": 13, + "character": 4 }, "end": { "line": 13, @@ -429,8 +429,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 13, - "character": 15 + "line": 14, + "character": 4 }, "end": { "line": 14, @@ -461,8 +461,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 14, - "character": 15 + "line": 15, + "character": 4 }, "end": { "line": 15, @@ -493,8 +493,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 15, - "character": 14 + "line": 16, + "character": 4 }, "end": { "line": 16, @@ -525,8 +525,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 16, - "character": 14 + "line": 17, + "character": 4 }, "end": { "line": 17, @@ -557,8 +557,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 17, - "character": 14 + "line": 18, + "character": 4 }, "end": { "line": 18, @@ -589,8 +589,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsInteractiveParameterNames.ts", "range": { "start": { - "line": 18, - "character": 14 + "line": 19, + "character": 4 }, "end": { "line": 19, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesInSpan1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesInSpan1.baseline index 504b5b9ab5..b47109f6b1 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesInSpan1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesInSpan1.baseline @@ -46,7 +46,7 @@ function c2 () { foo2(1, 2); } "range": { "start": { "line": 1, - "character": 25 + "character": 26 }, "end": { "line": 1, @@ -110,7 +110,7 @@ function c3 () { foo3(1, 2); } "range": { "start": { "line": 2, - "character": 25 + "character": 26 }, "end": { "line": 2, @@ -174,7 +174,7 @@ function c4 () { foo4(1, 2); } "range": { "start": { "line": 3, - "character": 25 + "character": 26 }, "end": { "line": 3, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesInSpan2.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesInSpan2.baseline index 436ed8a047..631bf05e5b 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesInSpan2.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesInSpan2.baseline @@ -46,7 +46,7 @@ foo2(1, 2); "range": { "start": { "line": 1, - "character": 25 + "character": 26 }, "end": { "line": 1, @@ -110,7 +110,7 @@ foo3(1, 2); "range": { "start": { "line": 2, - "character": 25 + "character": 26 }, "end": { "line": 2, @@ -174,7 +174,7 @@ foo4(1, 2); "range": { "start": { "line": 3, - "character": 25 + "character": 26 }, "end": { "line": 3, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesWithComments.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesWithComments.baseline index 39062f0cf7..e0607e4b1b 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesWithComments.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveParameterNamesWithComments.baseline @@ -78,7 +78,7 @@ fn(/* nobody knows exactly what this param is */ 42); "range": { "start": { "line": 2, - "character": 33 + "character": 34 }, "end": { "line": 2, @@ -110,7 +110,7 @@ fn(/* nobody knows exactly what this param is */ 42); "range": { "start": { "line": 2, - "character": 53 + "character": 54 }, "end": { "line": 2, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters1.baseline index 8c63805d77..989a5d4106 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters1.baseline @@ -142,7 +142,7 @@ foo2(1, 2, 3) "range": { "start": { "line": 2, - "character": 24 + "character": 25 }, "end": { "line": 2, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters2.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters2.baseline index 7629fcf5f2..f7f00df072 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters2.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters2.baseline @@ -46,7 +46,7 @@ "range": { "start": { "line": 0, - "character": 36 + "character": 37 }, "end": { "line": 0, @@ -110,7 +110,7 @@ "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, @@ -142,7 +142,7 @@ "range": { "start": { "line": 0, - "character": 36 + "character": 37 }, "end": { "line": 0, @@ -206,7 +206,7 @@ "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, @@ -270,7 +270,7 @@ "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, @@ -334,7 +334,7 @@ "range": { "start": { "line": 0, - "character": 36 + "character": 37 }, "end": { "line": 0, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters3.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters3.baseline index 0e112ce391..da68e8ed51 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters3.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveRestParameters3.baseline @@ -46,7 +46,7 @@ fn(...foo, 3, 4); "range": { "start": { "line": 0, - "character": 33 + "character": 34 }, "end": { "line": 0, @@ -78,7 +78,7 @@ fn(...foo, 3, 4); "range": { "start": { "line": 0, - "character": 44 + "character": 45 }, "end": { "line": 0, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline index f349607ea9..ed463f38db 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline @@ -85,7 +85,20 @@ "value": ": " }, { - "value": "Foo" + "value": "Foo", + "location": { + "uri": "file:///inlayHintsInteractiveVariableTypes1.ts", + "range": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 13 + } + } + } }, { "value": "[]" @@ -97,7 +110,20 @@ "value": " => " }, { - "value": "Foo" + "value": "Foo", + "location": { + "uri": "file:///inlayHintsInteractiveVariableTypes1.ts", + "range": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 13 + } + } + } } ], "kind": 1, @@ -143,13 +169,39 @@ "value": " " }, { - "value": "a" + "value": "a", + "location": { + "uri": "file:///inlayHintsInteractiveVariableTypes1.ts", + "range": { + "start": { + "line": 19, + "character": 21 + }, + "end": { + "line": 19, + "character": 22 + } + } + } }, { "value": ": " }, { - "value": "Foo" + "value": "Foo", + "location": { + "uri": "file:///inlayHintsInteractiveVariableTypes1.ts", + "range": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 13 + } + } + } }, { "value": " " @@ -164,7 +216,20 @@ "value": " => " }, { - "value": "Foo" + "value": "Foo", + "location": { + "uri": "file:///inlayHintsInteractiveVariableTypes1.ts", + "range": { + "start": { + "line": 2, + "character": 10 + }, + "end": { + "line": 2, + "character": 13 + } + } + } } ], "kind": 1, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline.diff b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline.diff deleted file mode 100644 index 42d8faf6b8..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline.diff +++ /dev/null @@ -1,42 +0,0 @@ ---- old.inlayHintsInteractiveVariableTypes1.baseline -+++ new.inlayHintsInteractiveVariableTypes1.baseline -@@= skipped -72, +72 lines =@@ - "value": ": " - }, - { -- "value": "Foo", -- "location": {}, -+ "value": "Foo" - }, - { - "value": "[]" -@@= skipped -13, +12 lines =@@ - "value": " => " - }, - { -- "value": "Foo", -- "location": {}, -+ "value": "Foo" - } - ], - "kind": 1, -@@= skipped -49, +48 lines =@@ - "value": ": " - }, - { -- "value": "Foo", -- "location": {}, -+ "value": "Foo" - }, - { - "value": " " -@@= skipped -16, +15 lines =@@ - "value": " => " - }, - { -- "value": "Foo", -- "location": {}, -+ "value": "Foo" - } - ], - "kind": 1, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes2.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes2.baseline index beb7ca6080..252c25d847 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes2.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsInteractiveVariableTypes2.baseline @@ -39,7 +39,20 @@ const a = object; "value": " " }, { - "value": "foo" + "value": "foo", + "location": { + "uri": "file:///inlayHintsInteractiveVariableTypes2.ts", + "range": { + "start": { + "line": 0, + "character": 17 + }, + "end": { + "line": 0, + "character": 20 + } + } + } }, { "value": ": " @@ -51,7 +64,20 @@ const a = object; "value": "; " }, { - "value": "bar" + "value": "bar", + "location": { + "uri": "file:///inlayHintsInteractiveVariableTypes2.ts", + "range": { + "start": { + "line": 0, + "character": 25 + }, + "end": { + "line": 0, + "character": 28 + } + } + } }, { "value": ": " diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsJsDocParameterNames.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsJsDocParameterNames.baseline index 8d0d159c6a..665e5f2989 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsJsDocParameterNames.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsJsDocParameterNames.baseline @@ -46,7 +46,7 @@ y.foo(1, 2) "range": { "start": { "line": 3, - "character": 27 + "character": 28 }, "end": { "line": 3, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsMultifile1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsMultifile1.baseline index d6bbfa3307..35ef20651b 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsMultifile1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsMultifile1.baseline @@ -11,13 +11,39 @@ async function foo () { "value": ": " }, { - "value": "Promise" + "value": "Promise", + "location": { + "uri": "bundled:///libs/lib.es5.d.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + } + } }, { "value": "<" }, { - "value": "Foo" + "value": "Foo", + "location": { + "uri": "file:///a.ts", + "range": { + "start": { + "line": 0, + "character": 17 + }, + "end": { + "line": 0, + "character": 20 + } + } + } }, { "value": ">" @@ -39,7 +65,20 @@ function bar () { return import('./a') } "value": ": " }, { - "value": "Promise" + "value": "Promise", + "location": { + "uri": "bundled:///libs/lib.es5.d.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + } + } }, { "value": "<" @@ -76,7 +115,20 @@ async function main () { "value": ": " }, { - "value": "Promise" + "value": "Promise", + "location": { + "uri": "bundled:///libs/lib.es5.d.ts", + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + } + } }, { "value": "<" @@ -104,7 +156,20 @@ async function main () { "value": ": " }, { - "value": "Foo" + "value": "Foo", + "location": { + "uri": "file:///a.ts", + "range": { + "start": { + "line": 0, + "character": 17 + }, + "end": { + "line": 0, + "character": 20 + } + } + } } ], "kind": 1, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsNoHintWhenArgumentMatchesName.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsNoHintWhenArgumentMatchesName.baseline index eded3f99d9..75b137bc90 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsNoHintWhenArgumentMatchesName.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsNoHintWhenArgumentMatchesName.baseline @@ -14,7 +14,7 @@ foo(a, 2); "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, @@ -46,7 +46,7 @@ foo(v.a, v.a); "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, @@ -142,7 +142,7 @@ foo(v.c, v.c); "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsOverloadCall1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsOverloadCall1.baseline index a4683ca4e5..33e0565486 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsOverloadCall1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsOverloadCall1.baseline @@ -78,7 +78,7 @@ call(1, 2); "range": { "start": { "line": 2, - "character": 15 + "character": 16 }, "end": { "line": 2, @@ -206,7 +206,7 @@ foo(1, 2) "range": { "start": { "line": 10, - "character": 31 + "character": 32 }, "end": { "line": 10, @@ -302,7 +302,7 @@ new Class(1, 2) "range": { "start": { "line": 16, - "character": 26 + "character": 27 }, "end": { "line": 16, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsOverloadCall2.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsOverloadCall2.baseline index 8d4ad02dbe..de4a1253f7 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsOverloadCall2.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsOverloadCall2.baseline @@ -46,7 +46,7 @@ "range": { "start": { "line": 9, - "character": 36 + "character": 37 }, "end": { "line": 9, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsParameterNames.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsParameterNames.baseline index 51a7cfd85f..e7974e7c5a 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsParameterNames.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsParameterNames.baseline @@ -46,7 +46,7 @@ "range": { "start": { "line": 0, - "character": 26 + "character": 27 }, "end": { "line": 0, @@ -110,7 +110,7 @@ foo3({}, 1); "range": { "start": { "line": 4, - "character": 21 + "character": 22 }, "end": { "line": 4, @@ -238,7 +238,7 @@ foo4(1, +1, -1, +"1"); "range": { "start": { "line": 9, - "character": 24 + "character": 25 }, "end": { "line": 9, @@ -270,7 +270,7 @@ foo4(1, +1, -1, +"1"); "range": { "start": { "line": 9, - "character": 35 + "character": 36 }, "end": { "line": 9, @@ -302,7 +302,7 @@ foo4(1, +1, -1, +"1"); "range": { "start": { "line": 9, - "character": 46 + "character": 47 }, "end": { "line": 9, @@ -333,8 +333,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 11, - "character": 14 + "line": 12, + "character": 4 }, "end": { "line": 12, @@ -365,8 +365,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 12, - "character": 14 + "line": 13, + "character": 4 }, "end": { "line": 13, @@ -397,8 +397,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 13, - "character": 17 + "line": 14, + "character": 4 }, "end": { "line": 14, @@ -429,8 +429,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 14, - "character": 12 + "line": 15, + "character": 4 }, "end": { "line": 15, @@ -461,8 +461,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 15, - "character": 15 + "line": 16, + "character": 4 }, "end": { "line": 16, @@ -493,8 +493,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 16, - "character": 15 + "line": 17, + "character": 4 }, "end": { "line": 17, @@ -525,8 +525,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 17, - "character": 14 + "line": 18, + "character": 4 }, "end": { "line": 18, @@ -557,8 +557,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 18, - "character": 14 + "line": 19, + "character": 4 }, "end": { "line": 19, @@ -589,8 +589,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 19, - "character": 14 + "line": 20, + "character": 4 }, "end": { "line": 20, @@ -621,8 +621,8 @@ foo4(1, +1, -1, +"1"); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 20, - "character": 14 + "line": 21, + "character": 4 }, "end": { "line": 21, @@ -717,8 +717,8 @@ trace(``); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 42, - "character": 19 + "line": 43, + "character": 4 }, "end": { "line": 43, @@ -749,8 +749,8 @@ trace(``); "uri": "file:///inlayHintsParameterNames.ts", "range": { "start": { - "line": 43, - "character": 19 + "line": 44, + "character": 4 }, "end": { "line": 44, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsRestParameters1.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsRestParameters1.baseline index ae7aedbf42..d37608498d 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsRestParameters1.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsRestParameters1.baseline @@ -142,7 +142,7 @@ foo2(1, 2, 3) "range": { "start": { "line": 2, - "character": 24 + "character": 25 }, "end": { "line": 2, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsRestParameters2.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsRestParameters2.baseline index 18aedbc375..8fe8f3267f 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsRestParameters2.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsRestParameters2.baseline @@ -46,7 +46,7 @@ "range": { "start": { "line": 0, - "character": 36 + "character": 37 }, "end": { "line": 0, @@ -110,7 +110,7 @@ "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, @@ -142,7 +142,7 @@ "range": { "start": { "line": 0, - "character": 36 + "character": 37 }, "end": { "line": 0, @@ -206,7 +206,7 @@ "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, @@ -270,7 +270,7 @@ "range": { "start": { "line": 0, - "character": 24 + "character": 25 }, "end": { "line": 0, @@ -334,7 +334,7 @@ "range": { "start": { "line": 0, - "character": 36 + "character": 37 }, "end": { "line": 0, diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes2.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes2.baseline index beb7ca6080..70303fcbdd 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes2.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes2.baseline @@ -39,7 +39,20 @@ const a = object; "value": " " }, { - "value": "foo" + "value": "foo", + "location": { + "uri": "file:///inlayHintsVariableTypes2.ts", + "range": { + "start": { + "line": 0, + "character": 17 + }, + "end": { + "line": 0, + "character": 20 + } + } + } }, { "value": ": " @@ -51,7 +64,20 @@ const a = object; "value": "; " }, { - "value": "bar" + "value": "bar", + "location": { + "uri": "file:///inlayHintsVariableTypes2.ts", + "range": { + "start": { + "line": 0, + "character": 25 + }, + "end": { + "line": 0, + "character": 28 + } + } + } }, { "value": ": " diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes3.baseline b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes3.baseline index e36f83d8ff..17cf2910f9 100644 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes3.baseline +++ b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes3.baseline @@ -29,19 +29,58 @@ const div = getCtor("div"); "value": ": " }, { - "value": "DivElement" + "value": "DivElement", + "location": { + "uri": "file:///inlayHintsVariableTypes3.ts", + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 20 + } + } + } }, { "value": "; " }, { - "value": "prototype" + "value": "prototype", + "location": { + "uri": "file:///inlayHintsVariableTypes3.ts", + "range": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 11 + } + } + } }, { "value": ": " }, { - "value": "DivElement" + "value": "DivElement", + "location": { + "uri": "file:///inlayHintsVariableTypes3.ts", + "range": { + "start": { + "line": 0, + "character": 10 + }, + "end": { + "line": 0, + "character": 20 + } + } + } }, { "value": " " diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes3.baseline.diff b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes3.baseline.diff deleted file mode 100644 index 49d63307be..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsVariableTypes3.baseline.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.inlayHintsVariableTypes3.baseline -+++ new.inlayHintsVariableTypes3.baseline -@@= skipped -24, +24 lines =@@ - "value": ": " - }, - { -- "value": "DivElement", -- "location": {}, -+ "value": "DivElement" - }, - { - "value": "; " -@@= skipped -13, +12 lines =@@ - "value": ": " - }, - { -- "value": "DivElement", -- "location": {}, -+ "value": "DivElement" - }, - { - "value": " " \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsFunctionParameterTypes1.baseline.diff b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsFunctionParameterTypes1.baseline.diff index baf52203de..3c0a4f9721 100644 --- a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsFunctionParameterTypes1.baseline.diff +++ b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsFunctionParameterTypes1.baseline.diff @@ -99,7 +99,8 @@ + "value": "(" + }, + { -+ "value": "c" ++ "value": "c", ++ "location": {}, + }, + { + "value": ": " @@ -108,7 +109,8 @@ + "value": "(" + }, + { -+ "value": "d" ++ "value": "d", ++ "location": {}, + }, + { + "value": ": " @@ -144,7 +146,7 @@ "kind": 1, "paddingLeft": true } -@@= skipped -8, +57 lines =@@ +@@= skipped -8, +59 lines =@@ a(d => {}) ^ { @@ -198,7 +200,8 @@ + "value": " " + }, + { -+ "value": "a" ++ "value": "a", ++ "location": {}, + }, + { + "value": ": " @@ -210,7 +213,8 @@ + "value": "; " + }, + { -+ "value": "b" ++ "value": "b", ++ "location": {}, + }, + { + "value": ": " diff --git a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline.diff b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline.diff new file mode 100644 index 0000000000..48a02a9f60 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline.diff @@ -0,0 +1,122 @@ +--- old.inlayHintsInteractiveFunctionParameterTypes1.baseline ++++ new.inlayHintsInteractiveFunctionParameterTypes1.baseline +@@= skipped -90, +90 lines =@@ + "value": "(" + }, + { +- "value": "c" ++ "value": "c", ++ "location": {}, + }, + { + "value": ": " +@@= skipped -9, +10 lines =@@ + "value": "(" + }, + { +- "value": "d" ++ "value": "d", ++ "location": {}, + }, + { + "value": ": " +@@= skipped -107, +108 lines =@@ + "value": "(" + }, + { +- "value": "x" ++ "value": "x", ++ "location": {}, + }, + { + "value": ": " +@@= skipped -47, +48 lines =@@ + "value": "; " + }, + { +- "value": "a" ++ "value": "a", ++ "location": {}, + }, + { + "value": ": " +@@= skipped -12, +13 lines =@@ + "value": "; " + }, + { +- "value": "b" ++ "value": "b", ++ "location": {}, + }, + { + "value": ": " +@@= skipped -18, +19 lines =@@ + "value": " " + }, + { +- "value": "c" ++ "value": "c", ++ "location": {}, + }, + { + "value": ": " +@@= skipped -12, +13 lines =@@ + "value": "; " + }, + { +- "value": "d" ++ "value": "d", ++ "location": {}, + }, + { + "value": "?" +@@= skipped -15, +16 lines =@@ + "value": "; " + }, + { +- "value": "e" ++ "value": "e", ++ "location": {}, + }, + { + "value": "(" +@@= skipped -18, +19 lines =@@ + "value": "; " + }, + { +- "value": "f" ++ "value": "f", ++ "location": {}, + }, + { + "value": "?" +@@= skipped -21, +22 lines =@@ + "value": "; " + }, + { +- "value": "g" ++ "value": "g", ++ "location": {}, + }, + { + "value": "<" +@@= skipped -29, +30 lines =@@ + "value": "; " + }, + { +- "value": "h" ++ "value": "h", ++ "location": {}, + }, + { + "value": "?" +@@= skipped -26, +27 lines =@@ + "value": "(" + }, + { +- "value": "x" ++ "value": "x", ++ "location": {}, + }, + { + "value": ": " \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline.diff b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline.diff new file mode 100644 index 0000000000..1c28e9f7ac --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline.diff @@ -0,0 +1,12 @@ +--- old.inlayHintsInteractiveVariableTypes1.baseline ++++ new.inlayHintsInteractiveVariableTypes1.baseline +@@= skipped -128, +128 lines =@@ + "value": " " + }, + { +- "value": "a" ++ "value": "a", ++ "location": {}, + }, + { + "value": ": " \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveVariableTypes2.baseline.diff b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveVariableTypes2.baseline.diff new file mode 100644 index 0000000000..c2adc2ca2f --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsInteractiveVariableTypes2.baseline.diff @@ -0,0 +1,22 @@ +--- old.inlayHintsInteractiveVariableTypes2.baseline ++++ new.inlayHintsInteractiveVariableTypes2.baseline +@@= skipped -30, +30 lines =@@ + "value": " " + }, + { +- "value": "foo" ++ "value": "foo", ++ "location": {}, + }, + { + "value": ": " +@@= skipped -12, +13 lines =@@ + "value": "; " + }, + { +- "value": "bar" ++ "value": "bar", ++ "location": {}, + }, + { + "value": ": " \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsMultifile1.baseline.diff b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsMultifile1.baseline.diff index acf3370b3c..5dcd783cdc 100644 --- a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsMultifile1.baseline.diff +++ b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsMultifile1.baseline.diff @@ -10,13 +10,15 @@ + "value": ": " + }, + { -+ "value": "Promise" ++ "value": "Promise", ++ "location": {}, + }, + { + "value": "<" + }, + { -+ "value": "Foo" ++ "value": "Foo", ++ "location": {}, + }, + { + "value": ">" @@ -25,7 +27,7 @@ "kind": 1, "paddingLeft": true } -@@= skipped -8, +24 lines =@@ +@@= skipped -8, +26 lines =@@ function bar () { return import('./a') } ^ { @@ -35,7 +37,8 @@ + "value": ": " + }, + { -+ "value": "Promise" ++ "value": "Promise", ++ "location": {}, + }, + { + "value": "<" @@ -59,7 +62,7 @@ "kind": 1, "paddingLeft": true } -@@= skipped -8, +33 lines =@@ +@@= skipped -8, +34 lines =@@ async function main () { ^ { @@ -69,7 +72,8 @@ + "value": ": " + }, + { -+ "value": "Promise" ++ "value": "Promise", ++ "location": {}, + }, + { + "value": "<" @@ -84,7 +88,7 @@ "kind": 1, "paddingLeft": true } -@@= skipped -8, +24 lines =@@ +@@= skipped -8, +25 lines =@@ const a = await foo() ^ { @@ -94,7 +98,8 @@ + "value": ": " + }, + { -+ "value": "Foo" ++ "value": "Foo", ++ "location": {}, + } + ], "kind": 1, diff --git a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsVariableTypes2.baseline.diff b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsVariableTypes2.baseline.diff index cb8fa67f40..0aadeedf14 100644 --- a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsVariableTypes2.baseline.diff +++ b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsVariableTypes2.baseline.diff @@ -35,7 +35,8 @@ + "value": " " + }, + { -+ "value": "foo" ++ "value": "foo", ++ "location": {}, + }, + { + "value": ": " @@ -47,7 +48,8 @@ + "value": "; " + }, + { -+ "value": "bar" ++ "value": "bar", ++ "location": {}, + }, + { + "value": ": " @@ -65,7 +67,7 @@ "kind": 1, "paddingLeft": true } -@@= skipped -8, +45 lines =@@ +@@= skipped -8, +47 lines =@@ const b = array; ^ { diff --git a/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsVariableTypes3.baseline.diff b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsVariableTypes3.baseline.diff new file mode 100644 index 0000000000..5f6b24eb1b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/fourslash/inlayHints/inlayHintsVariableTypes3.baseline.diff @@ -0,0 +1,12 @@ +--- old.inlayHintsVariableTypes3.baseline ++++ new.inlayHintsVariableTypes3.baseline +@@= skipped -31, +31 lines =@@ + "value": "; " + }, + { +- "value": "prototype" ++ "value": "prototype", ++ "location": {}, + }, + { + "value": ": " \ No newline at end of file diff --git a/testdata/submoduleAccepted.txt b/testdata/submoduleAccepted.txt index d23a697106..c0d0157bdf 100644 --- a/testdata/submoduleAccepted.txt +++ b/testdata/submoduleAccepted.txt @@ -53,3 +53,7 @@ fourslash/inlayHints/inlayHintsThisParameter.baseline.diff fourslash/inlayHints/inlayHintsVariableTypes1.baseline.diff fourslash/inlayHints/inlayHintsVariableTypes2.baseline.diff fourslash/inlayHints/inlayHintsWithClosures.baseline.diff +fourslash/inlayHints/inlayHintsInteractiveVariableTypes1.baseline.diff +fourslash/inlayHints/inlayHintsInteractiveVariableTypes2.baseline.diff +fourslash/inlayHints/inlayHintsVariableTypes3.baseline.diff +fourslash/inlayHints/inlayHintsInteractiveFunctionParameterTypes1.baseline.diff