You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: Clone Call in TypeScript Adds Spaces Causing Syntax Errors
Description:
When using the "clone call" feature in TypeScript, the new call is separated from the old call with spaces. This behavior results in a syntax error, as TypeScript does not permit multiple function calls separated by spaces without proper delimiters. Consequently, users must manually intervene to correct this by adding a line break or a semicolon after cloning the call.
Example:
Consider the following TypeScript code:
function example() {
myFunction();
myFunction(); // Cloned call
}
Upon using "clone call," the result is:
function example() {
myFunction();
myFunction() myFunction(); // Syntax error
}
This occurs because the cloned call is appended with spaces, causing a syntax error.
Expected Behavior:
The expected behavior when using "clone call" is either to:
Insert a line break after the cloned call:
function example() {
myFunction();
myFunction();
myFunction(); // Cloned call with line break
}
Append a semicolon after the cloned call:
function example() {
myFunction();
myFunction();; // Cloned call with semicolon
}
Impact:
This issue frequently arises when editing files with multiple function calls, such as in vitest files where each spec is its own call. The need for manual correction after each "clone call" operation disrupts workflow and reduces productivity.
Proposed Solution:
To address this issue, modify the "clone call" functionality to automatically insert a line break or a semicolon after the cloned call. While adding semicolons may be more complex to implement, it could provide a more robust solution.
Additional Notes:
This issue requires careful consideration as multiple function calls on the same line are possible, and the chosen solution should not break valid code patterns.
The text was updated successfully, but these errors were encountered:
Issue: Clone Call in TypeScript Adds Spaces Causing Syntax Errors
Description:
When using the "clone call" feature in TypeScript, the new call is separated from the old call with spaces. This behavior results in a syntax error, as TypeScript does not permit multiple function calls separated by spaces without proper delimiters. Consequently, users must manually intervene to correct this by adding a line break or a semicolon after cloning the call.
Example:
Consider the following TypeScript code:
Upon using "clone call," the result is:
This occurs because the cloned call is appended with spaces, causing a syntax error.
Expected Behavior:
The expected behavior when using "clone call" is either to:
Impact:
This issue frequently arises when editing files with multiple function calls, such as in vitest files where each spec is its own call. The need for manual correction after each "clone call" operation disrupts workflow and reduces productivity.
Proposed Solution:
To address this issue, modify the "clone call" functionality to automatically insert a line break or a semicolon after the cloned call. While adding semicolons may be more complex to implement, it could provide a more robust solution.
Additional Notes:
This issue requires careful consideration as multiple function calls on the same line are possible, and the chosen solution should not break valid code patterns.
The text was updated successfully, but these errors were encountered: