@neo-one/smart-contract-compiler
Version:
NEO•ONE TypeScript smart contract compiler.
24 lines (22 loc) • 838 B
JavaScript
import { tsUtils } from '@neo-one/ts-utils';
import { compileForDiagnostics } from './compile';
import { createContextForLanguageService } from './createContext';
export const getSemanticDiagnostics = ({ filePath, host, languageService, }) => {
const context = createContextForLanguageService(filePath, languageService, host);
let sourceFile;
try {
sourceFile = tsUtils.file.getSourceFileOrThrow(context.program, filePath);
compileForDiagnostics({
sourceFile,
context,
sourceMaps: {},
});
}
catch {
}
if (sourceFile !== undefined) {
return context.diagnostics.filter((diagnostic) => diagnostic.file === undefined || sourceFile === diagnostic.file);
}
return context.diagnostics;
};
//# sourceMappingURL=getSemanticDiagnostics.js.map