MCPcopy Create free account
hub / github.com/JordanCoin/codemap / ResolverExtensions

Function ResolverExtensions

scanner/types.go:139–156  ·  view source on GitHub ↗

ResolverExtensions returns extensions used for import path resolution, including index-file patterns for JS/TS/Python ecosystems. Sorted by length descending so longer extensions match first (.tsx before .ts), with empty string last as the final fallback.

()

Source from the content-addressed store, hash-verified

137// Sorted by length descending so longer extensions match first (.tsx before .ts),
138// with empty string last as the final fallback.
139func ResolverExtensions() []string {
140 var exts []string
141 for ext := range extToLang {
142 exts = append(exts, ext)
143 }
144 // Sort by length descending, then alphabetically for stability
145 sort.Slice(exts, func(i, j int) bool {
146 if len(exts[i]) != len(exts[j]) {
147 return len(exts[i]) > len(exts[j])
148 }
149 return exts[i] < exts[j]
150 })
151 // Index-file patterns for module resolution
152 exts = append(exts, "/index.js", "/index.ts", "/index.tsx", "/__init__.py", "/mod.rs")
153 // Empty string last — bare path match as final fallback
154 exts = append(exts, "")
155 return exts
156}
157
158// LangDisplay maps internal language names to display names
159var LangDisplay = map[string]string{

Callers 2

tryExactMatchFunction · 0.85
trySuffixMatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected