diff options
| author | David Czihak <git@dcz.at> | 2026-05-07 18:43:37 +0200 |
|---|---|---|
| committer | David Czihak <git@dcz.at> | 2026-05-07 18:43:37 +0200 |
| commit | 07f1f2952ca97bea50af28a5c169fd6b6de723ad (patch) | |
| tree | 55eee13096a03b82bdf3fc7a8b57e9676a41364d /Scripts | |
| parent | 384a44bd1189119326350996fcdff1cf4394a8cd (diff) | |
Chore: Improve ZLS error logging
Diffstat (limited to 'Scripts')
| -rw-r--r-- | Scripts/main.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Scripts/main.js b/Scripts/main.js index d9aac14..6f0a54e 100644 --- a/Scripts/main.js +++ b/Scripts/main.js | |||
| @@ -476,6 +476,21 @@ class ZigLanguageServer { | |||
| 476 | clientOptions | 476 | clientOptions |
| 477 | ); | 477 | ); |
| 478 | 478 | ||
| 479 | client.onNotification("window/logMessage", ({ type, message }) => { | ||
| 480 | // type: 1=Error, 2=Warning, 3=Info, 4=Log | ||
| 481 | const enriched = | ||
| 482 | message === "ParseError" | ||
| 483 | ? "ParseError — ZLS could not fully parse the Zig source (normal while editing)" | ||
| 484 | : message; | ||
| 485 | if (type === 1) { | ||
| 486 | console.error(`[ZLS] ${enriched}`); | ||
| 487 | } else if (type === 2) { | ||
| 488 | console.warn(`[ZLS] ${enriched}`); | ||
| 489 | } else if (debugLogs) { | ||
| 490 | console.log(`[ZLS] ${enriched}`); | ||
| 491 | } | ||
| 492 | }); | ||
| 493 | |||
| 479 | this.clientStopDisposable = client.onDidStop((error) => { | 494 | this.clientStopDisposable = client.onDidStop((error) => { |
| 480 | if (error) { | 495 | if (error) { |
| 481 | console.error(`[${LANGUAGE_CLIENT_ID}] ${error.message}`); | 496 | console.error(`[${LANGUAGE_CLIENT_ID}] ${error.message}`); |
