Quick editing (diffs) in SourceCraft Code Assistant
Warning
This feature is only available in Visual Studio Code.
In Code Assistant, instead of overwriting entire files, you can use quick editing based on using the differences (diffs) between the original and output files.
Quick editing (Enable editing through diffs) is on by default. Typically, there is no need to modify this parameter unless you are facing specific problems or want to experiment with various diff strategies.
In the Profile selector, choose the specific model configuration profile for which quick editing will be enabled.
Select Enable editing through diffs.
Optionally, matching precision under Match precision. This option controls how accurately the code sections identified by the AI must match the original code in you file before the changes are applied. The possible values are:
100% (default), requires exact match. This is the most secure option that minimizes the risk of incorrect edits.
80%-99%, allows incomplete match. Code Assistant can apply changes even if the code section is slightly different from what the AI expects. This can be of use if the file was slightly modified; however, it increases the risk of applying the changes in the wrong place.
Warning
Use values below 100% with extreme caution.
Lower accuracy may be necessary in some cases, but be sure to carefully review all the proposed changes.
Internally, this setting controls the fuzzyMatchThreshold parameter used with algorithms like the Levenshtein distance to analyze code for similarity.
To disable quick editing, follow the same procedure. Code Assistant will then revert to overwriting the entire file content for each edit with the help of the write_to_file tool instead of applying the target changes using apply_diff. This full-overwrite approach is typically slower when editing existing files and uses up more tokens.