MCPcopy Index your code
hub / github.com/srcbookdev/srcbook / convertTSDiagnosticToCM

Function convertTSDiagnosticToCM

packages/web/src/components/cells/code.tsx:92–108  ·  view source on GitHub ↗
(diagnostic: TsServerDiagnosticType, code: string)

Source from the content-addressed store, hash-verified

90}
91
92function convertTSDiagnosticToCM(diagnostic: TsServerDiagnosticType, code: string): Diagnostic {
93 const message = tsDiagnosticMessage(diagnostic);
94
95 return {
96 from: mapTsServerLocationToCM(code, diagnostic.start.line, diagnostic.start.offset),
97 to: mapTsServerLocationToCM(code, diagnostic.end.line, diagnostic.end.offset),
98 message: message,
99 severity: tsCategoryToSeverity(diagnostic),
100 renderMessage: () => {
101 const dom = document.createElement('div');
102 dom.className = 'p-2 space-y-3 border-t max-w-lg max-h-64 text-xs relative';
103 dom.innerText = message;
104
105 return dom;
106 },
107 };
108}
109
110const DEBOUNCE_DELAY = 500;
111

Callers 1

tsLinterFunction · 0.85

Calls 3

mapTsServerLocationToCMFunction · 0.90
tsDiagnosticMessageFunction · 0.85
tsCategoryToSeverityFunction · 0.85

Tested by

no test coverage detected