Skip to content

Commit

Permalink
Put diagnostics on the right row
Browse files Browse the repository at this point in the history
  • Loading branch information
mls-m5 committed Nov 3, 2023
1 parent 63ed10c commit 101ff13
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/plugin/gdbdebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/idebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
4 changes: 2 additions & 2 deletions src/plugin/lsp/lspplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
});
}

Expand Down
6 changes: 4 additions & 2 deletions src/plugin/rundebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "text/fstring.h"
#include "views/editor.h"
#include "views/mainwindow.h"
#include <string>
#include <string_view>

void debug(std::shared_ptr<IEnvironment> env) {
Expand Down Expand Up @@ -68,9 +69,10 @@ void debug(std::shared_ptr<IEnvironment> 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}},
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/bufferview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 101ff13

Please sign in to comment.