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

Function findContainingModuleSpecifier

internal/ls/sourcedefinition.go:447–456  ·  view source on GitHub ↗
(node *ast.Node)

Source from the content-addressed store, hash-verified

445}
446
447func findContainingModuleSpecifier(node *ast.Node) *ast.Node {
448 for current := node; current != nil; current = current.Parent {
449 if ast.IsAnyImportOrReExport(current) || ast.IsRequireCall(current, true /*requireStringLiteralLikeArgument*/) || ast.IsImportCall(current) {
450 if moduleSpecifier := ast.GetExternalModuleName(current); moduleSpecifier != nil && ast.IsStringLiteralLike(moduleSpecifier) {
451 return moduleSpecifier
452 }
453 }
454 }
455 return nil
456}
457
458func (r *sourceDefResolver) findDeclarationsInFile(
459 fileName string,

Callers 1

Calls 5

IsAnyImportOrReExportFunction · 0.92
IsRequireCallFunction · 0.92
IsImportCallFunction · 0.92
GetExternalModuleNameFunction · 0.92
IsStringLiteralLikeFunction · 0.92

Tested by

no test coverage detected