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

Function jsDocParamPatternWorker

internal/ls/completions.go:5778–5843  ·  view source on GitHub ↗
(
	path string,
	pattern *ast.BindingPatternNode,
	initializer *ast.Expression,
	dotDotDotToken *ast.TokenNode,
	isJS bool,
	isSnippet bool,
	typeChecker *checker.Checker,
	options *core.CompilerOptions,
	preferences lsutil.UserPreferences,
	counter *int,
)

Source from the content-addressed store, hash-verified

5776}
5777
5778func jsDocParamPatternWorker(
5779 path string,
5780 pattern *ast.BindingPatternNode,
5781 initializer *ast.Expression,
5782 dotDotDotToken *ast.TokenNode,
5783 isJS bool,
5784 isSnippet bool,
5785 typeChecker *checker.Checker,
5786 options *core.CompilerOptions,
5787 preferences lsutil.UserPreferences,
5788 counter *int,
5789) []string {
5790 if ast.IsObjectBindingPattern(pattern) && dotDotDotToken == nil {
5791 childCounter := *counter
5792 rootParam := getJSDocParamAnnotation(
5793 path,
5794 initializer,
5795 dotDotDotToken,
5796 isJS,
5797 /*isObject*/ true,
5798 isSnippet,
5799 typeChecker,
5800 options,
5801 preferences,
5802 &childCounter,
5803 )
5804 var childTags []string
5805 for _, element := range pattern.Elements() {
5806 elementTags := jsDocParamElementWorker(
5807 path,
5808 element,
5809 initializer,
5810 dotDotDotToken,
5811 isJS,
5812 isSnippet,
5813 typeChecker,
5814 options,
5815 preferences,
5816 &childCounter,
5817 )
5818 if len(elementTags) == 0 {
5819 childTags = nil
5820 break
5821 }
5822 childTags = append(childTags, elementTags...)
5823 }
5824 if len(childTags) > 0 {
5825 *counter = childCounter
5826 return append([]string{rootParam}, childTags...)
5827 }
5828 }
5829 return []string{
5830 getJSDocParamAnnotation(
5831 path,
5832 initializer,
5833 dotDotDotToken,
5834 isJS,
5835 /*isObject*/ false,

Callers 2

jsDocParamElementWorkerFunction · 0.85

Calls 6

IsObjectBindingPatternFunction · 0.92
getJSDocParamAnnotationFunction · 0.85
jsDocParamElementWorkerFunction · 0.85
lenFunction · 0.85
appendFunction · 0.50
ElementsMethod · 0.45

Tested by

no test coverage detected