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

Function functionSpan

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

Source from the content-addressed store, hash-verified

542}
543
544func functionSpan(ctx context.Context, node *ast.Node, body *ast.Node, sourceFile *ast.SourceFile, l *LanguageService) *lsproto.FoldingRange {
545 openToken := tryGetFunctionOpenToken(node, body, sourceFile)
546 closeToken := astnav.FindChildOfKind(body, ast.KindCloseBraceToken, sourceFile)
547 if openToken != nil && closeToken != nil {
548 return rangeBetweenTokens(ctx, openToken, closeToken, sourceFile, true /*useFullStart*/, l)
549 }
550 return nil
551}
552
553func tryGetFunctionOpenToken(node *ast.SignatureDeclaration, body *ast.Node, sourceFile *ast.SourceFile) *ast.Node {
554 if isNodeArrayMultiLine(node.Parameters(), sourceFile) {

Callers 1

getOutliningSpanForNodeFunction · 0.85

Calls 3

FindChildOfKindFunction · 0.92
tryGetFunctionOpenTokenFunction · 0.85
rangeBetweenTokensFunction · 0.85

Tested by

no test coverage detected