Closed tolauwae closed 1 year ago
This PR is waiting on #98.
I also just now force-pushed on this branch with the new content of main.
@tolauwae I think I understand why it does not work for Wast.
When debugging Wast the line numbers and column numbers are printed as a json in the form of "@ { line: 5, col_start: 29, col_end: 38 }"
. The column number for that JSON should thus be accessed as col_start
and not column
but this is not what happens as shown in line https://github.com/TOPLLab/WARDuino-VSCode/blob/7fa69d84ee22fd3b4a2bc2966a0303d32b54beb5/src/CompilerBridges/WASMCompilerBridge.ts#L60
The solution is to either 1. change the WABT to print the json in the expected format i.e., use column
instead of col_start
or to 2. change the extracLineInfo
method to account for the possibility that the json contains col_start
instead of column
.
I tried the later solution which in my case successfully fixes the column highlighting for Wast. Herefore I rewrote extractLineInfo
to become
function extractLineInfo(lineString: string): LineInfo {
lineString = lineString.substring(1);
const parsed: any = parseUtils.jsonParse(lineString);
if (parsed.column === undefined && parsed.col_start !== undefined) {
parsed.column = parsed.col_start;
}
return parsed;
}
This issue is in my opinion a separate bug that could be fixed via a separate PR and should therefore not stop the merge of this PR but if you rather we could also first fix the bug as part of this PR.
Use column info in debugger, both in the callstack view and in the main view (current position marker).