( cell: CodeCellType, getTsServerDiagnostics: (id: string) => TsServerDiagnosticType[], getTsServerSuggestions: (id: string) => TsServerDiagnosticType[], )
| 36 | import { Dialog, DialogContent } from '@srcbook/components/src/components/ui/dialog'; |
| 37 | |
| 38 | function tsLinter( |
| 39 | cell: CodeCellType, |
| 40 | getTsServerDiagnostics: (id: string) => TsServerDiagnosticType[], |
| 41 | getTsServerSuggestions: (id: string) => TsServerDiagnosticType[], |
| 42 | ) { |
| 43 | const semanticDiagnostics = getTsServerDiagnostics(cell.id); |
| 44 | const syntaticDiagnostics = getTsServerSuggestions(cell.id); |
| 45 | const diagnostics = [...syntaticDiagnostics, ...semanticDiagnostics].filter( |
| 46 | isDiagnosticWithLocation, |
| 47 | ); |
| 48 | |
| 49 | const cm_diagnostics = diagnostics.map((diagnostic) => { |
| 50 | return convertTSDiagnosticToCM(diagnostic, cell.source); |
| 51 | }); |
| 52 | |
| 53 | return linter(async (): Promise<readonly Diagnostic[]> => { |
| 54 | return cm_diagnostics; |
| 55 | }); |
| 56 | } |
| 57 | |
| 58 | function tsCategoryToSeverity( |
| 59 | diagnostic: Pick<TsServerDiagnosticType, 'category' | 'code'>, |
no test coverage detected