import { Diagnostic } from "vscode-languageserver" ; import { TextDocument } from "vscode-languageserver-textdocument" ; import { getUnusedActionImplementations } from "./diagnostics/getUnusedActionImplementations" ; import { getUnusedGuardsImplementations } from "./diagnostics/getUnusedGuardImplementations" ; import { getUnusedServicesImplementations } from "./diagnostics/getUnusedServicesImplementations" ; import { miscDiagnostics } from "./diagnostics/misc" ; import { DocumentValidationsResult } from "./server" ; export type DiagnosticGetter = ( result : DocumentValidationsResult , textDocument : TextDocument ) => Diagnostic [ ] ; const getters = [ miscDiagnostics , getUnusedActionImplementations , getUnusedServicesImplementations , getUnusedGuardsImplementations , ] ; export const getDiagnostics = ( validations , textDocument ) : Diagnostic [ ] => { const diagnostics = [ ] ; validations . forEach ( ( validation ) => { getters . forEach ( ( getter ) => { diagnostics . push ( ... getter ( validation , textDocument ) ) ; } ) ; } ) ; return diagnostics ; } ;