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

Function isValidReferenceLensNode

internal/ls/codelens.go:179–207  ·  view source on GitHub ↗
(node *ast.Node, userPrefs lsutil.CodeLensUserPreferences)

Source from the content-addressed store, hash-verified

177}
178
179func isValidReferenceLensNode(node *ast.Node, userPrefs lsutil.CodeLensUserPreferences) bool {
180 switch node.Kind {
181 case ast.KindFunctionDeclaration:
182 if userPrefs.ReferencesCodeLensShowOnAllFunctions.IsTrue() {
183 return true
184 }
185 fallthrough
186
187 case ast.KindVariableDeclaration:
188 return ast.GetCombinedModifierFlags(node)&ast.ModifierFlagsExport != 0
189
190 case ast.KindClassDeclaration, ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration, ast.KindEnumDeclaration, ast.KindEnumMember:
191 return true
192
193 case ast.KindMethodDeclaration, ast.KindMethodSignature, ast.KindConstructor,
194 ast.KindGetAccessor, ast.KindSetAccessor,
195 ast.KindPropertyDeclaration, ast.KindPropertySignature:
196 // Don't show if child and parent have same start
197 // For https://github.com/microsoft/vscode/issues/90396
198 // !!!
199
200 switch node.Parent.Kind {
201 case ast.KindClassDeclaration, ast.KindInterfaceDeclaration, ast.KindTypeLiteral:
202 return true
203 }
204 }
205
206 return false
207}

Callers 1

ProvideCodeLensesMethod · 0.85

Calls 2

GetCombinedModifierFlagsFunction · 0.92
IsTrueMethod · 0.80

Tested by

no test coverage detected