MCPcopy Create free account
hub / github.com/microsoft/typescript-go / spanForJSXAttributes

Function spanForJSXAttributes

internal/ls/folding.go:475–486  ·  view source on GitHub ↗
(ctx context.Context, node *ast.Node, sourceFile *ast.SourceFile, l *LanguageService)

Source from the content-addressed store, hash-verified

473}
474
475func spanForJSXAttributes(ctx context.Context, node *ast.Node, sourceFile *ast.SourceFile, l *LanguageService) *lsproto.FoldingRange {
476 var attributes *ast.JsxAttributesNode
477 if node.Kind == ast.KindJsxSelfClosingElement {
478 attributes = node.AsJsxSelfClosingElement().Attributes
479 } else {
480 attributes = node.AsJsxOpeningElement().Attributes
481 }
482 if len(attributes.Properties()) == 0 {
483 return nil
484 }
485 return createFoldingRangeFromBounds(ctx, astnav.GetStartOfNode(node, sourceFile, false /*includeJSDoc*/), node.End(), "", sourceFile, l)
486}
487
488func spanForNodeArray(ctx context.Context, statements *ast.NodeList, sourceFile *ast.SourceFile, l *LanguageService) *lsproto.FoldingRange {
489 if statements != nil && len(statements.Nodes) != 0 {

Callers 1

getOutliningSpanForNodeFunction · 0.85

Calls 7

GetStartOfNodeFunction · 0.92
lenFunction · 0.85
AsJsxOpeningElementMethod · 0.80
EndMethod · 0.65
PropertiesMethod · 0.45

Tested by

no test coverage detected