Copilot++ is an excellent code completion tool, surpassing any other I’ve tried. However, there is a common situation where it is slower and less efficient than manual code editing: when symbols are renamed.
Consider the following contrived TypeScript method as an example:
public static multiplyMatrix4s(matrix1: ReadonlyMatrix4, matrix2: ReadonlyMatrix4, result: Matrix4) {
const r1c1 = matrix1.r1c1;
const r2c1 = matrix1.r2c1;
const r3c1 = matrix1.r3c1;
const r4c1 = matrix1.r4c1;
const r1c2 = matrix1.r1c2;
const r2c2 = matrix1.r2c2;
const r3c2 = matrix1.r3c2;
const r4c2 = matrix1.r4c2;
const r1c3 = matrix1.r1c3;
const r2c3 = matrix1.r2c3;
const r3c3 = matrix1.r3c3;
const r4c3 = matrix1.r4c3;
const r1c4 = matrix1.r1c4;
const r2c4 = matrix1.r2c4;
const r3c4 = matrix1.r3c4;
const r4c4 = matrix1.r4c4;
const matrixR1c1 = matrix2.r1c1;
const matrixR2c1 = matrix2.r2c1;
const matrixR3c1 = matrix2.r3c1;
const matrixR4c1 = matrix2.r4c1;
const matrixR1c2 = matrix2.r1c2;
const matrixR2c2 = matrix2.r2c2;
const matrixR3c2 = matrix2.r3c2;
const matrixR4c2 = matrix2.r4c2;
const matrixR1c3 = matrix2.r1c3;
const matrixR2c3 = matrix2.r2c3;
const matrixR3c3 = matrix2.r3c3;
const matrixR4c3 = matrix2.r4c3;
const matrixR1c4 = matrix2.r1c4;
const matrixR2c4 = matrix2.r2c4;
const matrixR3c4 = matrix2.r3c4;
const matrixR4c4 = matrix2.r4c4;
result.setRaw(r1c1 * matrixR1c1 + r1c2 * matrixR2c1 + r1c3 * matrixR3c1 + r1c4 * matrixR4c1,
r1c1 * matrixR1c2 + r1c2 * matrixR2c2 + r1c3 * matrixR3c2 + r1c4 * matrixR4c2,
r1c1 * matrixR1c3 + r1c2 * matrixR2c3 + r1c3 * matrixR3c3 + r1c4 * matrixR4c3,
r1c1 * matrixR1c4 + r1c2 * matrixR2c4 + r1c3 * matrixR3c4 + r1c4 * matrixR4c4,
r2c1 * matrixR1c1 + r2c2 * matrixR2c1 + r2c3 * matrixR3c1 + r2c4 * matrixR4c1,
r2c1 * matrixR1c2 + r2c2 * matrixR2c2 + r2c3 * matrixR3c2 + r2c4 * matrixR4c2,
r2c1 * matrixR1c3 + r2c2 * matrixR2c3 + r2c3 * matrixR3c3 + r2c4 * matrixR4c3,
r2c1 * matrixR1c4 + r2c2 * matrixR2c4 + r2c3 * matrixR3c4 + r2c4 * matrixR4c4,
r3c1 * matrixR1c1 + r3c2 * matrixR2c1 + r3c3 * matrixR3c1 + r3c4 * matrixR4c1,
r3c1 * matrixR1c2 + r3c2 * matrixR2c2 + r3c3 * matrixR3c2 + r3c4 * matrixR4c2,
r3c1 * matrixR1c3 + r3c2 * matrixR2c3 + r3c3 * matrixR3c3 + r3c4 * matrixR4c3,
r3c1 * matrixR1c4 + r3c2 * matrixR2c4 + r3c3 * matrixR3c4 + r3c4 * matrixR4c4,
r4c1 * matrixR1c1 + r4c2 * matrixR2c1 + r4c3 * matrixR3c1 + r4c4 * matrixR4c1,
r4c1 * matrixR1c2 + r4c2 * matrixR2c2 + r4c3 * matrixR3c2 + r4c4 * matrixR4c2,
r4c1 * matrixR1c3 + r4c2 * matrixR2c3 + r4c3 * matrixR3c3 + r4c4 * matrixR4c3,
r4c1 * matrixR1c4 + r4c2 * matrixR2c4 + r4c3 * matrixR3c4 + r4c4 * matrixR4c4);
}
Let’s say I’m renaming matrix1
and matrix2
to matrixA
and matrixB
throughout the class. When I click this method’s declaration, Copilot++ correctly updates the parameter names and the next few lines.
However, it is actually faster for me to manually use the “Rename Symbol” (F2) functionality for the parameters rather than accept Copilot++'s changes, then tab and accept changes for the next few lines, and so on until the end of the method.
This situation also occurs for class variables, method names, class names and really any symbol.
If Copilot++ could identify when a symbol is being changed and execute a “Rename Symbol” operation instead of suggesting individual changes, it would significantly improve the efficiency of the tool in such scenarios.
This enhancement would not only save time for developers but also reduce the cost of running the service since fewer inference requests would be required.
Kindly consider.
Edit: after some thought, this might be hard to implement because the user may be trying to refer to a different symbol instead of renaming an existing symbol.