Skip to content

Commit

Permalink
Fix error indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
hurryabit committed Sep 29, 2024
1 parent 959438e commit 25504c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions rufus-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export default function App() {
const markers = [];
for (const problem of state.problems) {
const annotation = {
row: problem.start.line - 1,
col: problem.start.column - 1,
text: `${problem.severity} [Col ${problem.start.column}]: ${problem.message} -- ${problem.source}`,
row: problem.start.line,
col: problem.start.column ,
text: `${problem.severity} [Col ${problem.start.column + 1}]: ${problem.message} -- ${problem.source}`,
type: problem.severity.toLowerCase(),
};
annotations.push(annotation);
Expand All @@ -123,10 +123,10 @@ export default function App() {
break;
}
const marker = {
startRow: problem.start.line - 1,
startCol: problem.start.column - 1,
endRow: problem.end.line - 1,
endCol: problem.end.column - 1,
startRow: problem.start.line,
startCol: problem.start.column,
endRow: problem.end.line,
endCol: problem.end.column,
className,
type: "text" as const,
};
Expand Down
2 changes: 1 addition & 1 deletion rufus-ui/src/ProblemsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = {

export default function ProblemsPane({ problems }: Props) {
const text = problems.map(function ({ start, severity, message, source }) {
return `${severity} [Ln ${start.line}, Col ${start.column}]: ${message} -- ${source}`;
return `${severity} [Ln ${start.line + 1}, Col ${start.column + 1}]: ${message} -- ${source}`;
}).join("\n");

return <textarea
Expand Down
4 changes: 2 additions & 2 deletions rufus-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ impl Location {
fn from_index(index: u32, humanizer: &Humanizer) -> Self {
let loc = humanizer.run(index as usize);
Self {
line: loc.line + 1,
column: loc.column + 1,
line: loc.line,
column: loc.column,
}
}
}
Expand Down

0 comments on commit 25504c2

Please # to comment.