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

Method blockIsOnOneLine

internal/format/context.go:78–86  ·  view source on GitHub ↗
(node *ast.Node)

Source from the content-addressed store, hash-verified

76}
77
78func (this *FormattingContext) blockIsOnOneLine(node *ast.Node) core.Tristate {
79 openBrace := astnav.FindChildOfKind(node, ast.KindOpenBraceToken, this.SourceFile)
80 closeBrace := astnav.FindChildOfKind(node, ast.KindCloseBraceToken, this.SourceFile)
81 if openBrace != nil && closeBrace != nil {
82 closeBraceStart := scanner.GetTokenPosOfNode(closeBrace, this.SourceFile, false)
83 return this.rangeIsOnOneLine(core.NewTextRange(openBrace.End(), closeBraceStart))
84 }
85 return core.TSFalse
86}
87
88func (this *FormattingContext) ContextNodeAllOnSameLine() bool {
89 if this.contextNodeAllOnSameLine == core.TSUnknown {

Callers 2

Calls 5

rangeIsOnOneLineMethod · 0.95
FindChildOfKindFunction · 0.92
GetTokenPosOfNodeFunction · 0.92
NewTextRangeFunction · 0.92
EndMethod · 0.65

Tested by

no test coverage detected