(imp: ModelImport)
| 510 | * Returns `undefined` if the import cannot be resolved. |
| 511 | */ |
| 512 | export function resolveImportUri(imp: ModelImport) { |
| 513 | if (!imp.path) { |
| 514 | return undefined; |
| 515 | } |
| 516 | const doc = AstUtils.getDocument(imp); |
| 517 | const dir = path.dirname(doc.uri.fsPath); |
| 518 | const importPath = imp.path.endsWith('.zmodel') ? imp.path : `${imp.path}.zmodel`; |
| 519 | return URI.file(path.resolve(dir, importPath)); |
| 520 | } |
| 521 | |
| 522 | /** |
| 523 | * Gets data models and type defs in the ZModel schema. |
no test coverage detected