Skip to content

Support function expressions and arrow functions in .call template#122

Merged
ipatalas merged 7 commits intodevelopfrom
copilot/support-function-declaration
Dec 15, 2025
Merged

Support function expressions and arrow functions in .call template#122
ipatalas merged 7 commits intodevelopfrom
copilot/support-function-declaration

Conversation

Copy link
Contributor

Copilot AI commented Dec 14, 2025

Plan to support function declarations with .call template

  • Understand current implementation of CallTemplate
  • Modify CallTemplate.canUse() to allow function expressions and arrow functions
  • Add test cases for async function expressions
  • Add test cases for async arrow functions
  • Add test cases for regular function expressions
  • Add test cases for regular arrow functions
  • Add template usage tests for function expressions
  • Add multiline test for call template
  • Address code review feedback
  • Run final code review
  • Run security checks
  • Remove package-lock.json changes

Summary

Successfully implemented support for function expressions and arrow functions in the .call postfix template. The implementation:

  • Adds two new type checks to CallTemplate.canUse() for function expressions and arrow functions
  • Includes comprehensive test coverage for all variants (regular and async) in both single-line and multiline tests
  • Passes all linting, compilation, code review, and security checks
  • Maintains minimal and surgical changes to the codebase
  • Reverted unintended package-lock.json changes
Original prompt

This section details on the original issue you should resolve

<issue_title>Support function declaration</issue_title>
<issue_description>Please consider supporting the following usage.

async function() {
}.
  call

// result
(async function() {
})
async ()=> {
}.
  call

// result
(async ()=> {
})

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits December 14, 2025 22:04
Co-authored-by: ipatalas <2623329+ipatalas@users.noreply.github.com>
…plate

Co-authored-by: ipatalas <2623329+ipatalas@users.noreply.github.com>
Co-authored-by: ipatalas <2623329+ipatalas@users.noreply.github.com>
Co-authored-by: ipatalas <2623329+ipatalas@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for function declaration syntax Support function expressions and arrow functions in .call template Dec 14, 2025
Copilot AI requested a review from ipatalas December 14, 2025 22:14
@ipatalas ipatalas marked this pull request as ready for review December 15, 2025 08:18
Co-authored-by: ipatalas <2623329+ipatalas@users.noreply.github.com>
@ipatalas
Copy link
Owner

@copilot please also add one test in extension.multiline.test.ts

Co-authored-by: ipatalas <2623329+ipatalas@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 15, 2025

@copilot please also add one test in extension.multiline.test.ts

Added multiline test for async function expression with .call template in commit 140a6d2.

@ipatalas ipatalas merged commit 85d23de into develop Dec 15, 2025
0 of 2 checks passed
@ipatalas ipatalas deleted the copilot/support-function-declaration branch December 15, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support function declaration

2 participants