From 101ff13a8177899f0172b81a534b147619dd7493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Lasersk=C3=B6ld?= Date: Fri, 3 Nov 2023 09:05:37 +0100 Subject: [PATCH] Put diagnostics on the right row --- src/plugin/gdbdebugger.cpp | 2 +- src/plugin/idebugger.h | 2 +- src/plugin/lsp/lspplugin.cpp | 4 ++-- src/plugin/rundebug.cpp | 6 ++++-- src/views/bufferview.cpp | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/plugin/gdbdebugger.cpp b/src/plugin/gdbdebugger.cpp index 1870166..c671e1e 100644 --- a/src/plugin/gdbdebugger.cpp +++ b/src/plugin/gdbdebugger.cpp @@ -211,7 +211,7 @@ void GdbDebugger::inputThread(std::istream &in) { .breakpointNumber = match[1].str(), .functionSignature = match[2].str(), .filePath = match[3].str(), - .lineNumber = std::stoul(match[4].str()), + .lineNumber = std::stoul(match[4].str()) - 1, }); } } diff --git a/src/plugin/idebugger.h b/src/plugin/idebugger.h index d0ac76e..2634c7b 100644 --- a/src/plugin/idebugger.h +++ b/src/plugin/idebugger.h @@ -38,7 +38,7 @@ struct BreakpointInfo { std::string breakpointNumber; std::string functionSignature; std::string filePath; - size_t lineNumber; + size_t lineNumber; // medit line number, starting with 0 }; using BreakpointList = diff --git a/src/plugin/lsp/lspplugin.cpp b/src/plugin/lsp/lspplugin.cpp index d27dbee..e61a8ce 100644 --- a/src/plugin/lsp/lspplugin.cpp +++ b/src/plugin/lsp/lspplugin.cpp @@ -110,8 +110,8 @@ LspPlugin::Instance::Instance(LspConfiguration config, LspPlugin *parent) // item.source, // item.source, could // not get this to work .message = item.message, - .range = {toMeditPosition(item.range.start, true), - toMeditPosition(item.range.end, true)}, + .range = {toMeditPosition(item.range.start, false), + toMeditPosition(item.range.end, false)}, }); } diff --git a/src/plugin/rundebug.cpp b/src/plugin/rundebug.cpp index 09e2794..573d579c 100644 --- a/src/plugin/rundebug.cpp +++ b/src/plugin/rundebug.cpp @@ -8,6 +8,7 @@ #include "text/fstring.h" #include "views/editor.h" #include "views/mainwindow.h" +#include #include void debug(std::shared_ptr env) { @@ -68,9 +69,10 @@ void debug(std::shared_ptr env) { d.push_back({ .type = DiagnosticType::Breakpoint, .source = "debugger", - .message = "breakpoint", + .message = "breakpoint line " + + std::to_string(info.lineNumber + 1), .range = {.begin = {0, info.lineNumber}, - .end = {Position::max, info.lineNumber}}, + .end = {1, info.lineNumber}}, }); } diff --git a/src/views/bufferview.cpp b/src/views/bufferview.cpp index 0b15ce1..fdbe60b 100644 --- a/src/views/bufferview.cpp +++ b/src/views/bufferview.cpp @@ -41,7 +41,7 @@ void BufferView::draw(IScreen &screen) { auto l = ty + yScroll(); if (l < buffer().lines().size()) { auto hasLineDiagnostics = - buffer().diagnostics().findLineDiagnostic(l - 1); + buffer().diagnostics().findLineDiagnostic(l); auto &line = _buffer->lines().at(l);