|
43 | 43 | import org.eclipse.n4js.n4JS.ImportDeclaration;
|
44 | 44 | import org.eclipse.n4js.n4JS.ImportSpecifier;
|
45 | 45 | import org.eclipse.n4js.n4JS.LiteralOrComputedPropertyName;
|
| 46 | +import org.eclipse.n4js.n4JS.ModuleSpecifierForm; |
46 | 47 | import org.eclipse.n4js.n4JS.N4ClassDeclaration;
|
47 | 48 | import org.eclipse.n4js.n4JS.N4ClassifierDeclaration;
|
48 | 49 | import org.eclipse.n4js.n4JS.N4EnumDeclaration;
|
|
89 | 90 | import org.eclipse.n4js.typesystem.utils.RuleEnvironmentExtensions;
|
90 | 91 | import org.eclipse.n4js.utils.N4JSLanguageUtils;
|
91 | 92 | import org.eclipse.n4js.utils.N4JSLanguageUtils.EnumKind;
|
| 93 | +import org.eclipse.n4js.utils.URIUtils; |
92 | 94 | import org.eclipse.n4js.utils.parser.conversion.ValueConverterUtils;
|
93 | 95 | import org.eclipse.xtext.EcoreUtil2;
|
94 | 96 |
|
@@ -214,8 +216,19 @@ public Boolean caseImportDeclaration(ImportDeclaration original) {
|
214 | 216 | ? original.getModuleSpecifierAsText().replace("%3A", ":") // see ModuleSpecifierValueConverter
|
215 | 217 | : original.getModule().getQualifiedName();
|
216 | 218 |
|
| 219 | + if (original.getModuleSpecifierForm() != ModuleSpecifierForm.PROJECT |
| 220 | + && Strings.isNullOrEmpty(URIUtils.fileExtension(URIUtils.toFileUri(moduleSpecifier)))) { |
| 221 | + |
| 222 | + String extension = original.isBare() ? N4JSGlobals.JS_FILE_EXTENSION : N4JSGlobals.DTS_FILE_EXTENSION; |
| 223 | + moduleSpecifier += "." + extension; |
| 224 | + } |
| 225 | + |
217 | 226 | processAnnotations(original.getAnnotations());
|
218 | 227 | write("import ");
|
| 228 | + if (!original.isBare()) { |
| 229 | + write("type "); |
| 230 | + } |
| 231 | + |
219 | 232 | // 1) import specifiers
|
220 | 233 | List<ImportSpecifier> importSpecifiers = new ArrayList<>(original.getImportSpecifiers());
|
221 | 234 | if (!importSpecifiers.isEmpty() && importSpecifiers.get(0) instanceof DefaultImportSpecifier) {
|
|
0 commit comments