( prefs UserPreferences, host ModuleSpecifierGenerationHost, compilerOptions *core.CompilerOptions, importingSourceFile SourceFileForSpecifierGeneration, oldImportSpecifier string, resolutionMode core.ResolutionMode, )
| 112 | } |
| 113 | |
| 114 | func getPreferredEnding( |
| 115 | prefs UserPreferences, |
| 116 | host ModuleSpecifierGenerationHost, |
| 117 | compilerOptions *core.CompilerOptions, |
| 118 | importingSourceFile SourceFileForSpecifierGeneration, |
| 119 | oldImportSpecifier string, |
| 120 | resolutionMode core.ResolutionMode, |
| 121 | ) ModuleSpecifierEnding { |
| 122 | if len(oldImportSpecifier) > 0 { |
| 123 | if tspath.HasJSFileExtension(oldImportSpecifier) { |
| 124 | return ModuleSpecifierEndingJsExtension |
| 125 | } |
| 126 | if strings.HasSuffix(oldImportSpecifier, "/index") { |
| 127 | return ModuleSpecifierEndingIndex |
| 128 | } |
| 129 | } |
| 130 | if resolutionMode == core.ResolutionModeNone { |
| 131 | resolutionMode = host.GetDefaultResolutionModeForFile(importingSourceFile) |
| 132 | } |
| 133 | return getModuleSpecifierEndingPreference( |
| 134 | prefs.ImportModuleSpecifierEnding, |
| 135 | resolutionMode, |
| 136 | compilerOptions, |
| 137 | importingSourceFile, |
| 138 | ) |
| 139 | } |
| 140 | |
| 141 | type ModuleSpecifierPreferences struct { |
| 142 | relativePreference RelativePreferenceKind |
no test coverage detected