Skip to content

Commit b234de7

Browse files
committed
#3467 lsp: show log output as debug log
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent c91d17b commit b234de7

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@
1616
was called synchronously, causing a SIGSEGV in QtWidgets; the UI update is now
1717
deferred via `QTimer::singleShot` so it runs after the current event is fully
1818
processed (for [#3578](https://github.com/pbek/QOwnNotes/issues/3578))
19+
- All Markdown LSP server stderr output is now forwarded to the debug log
20+
(via `qDebug`) so the full server log is visible when running QOwnNotes
21+
with debug output enabled; previously only lines containing `ERR`/`ERROR`
22+
were forwarded (for [#3467](https://github.com/pbek/QOwnNotes/issues/3467))
23+
- Added debug logging when `textDocument/publishDiagnostics` notifications
24+
are received from the Markdown LSP server and when they are applied to the
25+
note text edit, to help diagnose why error markers may not appear; note that
26+
`marksman` (the default LSP server) does not publish diagnostics — it
27+
focuses on cross-reference and wiki-link completion only; to get real-time
28+
wave-underline error markers in the note editor, configure a linting LSP
29+
such as `rumdl` (command: `rumdl`, argument: `server`) which provides 71
30+
Markdown lint rules and publishes `textDocument/publishDiagnostics`
31+
(for [#3467](https://github.com/pbek/QOwnNotes/issues/3467))
1932

2033
## 26.4.22
2134

src/services/markdownlspclient.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ void MarkdownLspClient::onReadyReadStandardError() {
427427
if (trimmed.isEmpty()) {
428428
continue;
429429
}
430+
// Log all stderr output as debug for diagnostics
431+
qDebug() << "Markdown LSP server:" << trimmed;
430432
if (errorPattern.match(trimmed).hasMatch()) {
431433
emit errorMessage(trimmed);
432434
}
@@ -625,6 +627,7 @@ void MarkdownLspClient::handleNotification(const QJsonObject &object) {
625627
diagnostics.push_back(diagnostic);
626628
}
627629

630+
qDebug() << "Markdown LSP diagnostics received for" << uri << "- count:" << diagnostics.size();
628631
emit diagnosticsReceived(uri, diagnostics);
629632
}
630633

src/widgets/qownnotesmarkdowntextedit.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3598,9 +3598,12 @@ void QOwnNotesMarkdownTextEdit::showMarkdownLspCompletions(int requestId,
35983598
void QOwnNotesMarkdownTextEdit::showMarkdownLspDiagnostics(
35993599
const QString &uri, const QVector<MarkdownLspClient::Diagnostic> &diagnostics) {
36003600
if (uri != _markdownLspUri) {
3601+
qDebug() << "Markdown LSP: ignoring diagnostics for" << uri
3602+
<< "(current:" << _markdownLspUri << ")";
36013603
return;
36023604
}
36033605

3606+
qDebug() << "Markdown LSP: applying" << diagnostics.size() << "diagnostics for" << uri;
36043607
_markdownLspDiagnostics = diagnostics;
36053608
_markdownLspDiagnosticsSelections.clear();
36063609
for (const MarkdownLspClient::Diagnostic &diagnostic : diagnostics) {

0 commit comments

Comments
 (0)