9. Build a fix
We build a fix that will replace the text from the first argument by "bar".
A fix is made of at least one edit. We have different functions to build an edit (
buildEditUpdate). We choose buildEditUpdate to replace text in the code.
The function buildEditUpdate takes as arguments:
- the starting line of the edit
- the starting column of the edit
- the ending line of the edit
- the ending column of the edit
- the text to update
To make an edit that replaces the value of the argument, such as, updating from foo to var, build an edit like this:
const edit = buildEditUpdate( firstArgument.start.line, firstArgument.start.col, firstArgument.end.line, firstArgument.end.col, "bar" );
We create a fix with the previously created edit:
const fix = buildFix("print bar", );
Finally, once the report and the associated edit is complete, we can report it to the IDE using the function addError().
Start interacting with the tutorial!